NOISSUE more work on Legacy migration

This commit is contained in:
Petr Mrázek
2017-09-20 23:38:31 +02:00
parent 9a6c2b0e2c
commit ba3cbb7330
14 changed files with 149 additions and 12 deletions

View File

@@ -50,6 +50,9 @@ public:
if(legacy)
{
values.append(new LegacyUpgradePage(legacy.get()));
values.append(new NotesPage(legacy.get()));
values.append(new WorldListPage(legacy.get(), legacy->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
values.append(new ScreenshotsPage(FS::PathCombine(legacy->minecraftRoot(), "screenshots")));
}
auto logMatcher = inst->getLogFileMatcher();
if(logMatcher)

View File

@@ -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<LaunchTask> p
m_proc = proc;
}
void InstanceWindow::on_RunningState_changed(bool running)
void InstanceWindow::on_RunningState_changed(bool)
{
setKillButton(running);
updateLaunchButtons();
m_container->refreshContainer();
}

View File

@@ -57,7 +57,7 @@ protected:
void closeEvent(QCloseEvent *) override;
private:
void setKillButton(bool kill);
void updateLaunchButtons();
private:
std::shared_ptr<LaunchTask> m_proc;

View File

@@ -665,8 +665,10 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
}
QMenu myMenu;
myMenu.addActions(actions);
/*
if (onInstance)
myMenu.setEnabled(m_selectedInstance->canLaunch());
*/
myMenu.exec(view->mapToGlobal(pos));
}

View File

@@ -969,6 +969,11 @@ bool MultiMC::launch(InstancePtr instance, bool online, BaseProfilerFactory *pro
showInstanceWindow(instance, "console");
return true;
}
else if (instance->canEdit())
{
showInstanceWindow(instance);
return true;
}
return false;
}