From 1bbc49d2078ee53488e214d00eb47462687b05c5 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Sat, 24 Aug 2019 22:34:59 +0200 Subject: [gui] intro: inform caller if intro was shown --- src/qt/bitcoin.cpp | 5 +++-- src/qt/intro.cpp | 5 ++++- src/qt/intro.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index f2e62040ae..2592efc491 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -491,8 +491,9 @@ int GuiMain(int argc, char* argv[]) /// 5. Now that settings and translations are available, ask user for data directory // User language is set up: pick a data directory - if (!Intro::pickDataDirectory(*node)) - return EXIT_SUCCESS; + bool did_show_intro = false; + // Gracefully exit if the user cancels + if (!Intro::showIfNeeded(*node, did_show_intro)) return EXIT_SUCCESS; /// 6. Determine availability of data directory and parse bitcoin.conf /// - Do not call GetDataDir(true) before this step finishes diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 102e37e471..0a18561109 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -180,8 +180,10 @@ void Intro::setDataDirectory(const QString &dataDir) } } -bool Intro::pickDataDirectory(interfaces::Node& node) +bool Intro::showIfNeeded(interfaces::Node& node, bool& did_show_intro) { + did_show_intro = false; + QSettings settings; /* If data directory provided on command line, no need to look at settings or show a picking dialog */ @@ -205,6 +207,7 @@ bool Intro::pickDataDirectory(interfaces::Node& node) Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize()); intro.setDataDirectory(dataDir); intro.setWindowIcon(QIcon(":icons/bitcoin")); + did_show_intro = true; while(true) { diff --git a/src/qt/intro.h b/src/qt/intro.h index c3b26808d4..be8d6e34ad 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -46,7 +46,7 @@ public: * @note do NOT call global GetDataDir() before calling this function, this * will cause the wrong path to be cached. */ - static bool pickDataDirectory(interfaces::Node& node); + static bool showIfNeeded(interfaces::Node& node, bool& did_show_intro); Q_SIGNALS: void requestCheck(); -- cgit v1.2.3