MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / createSetupWizard

Method createSetupWizard

launcher/Application.cpp:1223–1296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1221}
1222
1223bool Application::createSetupWizard()
1224{
1225 bool javaRequired = [this]() {
1226 if (BuildConfig.JAVA_DOWNLOADER_ENABLED && settings()->get("AutomaticJavaDownload").toBool()) {
1227 return false;
1228 }
1229 bool ignoreJavaWizard = settings()->get("IgnoreJavaWizard").toBool();
1230 if (ignoreJavaWizard) {
1231 return false;
1232 }
1233 QString currentHostName = QHostInfo::localHostName();
1234 QString oldHostName = settings()->get("LastHostname").toString();
1235 if (currentHostName != oldHostName) {
1236 settings()->set("LastHostname", currentHostName);
1237 return true;
1238 }
1239 QString currentJavaPath = settings()->get("JavaPath").toString();
1240 QString actualPath = FS::ResolveExecutable(currentJavaPath);
1241 return actualPath.isNull();
1242 }();
1243 bool askjava = BuildConfig.JAVA_DOWNLOADER_ENABLED && !javaRequired && !settings()->get("AutomaticJavaDownload").toBool() &&
1244 !settings()->get("AutomaticJavaSwitch").toBool() && !settings()->get("UserAskedAboutAutomaticJavaDownload").toBool();
1245 bool languageRequired = settings()->get("Language").toString().isEmpty();
1246 bool pasteInterventionRequired = settings()->get("PastebinURL") != "";
1247 bool validWidgets = m_themeManager->isValidApplicationTheme(settings()->get("ApplicationTheme").toString());
1248 bool validIcons = m_themeManager->isValidIconTheme(settings()->get("IconTheme").toString());
1249 bool login = !m_accounts->anyAccountIsValid() && capabilities() & Application::SupportsMSA;
1250 bool themeInterventionRequired = !validWidgets || !validIcons;
1251 bool wizardRequired = javaRequired || languageRequired || pasteInterventionRequired || themeInterventionRequired || askjava || login;
1252 if (wizardRequired) {
1253 // set default theme after going into theme wizard
1254 if (!validIcons)
1255 settings()->set("IconTheme", QString("pe_colored"));
1256 if (!validWidgets) {
1257#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1258 const QString style =
1259 QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ? QStringLiteral("dark") : QStringLiteral("bright");
1260#else
1261 const QString style = QStringLiteral("system");
1262#endif
1263
1264 settings()->set("ApplicationTheme", style);
1265 }
1266
1267 m_themeManager->applyCurrentlySelectedTheme(true);
1268
1269 m_setupWizard = new SetupWizard(nullptr);
1270 if (languageRequired) {
1271 m_setupWizard->addPage(new LanguageWizardPage(m_setupWizard));
1272 }
1273
1274 if (javaRequired) {
1275 m_setupWizard->addPage(new JavaWizardPage(m_setupWizard));
1276 } else if (askjava) {
1277 m_setupWizard->addPage(new AutoJavaWizardPage(m_setupWizard));
1278 }
1279
1280 if (pasteInterventionRequired) {

Callers

nothing calls this directly

Calls 13

ResolveExecutableFunction · 0.85
isValidIconThemeMethod · 0.80
anyAccountIsValidMethod · 0.80
addPageMethod · 0.80
showMethod · 0.80
QStringClass · 0.70
getMethod · 0.45
toStringMethod · 0.45
setMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected