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

Method performMainStartupAction

launcher/Application.cpp:1065–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063}
1064
1065void Application::performMainStartupAction()
1066{
1067 m_status = Application::Initialized;
1068 if(!m_instanceIdToLaunch.isEmpty())
1069 {
1070 auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
1071 if(inst)
1072 {
1073 MinecraftServerTargetPtr serverToJoin = nullptr;
1074 MinecraftAccountPtr accountToUse = nullptr;
1075 bool offline = m_offline;
1076
1077 qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching";
1078 if(!m_serverToJoin.isEmpty())
1079 {
1080 // FIXME: validate the server string
1081 serverToJoin.reset(new MinecraftServerTarget(MinecraftServerTarget::parse(m_serverToJoin)));
1082 qDebug() << " Launching with server" << m_serverToJoin;
1083 }
1084
1085 if(!m_profileToUse.isEmpty())
1086 {
1087 accountToUse = accounts()->getAccountByProfileName(m_profileToUse);
1088 if(!accountToUse) {
1089 return;
1090 }
1091 qDebug() << " Launching with account" << m_profileToUse;
1092 }
1093
1094 launch(inst, !offline, nullptr, serverToJoin, accountToUse, m_offlineName);
1095 return;
1096 }
1097 }
1098 if(!m_mainWindow)
1099 {
1100 // normal main window
1101 showMainWindow(false);
1102 qDebug() << "<> Main window shown.";
1103 }
1104 if(!m_zipToImport.isEmpty())
1105 {
1106 qDebug() << "<> Importing instance from zip:" << m_zipToImport;
1107 m_mainWindow->droppedURLs({ m_zipToImport });
1108 }
1109}
1110
1111void Application::showFatalErrorMessage(const QString& title, const QString& content)
1112{

Callers

nothing calls this directly

Calls 5

isEmptyMethod · 0.80
getInstanceByIdMethod · 0.80
droppedURLsMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected