Commit 854a5889 authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

In this patch, I implemented batch downloads for object lists. Note that it...

In this patch, I implemented batch downloads for object lists.  Note that it will download the objects currently selected/shown in the list based on filtering options, not everything in the entire massive list.
If the user wants the *whole* list, they should turn off the visible objects only button and the favorites only button and set the sky quality to 1.
I also enabled the wikipedia downloading info text to overwrite previously existing downloaded info text files, so now it truly is an updater.
I also improved the search results for stars and constellations.  Also, I prevented the object description from being downloaded unless a real wikipedia article about the object is found.
There were way too many false results in the object descriptions that were downloading.  Finally, I added a progress bar for the initial object load and disabled the list access until loading is done.
It is certainly possible to make that more list specific in the future, but for now, loading everything doesn’t take too long.
parent 4df43323
......@@ -53,6 +53,7 @@ ModelManager::~ModelManager()
void ModelManager::loadLists()
emit loadProgressUpdated(0);
KStarsData * data = KStarsData::Instance();
QVector<QPair<QString, const SkyObject *>> listStars;
......@@ -107,22 +108,33 @@ void ModelManager::loadLists()
emit loadProgressUpdated(0.20);
loadObjectList(m_ObjectList[Asteroids], SkyObject::ASTEROID);
emit loadProgressUpdated(0.30);
loadObjectList(m_ObjectList[Comets], SkyObject::COMET);
emit loadProgressUpdated(0.40);
loadObjectList(m_ObjectList[Satellites], SkyObject::SATELLITE);
emit loadProgressUpdated(0.50);
loadObjectList(m_ObjectList[Constellations], SkyObject::CONSTELLATION);
emit loadProgressUpdated(0.55);
loadObjectList(m_ObjectList[Planets], SkyObject::PLANET);
emit loadProgressUpdated(0.60);
loadObjectList(m_ObjectList[Galaxies], SkyObject::GALAXY);
emit loadProgressUpdated(0.70);
loadObjectList(m_ObjectList[Clusters], SkyObject::OPEN_CLUSTER);
loadObjectList(m_ObjectList[Clusters], SkyObject::GLOBULAR_CLUSTER);
loadObjectList(m_ObjectList[Clusters], SkyObject::GALAXY_CLUSTER);
emit loadProgressUpdated(0.80);
loadObjectList(m_ObjectList[Nebulas], SkyObject::PLANETARY_NEBULA);
loadObjectList(m_ObjectList[Nebulas], SkyObject::GASEOUS_NEBULA);
loadObjectList(m_ObjectList[Nebulas], SkyObject::DARK_NEBULA);
emit loadProgressUpdated(0.90);
for(int i=1;i<=110;i++)
......@@ -130,6 +142,7 @@ 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++)
......@@ -177,6 +190,16 @@ void ModelManager::loadObjectList(QList<SkyObjItem *> & skyObjectList, int type)
if(listObject->name() != "Sun")
skyObjectList.append(new SkyObjItem(listObject->clone()));
QString prevName;
for(int i = 0; i < skyObjectList.size(); i++)
SkyObjItem *;
prevName = obj->getName();
void ModelManager::loadObjectsIntoModel(SkyObjListModel & model, QList<SkyObjItem *> &skyObjectList){
......@@ -28,8 +28,9 @@
* \brief Manages models for QML listviews of different types of sky-objects.
* \author Samikshan Bairagya
class ModelManager
class ModelManager: public QObject
* \enum ModelType
......@@ -87,6 +88,9 @@ class ModelManager
SkyObjListModel * getTempModel(){ return tempModel;}
void loadProgressUpdated(double progress);
ObsConditions * m_ObsConditions;
void loadLists();
......@@ -20,6 +20,13 @@ Rectangle {
property double buttonOpacity: 0.2
property double categoryTitleOpacity: 0.350
ProgressBar {
id: progress
objectName: "progressBar"
width: container.width
value: 0.10
Text {
id: title
......@@ -1615,7 +1622,7 @@ Rectangle {
states: [
State {
name: "invisible"
when: skyObjView.flipped == false || (container.state != "objectFromListSelected" && container.state != "singleItemSelected")
when: container.state == "base" || container.state == ""
PropertyChanges {target: downloadMouseArea; enabled: false}
PropertyChanges {target: downloadIcon; opacity: 0}
......@@ -210,5 +210,5 @@ inline QString SkyObjItem::loadObjectDescription() const{
return line;
return "";
return getTypeName();
This diff is collapsed.
......@@ -125,24 +125,30 @@ class WIView : public QWidget
void onFavoriteIconClicked(bool checked);
void onDownloadIconClicked();
void onUpdateIconClicked();
void tryToLoadDescFromWikipedia(QObject * descTextObj, SkyObjItem * soitem);
void loadObjectDescription(QObject * descTextObj, SkyObjItem * soitem);
void tryToLoadInfoBoxFromWikipedia(QObject * infoBoxText, SkyObjItem * soitem, QString name);
void loadObjectInfoBox(QObject * infoBoxText, SkyObjItem * soitem);
void updateWikipediaDescription(SkyObjItem * soitem);
void loadObjectDescription(SkyObjItem * soitem);
void tryToUpdateWikipediaInfo(SkyObjItem * soitem, QString name);
void loadObjectInfoBox(SkyObjItem * soitem);
void saveImageURL(SkyObjItem * soitem, QString imageURL);
void saveObjectText(SkyObjItem * soitem, QString type, QString infoText);
void saveObjectInfoBoxText(SkyObjItem * soitem, QString type, QString infoText);
void downloadWikipediaImage(SkyObjItem * soitem, QString imageURL);
void inspectSkyObject(QString name);
void inspectSkyObject(SkyObject *obj);
void updateObservingConditions();
void tryToUpdateWikipediaInfoInModel(bool onlyMissing);
void refreshListView();
void updateProgress(double value);
void setProgressBarVisible(bool visible);
QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj,
QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj, *m_ProgressBar,
*m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * visibleIconObj, * favoriteIconObj;
QQmlContext * m_Ctxt;
QObject * infoBoxText, * descTextObj;
QQuickView * m_BaseView;
ObsConditions * m_Obs;
ModelManager * m_ModManager;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment