diff options
author | Saturneric <[email protected]> | 2022-05-20 18:07:02 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-05-20 18:07:02 +0000 |
commit | a62eed1038f618ec294fbfefe8ef5c8427147a33 (patch) | |
tree | 34e07f6029b25987aa46378ede668b9a7b4f755c /src/ui/thread/VersionCheckTask.h | |
parent | feat: handle application's exceptions and crash (diff) | |
download | GpgFrontend-a62eed1038f618ec294fbfefe8ef5c8427147a33.tar.gz GpgFrontend-a62eed1038f618ec294fbfefe8ef5c8427147a33.zip |
refactor: change version checking to task
Diffstat (limited to '')
-rw-r--r-- | src/ui/thread/VersionCheckTask.h (renamed from src/ui/thread/VersionCheckThread.h) | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/ui/thread/VersionCheckThread.h b/src/ui/thread/VersionCheckTask.h index 6ad35afe..0dbce17f 100644 --- a/src/ui/thread/VersionCheckThread.h +++ b/src/ui/thread/VersionCheckTask.h @@ -29,6 +29,10 @@ #ifndef GPGFRONTEND_VERSIONCHECKTHREAD_H #define GPGFRONTEND_VERSIONCHECKTHREAD_H +#include <memory> +#include <string> + +#include "core/thread/Task.h" #include "ui/GpgFrontendUI.h" #include "ui/struct/SoftwareVersion.h" @@ -38,7 +42,7 @@ namespace GpgFrontend::UI { * @brief * */ -class VersionCheckThread : public QThread { +class VersionCheckTask : public Thread::Task { Q_OBJECT public: @@ -46,7 +50,7 @@ class VersionCheckThread : public QThread { * @brief Construct a new Version Check Thread object * */ - explicit VersionCheckThread(); + explicit VersionCheckTask(); signals: @@ -63,11 +67,30 @@ class VersionCheckThread : public QThread { * */ - void run() override; + void Run() override; + + private slots: + + /** + * @brief + * + */ + void slot_parse_latest_version_info(); + + /** + * @brief + * + */ + void slot_parse_current_version_info(); private: - QByteArray latest_reply_bytes_; ///< - QByteArray current_reply_bytes_; ///< + QByteArray latest_reply_bytes_; ///< + QByteArray current_reply_bytes_; ///< + QNetworkReply* latest_reply_ = nullptr; ///< latest version info reply + QNetworkReply* current_reply_ = nullptr; ///< current version info reply + QNetworkAccessManager* network_manager_; ///< + std::string current_version_; + SoftwareVersion version_; }; } // namespace GpgFrontend::UI |