Merge branch 'develop' of https://github.com/PolyMC/PolyMC into rebase
This commit is contained in:
@@ -240,6 +240,7 @@ public:
|
||||
TranslatedAction actionCAT;
|
||||
TranslatedAction actionCopyInstance;
|
||||
TranslatedAction actionLaunchInstanceOffline;
|
||||
TranslatedAction actionLaunchInstanceDemo;
|
||||
TranslatedAction actionScreenshots;
|
||||
TranslatedAction actionExportInstance;
|
||||
QVector<TranslatedAction *> all_actions;
|
||||
@@ -499,6 +500,7 @@ public:
|
||||
fileMenu->addAction(actionAddInstance);
|
||||
fileMenu->addAction(actionLaunchInstance);
|
||||
fileMenu->addAction(actionLaunchInstanceOffline);
|
||||
fileMenu->addAction(actionLaunchInstanceDemo);
|
||||
fileMenu->addAction(actionKillInstance);
|
||||
fileMenu->addAction(actionCloseWindow);
|
||||
fileMenu->addSeparator();
|
||||
@@ -669,6 +671,12 @@ public:
|
||||
actionLaunchInstanceOffline.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Launch the selected instance in offline mode."));
|
||||
all_actions.append(&actionLaunchInstanceOffline);
|
||||
|
||||
actionLaunchInstanceDemo = TranslatedAction(MainWindow);
|
||||
actionLaunchInstanceDemo->setObjectName(QStringLiteral("actionLaunchInstanceDemo"));
|
||||
actionLaunchInstanceDemo.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Launch &Demo"));
|
||||
actionLaunchInstanceDemo.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Launch the selected instance in demo mode."));
|
||||
all_actions.append(&actionLaunchInstanceDemo);
|
||||
|
||||
actionKillInstance = TranslatedAction(MainWindow);
|
||||
actionKillInstance->setObjectName(QStringLiteral("actionKillInstance"));
|
||||
actionKillInstance->setDisabled(true);
|
||||
@@ -1195,6 +1203,7 @@ void MainWindow::updateToolsMenu()
|
||||
|
||||
ui->actionLaunchInstance->setDisabled(!m_selectedInstance || currentInstanceRunning);
|
||||
ui->actionLaunchInstanceOffline->setDisabled(!m_selectedInstance || currentInstanceRunning);
|
||||
ui->actionLaunchInstanceDemo->setDisabled(!m_selectedInstance || currentInstanceRunning);
|
||||
|
||||
QMenu *launchMenu = ui->actionLaunchInstance->menu();
|
||||
QMenu *launchOfflineMenu = ui->actionLaunchInstanceOffline->menu();
|
||||
@@ -1220,23 +1229,37 @@ void MainWindow::updateToolsMenu()
|
||||
normalLaunch->setShortcut(QKeySequence::Open);
|
||||
QAction *normalLaunchOffline = launchOfflineMenu->addAction(tr("Launch Offline"));
|
||||
normalLaunchOffline->setShortcut(QKeySequence(tr("Ctrl+Shift+O")));
|
||||
QAction *normalLaunchDemo = launchOfflineMenu->addAction(tr("Launch Demo"));
|
||||
normalLaunchDemo->setShortcut(QKeySequence(tr("Ctrl+Alt+O")));
|
||||
if (m_selectedInstance)
|
||||
{
|
||||
normalLaunch->setEnabled(m_selectedInstance->canLaunch());
|
||||
normalLaunchOffline->setEnabled(m_selectedInstance->canLaunch());
|
||||
normalLaunchDemo->setEnabled(m_selectedInstance->canLaunch());
|
||||
|
||||
connect(normalLaunch, &QAction::triggered, [this]() {
|
||||
APPLICATION->launch(m_selectedInstance, true);
|
||||
APPLICATION->launch(m_selectedInstance, true, false);
|
||||
});
|
||||
connect(normalLaunchOffline, &QAction::triggered, [this]() {
|
||||
APPLICATION->launch(m_selectedInstance, false);
|
||||
APPLICATION->launch(m_selectedInstance, false, false);
|
||||
});
|
||||
connect(normalLaunchDemo, &QAction::triggered, [this]() {
|
||||
APPLICATION->launch(m_selectedInstance, false, true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
normalLaunch->setDisabled(true);
|
||||
normalLaunchOffline->setDisabled(true);
|
||||
normalLaunchDemo->setDisabled(true);
|
||||
}
|
||||
|
||||
// Disable demo-mode if not available.
|
||||
auto instance = dynamic_cast<MinecraftInstance*>(m_selectedInstance.get());
|
||||
if (instance) {
|
||||
normalLaunchDemo->setEnabled(instance->supportsDemo());
|
||||
}
|
||||
|
||||
QString profilersTitle = tr("Profilers");
|
||||
launchMenu->addSeparator()->setText(profilersTitle);
|
||||
launchOfflineMenu->addSeparator()->setText(profilersTitle);
|
||||
@@ -1260,11 +1283,11 @@ void MainWindow::updateToolsMenu()
|
||||
|
||||
connect(profilerAction, &QAction::triggered, [this, profiler]()
|
||||
{
|
||||
APPLICATION->launch(m_selectedInstance, true, profiler.get());
|
||||
APPLICATION->launch(m_selectedInstance, true, false, profiler.get());
|
||||
});
|
||||
connect(profilerOfflineAction, &QAction::triggered, [this, profiler]()
|
||||
{
|
||||
APPLICATION->launch(m_selectedInstance, false, profiler.get());
|
||||
APPLICATION->launch(m_selectedInstance, false, false, profiler.get());
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -1633,6 +1656,10 @@ void MainWindow::runModalTask(Task *task)
|
||||
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
|
||||
}
|
||||
});
|
||||
connect(task, &Task::aborted, [this]
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)->show();
|
||||
});
|
||||
ProgressDialog loadDialog(this);
|
||||
loadDialog.setSkipButton(true, tr("Abort"));
|
||||
loadDialog.execWithTask(task);
|
||||
@@ -2096,6 +2123,14 @@ void MainWindow::on_actionLaunchInstanceOffline_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionLaunchInstanceDemo_triggered()
|
||||
{
|
||||
if (m_selectedInstance)
|
||||
{
|
||||
APPLICATION->launch(m_selectedInstance, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionKillInstance_triggered()
|
||||
{
|
||||
if(m_selectedInstance && m_selectedInstance->isRunning())
|
||||
@@ -2139,6 +2174,14 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
|
||||
ui->setInstanceActionsEnabled(true);
|
||||
ui->actionLaunchInstance->setEnabled(m_selectedInstance->canLaunch());
|
||||
ui->actionLaunchInstanceOffline->setEnabled(m_selectedInstance->canLaunch());
|
||||
ui->actionLaunchInstanceDemo->setEnabled(m_selectedInstance->canLaunch());
|
||||
|
||||
// Disable demo-mode if not available.
|
||||
auto instance = dynamic_cast<MinecraftInstance*>(m_selectedInstance.get());
|
||||
if (instance) {
|
||||
ui->actionLaunchInstanceDemo->setEnabled(instance->supportsDemo());
|
||||
}
|
||||
|
||||
ui->actionKillInstance->setEnabled(m_selectedInstance->isRunning());
|
||||
ui->actionExportInstance->setEnabled(m_selectedInstance->canExport());
|
||||
ui->renameButton->setText(m_selectedInstance->name());
|
||||
@@ -2158,6 +2201,7 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
|
||||
ui->setInstanceActionsEnabled(false);
|
||||
ui->actionLaunchInstance->setEnabled(false);
|
||||
ui->actionLaunchInstanceOffline->setEnabled(false);
|
||||
ui->actionLaunchInstanceDemo->setEnabled(false);
|
||||
ui->actionKillInstance->setEnabled(false);
|
||||
APPLICATION->settings()->set("SelectedInstance", QString());
|
||||
selectionBad();
|
||||
|
||||
Reference in New Issue
Block a user