diff options
author | Saturneric <[email protected]> | 2022-05-19 19:02:22 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-05-19 19:02:22 +0000 |
commit | 6d2f0fec12c142cd378c5515091e1aa5b58597fd (patch) | |
tree | e4dcd5a3e93e6a28a058516e43f0986195bc2083 | |
parent | pref: improve pch for compiling speed (diff) | |
download | GpgFrontend-6d2f0fec12c142cd378c5515091e1aa5b58597fd.tar.gz GpgFrontend-6d2f0fec12c142cd378c5515091e1aa5b58597fd.zip |
fix: adjust initialized order and organize
1. disable command line file arg input ability
-rw-r--r-- | src/core/function/GlobalSettingStation.h | 2 | ||||
-rw-r--r-- | src/core/thread/CtxCheckTask.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 12 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.cpp | 18 |
4 files changed, 9 insertions, 26 deletions
diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index ee0b6b12..ccf8e8f0 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -143,7 +143,7 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation private: std::filesystem::path app_path_ = - qApp->applicationDirPath().toStdString(); ///< Program Location + QCoreApplication::applicationDirPath().toStdString(); ///< Program Location std::filesystem::path app_data_path_ = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) .toStdString(); ///< Program Data Location diff --git a/src/core/thread/CtxCheckTask.cpp b/src/core/thread/CtxCheckTask.cpp index ee170fbc..997dd341 100644 --- a/src/core/thread/CtxCheckTask.cpp +++ b/src/core/thread/CtxCheckTask.cpp @@ -38,9 +38,6 @@ GpgFrontend::Thread::CtxCheckTask::CtxCheckTask() { } void GpgFrontend::Thread::CtxCheckTask::Run() { - // init logging - init_logging(); - // Init GpgFrontend Core init_gpgfrontend_core(); diff --git a/src/main.cpp b/src/main.cpp index 6ef5a7bc..4383bb21 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -97,18 +97,18 @@ int main(int argc, char* argv[]) { // clean something before exit atexit(before_exit); - // init the logging system - init_logging_system(); - - // init the logging system for core - GpgFrontend::InitLoggingSystem(); - // initialize qt resources Q_INIT_RESOURCE(gpgfrontend); // create qt application auto* app = init_qapplication(argc, argv); + // init the logging system + init_logging_system(); + + // init the logging system for core + GpgFrontend::InitLoggingSystem(); + /** * internationalisation. loop to restart main window * with changed translation when settings change. diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 368c5630..f4d2c7da 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -85,14 +85,6 @@ void MainWindow::Init() noexcept { restore_settings(); - // open filename if provided as first command line parameter - QStringList args = qApp->arguments(); - if (args.size() > 1) { - if (!args[1].startsWith("-")) { - if (QFile::exists(args[1])) - edit_->LoadFile(args[1]); - } - } edit_->CurTextPage()->setFocus(); auto &settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -147,7 +139,6 @@ void MainWindow::restore_settings() { LOG(INFO) << _("Called"); try { - LOG(INFO) << "restore settings main_windows_state"; SettingsObject main_windows_state("main_windows_state"); @@ -230,7 +221,6 @@ void MainWindow::restore_settings() { general.lookupValue("save_key_checked", save_key_checked); try { - LOG(INFO) << "restore settings default_key_checked"; // Checked Keys @@ -248,11 +238,6 @@ void MainWindow::restore_settings() { LOG(ERROR) << "restore default_key_checked failed"; } - LOG(INFO) << "restore settings smtp_passport"; - - SettingsObject smtp_passport("smtp_passport"); - smtp_passport.Check("enable", false); - prohibit_update_checking_ = false; try { prohibit_update_checking_ = @@ -267,6 +252,7 @@ void MainWindow::restore_settings() { } GlobalSettingStation::GetInstance().SyncSettings(); + LOG(INFO) << _("settings restored"); } void MainWindow::save_settings() { @@ -329,4 +315,4 @@ void MainWindow::closeEvent(QCloseEvent *event) { // GpgContext::GetInstance().clearPasswordCache(); } -} // namespace GpgFrontend::UI +} // namespace GpgFrontend::UI |