From 2f64e4300b77f74cc4a7f0f50dbfe87862b72b95 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Tue, 4 Jan 2022 06:10:04 +0800 Subject: (core, ui): version system upgrade. 1. can notice user withdraw version now. 2. fix software not restart when signal caught. 3. improve ui. --- src/ui/help/AboutDialog.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src/ui/help/AboutDialog.cpp') diff --git a/src/ui/help/AboutDialog.cpp b/src/ui/help/AboutDialog.cpp index 5ee90e23..a3db6eda 100644 --- a/src/ui/help/AboutDialog.cpp +++ b/src/ui/help/AboutDialog.cpp @@ -163,14 +163,6 @@ UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) { latestVersionLabel->setWordWrap(true); upgradeLabel = new QLabel(); - upgradeLabel->setText( - "
" + - QString(_("The current version is less than the latest version on " - "github.")) + - "
" + _("Please click") + - " " + - _("Here") + " " + _("to download the latest version.") + "
"); upgradeLabel->setWordWrap(true); upgradeLabel->setOpenExternalLinks(true); upgradeLabel->setHidden(true); @@ -196,11 +188,7 @@ void UpdateTab::getLatestVersion() { LOG(INFO) << _("try to get latest version"); - QString base_url = - "https://api.github.com/repos/saturneric/gpgfrontend/releases/latest"; - QNetworkRequest request; - request.setUrl(QUrl(base_url)); - auto version_thread = new VersionCheckThread(manager->get(request)); + auto version_thread = new VersionCheckThread(); connect(version_thread, SIGNAL(finished()), version_thread, SLOT(deleteLater())); @@ -210,16 +198,33 @@ void UpdateTab::getLatestVersion() { version_thread->start(); } -void UpdateTab::slotShowVersionStatus(const QString& current, - const QString& server) { +void UpdateTab::slotShowVersionStatus(const SoftwareVersion& version) { this->pb->setHidden(true); - latestVersionLabel->setText("
" + QString(_("Latest Version From Github")) + ": " + - server + "
"); - - if (current < server) { + version.latest_version.c_str() + ""); + + if (version.NeedUpgrade()) { + upgradeLabel->setText( + "
" + + QString(_("The current version is less than the latest version on " + "github.")) + + "
" + _("Please click") + + " " + + _("Here") + " " + _("to download the latest stable version.") + + "
"); upgradeLabel->show(); + } else if (version.VersionWithDrawn()) { + upgradeLabel->setText( + "
" + + QString(_("This version has serious problems and has been withdrawn. " + "Please stop using it immediately.")) + + "
" + _("Please click") + + " " + + _("Here") + " " + _("to download the latest stable version.") + + "
"); } } -- cgit v1.2.3