diff --git a/src/m_ver_check/UpdateTab.cpp b/src/m_ver_check/UpdateTab.cpp
index 11c637a..9dd281e 100644
--- a/src/m_ver_check/UpdateTab.cpp
+++ b/src/m_ver_check/UpdateTab.cpp
@@ -30,15 +30,47 @@
#include "GFModuleCommonUtils.hpp"
#include "GFSDKBasic.h"
-#include "GFSDKLog.h"
#include "GFSDKModule.h"
#include "VersionCheckTask.h"
#include "VersionCheckingModule.h"
-UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) {
- auto* layout = new QGridLayout();
+UpdateTab::UpdateTab(QWidget* parent)
+ : QWidget(parent), current_version_(GFProjectVersion()) {
+ auto* layout = new QVBoxLayout();
- current_version_ = GFProjectVersion();
+ auto* current_version_box = new QGroupBox(tr("Current Version Information"));
+ auto* current_version_layout = new QVBoxLayout();
+ current_version_label_ = new QLabel();
+ current_version_label_->setText("
" + tr("Current Version") +
+ tr(": ") + "" + current_version_ +
+ "");
+ current_version_label_->setWordWrap(true);
+ latest_version_label_ = new QLabel();
+ current_version_layout->addWidget(current_version_label_);
+ current_version_layout->addWidget(latest_version_label_);
+ current_version_box->setLayout(current_version_layout);
+
+ auto* upgrade_info_box = new QGroupBox(tr("Upgrade Information"));
+ auto* upgrade_info_layout = new QVBoxLayout();
+ upgrade_label_ = new QLabel();
+ upgrade_label_->setWordWrap(true);
+ upgrade_label_->setOpenExternalLinks(true);
+ upgrade_label_->setHidden(true);
+ pb_ = new QProgressBar();
+ pb_->setRange(0, 0);
+ pb_->setTextVisible(false);
+ upgrade_info_layout->addWidget(upgrade_label_);
+ upgrade_info_layout->addWidget(pb_);
+ upgrade_info_box->setLayout(upgrade_info_layout);
+
+ auto* release_note_box = new QGroupBox(tr("Release Notes"));
+ auto* release_note_layout = new QVBoxLayout();
+ release_note_viewer_ = new QTextEdit();
+ release_note_viewer_->setReadOnly(true);
+ release_note_viewer_->setAcceptRichText(true);
+ release_note_viewer_->hide();
+ release_note_layout->addWidget(release_note_viewer_);
+ release_note_box->setLayout(release_note_layout);
auto* tips_label = new QLabel();
tips_label->setText(
@@ -51,39 +83,16 @@ UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) {
"");
tips_label->setWordWrap(true);
- current_version_label_ = new QLabel();
- current_version_label_->setText("" + tr("Current Version") +
- tr(": ") + "" + current_version_ +
- "");
- current_version_label_->setWordWrap(true);
-
- latest_version_label_ = new QLabel();
- latest_version_label_->setWordWrap(true);
-
- upgrade_label_ = new QLabel();
- upgrade_label_->setWordWrap(true);
- upgrade_label_->setOpenExternalLinks(true);
- upgrade_label_->setHidden(true);
-
- pb_ = new QProgressBar();
- pb_->setRange(0, 0);
- pb_->setTextVisible(false);
-
- layout->addWidget(tips_label, 1, 0, 1, -1);
- layout->addWidget(current_version_label_, 2, 0, 1, -1);
- layout->addWidget(latest_version_label_, 3, 0, 1, -1);
- layout->addWidget(upgrade_label_, 4, 0, 1, -1);
- layout->addWidget(pb_, 5, 0, 1, -1);
- layout->addItem(
- new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1,
- 1, 1);
+ layout->addWidget(current_version_box);
+ layout->addWidget(upgrade_info_box);
+ layout->addWidget(release_note_box);
+ layout->addWidget(tips_label);
setLayout(layout);
}
void UpdateTab::showEvent(QShowEvent* event) {
QWidget::showEvent(event);
- MLogDebug("loading version loading info from rt");
auto is_loading_done = GFModuleRetrieveRTValueOrDefaultBool(
GFGetModuleID(), GFModuleStrDup("version.loading_done"), 0);
@@ -103,7 +112,6 @@ void UpdateTab::showEvent(QShowEvent* event) {
}
void UpdateTab::slot_show_version_status() {
- MLogDebug("loading version info from rt");
this->pb_->setHidden(true);
auto is_loading_done = GFModuleRetrieveRTValueOrDefaultBool(
@@ -128,44 +136,54 @@ void UpdateTab::slot_show_version_status() {
GFGetModuleID(), GFModuleStrDup("version.latest_version"),
GFModuleStrDup("")));
+ QString const release_note = UDUP(GFModuleRetrieveRTValueOrDefault(
+ GFGetModuleID(), GFModuleStrDup("version.release_note"),
+ GFModuleStrDup("")));
+
latest_version_label_->setText("" +
tr("Latest Version From Github") + ": " +
latest_version + "");
if (is_need_upgrade != 0) {
upgrade_label_->setText(
- "" +
- tr("The current version is less than the latest version on "
- "github.") +
- "" + tr("Please click") +
- " " +
- tr("Here") + " " + tr("to download the latest stable version.") +
+ "" + tr("Your current version is outdated.") +
+ "" + tr("Click") +
+ " " +
+ tr("here") + " " + tr("to download the latest stable version.") +
"");
upgrade_label_->show();
} else if (is_current_a_withdrawn_version != 0) {
upgrade_label_->setText(
"" +
- tr("This version has serious problems and has been withdrawn. "
- "Please stop using it immediately.") +
- "" + tr("Please click") +
- " " +
- tr("Here") + " " + tr("to download the latest stable version.") +
+ tr("This version has critical issues and has been withdrawn. Please "
+ "stop using it immediately.") +
+ "" + tr("Click") +
+ " " +
+ tr("here") + " " + tr("to download the latest stable version.") +
"");
upgrade_label_->show();
} else if (is_current_version_released == 0) {
upgrade_label_->setText(
"" +
- tr("This version has not been released yet, it may be a beta "
- "version. If you are not a tester and care about version "
- "stability, please do not use this version.") +
- "" + tr("Please click") +
- " " +
- tr("Here") + " " + tr("to download the latest stable version.") +
+ tr("This is an unreleased version, possibly a beta. If stability is "
+ "important to you, please avoid using this version.") +
+ "" + tr("Click") +
+ " " +
+ tr("here") + " " + tr("to download the latest stable version.") +
"");
upgrade_label_->show();
+ } else {
+ upgrade_label_->setText(
+ "" +
+ tr("You are using the latest stable version. No action is required.") +
+ "");
+ upgrade_label_->show();
+ }
+
+ if (!release_note.trimmed().isEmpty()) {
+ release_note_viewer_->clear();
+ release_note_viewer_->setMarkdown(release_note);
+ release_note_viewer_->show();
}
}
diff --git a/src/m_ver_check/UpdateTab.h b/src/m_ver_check/UpdateTab.h
index 92f1b2f..7616200 100644
--- a/src/m_ver_check/UpdateTab.h
+++ b/src/m_ver_check/UpdateTab.h
@@ -37,11 +37,12 @@
class UpdateTab : public QWidget {
Q_OBJECT
- QLabel* current_version_label_; ///<
- QLabel* latest_version_label_; ///<
- QLabel* upgrade_label_; ///<
- QProgressBar* pb_; ///<
- QString current_version_; ///<
+ QLabel* current_version_label_; ///<
+ QLabel* latest_version_label_; ///<
+ QLabel* upgrade_label_; ///<
+ QProgressBar* pb_; ///<
+ QTextEdit* release_note_viewer_; ///<
+ QString current_version_; ///<
public:
/**
diff --git a/src/m_ver_check/VersionCheckTask.cpp b/src/m_ver_check/VersionCheckTask.cpp
index 6cb5af1..38572cc 100644
--- a/src/m_ver_check/VersionCheckTask.cpp
+++ b/src/m_ver_check/VersionCheckTask.cpp
@@ -193,6 +193,9 @@ void VersionCheckTask::slot_fill_grt_with_version_info(
GFModuleUpsertRTValueBool(
GFGetModuleID(), GFModuleStrDup("version.current_a_withdrawn_version"),
version.VersionWithdrawn() ? 1 : 0);
+
+ GFModuleUpsertRTValue(GFGetModuleID(), GFModuleStrDup("version.release_note"),
+ GFModuleStrDup(version.release_note.toUtf8()));
GFModuleUpsertRTValueBool(GFGetModuleID(),
GFModuleStrDup("version.loading_done"),
version.loading_done ? 1 : 0);
diff --git a/src/m_ver_check/VersionCheckingModule.cpp b/src/m_ver_check/VersionCheckingModule.cpp
index e9daf59..723e833 100644
--- a/src/m_ver_check/VersionCheckingModule.cpp
+++ b/src/m_ver_check/VersionCheckingModule.cpp
@@ -44,7 +44,7 @@
#include "VersionCheckTask.h"
GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.version_checking",
- "VersionChecking", "1.0.0",
+ "VersionChecking", "1.1.0",
"Try checking GpgFrontend version.", "Saturneric");
DEFINE_TRANSLATIONS_STRUCTURE(ModuleVersionChecking);