aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/help
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ui/help/AboutDialog.cpp43
-rw-r--r--src/ui/help/AboutDialog.h4
2 files changed, 27 insertions, 20 deletions
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(
- "<center>" +
- QString(_("The current version is less than the latest version on "
- "github.")) +
- "</center><center>" + _("Please click") +
- " <a "
- "href=\"https://github.com/saturneric/GpgFrontend/releases\">" +
- _("Here") + "</a> " + _("to download the latest version.") + "</center>");
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("<center><b>" +
QString(_("Latest Version From Github")) + ": " +
- server + "</b></center>");
-
- if (current < server) {
+ version.latest_version.c_str() + "</b></center>");
+
+ if (version.NeedUpgrade()) {
+ upgradeLabel->setText(
+ "<center>" +
+ QString(_("The current version is less than the latest version on "
+ "github.")) +
+ "</center><center>" + _("Please click") +
+ " <a "
+ "href=\"https://github.com/saturneric/GpgFrontend/releases\">" +
+ _("Here") + "</a> " + _("to download the latest stable version.") +
+ "</center>");
upgradeLabel->show();
+ } else if (version.VersionWithDrawn()) {
+ upgradeLabel->setText(
+ "<center>" +
+ QString(_("This version has serious problems and has been withdrawn. "
+ "Please stop using it immediately.")) +
+ "</center><center>" + _("Please click") +
+ " <a "
+ "href=\"https://github.com/saturneric/GpgFrontend/releases\">" +
+ _("Here") + "</a> " + _("to download the latest stable version.") +
+ "</center>");
}
}
diff --git a/src/ui/help/AboutDialog.h b/src/ui/help/AboutDialog.h
index 78c98149..44ab0e3c 100644
--- a/src/ui/help/AboutDialog.h
+++ b/src/ui/help/AboutDialog.h
@@ -27,6 +27,8 @@
#include "gpg/GpgContext.h"
#include "ui/GpgFrontendUI.h"
+#include "ui/data_struct/SoftwareVersion.h"
+
namespace GpgFrontend::UI {
/**
@@ -73,7 +75,7 @@ class UpdateTab : public QWidget {
void getLatestVersion();
private slots:
- void slotShowVersionStatus(const QString& current, const QString& server);
+ void slotShowVersionStatus(const SoftwareVersion& version);
signals:
void replyFromUpdateServer(QByteArray data);