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

Method createSetupWizard

launcher/Application.cpp:941–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941bool Application::createSetupWizard()
942{
943 bool javaRequired = [&]()
944 {
945 QString currentHostName = QHostInfo::localHostName();
946 QString oldHostName = settings()->get("LastHostname").toString();
947 if (currentHostName != oldHostName)
948 {
949 settings()->set("LastHostname", currentHostName);
950 return true;
951 }
952 QString currentJavaPath = settings()->get("JavaPath").toString();
953 QString actualPath = FS::ResolveExecutable(currentJavaPath);
954 if (actualPath.isNull())
955 {
956 return true;
957 }
958 return false;
959 }();
960 bool analyticsRequired = [&]()
961 {
962 if(BuildConfig.ANALYTICS_ID.isEmpty())
963 {
964 return false;
965 }
966 if (!settings()->get("Analytics").toBool())
967 {
968 return false;
969 }
970 if (settings()->get("AnalyticsSeen").toInt() < analytics()->version())
971 {
972 return true;
973 }
974 return false;
975 }();
976 bool languageRequired = [&]()
977 {
978 if (settings()->get("Language").toString().isEmpty())
979 return true;
980 return false;
981 }();
982 bool wizardRequired = javaRequired || analyticsRequired || languageRequired;
983
984 if(wizardRequired)
985 {
986 m_setupWizard = new SetupWizard(nullptr);
987 if (languageRequired)
988 {
989 m_setupWizard->addPage(new LanguageWizardPage(m_setupWizard));
990 }
991 if (javaRequired)
992 {
993 m_setupWizard->addPage(new JavaWizardPage(m_setupWizard));
994 }
995 if(analyticsRequired)
996 {
997 m_setupWizard->addPage(new AnalyticsWizardPage(m_setupWizard));
998 }

Callers

nothing calls this directly

Calls 7

ResolveExecutableFunction · 0.85
isEmptyMethod · 0.80
addPageMethod · 0.80
toStringMethod · 0.45
getMethod · 0.45
setMethod · 0.45
versionMethod · 0.45

Tested by

no test coverage detected