Skip to content

Commit 1bbc49d

Browse files
committed
[gui] intro: inform caller if intro was shown
1 parent 1957103 commit 1bbc49d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/qt/bitcoin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,9 @@ int GuiMain(int argc, char* argv[])
491491

492492
/// 5. Now that settings and translations are available, ask user for data directory
493493
// User language is set up: pick a data directory
494-
if (!Intro::pickDataDirectory(*node))
495-
return EXIT_SUCCESS;
494+
bool did_show_intro = false;
495+
// Gracefully exit if the user cancels
496+
if (!Intro::showIfNeeded(*node, did_show_intro)) return EXIT_SUCCESS;
496497

497498
/// 6. Determine availability of data directory and parse bitcoin.conf
498499
/// - Do not call GetDataDir(true) before this step finishes

src/qt/intro.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ void Intro::setDataDirectory(const QString &dataDir)
180180
}
181181
}
182182

183-
bool Intro::pickDataDirectory(interfaces::Node& node)
183+
bool Intro::showIfNeeded(interfaces::Node& node, bool& did_show_intro)
184184
{
185+
did_show_intro = false;
186+
185187
QSettings settings;
186188
/* If data directory provided on command line, no need to look at settings
187189
or show a picking dialog */
@@ -205,6 +207,7 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
205207
Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize());
206208
intro.setDataDirectory(dataDir);
207209
intro.setWindowIcon(QIcon(":icons/bitcoin"));
210+
did_show_intro = true;
208211

209212
while(true)
210213
{

src/qt/intro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Intro : public QDialog
4646
* @note do NOT call global GetDataDir() before calling this function, this
4747
* will cause the wrong path to be cached.
4848
*/
49-
static bool pickDataDirectory(interfaces::Node& node);
49+
static bool showIfNeeded(interfaces::Node& node, bool& did_show_intro);
5050

5151
Q_SIGNALS:
5252
void requestCheck();

0 commit comments

Comments
 (0)