diff options
Diffstat (limited to '')
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 7 | ||||
-rw-r--r-- | src/ui/struct/SoftwareVersion.cpp | 12 | ||||
-rw-r--r-- | src/ui/struct/SoftwareVersion.h | 1 | ||||
-rw-r--r-- | src/ui/thread/VersionCheckTask.cpp | 12 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index e17ddaeb..870c7c5c 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -37,6 +37,7 @@ #include "core/function/gpg/GpgKeyGetter.h" #include "core/function/gpg/GpgKeyImportExporter.h" #include "dialog/SignersPicker.h" +#include "spdlog/spdlog.h" #include "ui/UserInterfaceUtils.h" #include "ui/dialog/help/AboutDialog.h" @@ -666,6 +667,12 @@ void MainWindow::slot_version_upgrade(const SoftwareVersion& version) { return; } + SPDLOG_DEBUG( + "version info, need upgrade: {}, with drawn: {}, current version " + "released: {}", + version.NeedUpgrade(), version.VersionWithDrawn(), + version.CurrentVersionReleased()); + if (version.NeedUpgrade()) { statusBar()->showMessage( QString(_("GpgFrontend Upgradeable (New Version: %1).")) diff --git a/src/ui/struct/SoftwareVersion.cpp b/src/ui/struct/SoftwareVersion.cpp index a0ad594b..6a60cb02 100644 --- a/src/ui/struct/SoftwareVersion.cpp +++ b/src/ui/struct/SoftwareVersion.cpp @@ -34,12 +34,12 @@ int GpgFrontend::UI::SoftwareVersion::version_compare(const std::string& a, if (!temp_a.empty() && temp_a.front() == 'v') { temp_a = temp_a.erase(0, 1); - SPDLOG_INFO("real version a: {}", temp_a); + SPDLOG_DEBUG("real version a: {}", temp_a); } if (!temp_b.empty() && temp_b.front() == 'v') { temp_b.erase(0, 1); - SPDLOG_INFO("real version b: {}", temp_b); + SPDLOG_DEBUG("real version b: {}", temp_b); } // First, split the string. @@ -81,6 +81,12 @@ int GpgFrontend::UI::SoftwareVersion::version_compare(const std::string& a, } bool GpgFrontend::UI::SoftwareVersion::NeedUpgrade() const { + SPDLOG_DEBUG("compair version current {} latest {}, result {}", + current_version, latest_version, + version_compare(current_version, latest_version)); + + SPDLOG_DEBUG("load done: {}, pre-release: {}, draft: {}", load_info_done, + latest_prerelease, latest_draft); return load_info_done && !latest_prerelease && !latest_draft && version_compare(current_version, latest_version) < 0; } @@ -92,4 +98,4 @@ bool GpgFrontend::UI::SoftwareVersion::VersionWithDrawn() const { bool GpgFrontend::UI::SoftwareVersion::CurrentVersionReleased() const { return load_info_done && current_version_found; -} +}
\ No newline at end of file diff --git a/src/ui/struct/SoftwareVersion.h b/src/ui/struct/SoftwareVersion.h index 942efec9..9d861ef1 100644 --- a/src/ui/struct/SoftwareVersion.h +++ b/src/ui/struct/SoftwareVersion.h @@ -81,7 +81,6 @@ struct SoftwareVersion { [[nodiscard]] bool CurrentVersionReleased() const; private: - static int version_compare(const std::string& a, const std::string& b); }; } // namespace GpgFrontend::UI diff --git a/src/ui/thread/VersionCheckTask.cpp b/src/ui/thread/VersionCheckTask.cpp index 99094891..ebb970a8 100644 --- a/src/ui/thread/VersionCheckTask.cpp +++ b/src/ui/thread/VersionCheckTask.cpp @@ -63,6 +63,7 @@ void VersionCheckTask::Run() { version_.load_info_done = true; } catch (...) { + SPDLOG_ERROR("unknown error occurred"); emit SignalTaskFinished(); } } @@ -106,7 +107,7 @@ void VersionCheckTask::slot_parse_latest_version_info() { version_.release_note = release_note; } } catch (...) { - SPDLOG_INFO("error occurred"); + SPDLOG_ERROR("unknown error occurred"); version_.load_info_done = false; } @@ -135,8 +136,10 @@ void VersionCheckTask::slot_parse_current_version_info() { try { if (current_reply_ == nullptr || current_reply_->error() != QNetworkReply::NoError) { - SPDLOG_ERROR("current version request network error"); + SPDLOG_ERROR("current version request network error: {}", + current_reply_->errorString().toStdString()); version_.current_version_found = false; + version_.load_info_done = false; } else { version_.current_version_found = true; current_reply_bytes_ = current_reply_->readAll(); @@ -150,11 +153,12 @@ void VersionCheckTask::slot_parse_current_version_info() { version_.load_info_done = true; } } catch (...) { - SPDLOG_INFO("error occurred"); + SPDLOG_ERROR("unknown error occurred"); version_.load_info_done = false; } - SPDLOG_INFO("current version parse done: {}", version_.current_version_found); + SPDLOG_DEBUG("current version parse done: {}", + version_.current_version_found); if (current_reply_ != nullptr) { current_reply_->deleteLater(); |