From 81e326571bb31dc4a92f1dbe32cb3ec50ace71f8 Mon Sep 17 00:00:00 2001 From: flow Date: Thu, 15 Sep 2022 19:23:58 -0300 Subject: fix: enable demo launch only on supported instances e.g. >= 1.3.1 instances Signed-off-by: flow --- launcher/ui/InstanceWindow.cpp | 8 +++++++- launcher/ui/MainWindow.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'launcher/ui') diff --git a/launcher/ui/InstanceWindow.cpp b/launcher/ui/InstanceWindow.cpp index 5bf42bb5..09ce0d67 100644 --- a/launcher/ui/InstanceWindow.cpp +++ b/launcher/ui/InstanceWindow.cpp @@ -166,7 +166,13 @@ void InstanceWindow::updateLaunchButtons() else { m_launchOfflineButton->setEnabled(true); - m_launchDemoButton->setEnabled(true); + + // Disable demo-mode if not available. + auto instance = dynamic_cast(m_instance.get()); + if (instance) { + m_launchDemoButton->setEnabled(instance->supportsDemo()); + } + m_killButton->setText(tr("Launch")); m_killButton->setObjectName("launchButton"); m_killButton->setToolTip(tr("Launch the instance")); diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 9b195d26..58b1ae80 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1253,6 +1253,13 @@ void MainWindow::updateToolsMenu() normalLaunchOffline->setDisabled(true); normalLaunchDemo->setDisabled(true); } + + // Disable demo-mode if not available. + auto instance = dynamic_cast(m_selectedInstance.get()); + if (instance) { + normalLaunchDemo->setEnabled(instance->supportsDemo()); + } + QString profilersTitle = tr("Profilers"); launchMenu->addSeparator()->setText(profilersTitle); launchOfflineMenu->addSeparator()->setText(profilersTitle); @@ -2164,6 +2171,13 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & 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(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()); -- cgit