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

Method launch

launcher/Application.cpp:1394–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394bool Application::launch(InstancePtr instance, bool online, bool demo, MinecraftTarget::Ptr targetToJoin, MinecraftAccountPtr accountToUse)
1395{
1396 if (m_updateRunning) {
1397 qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed.";
1398 } else if (instance->canLaunch()) {
1399 QMutexLocker locker(&m_instanceExtrasMutex);
1400 auto& extras = m_instanceExtras[instance->id()];
1401 auto window = extras.window;
1402 if (window) {
1403 if (!window->saveAll()) {
1404 return false;
1405 }
1406 }
1407 auto& controller = extras.controller;
1408 controller.reset(new LaunchController());
1409 controller->setInstance(instance);
1410 controller->setOnline(online);
1411 controller->setDemo(demo);
1412 controller->setProfiler(profilers().value(instance->settings()->get("Profiler").toString(), nullptr).get());
1413 controller->setTargetToJoin(targetToJoin);
1414 controller->setAccountToUse(accountToUse);
1415 if (window) {
1416 controller->setParentWidget(window);
1417 } else if (m_mainWindow) {
1418 controller->setParentWidget(m_mainWindow);
1419 }
1420 connect(controller.get(), &LaunchController::succeeded, this, &Application::controllerSucceeded);
1421 connect(controller.get(), &LaunchController::failed, this, &Application::controllerFailed);
1422 connect(controller.get(), &LaunchController::aborted, this, [this] { controllerFailed(tr("Aborted")); });
1423 addRunningInstance();
1424 QMetaObject::invokeMethod(controller.get(), &Task::start, Qt::QueuedConnection);
1425 return true;
1426 } else if (instance->isRunning()) {
1427 showInstanceWindow(instance, "console");
1428 return true;
1429 } else if (instance->canEdit()) {
1430 showInstanceWindow(instance);
1431 return true;
1432 }
1433 return false;
1434}
1435
1436bool Application::kill(InstancePtr instance)
1437{

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected