diff ui/mainwindow.cpp @ 1126:a07030035349

(issue96) Add progressbar during download if window is visible.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 17 Sep 2014 12:14:07 +0200
parents dd9094d92899
children 1a5f9e260099
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Wed Sep 17 12:12:44 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Sep 17 12:14:07 2014 +0200
@@ -146,7 +146,6 @@
 void MainWindow::messageClicked()
 {
     if (mCurState == NewSoftwareAvailable) {
-        hide();
         verifySWData();
         QString swFileName = mSettings.value("Software/available").toString();
         if (swFileName.isEmpty()) {
@@ -302,7 +301,7 @@
         qDebug () << "Failed to create temporary directory.";
         return QString();
     }
-    QString targetPath = tDir.path() + QObject::tr("TrustBridge-Updater",
+    QString targetPath = tDir.path() + "/" + QObject::tr("TrustBridge-Updater",
             "Used as filename for the updater. Only use ASCII please.");
 
     tDir.setAutoRemove(false);
@@ -507,6 +506,17 @@
     connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)),
             this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
     downloader->start();
+
+    if (downloadSW && getState() == DownloadingSW && isVisible()) {
+        QProgressDialog *progDlg = new QProgressDialog(this);
+        progDlg->setCancelButton(0);
+        progDlg->setRange(0,0);
+        progDlg->setMinimumDuration(0);
+        progDlg->setLabelText(tr("Downloading update..."));
+        progDlg->show();
+        connect(downloader, SIGNAL(finished()), progDlg, SLOT(deleteLater()));
+        connect(downloader, SIGNAL(finished()), progDlg, SLOT(cancel()));
+    }
 }
 
 void MainWindow::getLastModForCurrentVersion()

http://wald.intevation.org/projects/trustbridge/