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

Method launch

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

Source from the content-addressed store, hash-verified

1294}
1295
1296bool Application::launch(
1297 InstancePtr instance,
1298 bool online,
1299 BaseProfilerFactory *profiler,
1300 MinecraftServerTargetPtr serverToJoin,
1301 MinecraftAccountPtr accountToUse,
1302 const QString& offlineName
1303) {
1304 if(m_updateRunning)
1305 {
1306 qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
1307 }
1308 else if(instance->canLaunch())
1309 {
1310 auto & extras = m_instanceExtras[instance->id()];
1311 auto & window = extras.window;
1312 if(window)
1313 {
1314 if(!window->saveAll())
1315 {
1316 return false;
1317 }
1318 }
1319 auto & controller = extras.controller;
1320 controller.reset(new LaunchController());
1321 controller->setInstance(instance);
1322 controller->setOnline(online);
1323 controller->setProfiler(profiler);
1324 controller->setServerToJoin(serverToJoin);
1325 controller->setAccountToUse(accountToUse);
1326 controller->setOfflineName(offlineName);
1327 if(window)
1328 {
1329 controller->setParentWidget(window);
1330 }
1331 else if(m_mainWindow)
1332 {
1333 controller->setParentWidget(m_mainWindow);
1334 }
1335 connect(controller.get(), &LaunchController::succeeded, this, &Application::controllerSucceeded);
1336 connect(controller.get(), &LaunchController::failed, this, &Application::controllerFailed);
1337 addRunningInstance();
1338 controller->start();
1339 return true;
1340 }
1341 else if (instance->isRunning())
1342 {
1343 showInstanceWindow(instance, "console");
1344 return true;
1345 }
1346 else if (instance->canEdit())
1347 {
1348 showInstanceWindow(instance);
1349 return true;
1350 }
1351 return false;
1352}
1353

Callers

nothing calls this directly

Calls 15

setInstanceMethod · 0.80
setOnlineMethod · 0.80
setProfilerMethod · 0.80
setAccountToUseMethod · 0.80
setOfflineNameMethod · 0.80
setParentWidgetMethod · 0.80
canLaunchMethod · 0.45
idMethod · 0.45
saveAllMethod · 0.45
resetMethod · 0.45
setServerToJoinMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected