[kstars] kstars/tools/whatsinteresting: This patch addresses several key issues with whats interesting. First, on Macs it will first check inside the app bundle for the whats interesting before it checks in the data directory. That way if the user installed from a dmg and then updated to a new dmg the any whats interesting improvements will be included. It still checks the data directory as a backup in case the user didn’t install from a dmg. Second, when there are no objects in a list, it displays a nice message explaining that, rather than just a blank screen. Also I added Supernovas, the NGC Catalog, the IC Catalog, and the Sharpless Catalog. I also added some more objects to the object lists. For the catalogs, I made them load separately on demand with a nice progress bar and a message explaining that they are loading. Also I corrected a bug for the moon and similar objects that were not object types originally included in Whats Interesting. I also disabled automatic downloading for object information because I don’t think it should be initiating lots of network traffic when there is no internet connection and also it shouldn’t try to download data many many times for objects that really have no article. The user can now initiate the download of all the data for the entire list, for individual objects, or just objects that have no data, so that should be fine. I also did a little rearranging on the category screen. Also just in case, I added some checks to see if some objects are null for safety.

Jasem Mutlaq null at kde.org
Fri Apr 28 08:24:40 UTC 2017


Git commit 490b49b5798a3ca2e33ede4d335b3b98e67be81e by Jasem Mutlaq, on behalf of Robert Lancaster.
Committed on 28/04/2017 at 08:23.
Pushed by mutlaqja into branch 'master'.

This patch addresses several key issues with whats interesting.  First, on Macs it will first check inside the app bundle for the whats interesting before it checks in the data directory.  That way if the user installed from a dmg and then updated to a new dmg the any whats interesting improvements will be included.  It still checks the data directory as a backup in case the user didn’t install from a dmg. Second, when there are no objects in a list, it displays a nice message explaining that, rather than just a blank screen.  Also I added Supernovas, the NGC Catalog, the IC Catalog, and the Sharpless Catalog.  I also added some more objects to the object lists.  For the catalogs, I made them load separately on demand with a nice progress bar and a message explaining that they are loading.  Also I corrected a bug for the moon and similar objects that were not object types originally included in Whats Interesting.  I also disabled automatic downloading for object information because I don’t think it should be initiating lots of network traffic when there is no internet connection and also it shouldn’t try to download data many many times for objects that really have no article.  The user can now initiate the download of all the data for the entire list, for individual objects, or just objects that have no data, so that should be fine.  I also did a little rearranging on the category screen.  Also just in case, I added some checks to see if some objects are null for safety.

CCMAIL:kstars-devel at kde.org

M  +60   -8    kstars/tools/whatsinteresting/modelmanager.cpp
M  +13   -2    kstars/tools/whatsinteresting/modelmanager.h
M  +409  -257  kstars/tools/whatsinteresting/qml/wiview.qml
M  +9    -3    kstars/tools/whatsinteresting/skyobjitem.cpp
M  +1    -1    kstars/tools/whatsinteresting/skyobjitem.h
M  +70   -24   kstars/tools/whatsinteresting/wiview.cpp
M  +1    -1    kstars/tools/whatsinteresting/wiview.h

https://commits.kde.org/kstars/490b49b5798a3ca2e33ede4d335b3b98e67be81e

diff --git a/kstars/tools/whatsinteresting/modelmanager.cpp b/kstars/tools/whatsinteresting/modelmanager.cpp
index 849031754..fdb3feace 100644
--- a/kstars/tools/whatsinteresting/modelmanager.cpp
+++ b/kstars/tools/whatsinteresting/modelmanager.cpp
@@ -115,6 +115,7 @@ void ModelManager::loadLists()
     loadObjectList(m_ObjectList[Comets], SkyObject::COMET);
     emit loadProgressUpdated(0.40);
     loadObjectList(m_ObjectList[Satellites], SkyObject::SATELLITE);
+    loadObjectList(m_ObjectList[Supernovas], SkyObject::SUPERNOVA);
     emit loadProgressUpdated(0.50);
     loadObjectList(m_ObjectList[Constellations], SkyObject::CONSTELLATION);
     emit loadProgressUpdated(0.55);
@@ -130,6 +131,7 @@ void ModelManager::loadLists()
     emit loadProgressUpdated(0.80);
 
     loadObjectList(m_ObjectList[Nebulas], SkyObject::PLANETARY_NEBULA);
+    loadObjectList(m_ObjectList[Nebulas], SkyObject::SUPERNOVA_REMNANT);
     loadObjectList(m_ObjectList[Nebulas], SkyObject::GASEOUS_NEBULA);
     loadObjectList(m_ObjectList[Nebulas], SkyObject::DARK_NEBULA);
 
@@ -142,16 +144,59 @@ void ModelManager::loadLists()
            if ((o = data->skyComposite()->findByName("M " + QString::number(i))))
                m_ObjectList[Messier].append(new SkyObjItem(o));
     }
+
     emit loadProgressUpdated(1);
-/**
-   Note:  The sharpless catalog did not have good wikipedia articles
-    for(int i=1;i<=350;i++)
-    {
-           SkyObject * o;
-           if ((o = data->skyComposite()->findByName("Sh2 " + QString::number(i))))
-               m_SharplessModel->addSkyObject(new SkyObjItem(o));
+}
+
+void ModelManager::loadNGCCatalog(){
+    KStarsData * data = KStarsData::Instance();
+    if(!ngcLoaded){
+        for(int i=1;i<=7840;i++)
+        {
+            if(i%100==0)
+                emit loadProgressUpdated((double)i/7840.0);
+            SkyObject * o;
+            if ((o = data->skyComposite()->findByName("NGC " + QString::number(i))))
+                m_ObjectList[NGC].append(new SkyObjItem(o));
+        }
+        updateModel(m_ObsConditions,"ngc");
+        emit loadProgressUpdated(1);
+    }
+    ngcLoaded = true;
+}
+
+void ModelManager::loadICCatalog(){
+    KStarsData * data = KStarsData::Instance();
+    if(!icLoaded){
+        for(int i=1;i<=3866;i++)
+        {
+            if(i%100==0)
+                emit loadProgressUpdated((double)i/3866.0);
+            SkyObject * o;
+            if ((o = data->skyComposite()->findByName("IC " + QString::number(i))))
+                m_ObjectList[IC].append(new SkyObjItem(o));
+        }
+        updateModel(m_ObsConditions,"ic");
+        emit loadProgressUpdated(1);
+    }
+    icLoaded = true;
+}
+
+void ModelManager::loadSharplessCatalog(){
+    KStarsData * data = KStarsData::Instance();
+    if(!sharplessLoaded){
+        for(int i=1;i<=320;i++)
+        {
+            if(i%100==0)
+                emit loadProgressUpdated((double)i/320.0);
+            SkyObject * o;
+            if ((o = data->skyComposite()->findByName("Sh2 " + QString::number(i))))
+                m_ObjectList[Sharpless].append(new SkyObjItem(o));
+        }
+        updateModel(m_ObsConditions,"sharpless");
+        emit loadProgressUpdated(1);
     }
-**/
+    sharplessLoaded = true;
 }
 
 void ModelManager::updateAllModels(ObsConditions * obs)
@@ -176,6 +221,7 @@ void ModelManager::updateModel(ObsConditions * obs, QString modelName){
             loadObjectsIntoModel(*m_ModelList[getModelNumber(modelName)], favoriteClusters);
         else
             loadObjectsIntoModel(*m_ModelList[getModelNumber(modelName)], m_ObjectList[getModelNumber(modelName)]);
+        emit modelUpdated();
     }
 }
 
