MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / createSetupWizard

Method createSetupWizard

launcher/Application.cpp:1073–1146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1071}
1072
1073bool Application::createSetupWizard()
1074{
1075 bool javaRequired = [&]() {
1076 if (BuildConfig.JAVA_DOWNLOADER_ENABLED && m_settings->get("AutomaticJavaDownload").toBool()) {
1077 return false;
1078 }
1079 bool ignoreJavaWizard = m_settings->get("IgnoreJavaWizard").toBool();
1080 if (ignoreJavaWizard) {
1081 return false;
1082 }
1083 QString currentHostName = QHostInfo::localHostName();
1084 QString oldHostName = settings()->get("LastHostname").toString();
1085 if (currentHostName != oldHostName) {
1086 settings()->set("LastHostname", currentHostName);
1087 return true;
1088 }
1089 QString currentJavaPath = settings()->get("JavaPath").toString();
1090 QString actualPath = FS::ResolveExecutable(currentJavaPath);
1091 return actualPath.isNull();
1092 }();
1093 bool askjava = BuildConfig.JAVA_DOWNLOADER_ENABLED && !javaRequired && !m_settings->get("AutomaticJavaDownload").toBool() &&
1094 !m_settings->get("AutomaticJavaSwitch").toBool() && !m_settings->get("UserAskedAboutAutomaticJavaDownload").toBool();
1095 bool languageRequired = settings()->get("Language").toString().isEmpty();
1096 bool pasteInterventionRequired = settings()->get("PastebinURL") != "";
1097 bool validWidgets = m_themeManager->isValidApplicationTheme(settings()->get("ApplicationTheme").toString());
1098 bool validIcons = m_themeManager->isValidIconTheme(settings()->get("IconTheme").toString());
1099 bool login = !m_accounts->anyAccountIsValid() && capabilities() & Application::SupportsMSA;
1100 bool themeInterventionRequired = !validWidgets || !validIcons;
1101 bool wizardRequired = javaRequired || languageRequired || pasteInterventionRequired || themeInterventionRequired || askjava || login;
1102 if (wizardRequired) {
1103 // set default theme after going into theme wizard
1104 if (!validIcons)
1105 settings()->set("IconTheme", QString("pe_colored"));
1106 if (!validWidgets) {
1107#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1108 const QString style =
1109 QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ? QStringLiteral("dark") : QStringLiteral("bright");
1110#else
1111 const QString style = QStringLiteral("system");
1112#endif
1113
1114 settings()->set("ApplicationTheme", style);
1115 }
1116
1117 m_themeManager->applyCurrentlySelectedTheme(true);
1118
1119 m_setupWizard = new SetupWizard(nullptr);
1120 if (languageRequired) {
1121 m_setupWizard->addPage(new LanguageWizardPage(m_setupWizard));
1122 }
1123
1124 if (javaRequired) {
1125 m_setupWizard->addPage(new JavaWizardPage(m_setupWizard));
1126 } else if (askjava) {
1127 m_setupWizard->addPage(new AutoJavaWizardPage(m_setupWizard));
1128 }
1129
1130 if (pasteInterventionRequired) {

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected