diff options
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r-- | src/qt/bitcoin.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index b6720b0433..59f433749d 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -228,14 +228,8 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons static int qt_argc = 1; static const char* qt_argv = "bitcoin-qt"; -BitcoinApplication::BitcoinApplication(): - QApplication(qt_argc, const_cast<char **>(&qt_argv)), - optionsModel(nullptr), - clientModel(nullptr), - window(nullptr), - pollShutdownTimer(nullptr), - returnValue(0), - platformStyle(nullptr) +BitcoinApplication::BitcoinApplication() + : QApplication(qt_argc, const_cast<char**>(&qt_argv)) { // Qt runs setlocale(LC_ALL, "") on initialization. RegisterMetaTypes(); @@ -592,29 +586,30 @@ int GuiMain(int argc, char* argv[]) // Gracefully exit if the user cancels if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS; - /// 6. Determine availability of data directory and parse bitcoin.conf - /// - Do not call gArgs.GetDataDirNet() before this step finishes + /// 6a. Determine availability of data directory if (!CheckDataDirOption()) { InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", ""))); QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); return EXIT_FAILURE; } - if (!gArgs.ReadConfigFiles(error, true)) { - InitError(strprintf(Untranslated("Error reading configuration file: %s\n"), error)); - QMessageBox::critical(nullptr, PACKAGE_NAME, - QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); - return EXIT_FAILURE; - } + try { + /// 6b. Parse bitcoin.conf + /// - Do not call gArgs.GetDataDirNet() before this step finishes + if (!gArgs.ReadConfigFiles(error, true)) { + InitError(strprintf(Untranslated("Error reading configuration file: %s\n"), error)); + QMessageBox::critical(nullptr, PACKAGE_NAME, + QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); + return EXIT_FAILURE; + } - /// 7. Determine network (and switch to network specific options) - // - Do not call Params() before this step - // - Do this after parsing the configuration file, as the network can be switched there - // - QSettings() will use the new application name after this, resulting in network-specific settings - // - Needs to be done before createOptionsModel + /// 7. Determine network (and switch to network specific options) + // - Do not call Params() before this step + // - Do this after parsing the configuration file, as the network can be switched there + // - QSettings() will use the new application name after this, resulting in network-specific settings + // - Needs to be done before createOptionsModel - // Check for chain settings (Params() calls are only valid after this clause) - try { + // Check for chain settings (Params() calls are only valid after this clause) SelectParams(gArgs.GetChainName()); } catch(std::exception &e) { InitError(Untranslated(strprintf("%s\n", e.what()))); |