diff options
author | Saturn&Eric <[email protected]> | 2022-05-09 15:58:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-09 15:58:36 +0000 |
commit | a1bef0cc06a5c128a0f868ab59d7c153f5ab8aec (patch) | |
tree | f55b3c76f4203590b4bf40b6ab2f97965f5a51ec /src/main.cpp | |
parent | Merge pull request #56 from saturneric/develop-2.0.6 (diff) | |
parent | fix: modified init order (diff) | |
download | GpgFrontend-a1bef0cc06a5c128a0f868ab59d7c153f5ab8aec.tar.gz GpgFrontend-a1bef0cc06a5c128a0f868ab59d7c153f5ab8aec.zip |
Merge pull request #57 from saturneric/develop-2.0.7v2.0.7
Develop 2.0.7
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/main.cpp b/src/main.cpp index 51d977b2..6a03f5ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -125,48 +125,8 @@ int main(int argc, char* argv[]) { file.close(); #endif - // create the thread to load the gpg context - auto* init_ctx_thread = new GpgFrontend::CtxCheckThread(); - QApplication::connect(init_ctx_thread, &QThread::finished, init_ctx_thread, - &QThread::deleteLater); - - // create and show loading window before starting the main window - auto* waiting_dialog = new QProgressDialog(); - waiting_dialog->setMaximum(0); - waiting_dialog->setMinimum(0); - auto waiting_dialog_label = - new QLabel(QString(_("Loading Gnupg Info...")) + "<br /><br />" + - _("If this process is too slow, please set the key " - "server address appropriately in the gnupg configuration " - "file (depending " - "on the network situation in your country or region).")); - waiting_dialog_label->setWordWrap(true); - waiting_dialog->setLabel(waiting_dialog_label); - waiting_dialog->resize(420, 120); - QApplication::connect(init_ctx_thread, &QThread::finished, [=]() { - waiting_dialog->finished(0); - waiting_dialog->deleteLater(); - }); - QApplication::connect(waiting_dialog, &QProgressDialog::canceled, [=]() { - LOG(INFO) << "cancel clicked"; - if (init_ctx_thread->isRunning()) init_ctx_thread->terminate(); - QCoreApplication::quit(); - exit(0); - }); - - // show the loading window - waiting_dialog->show(); - waiting_dialog->setFocus(); - - // start the thread to load the gpg context - init_ctx_thread->start(); - QEventLoop loop; - QApplication::connect(init_ctx_thread, &QThread::finished, &loop, - &QEventLoop::quit); - loop.exec(); - - // init ui logging - GpgFrontend::UI::init_logging(); + // init ui library + GpgFrontend::UI::InitGpgFrontendUI(); /** * internationalisation. loop to restart main window @@ -187,6 +147,46 @@ int main(int argc, char* argv[]) { // init the i18n support init_locale(); + // create the thread to load the gpg context + auto* init_ctx_thread = new GpgFrontend::CtxCheckThread(); + QApplication::connect(init_ctx_thread, &QThread::finished, init_ctx_thread, + &QThread::deleteLater); + + // create and show loading window before starting the main window + auto* waiting_dialog = new QProgressDialog(); + waiting_dialog->setMaximum(0); + waiting_dialog->setMinimum(0); + auto waiting_dialog_label = + new QLabel(QString(_("Loading Gnupg Info...")) + "<br /><br />" + + _("If this process is too slow, please set the key " + "server address appropriately in the gnupg configuration " + "file (depending " + "on the network situation in your country or region).")); + waiting_dialog_label->setWordWrap(true); + waiting_dialog->setLabel(waiting_dialog_label); + waiting_dialog->resize(420, 120); + QApplication::connect(init_ctx_thread, &QThread::finished, [=]() { + waiting_dialog->finished(0); + waiting_dialog->deleteLater(); + }); + QApplication::connect(waiting_dialog, &QProgressDialog::canceled, [=]() { + LOG(INFO) << "cancel clicked"; + if (init_ctx_thread->isRunning()) init_ctx_thread->terminate(); + QCoreApplication::quit(); + exit(0); + }); + + // show the loading window + waiting_dialog->show(); + waiting_dialog->setFocus(); + + // start the thread to load the gpg context + init_ctx_thread->start(); + QEventLoop loop; + QApplication::connect(init_ctx_thread, &QThread::finished, &loop, + &QEventLoop::quit); + loop.exec(); + QApplication::setQuitOnLastWindowClosed(true); // create main window and show it |