[gui] intro: inform caller if intro was shown

This commit is contained in:
Sjors Provoost 2019-08-24 22:34:59 +02:00
parent 1957103786
commit 1bbc49d207
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009
3 changed files with 8 additions and 4 deletions

View file

@ -491,8 +491,9 @@ int GuiMain(int argc, char* argv[])
/// 5. Now that settings and translations are available, ask user for data directory /// 5. Now that settings and translations are available, ask user for data directory
// User language is set up: pick a data directory // User language is set up: pick a data directory
if (!Intro::pickDataDirectory(*node)) bool did_show_intro = false;
return EXIT_SUCCESS; // 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 /// 6. Determine availability of data directory and parse bitcoin.conf
/// - Do not call GetDataDir(true) before this step finishes /// - Do not call GetDataDir(true) before this step finishes

View file

@ -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; QSettings settings;
/* If data directory provided on command line, no need to look at settings /* If data directory provided on command line, no need to look at settings
or show a picking dialog */ or show a picking dialog */
@ -205,6 +207,7 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize()); Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize());
intro.setDataDirectory(dataDir); intro.setDataDirectory(dataDir);
intro.setWindowIcon(QIcon(":icons/bitcoin")); intro.setWindowIcon(QIcon(":icons/bitcoin"));
did_show_intro = true;
while(true) while(true)
{ {

View file

@ -46,7 +46,7 @@ public:
* @note do NOT call global GetDataDir() before calling this function, this * @note do NOT call global GetDataDir() before calling this function, this
* will cause the wrong path to be cached. * 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: Q_SIGNALS:
void requestCheck(); void requestCheck();