NOISSUE allow killing the instance from main window

This commit is contained in:
Petr Mrázek
2016-11-26 18:06:08 +01:00
parent ce70407363
commit 66ffab71ae
9 changed files with 131 additions and 25 deletions

View File

@ -877,7 +877,7 @@ bool MultiMC::openJsonEditor(const QString &filename)
}
}
void MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *profiler)
bool MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *profiler)
{
if(instance->canLaunch())
{
@ -887,7 +887,7 @@ void MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *pro
{
if(!window->saveAll())
{
return;
return false;
}
}
auto & controller = extras.controller;
@ -907,13 +907,33 @@ void MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *pro
connect(controller.get(), &LaunchController::failed, this, &MultiMC::controllerFailed);
controller->start();
m_runningInstances ++;
return true;
}
else if (instance->isRunning())
{
showInstanceWindow(instance, "console");
return true;
}
return false;
}
bool MultiMC::kill(InstancePtr instance)
{
if (!instance->isRunning())
{
qWarning() << "Attempted to kill instance" << instance->id() << "which isn't running.";
return false;
}
auto & extras = m_instanceExtras[instance->id()];
auto & controller = extras.controller;
if(controller)
{
return controller->abort();
}
return true;
}
void MultiMC::controllerSucceeded()
{
auto controller = qobject_cast<LaunchController *>(QObject::sender());