Mercurial > trustbridge
diff ui/mainwindow.cpp @ 1134:f1384bf9d4a4
Mergerd
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 17 Sep 2014 15:01:19 +0200 |
parents | 1a5f9e260099 |
children | a4282bc67a8b |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Sep 17 13:13:33 2014 +0200 +++ b/ui/mainwindow.cpp Wed Sep 17 15:01:19 2014 +0200 @@ -66,7 +66,7 @@ #define TB_ARCH_STRING "-amd64" #endif -#ifdef USE_REAL_RESOURCES +#ifdef IS_TAG_BUILD # define LIST_RESOURCE "/zertifikatsliste.txt" # ifdef Q_OS_WIN # define SW_RESOURCE_VERSION "/TrustBridge-%1.exe" @@ -75,13 +75,13 @@ # define SW_RESOURCE_VERSION "/TrustBridge-%1" TB_ARCH_STRING ".sh" # define SW_RESOURCE "/TrustBridge" TB_ARCH_STRING ".sh" # endif -#else // RELEASE_BUILD +#else // Not tag build means develpment build # define LIST_RESOURCE "/zertifikatsliste.txt" # ifdef Q_OS_WIN -# define SW_RESOURCE_VERSION "/development/TrustBridge-development.exe" +# define SW_RESOURCE_VERSION "/development/TrustBridge-%1.exe" # define SW_RESOURCE "/development/TrustBridge.exe" # else -# define SW_RESOURCE_VERSION "/development/TrustBridge-development" TB_ARCH_STRING ".sh" +# define SW_RESOURCE_VERSION "/development/TrustBridge-%1" TB_ARCH_STRING ".sh" # define SW_RESOURCE "/development/TrustBridge" TB_ARCH_STRING ".sh" # endif #endif @@ -119,7 +119,11 @@ checkUpdates(); loadUnselectedCertificates(); loadCertificateList(); - if (!trayMode) { + + if (mSettings.value("ShowOnNextStart").toBool()) { + mSettings.remove("ShowOnNextStart"); + show(); + } else if (!trayMode) { show(); } } @@ -142,7 +146,6 @@ void MainWindow::messageClicked() { if (mCurState == NewSoftwareAvailable) { - hide(); verifySWData(); QString swFileName = mSettings.value("Software/available").toString(); if (swFileName.isEmpty()) { @@ -219,6 +222,7 @@ QString swFileName = mSettings.value("Software/available").toString(); if (swFileName.isEmpty()) { + qDebug() << "Date set but no fileName"; mSettings.remove("Software/availableDate"); return; } @@ -298,7 +302,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); @@ -377,9 +381,6 @@ installDir.cdUp(); parameters << "--prefix" << installDir.path(); parameters << "--update"; - if (isVisible()) { - parameters << "--show-after-update"; - } bool sudo_started = false; bool use_sudo = is_admin() && is_system_install(); if (use_sudo) { @@ -406,6 +407,10 @@ } #endif + if (isVisible()) { + mSettings.setValue("ShowOnNextStart", true); + mSettings.sync(); + } syslog_info_printf ("Installing update: %s\n", fileName.toUtf8().constData()); /* Installer process should now be running. We exit */ @@ -502,6 +507,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() @@ -523,7 +539,6 @@ this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode))); connect(downloader, SIGNAL(lastModifiedDate(const QDateTime&)), this, SLOT(setLastModifiedSWDate(const QDateTime&))); - downloader->start(); } @@ -548,6 +563,15 @@ showErrorMessage(tr("Failed to check for updates:") + "\n" + message); } setState(TransferError); + +#ifndef IS_TAG_BUILD + /* For development versions we default to datetime::now if + * we can not find our version. */ + if (!mSettings.contains("Software/installedDate") || + mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) { + setLastModifiedSWDate(QDateTime::currentDateTime()); + } +#endif } void MainWindow::createActions()