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