aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindow.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-05-20 18:07:02 +0000
committerSaturneric <[email protected]>2022-05-20 18:07:02 +0000
commita62eed1038f618ec294fbfefe8ef5c8427147a33 (patch)
tree34e07f6029b25987aa46378ede668b9a7b4f755c /src/ui/main_window/MainWindow.cpp
parentfeat: handle application's exceptions and crash (diff)
downloadGpgFrontend-a62eed1038f618ec294fbfefe8ef5c8427147a33.tar.gz
GpgFrontend-a62eed1038f618ec294fbfefe8ef5c8427147a33.zip
refactor: change version checking to task
Diffstat (limited to 'src/ui/main_window/MainWindow.cpp')
-rw-r--r--src/ui/main_window/MainWindow.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp
index f4d2c7da..d04e3dbd 100644
--- a/src/ui/main_window/MainWindow.cpp
+++ b/src/ui/main_window/MainWindow.cpp
@@ -28,13 +28,11 @@
#include "MainWindow.h"
-#include "ui/UserInterfaceUtils.h"
-#ifdef RELEASE
-#include "ui/thread/VersionCheckThread.h"
-#endif
#include "core/function/GlobalSettingStation.h"
#include "ui/SignalStation.h"
+#include "ui/UserInterfaceUtils.h"
#include "ui/struct/SettingsObject.h"
+#include "ui/thread/VersionCheckTask.h"
namespace GpgFrontend::UI {
@@ -114,16 +112,14 @@ void MainWindow::Init() noexcept {
// if not prohibit update checking
if (!prohibit_update_checking_) {
-#ifdef RELEASE
- auto version_thread = new VersionCheckThread();
+ auto *version_task = new VersionCheckTask();
- connect(version_thread, &VersionCheckThread::finished, version_thread,
- &VersionCheckThread::deleteLater);
- connect(version_thread, &VersionCheckThread::SignalUpgradeVersion, this,
+ connect(version_task, &VersionCheckTask::SignalUpgradeVersion, this,
&MainWindow::slot_version_upgrade);
- version_thread->start();
-#endif
+ Thread::TaskRunnerGetter::GetInstance()
+ .GetTaskRunner(Thread::TaskRunnerGetter::kTaskRunnerType_Network)
+ ->PostTask(version_task);
}
} catch (...) {