@@ -236,10 +282,16 @@ int ModelManager::getModelNumber(QString modelName){
         return Asteroids;
     if(modelName=="comets")
         return Comets;
+    if(modelName=="supernovas")
+        return Supernovas;
     if(modelName=="satellites")
         return Satellites;
     if(modelName=="messier")
         return Messier;
+    if(modelName=="ngc")
+        return NGC;
+    if(modelName=="ic")
+        return IC;
     if(modelName=="sharpless")
         return Sharpless;
     else return -1;
diff --git a/kstars/tools/whatsinteresting/modelmanager.h b/kstars/tools/whatsinteresting/modelmanager.h
index ff7638318..405afd26b 100644
--- a/kstars/tools/whatsinteresting/modelmanager.h
+++ b/kstars/tools/whatsinteresting/modelmanager.h
@@ -36,7 +36,7 @@ class ModelManager: public QObject
          * \enum ModelType
          * \brief Model type for different types of sky-objects.
          */
-        enum ObjectList {Planets, Stars, Constellations, Galaxies, Clusters, Nebulas, Satellites, Asteroids, Comets, Messier, Sharpless, NumberOfLists};
+        enum ObjectList {Planets, Stars, Constellations, Galaxies, Clusters, Nebulas, Satellites, Asteroids, Comets, Supernovas, Messier, NGC, IC, Sharpless, NumberOfLists};
 
         /**
          * \brief Constructor - Creates models for different sky-object types.
@@ -86,10 +86,18 @@ class ModelManager: public QObject
 
         int getModelNumber(QString modelName);
 
-        SkyObjListModel * getTempModel(){ return tempModel;}
+        SkyObjListModel * getTempModel(){ return tempModel; }
+
+        void loadNGCCatalog();
+        void loadICCatalog();
+        void loadSharplessCatalog();
+        bool isNGCLoaded(){ return ngcLoaded; }
+        bool isICLoaded(){ return icLoaded; }
+        bool isSharplessLoaded(){ return sharplessLoaded; }
 
     signals:
         void loadProgressUpdated(double progress);
+        void modelUpdated();
 
     private:
         ObsConditions * m_ObsConditions;
@@ -105,6 +113,9 @@ class ModelManager: public QObject
         QList <SkyObjItem *> favoriteNebulas;
         QList <SkyObjItem *> favoriteClusters;
         SkyObjListModel * tempModel;
+        bool ngcLoaded = false;
+        bool icLoaded = false;
+        bool sharplessLoaded = false;
 
 
 };
diff --git a/kstars/tools/whatsinteresting/qml/wiview.qml b/kstars/tools/whatsinteresting/qml/wiview.qml
index 28bdd8d1e..7b3107d1b 100644
--- a/kstars/tools/whatsinteresting/qml/wiview.qml
+++ b/kstars/tools/whatsinteresting/qml/wiview.qml
@@ -1,5 +1,5 @@
 
-// Copyright (C) 2013 Samikshan Bairagya <samikshan at gmail.com>
+// Copyright (C) 2017 Robert Lancaster <rlancaste at gmail.com> based on work in 2013 by Samikshan Bairagya <samikshan at gmail.com>
 /***************************************************************************
  *                                                                         *
   *   This program is free software; you can redistribute it and/or modify  *
@@ -223,6 +223,36 @@ Rectangle {
                         }
                     }
                 }
+                
+                Item {
+                    id: satelliteItem
+                    width: satelliteText.width
+                    height: satelliteText.height
+                    anchors {
+                        verticalCenterOffset: -130
+                        horizontalCenterOffset: 50
+                        centerIn: parent
+                    }
+
+                    CategoryTitle {
+                        id: satelliteText
+                        title: xi18n("Satellites")
+                        anchors.centerIn: parent
+
+                        MouseArea {
+                            id: satelliteMouseArea
+                            anchors.fill: parent
+                            hoverEnabled: true
+                            onEntered: satelliteText.state = "selected"
+                            onExited: satelliteText.state = ""
+                            onClicked: {
+                                viewsRow.categorySelected("satellites")
+                                catTitle.text = "Satellites"
+                                container.state = "objectFromListSelected"
+                            }
+                        }
+                    }
+                }
 
                 Item {
                     id: starItem
@@ -230,8 +260,8 @@ Rectangle {
                     width: starText.width
                     height: starText.height
                     anchors{
-                        verticalCenterOffset: -130
-                        horizontalCenterOffset: 50
+                        verticalCenterOffset: -90
+                        horizontalCenterOffset: -50
                         centerIn: parent
                     }
 
@@ -257,12 +287,61 @@ Rectangle {
                 }
                 
                 Item {
+                    id: conItem
+                    width: conText.width
+                    height: conText.height
+                    anchors {
+                        verticalCenterOffset: -90
+                        horizontalCenterOffset: 50
+                        centerIn: parent
+                    }
+
+                    CategoryTitle {
+                        id: conText
+                        title: xi18n("Constellations")
+                        anchors.centerIn: parent
+
+                        MouseArea {
+                            id: conMouseArea
+                            anchors.fill: parent
+                            hoverEnabled: true
+                            onEntered: conText.state = "selected"
+                            onExited: conText.state = ""
+                            onClicked: {
+                                viewsRow.categorySelected("constellations")
+                                catTitle.text = "Constellations"
+                                container.state = "objectFromListSelected"
+                            }
+                        }
+                    }
+                }
+
+				Item {
+					id: dsoItem
+					width: dsoText.width
+					height: dsoText.height
+
+					anchors {
+						verticalCenterOffset: -50
+						horizontalCenterOffset: 0
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: dsoText
+						color: "yellow"
+						title: xi18n("Deep-sky Objects")
+						anchors.centerIn: parent
+					}
+				}
+				
+				Item {
                     id: asteroidItem
 
                     width: asteroidText.width
                     height: asteroidText.height
                     anchors{
-                        verticalCenterOffset: -90
+                        verticalCenterOffset: -10
                         horizontalCenterOffset: -50
                         centerIn: parent
                     }
@@ -294,7 +373,7 @@ Rectangle {
                     width: cometText.width
                     height: cometText.height
                     anchors{
-                        verticalCenterOffset: -90
+                        verticalCenterOffset: -10
                         horizontalCenterOffset: 50
                         centerIn: parent
                     }
@@ -320,274 +399,282 @@ Rectangle {
                     }
                 }
 
+				Item {
+					id: galItem
+
+					width: galText.width
+					height: galText.height
+
+					anchors {
+						verticalCenterOffset: 30
+						horizontalCenterOffset: -50
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: galText
+						title: xi18n("Galaxies")
+						anchors {
+							centerIn: parent
+							margins: 0
+						}
+
+						MouseArea {
+							id: galMouseArea
+							hoverEnabled: true
+							anchors.fill: parent
+							onEntered: galText.state = "selected"
+							onExited: galText.state = ""
+							onClicked: {
+								viewsRow.categorySelected("galaxies")
+								catTitle.text = "Galaxies"
+								container.state = "objectFromListSelected"
+							}
+						}
+					}
+				}
+
+				Item {
+					id: nebItem
+
+					width: nebText.width
+					height: nebText.height
+
+					anchors {
+						verticalCenterOffset: 30
+						horizontalCenterOffset: 50
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: nebText
+						title: xi18n("Nebulae")
+						anchors.centerIn: parent
+
+						MouseArea {
+							id: nebMouseArea
+							hoverEnabled: true
+							anchors.fill: parent
+							onEntered: nebText.state = "selected"
+							onExited: nebText.state = ""
+							onClicked: {
+								viewsRow.categorySelected("nebulas")
+								catTitle.text = "Nebulas"
+								container.state = "objectFromListSelected"
+							}
+						}
+					}
+				}
+
+				Item {
+					id: clustItem
+
+					width: clustText.width
+					height: clustText.height
+
+					anchors {
+						verticalCenterOffset: 70
+						horizontalCenterOffset: -50
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: clustText
+						title: xi18n("Clusters")
+						anchors.centerIn: parent
+
+						MouseArea {
+							id: clustMouseArea
+							hoverEnabled: true
+							anchors.fill: parent
+							onEntered: clustText.state = "selected"
+							onExited: clustText.state = ""
+							onClicked: {
+								viewsRow.categorySelected("clusters")
+								catTitle.text = "Clusters"
+								container.state = "objectFromListSelected"
+							}
+						}
+					}
+				}
+				
+				Item {
+					id: superItem
+
+					width: superText.width
+					height: superText.height
+
+					anchors {
+						verticalCenterOffset: 70
+						horizontalCenterOffset: 50
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: superText
+						title: xi18n("Supernovae")
+						anchors.centerIn: parent
+
+						MouseArea {
+							id: superMouseArea
+							hoverEnabled: true
+							anchors.fill: parent
+							onEntered: superText.state = "selected"
+							onExited: superText.state = ""
+							onClicked: {
+								viewsRow.categorySelected("supernovas")
+								catTitle.text = "Supernovae"
+								container.state = "objectFromListSelected"
+							}
+						}
+					}
+				}
+				
+				Item {
+					id: catalogsItem
+					width: catalogText.width
+					height: catalogText.height
+					anchors{
+						verticalCenterOffset: 110
+						horizontalCenterOffset: 0
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: catalogText
+						color: "yellow"
+						title: xi18n("Explore Catalogs")
+						anchors.centerIn: parent
+					}
+				}
+			
+				Item {
+					id: messierItem
+
+					width: messierText.width
+					height: messierText.height
+
+					anchors {
+						verticalCenterOffset: 150
+						horizontalCenterOffset: 0
+						centerIn: parent
+					}
+
+					CategoryTitle {
+						id: messierText
+						title: xi18n("Messier Catalog")
+						anchors.centerIn: parent
+
+						MouseArea {
+							id: messierMouseArea
+							hoverEnabled: true
+							anchors.fill: parent
+							onEntered: messierText.state = "selected"
+							onExited: messierText.state = ""
+							onClicked: {
+								viewsRow.categorySelected("messier")
+								catTitle.text = "Messier Catalog"
+								container.state = "objectFromListSelected"
+							}
+						}
+					}
+				}
+				
+				Item {
+			        id: ngcItem
+
+                    width: ngcText.width
+                    height: ngcText.height
 
-                Item {
-                    id: satelliteItem
-                    width: satelliteText.width
-                    height: satelliteText.height
                     anchors {
-                        verticalCenterOffset: -50
+                        verticalCenterOffset: 190
                         horizontalCenterOffset: 0
-                        centerIn: parent
-                    }
+	                    centerIn: parent
+	                }
 
                     CategoryTitle {
-                        id: satelliteText
-                        title: xi18n("Satellites")
-                        anchors.centerIn: parent
+                        id: ngcText
+                        title: xi18n("NGC Catalog")
+	                    anchors.centerIn: parent
 
                         MouseArea {
-                            id: satelliteMouseArea
-                            anchors.fill: parent
+                            id: ngcMouseArea
                             hoverEnabled: true
-                            onEntered: satelliteText.state = "selected"
-                            onExited: satelliteText.state = ""
-                            onClicked: {
-                                viewsRow.categorySelected("satellites")
-                                catTitle.text = "Satellites"
-                                container.state = "objectFromListSelected"
-                            }
-                        }
-                    }
-                }
-                
-                Item {
-                    id: conItem
-                    width: conText.width
-                    height: conText.height
+	                        anchors.fill: parent
+	                        onEntered: ngcText.state = "selected"
+	                        onExited: ngcText.state = ""
+		                    onClicked: {
+		                        viewsRow.categorySelected("ngc")
+		  						catTitle.text = "NGC Catalog"
+			                    container.state = "objectFromListSelected"
+			                }
+				        }
+				    }
+			    }
+			    
+			    Item {
+			        id: icItem
+
+                    width: icText.width
+                    height: icText.height
+
                     anchors {
-                        verticalCenterOffset: -10
+                        verticalCenterOffset: 230
                         horizontalCenterOffset: 0
-                        centerIn: parent
-                    }
+	                    centerIn: parent
+	                }
 
                     CategoryTitle {
-                        id: conText
-                        title: xi18n("Constellations")
-                        anchors.centerIn: parent
+                        id: icText
+                        title: xi18n("IC Catalog")
+	                    anchors.centerIn: parent
 
                         MouseArea {
-                            id: conMouseArea
-                            anchors.fill: parent
+                            id: icMouseArea
                             hoverEnabled: true
-                            onEntered: conText.state = "selected"
-                            onExited: conText.state = ""
-                            onClicked: {
-                                viewsRow.categorySelected("constellations")
-                                catTitle.text = "Constellations"
-                                container.state = "objectFromListSelected"
-                            }
-                        }
-                    }
-                }
+	                        anchors.fill: parent
+	                        onEntered: icText.state = "selected"
+	                        onExited: icText.state = ""
+		                    onClicked: {
+		                        viewsRow.categorySelected("ic")
+		  						catTitle.text = "IC Catalog"
+			                    container.state = "objectFromListSelected"
+			                }
+				        }
+				    }
+			    }
+				
+			    Item {
+			        id: sh2Item
+
+                    width: sh2Text.width
+                    height: sh2Text.height
 
-                Item {
-                    id: dsoContainer
-                    y: 172
-                    height: 200
                     anchors {
-                        right: parent.right
-                        rightMargin: 35
-                        left: parent.left
-                        leftMargin: 35
-                    }
-
-                    Item {
-                        id: dsoItem
-                        width: dsoText.width
-                        height: dsoText.height
-
-                        anchors {
-                            verticalCenterOffset: 10
-                            horizontalCenterOffset: 0
-                            centerIn: parent
-                        }
-
-                        CategoryTitle {
-                            id: dsoText
-                            color: "yellow"
-                            title: xi18n("Deep-sky Objects")
-                            anchors.centerIn: parent
-                        }
-                    }
-
-                    Item {
-                        id: galItem
-
-                        width: galText.width
-                        height: galText.height
-
-                        anchors {
-                            verticalCenterOffset: 50
-                            horizontalCenterOffset: -50
-                            centerIn: parent
-                        }
-
-                        CategoryTitle {
-                            id: galText
-                            title: xi18n("Galaxies")
-                            anchors {
-                                centerIn: parent
-                                margins: 0
-                            }
-
-                            MouseArea {
-                                id: galMouseArea
-                                hoverEnabled: true
-                                anchors.fill: parent
-                                onEntered: galText.state = "selected"
-                            	onExited: galText.state = ""
-                                onClicked: {
-                                    viewsRow.categorySelected("galaxies")
-                                    catTitle.text = "Galaxies"
-                                    container.state = "objectFromListSelected"
-                                }
-                            }
-                        }
-                    }
-
-                    Item {
-                        id: nebItem
-
-                        width: nebText.width
-                        height: nebText.height
-
-                        anchors {
-                            verticalCenterOffset: 90
-                            horizontalCenterOffset: 0
-                            centerIn: parent
-                        }
-
-                        CategoryTitle {
-                            id: nebText
-                            title: xi18n("Nebulae")
-                            anchors.centerIn: parent
-
-                            MouseArea {
-                                id: nebMouseArea
-                                hoverEnabled: true
-                                anchors.fill: parent
-                                onEntered: nebText.state = "selected"
-                            	onExited: nebText.state = ""
-                                onClicked: {
-                                    viewsRow.categorySelected("nebulas")
-                                    catTitle.text = "Nebulas"
-                                    container.state = "objectFromListSelected"
-                                }
-                            }
-                        }
-                    }
-
-                    Item {
-                        id: clustItem
-
-                        width: clustText.width
-                        height: clustText.height
-
-                        anchors {
-                            verticalCenterOffset: 50
-                            horizontalCenterOffset: 50
-                            centerIn: parent
-                        }
-
-                        CategoryTitle {
-                            id: clustText
-                            title: xi18n("Clusters")
-                            anchors.centerIn: parent
-
-                            MouseArea {
-                                id: clustMouseArea
-                                hoverEnabled: true
-                                anchors.fill: parent
-                                onEntered: clustText.state = "selected"
-                            	onExited: clustText.state = ""
-                                onClicked: {
-                                    viewsRow.categorySelected("clusters")
-                                    catTitle.text = "Clusters"
-                                    container.state = "objectFromListSelected"
-                                }
-                            }
-                        }
-                    }
-                    Item {
-                    id: catalogsItem
-                    width: catalogText.width
-                    height: catalogText.height
-                    anchors{
-                        verticalCenterOffset: 130
+                        verticalCenterOffset: 270
                         horizontalCenterOffset: 0
-                        centerIn: parent
-                    }
+	                    centerIn: parent
+	                }
 
                     CategoryTitle {
-                        id: catalogText
-                        color: "yellow"
-                        title: xi18n("Explore Catalogs")
-                        anchors.centerIn: parent
-                    }
-                }
-                    Item {
-                        id: messierItem
+                        id: sh2Text
+                        title: xi18n("Sharpless Catalog")
+	                    anchors.centerIn: parent
 
-                        width: messierText.width
-                        height: messierText.height
-
-                        anchors {
-                            verticalCenterOffset: 170
-                            horizontalCenterOffset: 0
-                            centerIn: parent
-                        }
-
-                        CategoryTitle {
-                            id: messierText
-                            title: xi18n("Messier Objects")
-                            anchors.centerIn: parent
-
-                            MouseArea {
-                                id: messierMouseArea
-                                hoverEnabled: true
-                                anchors.fill: parent
-                                onEntered: messierText.state = "selected"
-                            	onExited: messierText.state = ""
-                                onClicked: {
-                                    viewsRow.categorySelected("messier")
-                                    catTitle.text = "Messier Objects"
-                                    container.state = "objectFromListSelected"
-                                }
-                            }
-                        }
-                    }
-                 //   Item {
-                 //       id: sh2Item
-//
- //                       width: sh2Text.width
-  //                      height: sh2Text.height
-//
-  //                      anchors {
-    //                        verticalCenterOffset: 190
-      //                      horizontalCenterOffset: 69
-        //                    centerIn: parent
-          //              }
-//
-  //                      CategoryTitle {
-    //                        id: sh2Text
-      //                      title: xi18n("Sharpless Objects")
-        //                    anchors.centerIn: parent
-//
-  //                          MouseArea {
-    //                            id: sh2MouseArea
-      //                          hoverEnabled: true
-        //                        anchors.fill: parent
-          //                      onEntered: container.state = "sh2AreaEntered"
-            //                    onClicked: {
-              //                      viewsRow.categorySelected("sharpless")
-              //					  catTitle.text = "Sharpless Objects"
-                //                    container.state = "objectFromListSelected"
-                  //              }
-                    //        }
-                      //  }
-                 //   }
-                }
+                        MouseArea {
+                            id: sh2MouseArea
+                            hoverEnabled: true
+	                        anchors.fill: parent
+	                        onEntered: sh2Text.state = "selected"
+	                        onExited: sh2Text.state = ""
+		                    onClicked: {
+		                        viewsRow.categorySelected("sharpless")
+		  						catTitle.text = "Sharpless Catalog"
+			                    container.state = "objectFromListSelected"
+			                }
+				        }
+				    }
+			    }
             } //end of categoryView
 
             Flipable {
@@ -647,6 +734,25 @@ Rectangle {
 								
 								model: soListModel
 								
+								Rectangle{
+									id: soListEmptyMessage
+									objectName: "soListEmptyMessage"
+									color: "#00060b"
+									anchors.fill: parent
+									Text{
+										anchors.fill: parent
+										text: "No Items to display"
+										verticalAlignment: Text.AlignVCenter
+										horizontalAlignment: Text.AlignHCenter
+										color: "white"
+										font{
+											family: "Arial"
+											pointSize: 20
+										}
+									}
+									visible: (soListView.count > 0) ? false : true
+								}
+								
 								Rectangle {
         							id: scrollbar
         							anchors.right: soListView.right
@@ -750,7 +856,6 @@ Rectangle {
                             width: 4
                             color: "#000000"
                         }
-                        
 
                         Text {
                             id: soname
@@ -1095,7 +1200,9 @@ Rectangle {
     												}
 										
 													wrapMode: Text.WrapAtWordBoundaryOrAnywhere
-													text: xi18n("\ntrying to Load from Wikipedia. . .")
+													verticalAlignment: Text.AlignVCenter
+													horizontalAlignment: Text.AlignHCenter
+													text: xi18n("Info Text")
 													clip: true
 													width: parent.width
 													font{
@@ -1270,10 +1377,27 @@ Rectangle {
             					event.accepted = true;
     						}
     						soListView.positionViewAtIndex(soListView.currentIndex, ListView.Beginning)
-    					}
-
-                        
+    					}                     
                     } //end of detailsView
+                    
+                    Rectangle{
+						id: soItemEmptyMessage
+						objectName: "soItemEmptyMessage"
+						color: "#00060b"
+						anchors.fill: parent
+						Text{
+							anchors.fill: parent
+							text: "No Items to display"
+							verticalAlignment: Text.AlignVCenter
+							horizontalAlignment: Text.AlignHCenter
+							color: "white"
+							font{
+								family: "Arial"
+								pointSize: 20
+							}
+						}
+						visible: (soListView.count > 0) ? false : true
+					}                        
                 } //end of detailsViewContainer
 
                 states: [
@@ -1304,6 +1428,34 @@ Rectangle {
                     axis.y: 1
                     axis.z: 0
                 }
+                					
+				Rectangle{
+					id: loadingMessage
+					objectName: "loadingMessage"
+					color: "#00060b"
+					anchors.fill: parent
+					visible: false
+					Text{
+							anchors.fill: parent
+							text: "Loading . . ."
+							verticalAlignment: Text.AlignVCenter
+							horizontalAlignment: Text.AlignHCenter
+							color: "white"
+							font{
+                				family: "Arial"
+                				pointSize: 30
+            				}
+					}
+					states: [
+                   		State {
+                        	name: "loading"
+                        	PropertyChanges {target: loadingMessage; visible: true }
+                        	PropertyChanges {target: skyObjView; flipped:false }
+                    	}
+                	]
+				}
+
+                
             } //end of skyObjView
         } //end of viewsContainer
     } //end of base
diff --git a/kstars/tools/whatsinteresting/skyobjitem.cpp b/kstars/tools/whatsinteresting/skyobjitem.cpp
index d73964653..b85331311 100644
--- a/kstars/tools/whatsinteresting/skyobjitem.cpp
+++ b/kstars/tools/whatsinteresting/skyobjitem.cpp
@@ -23,18 +23,21 @@
 #include "ksutils.h"
 #include "kspaths.h"
 
-SkyObjItem::SkyObjItem(SkyObject * so) : m_Name(so->name()), m_LongName(so->longname()),m_TypeName(so->typeName()), m_So(so), skd(NULL)
+SkyObjItem::SkyObjItem(SkyObject * so) : m_Name(so->name()), m_LongName(so->longname()),m_TypeName(so->typeName()), m_So(so)
 {
     switch (so->type())
     {
         case SkyObject::PLANET:
+        case SkyObject::MOON:
             m_Type = Planet;
             break;
         case SkyObject::STAR:
-            skd = new SkyObjDescription(m_Name, m_TypeName);
+        case SkyObject::CATALOG_STAR:
+        case SkyObject::MULT_STAR:
             m_Type = Star;
             break;
         case SkyObject::CONSTELLATION:
+        case SkyObject::ASTERISM:
             m_Type = Constellation;
             break;
         case SkyObject::GALAXY:
@@ -46,10 +49,13 @@ SkyObjItem::SkyObjItem(SkyObject * so) : m_Name(so->name()), m_LongName(so->long
             m_Type = Cluster;
             break;
         case SkyObject::PLANETARY_NEBULA:
+        case SkyObject::SUPERNOVA_REMNANT:
         case SkyObject::GASEOUS_NEBULA:
         case SkyObject::DARK_NEBULA:
             m_Type = Nebula;
             break;
+        case SkyObject::SUPERNOVA:
+            m_Type = Supernova;
     }
 
     setPosition(m_So);
@@ -57,7 +63,7 @@ SkyObjItem::SkyObjItem(SkyObject * so) : m_Name(so->name()), m_LongName(so->long
 
 SkyObjItem::~SkyObjItem()
 {
-    delete skd;
+
 }
 
 QVariant SkyObjItem::data(int role)
diff --git a/kstars/tools/whatsinteresting/skyobjitem.h b/kstars/tools/whatsinteresting/skyobjitem.h
index 3deee541c..2674d8bda 100644
--- a/kstars/tools/whatsinteresting/skyobjitem.h
+++ b/kstars/tools/whatsinteresting/skyobjitem.h
@@ -40,7 +40,7 @@ class SkyObjItem
          * \enum Type
          * The type classification for the SkyObjItem
          */
-        enum Type { Planet, Star, Constellation, Galaxy, Cluster, Nebula };
+        enum Type { Planet, Star, Constellation, Galaxy, Cluster, Nebula, Supernova };
 
         /**
          * \brief Constructor
diff --git a/kstars/tools/whatsinteresting/wiview.cpp b/kstars/tools/whatsinteresting/wiview.cpp
index f0fdf29c1..a9ac85fee 100644
--- a/kstars/tools/whatsinteresting/wiview.cpp
+++ b/kstars/tools/whatsinteresting/wiview.cpp
@@ -28,6 +28,7 @@
 #include "Options.h"
 #include "wiequipsettings.h"
 #include "skymapcomposite.h"
+#include <QtConcurrent>
 
 
 #ifdef HAVE_INDI
@@ -66,12 +67,23 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1)
     ///Use instead of KDeclarative
     m_Ctxt->setContextObject(new KLocalizedContext(m_BaseView));
 
-    m_BaseView->setSource(QUrl::fromLocalFile(KSPaths::locate(QStandardPaths::AppDataLocation, "tools/whatsinteresting/qml/wiview.qml")));
+    QString WI_Location="";
+    #ifdef Q_OS_OSX
+        WI_Location = QCoreApplication::applicationDirPath()+"/../Resources/data/tools/whatsinteresting/qml/wiview.qml";
+        if(!QFileInfo(WI_Location).exists())
+            WI_Location = KSPaths::locate(QStandardPaths::AppDataLocation, "tools/whatsinteresting/qml/wiview.qml");
+    #else
+        WI_Location = KSPaths::locate(QStandardPaths::AppDataLocation, "tools/whatsinteresting/qml/wiview.qml");
+    #endif
+
+    m_BaseView->setSource(QUrl::fromLocalFile(WI_Location));
 
     m_BaseObj = m_BaseView->rootObject();
 
     m_ProgressBar = m_BaseObj->findChild<QQuickItem *>("progressBar");
 
+    m_loadingMessage = m_BaseObj->findChild<QQuickItem *>("loadingMessage");
+
     m_CategoryTitle = m_BaseObj->findChild<QQuickItem *>(QString("categoryTitle"));
 
     m_ViewsRowObj = m_BaseObj->findChild<QQuickItem *>(QString("viewsRowObj"));
@@ -127,6 +139,7 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1)
 
     setProgressBarVisible(true);
     connect(m_ModManager, SIGNAL(loadProgressUpdated(double)),this,SLOT(updateProgress(double)));
+    connect(m_ModManager, SIGNAL(modelUpdated()),this,SLOT(refreshListView()));
     m_ViewsRowObj->setProperty("enabled",false);
 
 }
@@ -144,9 +157,14 @@ void WIView::setProgressBarVisible(bool visible){
 
 void WIView::updateProgress(double value){
     m_ProgressBar->setProperty("value", value);
+
     if(value==1){
         setProgressBarVisible(false);
         m_ViewsRowObj->setProperty("enabled",true);
+        m_loadingMessage->setProperty("state", "");
+    } else{
+        setProgressBarVisible(true);
+        m_loadingMessage->setProperty("state", "loading");
     }
 }
 
@@ -191,13 +209,25 @@ void WIView::updateObservingConditions(){
 void WIView::onCategorySelected(QString model)
 {
     m_CurrentObjectListName = model;
-    updateModel(m_Obs);
-    m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(model));
+    m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(m_CurrentObjectListName));
+    m_CurIndex = -2;
     if(!m_ModManager->showOnlyVisibleObjects())
         visibleIconObj->setProperty("state","unchecked");
     if(!m_ModManager->showOnlyFavoriteObjects())
         favoriteIconObj->setProperty("state","unchecked");
-    onSoListItemClicked(0);
+    if(model=="ngc"&&(!m_ModManager->isNGCLoaded())){
+        QtConcurrent::run(m_ModManager,&ModelManager::loadNGCCatalog);
+        return;
+    }
+    if(model=="ic"&&(!m_ModManager->isICLoaded())){
+        QtConcurrent::run(m_ModManager,&ModelManager::loadICCatalog);
+        return;
+    }
+    if(model=="sharpless"&&(!m_ModManager->isSharplessLoaded())){
+        QtConcurrent::run(m_ModManager,&ModelManager::loadSharplessCatalog);
+        return;
+    }
+    updateModel(m_Obs);
 }
 
 void WIView::onSoListItemClicked(int index)
@@ -209,16 +239,20 @@ void WIView::onSoListItemClicked(int index)
 
 void WIView::onNextObjClicked()
 {
-    int modelSize = m_ModManager->returnModel(m_CurrentObjectListName)->rowCount();
-    SkyObjItem * nextItem = m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjItem((m_CurIndex+1)%modelSize);
-    loadDetailsView(nextItem, (m_CurIndex+1)%modelSize);
+    if( m_CurrentObjectListName!=""){
+        int modelSize = m_ModManager->returnModel(m_CurrentObjectListName)->rowCount();
+        SkyObjItem * nextItem = m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjItem((m_CurIndex+1)%modelSize);
+        loadDetailsView(nextItem, (m_CurIndex+1)%modelSize);
+    }
 }
 
 void WIView::onPrevObjClicked()
 {
-    int modelSize = m_ModManager->returnModel(m_CurrentObjectListName)->rowCount();
-    SkyObjItem * prevItem = m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
-    loadDetailsView(prevItem, (m_CurIndex-1+modelSize)%modelSize);
+    if( m_CurrentObjectListName!=""){
+        int modelSize = m_ModManager->returnModel(m_CurrentObjectListName)->rowCount();
+        SkyObjItem * prevItem = m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
+        loadDetailsView(prevItem, (m_CurIndex-1+modelSize)%modelSize);
+    }
 }
 
 void WIView::onCenterButtonClicked()
@@ -291,9 +325,11 @@ void WIView::onDetailsButtonClicked()
     ///Code taken from WUTDialog::slotDetails()
     KStars * kstars = KStars::Instance();
     SkyObject * so = m_CurSoItem->getSkyObject();
-    DetailDialog * detail = new DetailDialog(so, kstars->data()->lt(), kstars->data()->geo(), kstars);
-    detail->exec();
-    delete detail;
+    if(so){
+        DetailDialog * detail = new DetailDialog(so, kstars->data()->lt(), kstars->data()->geo(), kstars);
+        detail->exec();
+        delete detail;
+    }
 }
 
 void WIView::onSettingsIconClicked()
@@ -305,7 +341,8 @@ void WIView::onSettingsIconClicked()
 void WIView::onReloadIconClicked()
 {
     updateModel(m_Obs);
-    m_CurIndex=m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjIndex(m_CurSoItem);
+    if(m_CurrentObjectListName!="")
+        m_CurIndex=m_ModManager->returnModel(m_CurrentObjectListName)->getSkyObjIndex(m_CurSoItem);
     loadDetailsView(m_CurSoItem, m_CurIndex);
 }
 
@@ -325,12 +362,15 @@ void WIView::onUpdateIconClicked(){
     QMessageBox mbox;
     mbox.setText( "Please choose which object(s) to try to update with Wikipedia data." );
     QPushButton * currentObject = mbox.addButton("Current Object" , QMessageBox::AcceptRole);
-    QPushButton * missingObjects = mbox.addButton("Objects with no data" , QMessageBox::AcceptRole);
-    QPushButton * allObjects = mbox.addButton("Entire List" , QMessageBox::AcceptRole);
+    QPushButton * missingObjects;
+    QPushButton * allObjects;
+    if(m_CurrentObjectListName!=""){
+        missingObjects = mbox.addButton("Objects with no data" , QMessageBox::AcceptRole);
+        allObjects = mbox.addButton("Entire List" , QMessageBox::AcceptRole);
+    }
     QPushButton * cancel = mbox.addButton( "Cancel", QMessageBox::AcceptRole );
     mbox.setDefaultButton(cancel);
 
-
     mbox.exec();
     if(mbox.clickedButton()==currentObject)
     {
@@ -357,6 +397,8 @@ void WIView::refreshListView(){
     m_Ctxt->setContextProperty("soListModel",0);
     if (m_CurrentObjectListName !="")
         m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(m_CurrentObjectListName));
+    if(m_CurIndex==-2)
+        onSoListItemClicked(0);
     if(m_CurIndex!=-1)
         m_SoListObj->setProperty("currentIndex", m_CurIndex);
 }
@@ -365,7 +407,6 @@ void WIView::updateModel(ObsConditions * obs)
 {
     m_Obs = obs;
     m_ModManager->updateModel(m_Obs,m_CurrentObjectListName);
-    refreshListView();
 }
 
 void WIView::inspectSkyObject(QString name){
@@ -377,6 +418,7 @@ void WIView::inspectSkyObject(QString name){
 void WIView::inspectSkyObject(SkyObject *obj){
     if(obj){
         if(obj->name()!="star"){
+            m_CurrentObjectListName="";
             loadDetailsView(new SkyObjItem(obj),-1);
             m_BaseObj->setProperty("state", "singleItemSelected");
             m_CategoryTitle->setProperty("text", "Selected Object");
@@ -386,6 +428,8 @@ void WIView::inspectSkyObject(SkyObject *obj){
 
 void WIView::loadDetailsView(SkyObjItem * soitem, int index)
 {
+    if(!soitem)
+        return;
     m_CurSoItem = soitem;
     m_CurIndex = index;
     int modelSize;
@@ -423,7 +467,7 @@ void WIView::loadDetailsView(SkyObjItem * soitem, int index)
 
     loadObjectDescription(soitem);
 
-    infoBoxText->setProperty("text", "trying to Load infoText box from Wikipedia. . .");
+    infoBoxText->setProperty("text", "<BR><BR>No Wikipedia information. <BR>  Please try to download it using the orange download button below.");
     loadObjectInfoBox(soitem);
 
     QString summary=soitem->getSummary(false);
@@ -451,6 +495,8 @@ void WIView::loadDetailsView(SkyObjItem * soitem, int index)
 }
 
 QString WIView::getWikipediaName(SkyObjItem *soitem){
+    if(!soitem)
+        return "";
     QString name;
     if(soitem->getName().toLower().startsWith("m "))
         name = soitem->getName().replace("M ","Messier_").remove( ' ' );
@@ -490,6 +536,8 @@ QString WIView::getWikipediaName(SkyObjItem *soitem){
 
 void WIView::updateWikipediaDescription(SkyObjItem * soitem)
 {
+    if(!soitem)
+        return;
     QString name=getWikipediaName(soitem);
 
     QUrl url("https://en.wikipedia.org/w/api.php?action=opensearch&search=" + name + "&format=xml");
@@ -550,6 +598,8 @@ void WIView::loadObjectDescription(SkyObjItem * soitem){
 
 void WIView::loadObjectInfoBox(SkyObjItem * soitem)
 {
+    if(!soitem)
+        return;
     QFile file;
     QString fname = "infoText-" + soitem->getName().toLower().remove( ' ' ) + ".html";
     file.setFileName( KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "descriptions/" + fname ) ; //determine filename in local user KDE directory tree.
@@ -578,10 +628,6 @@ void WIView::loadObjectInfoBox(SkyObjItem * soitem)
             file.close();
         }
     }
-    else
-    {
-        tryToUpdateWikipediaInfo(soitem, getWikipediaName(soitem));
-    }
 }
 
 void WIView::tryToUpdateWikipediaInfoInModel(bool onlyMissing){
@@ -603,7 +649,7 @@ void WIView::tryToUpdateWikipediaInfoInModel(bool onlyMissing){
 
 void WIView::tryToUpdateWikipediaInfo(SkyObjItem * soitem, QString name)
 {
-    if(name=="")
+    if(name==""||!soitem)
         return;
     QUrl url("https://en.wikipedia.org/w/index.php?action=render&title="+ name + "&redirects");
 
diff --git a/kstars/tools/whatsinteresting/wiview.h b/kstars/tools/whatsinteresting/wiview.h
index 36ed55d57..2fbda8a14 100644
--- a/kstars/tools/whatsinteresting/wiview.h
+++ b/kstars/tools/whatsinteresting/wiview.h
@@ -144,7 +144,7 @@ class WIView : public QWidget
 
 
     private:
-        QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj,  *m_ProgressBar,
+        QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj,  *m_ProgressBar, *m_loadingMessage,
                    *m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * visibleIconObj, * favoriteIconObj;
         QQmlContext * m_Ctxt;
         QObject * infoBoxText, * descTextObj;


More information about the Kstars-devel mailing list