Skip to content

Commit

Permalink
[gui] intro: inform caller if intro was shown
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Aug 24, 2019
1 parent 1957103 commit 1bbc49d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/qt/bitcoin.cpp
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/qt/intro.cpp
Expand Up @@ -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 */
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/intro.h
Expand Up @@ -46,7 +46,7 @@ class Intro : public QDialog
* @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();
Expand Down

0 comments on commit 1bbc49d

Please sign in to comment.