@@ -90,6 +90,26 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
90
90
LogPrintf (" GUI: %s\n " , msg.toStdString ());
91
91
}
92
92
}
93
+
94
+ bool ConfigurationFileExists (ArgsManager& argsman)
95
+ {
96
+ fs::path settings_path;
97
+ if (!argsman.GetSettingsPath (&settings_path)) {
98
+ // settings file is disabled
99
+ return true ;
100
+ }
101
+ if (fs::exists (settings_path)) {
102
+ return true ;
103
+ }
104
+
105
+ const fs::path rel_config_path = argsman.GetPathArg (" -conf" , BITCOIN_CONF_FILENAME);
106
+ const fs::path abs_config_path = AbsPathForConfigVal (rel_config_path, true );
107
+ if (fs::exists (abs_config_path)) {
108
+ return true ;
109
+ }
110
+
111
+ return false ;
112
+ }
93
113
} // namespace
94
114
95
115
@@ -144,11 +164,19 @@ int QmlGuiMain(int argc, char* argv[])
144
164
}
145
165
146
166
// / Read and parse settings.json file.
147
- if (!gArgs .InitSettings (error)) {
167
+ std::vector<std::string> errors;
168
+ if (!gArgs .ReadSettingsFile (&errors)) {
169
+ error = strprintf (" Failed loading settings file:\n %s\n " , MakeUnorderedList (errors));
148
170
InitError (Untranslated (error));
149
171
return EXIT_FAILURE;
150
172
}
151
173
174
+ QVariant need_onboarding (true );
175
+ if (gArgs .IsArgSet (" -datadir" ) && !gArgs .GetPathArg (" -datadir" ).empty ()) {
176
+ need_onboarding.setValue (false );
177
+ } else if (ConfigurationFileExists (gArgs )) {
178
+ need_onboarding.setValue (false );
179
+ }
152
180
// Default printtoconsole to false for the GUI. GUI programs should not
153
181
// print to the console unnecessarily.
154
182
gArgs .SoftSetBoolArg (" -printtoconsole" , false );
@@ -199,6 +227,7 @@ int QmlGuiMain(int argc, char* argv[])
199
227
OptionsQmlModel options_model{*node};
200
228
engine.rootContext ()->setContextProperty (" optionsModel" , &options_model);
201
229
230
+ engine.rootContext ()->setContextProperty (" needOnboarding" , need_onboarding);
202
231
#ifdef __ANDROID__
203
232
AppMode app_mode (AppMode::MOBILE);
204
233
#else
0 commit comments