comparison 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
comparison
equal deleted inserted replaced
1125:dd9094d92899 1126:a07030035349
144 } 144 }
145 145
146 void MainWindow::messageClicked() 146 void MainWindow::messageClicked()
147 { 147 {
148 if (mCurState == NewSoftwareAvailable) { 148 if (mCurState == NewSoftwareAvailable) {
149 hide();
150 verifySWData(); 149 verifySWData();
151 QString swFileName = mSettings.value("Software/available").toString(); 150 QString swFileName = mSettings.value("Software/available").toString();
152 if (swFileName.isEmpty()) { 151 if (swFileName.isEmpty()) {
153 checkUpdates(true); 152 checkUpdates(true);
154 mCurState = DownloadingSW; 153 mCurState = DownloadingSW;
300 QTemporaryDir tDir; 299 QTemporaryDir tDir;
301 if (!tDir.isValid()) { 300 if (!tDir.isValid()) {
302 qDebug () << "Failed to create temporary directory."; 301 qDebug () << "Failed to create temporary directory.";
303 return QString(); 302 return QString();
304 } 303 }
305 QString targetPath = tDir.path() + QObject::tr("TrustBridge-Updater", 304 QString targetPath = tDir.path() + "/" + QObject::tr("TrustBridge-Updater",
306 "Used as filename for the updater. Only use ASCII please."); 305 "Used as filename for the updater. Only use ASCII please.");
307 306
308 tDir.setAutoRemove(false); 307 tDir.setAutoRemove(false);
309 #ifdef WIN32 308 #ifdef WIN32
310 targetPath += ".exe"; 309 targetPath += ".exe";
505 connect(downloader, SIGNAL(finished()), downloader, SLOT(deleteLater())); 504 connect(downloader, SIGNAL(finished()), downloader, SLOT(deleteLater()));
506 connect(downloader, SIGNAL(finished()), this, SLOT(updateCheckSuccess())); 505 connect(downloader, SIGNAL(finished()), this, SLOT(updateCheckSuccess()));
507 connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)), 506 connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)),
508 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode))); 507 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
509 downloader->start(); 508 downloader->start();
509
510 if (downloadSW && getState() == DownloadingSW && isVisible()) {
511 QProgressDialog *progDlg = new QProgressDialog(this);
512 progDlg->setCancelButton(0);
513 progDlg->setRange(0,0);
514 progDlg->setMinimumDuration(0);
515 progDlg->setLabelText(tr("Downloading update..."));
516 progDlg->show();
517 connect(downloader, SIGNAL(finished()), progDlg, SLOT(deleteLater()));
518 connect(downloader, SIGNAL(finished()), progDlg, SLOT(cancel()));
519 }
510 } 520 }
511 521
512 void MainWindow::getLastModForCurrentVersion() 522 void MainWindow::getLastModForCurrentVersion()
513 { 523 {
514 QString softwareVersion = QString::fromLatin1(SW_RESOURCE_VERSION).arg( 524 QString softwareVersion = QString::fromLatin1(SW_RESOURCE_VERSION).arg(

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