@@ -90,6 +90,16 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
90
90
LogPrintf (" GUI: %s\n " , msg.toStdString ());
91
91
}
92
92
}
93
+
94
+ bool SettingsFileExists (ArgsManager& argsman)
95
+ {
96
+ fs::path settings_path;
97
+ if (!argsman.GetSettingsPath (&settings_path)) {
98
+ // settings file is disabled
99
+ return true ;
100
+ }
101
+ return fs::exists (settings_path);
102
+ }
93
103
} // namespace
94
104
95
105
@@ -144,11 +154,19 @@ int QmlGuiMain(int argc, char* argv[])
144
154
}
145
155
146
156
// / Read and parse settings.json file.
147
- if (!gArgs .InitSettings (error)) {
157
+ std::vector<std::string> errors;
158
+ if (!gArgs .ReadSettingsFile (&errors)) {
159
+ error = strprintf (" Failed loading settings file:\n %s\n " , MakeUnorderedList (errors));
148
160
InitError (Untranslated (error));
149
161
return EXIT_FAILURE;
150
162
}
151
163
164
+ QVariant need_onboarding (true );
165
+ if (gArgs .IsArgSet (" -datadir" )) {
166
+ need_onboarding.setValue (false );
167
+ } else if (SettingsFileExists (gArgs )) {
168
+ need_onboarding.setValue (false );
169
+ }
152
170
// Default printtoconsole to false for the GUI. GUI programs should not
153
171
// print to the console unnecessarily.
154
172
gArgs .SoftSetBoolArg (" -printtoconsole" , false );
@@ -199,6 +217,7 @@ int QmlGuiMain(int argc, char* argv[])
199
217
OptionsQmlModel options_model{*node};
200
218
engine.rootContext ()->setContextProperty (" optionsModel" , &options_model);
201
219
220
+ engine.rootContext ()->setContextProperty (" needOnboarding" , need_onboarding);
202
221
#ifdef __ANDROID__
203
222
AppMode app_mode (AppMode::MOBILE);
204
223
#else
0 commit comments