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

Method performMainStartupAction

launcher/Application.cpp:1198–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1196}
1197
1198void Application::performMainStartupAction()
1199{
1200 m_status = Application::Initialized;
1201 if (!m_instanceIdToLaunch.isEmpty()) {
1202 auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
1203 if (inst) {
1204 MinecraftTarget::Ptr targetToJoin = nullptr;
1205 MinecraftAccountPtr accountToUse = nullptr;
1206
1207 qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching";
1208 if (!m_serverToJoin.isEmpty()) {
1209 // FIXME: validate the server string
1210 targetToJoin.reset(new MinecraftTarget(MinecraftTarget::parse(m_serverToJoin, false)));
1211 qDebug() << " Launching with server" << m_serverToJoin;
1212 } else if (!m_worldToJoin.isEmpty()) {
1213 targetToJoin.reset(new MinecraftTarget(MinecraftTarget::parse(m_worldToJoin, true)));
1214 qDebug() << " Launching with world" << m_worldToJoin;
1215 }
1216
1217 if (!m_profileToUse.isEmpty()) {
1218 accountToUse = accounts()->getAccountByProfileName(m_profileToUse);
1219 if (!accountToUse) {
1220 return;
1221 }
1222 qDebug() << " Launching with account" << m_profileToUse;
1223 }
1224
1225 launch(inst, true, false, targetToJoin, accountToUse);
1226 return;
1227 }
1228 }
1229 if (!m_instanceIdToShowWindowOf.isEmpty()) {
1230 auto inst = instances()->getInstanceById(m_instanceIdToShowWindowOf);
1231 if (inst) {
1232 qDebug() << "<> Showing window of instance " << m_instanceIdToShowWindowOf;
1233 showInstanceWindow(inst);
1234 return;
1235 }
1236 }
1237 if (!m_mainWindow) {
1238 // normal main window
1239 showMainWindow(false);
1240 qDebug() << "<> Main window shown.";
1241 }
1242
1243 // initialize the updater
1244 if (updaterEnabled()) {
1245 qDebug() << "Initializing updater";
1246#ifdef Q_OS_MAC
1247#if defined(SPARKLE_ENABLED)
1248 m_updater.reset(new MacSparkleUpdater());
1249#endif
1250#else
1251 m_updater.reset(new PrismExternalUpdater(m_mainWindow, m_rootPath, m_dataPath));
1252#endif
1253 qDebug() << "<> Updater started.";
1254 }
1255

Callers

nothing calls this directly

Calls 9

PathCombineFunction · 0.85
deletePathFunction · 0.85
getInstanceByIdMethod · 0.80
processURLsMethod · 0.80
isEmptyMethod · 0.45
resetMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected