[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kstars] kstars/skycomponents: Use progress dialog so user can see some progress and ability to canc
From: Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date: 2016-11-23 10:08:44
Message-ID: E1c9UTs-0006Vo-Fx () code ! kde ! org
[Download RAW message or body]
Git commit c98efd3e6c7457a27a73aa74fe8d6282563250a8 by Jasem Mutlaq.
Committed on 23/11/2016 at 10:02.
Pushed by mutlaqja into branch 'master'.
Use progress dialog so user can see some progress and ability to cancel download
M +8 -5 kstars/skycomponents/asteroidscomponent.cpp
M +6 -0 kstars/skycomponents/cometscomponent.cpp
https://commits.kde.org/kstars/c98efd3e6c7457a27a73aa74fe8d6282563250a8
diff --git a/kstars/skycomponents/asteroidscomponent.cpp \
b/kstars/skycomponents/asteroidscomponent.cpp index 8a6cf34..d561048 100644
--- a/kstars/skycomponents/asteroidscomponent.cpp
+++ b/kstars/skycomponents/asteroidscomponent.cpp
@@ -41,6 +41,7 @@
#include "kstarsdata.h"
#include "ksfilereader.h"
#include "auxiliary/kspaths.h"
+#include "auxiliary/ksnotification.h"
AsteroidsComponent::AsteroidsComponent(SolarSystemComposite *parent) : \
SolarSystemListComponent(parent) {
@@ -95,9 +96,12 @@ void AsteroidsComponent::loadData()
emitProgressText( i18n("Loading asteroids") );
// Clear lists
+ qDeleteAll(m_ObjectList);
m_ObjectList.clear();
- objectNames( SkyObject::ASTEROID ).clear();
+
objectLists( SkyObject::ASTEROID ).clear();
+ objectNames( SkyObject::ASTEROID ).clear();
+
QList< QPair<QString, KSParser::DataTypes> > sequence;
sequence.append(qMakePair(QString("full name"), KSParser::D_QSTRING));
@@ -257,6 +261,8 @@ void AsteroidsComponent::updateDataFile()
{
downloadJob = new FileDownloader();
+ downloadJob->setProgressDialogEnabled(true, i18n("Asteroid Update"), \
i18n("Downloading asteroids updates...")); +
QObject::connect(downloadJob, SIGNAL(downloaded()), this, \
SLOT(downloadReady()));
QObject::connect(downloadJob, SIGNAL(error(QString)), this, \
SLOT(downloadError(QString)));
@@ -297,10 +303,7 @@ void AsteroidsComponent::downloadReady()
void AsteroidsComponent::downloadError(const QString &errorString)
{
-#ifndef KSTARS_LITE
- KMessageBox::error(0, i18n("Error downloading asteroids data: %1", \
errorString));
-#else
+ KSNotification::error(i18n("Error downloading asteroids data: %1", \
errorString));
qDebug() << i18n("Error downloading asteroids data: %1", errorString);
-#endif
downloadJob->deleteLater();
}
diff --git a/kstars/skycomponents/cometscomponent.cpp \
b/kstars/skycomponents/cometscomponent.cpp index d9eaa01..cc303f3 100644
--- a/kstars/skycomponents/cometscomponent.cpp
+++ b/kstars/skycomponents/cometscomponent.cpp
@@ -92,6 +92,10 @@ void CometsComponent::loadData() {
float M1, M2, K1, K2, diameter, albedo, rot_period, period;
emitProgressText(i18n("Loading comets"));
+
+ qDeleteAll(m_ObjectList);
+ m_ObjectList.clear();
+
objectNames(SkyObject::COMET).clear();
objectLists(SkyObject::COMET).clear();
@@ -214,6 +218,8 @@ void CometsComponent::updateDataFile()
{
downloadJob = new FileDownloader();
+ downloadJob->setProgressDialogEnabled(true, i18n("Comets Update"), \
i18n("Downloading comets updates...")); +
connect(downloadJob, SIGNAL(downloaded()), this, SLOT(downloadReady()));
connect(downloadJob, SIGNAL(error(QString)), this, \
SLOT(downloadError(QString)));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic