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

Method launch

launcher/Application.cpp:1239–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239bool Application::launch(
1240 InstancePtr instance,
1241 bool online,
1242 BaseProfilerFactory *profiler,
1243 MinecraftServerTargetPtr serverToJoin,
1244 MinecraftAccountPtr accountToUse
1245) {
1246 if(m_updateRunning)
1247 {
1248 qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
1249 }
1250 else if(instance->canLaunch())
1251 {
1252 auto & extras = m_instanceExtras[instance->id()];
1253 auto & window = extras.window;
1254 if(window)
1255 {
1256 if(!window->saveAll())
1257 {
1258 return false;
1259 }
1260 }
1261 auto & controller = extras.controller;
1262 controller.reset(new LaunchController());
1263 controller->setInstance(instance);
1264 controller->setOnline(online);
1265 controller->setProfiler(profiler);
1266 controller->setServerToJoin(serverToJoin);
1267 controller->setAccountToUse(accountToUse);
1268 if(window)
1269 {
1270 controller->setParentWidget(window);
1271 }
1272 else if(m_mainWindow)
1273 {
1274 controller->setParentWidget(m_mainWindow);
1275 }
1276 connect(controller.get(), &LaunchController::succeeded, this, &Application::controllerSucceeded);
1277 connect(controller.get(), &LaunchController::failed, this, &Application::controllerFailed);
1278 addRunningInstance();
1279 controller->start();
1280 return true;
1281 }
1282 else if (instance->isRunning())
1283 {
1284 showInstanceWindow(instance, "console");
1285 return true;
1286 }
1287 else if (instance->canEdit())
1288 {
1289 showInstanceWindow(instance);
1290 return true;
1291 }
1292 return false;
1293}
1294
1295bool Application::kill(InstancePtr instance)
1296{

Callers

nothing calls this directly

Calls 14

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

Tested by

no test coverage detected