[PATCH 5 of 5] (issue96) Add progressbar during download if window is visible
Wald Commits
scm-commit at wald.intevation.org
Wed Sep 17 12:14:18 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410948847 -7200
# Node ID a07030035349095d2393a0f7c4bcae6fa5fe1c32
# Parent dd9094d92899389e198d225c129bf43b55da3599
(issue96) Add progressbar during download if window is visible.
diff -r dd9094d92899 -r a07030035349 ui/mainwindow.cpp
--- 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()
More information about the Trustbridge-commits
mailing list