MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / launch

Method launch

launcher/Application.cpp:1213–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211}
1212
1213bool Application::launch(
1214 InstancePtr instance,
1215 bool online,
1216 bool demo,
1217 BaseProfilerFactory *profiler,
1218 MinecraftServerTargetPtr serverToJoin,
1219 MinecraftAccountPtr accountToUse
1220) {
1221 if(m_updateRunning)
1222 {
1223 qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
1224 }
1225 else if(instance->canLaunch())
1226 {
1227 auto & extras = m_instanceExtras[instance->id()];
1228 auto & window = extras.window;
1229 if(window)
1230 {
1231 if(!window->saveAll())
1232 {
1233 return false;
1234 }
1235 }
1236 auto & controller = extras.controller;
1237 controller.reset(new LaunchController());
1238 controller->setInstance(instance);
1239 controller->setOnline(online);
1240 controller->setDemo(demo);
1241 controller->setProfiler(profiler);
1242 controller->setServerToJoin(serverToJoin);
1243 controller->setAccountToUse(accountToUse);
1244 if(window)
1245 {
1246 controller->setParentWidget(window);
1247 }
1248 else if(m_mainWindow)
1249 {
1250 controller->setParentWidget(m_mainWindow);
1251 }
1252 connect(controller.get(), &LaunchController::succeeded, this, &Application::controllerSucceeded);
1253 connect(controller.get(), &LaunchController::failed, this, &Application::controllerFailed);
1254 connect(controller.get(), &LaunchController::aborted, this, [this] {
1255 controllerFailed(tr("Aborted"));
1256 });
1257 addRunningInstance();
1258 controller->start();
1259 return true;
1260 }
1261 else if (instance->isRunning())
1262 {
1263 showInstanceWindow(instance, "console");
1264 return true;
1265 }
1266 else if (instance->canEdit())
1267 {
1268 showInstanceWindow(instance);
1269 return true;
1270 }

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected