From ba3cbb7330fd3435423eb3a77373ca82d65681d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 20 Sep 2017 23:38:31 +0200 Subject: NOISSUE more work on Legacy migration --- application/InstanceWindow.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'application/InstanceWindow.cpp') diff --git a/application/InstanceWindow.cpp b/application/InstanceWindow.cpp index dd643f47..3c39491b 100644 --- a/application/InstanceWindow.cpp +++ b/application/InstanceWindow.cpp @@ -72,7 +72,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent) m_launchOfflineButton = new QPushButton(); horizontalLayout->addWidget(m_launchOfflineButton); m_launchOfflineButton->setText(tr("Launch Offline")); - setKillButton(m_instance->isRunning()); + updateLaunchButtons(); connect(m_launchOfflineButton, SIGNAL(clicked(bool)), SLOT(on_btnLaunchMinecraftOffline_clicked())); m_closeButton = new QPushButton(); @@ -115,14 +115,21 @@ void InstanceWindow::on_instanceStatusChanged(BaseInstance::Status, BaseInstance } } -void InstanceWindow::setKillButton(bool kill) +void InstanceWindow::updateLaunchButtons() { - if(kill) + if(m_instance->isRunning()) { m_launchOfflineButton->setEnabled(false); m_killButton->setText(tr("Kill")); m_killButton->setToolTip(tr("Kill the running instance")); } + else if(!m_instance->canLaunch()) + { + m_launchOfflineButton->setEnabled(false); + m_killButton->setText(tr("Launch")); + m_killButton->setToolTip(tr("Launch the instance")); + m_killButton->setEnabled(false); + } else { m_launchOfflineButton->setEnabled(true); @@ -141,9 +148,9 @@ void InstanceWindow::on_InstanceLaunchTask_changed(std::shared_ptr p m_proc = proc; } -void InstanceWindow::on_RunningState_changed(bool running) +void InstanceWindow::on_RunningState_changed(bool) { - setKillButton(running); + updateLaunchButtons(); m_container->refreshContainer(); } -- cgit v1.2.3