NOISSUE shortcut creation: add option to create launch scripts

This allows shortcuts to be created on Macs (which don't have a concept of desktop shortcuts) as well as Linux systems that don't support the desktop file specification. Also included a windows batch file implementation.
This commit is contained in:
arthomnix
2022-07-03 09:52:56 +01:00
parent 645bc3f445
commit 6a3ff58c8c
4 changed files with 104 additions and 71 deletions

View File

@@ -223,9 +223,7 @@ public:
TranslatedAction actionLaunchInstanceOffline;
TranslatedAction actionScreenshots;
TranslatedAction actionExportInstance;
#if defined(Q_OS_LINUX) // currently only implemented for linux; TODO: other OS implementations
TranslatedAction actionCreateShortcut;
#endif
QVector<TranslatedAction *> all_actions;
LabeledToolButton *renameButton = nullptr;
@@ -598,14 +596,12 @@ public:
instanceToolBar->addSeparator();
#if defined(Q_OS_LINUX)
actionCreateShortcut = TranslatedAction(MainWindow);
actionCreateShortcut->setObjectName(QStringLiteral("actionCreateShortcut"));
actionCreateShortcut.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Create Shortcut"));
actionCreateShortcut.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Create a shortcut that launches the selected instance"));
all_actions.append(&actionCreateShortcut);
instanceToolBar->addAction(actionCreateShortcut);
#endif
actionExportInstance = TranslatedAction(MainWindow);
actionExportInstance->setObjectName(QStringLiteral("actionExportInstance"));
@@ -1857,14 +1853,12 @@ void MainWindow::on_actionLaunchInstance_triggered()
}
}
#if defined(Q_OS_LINUX)
void MainWindow::on_actionCreateShortcut_triggered() {
if (m_selectedInstance)
{
CreateShortcutDialog(this, m_selectedInstance).exec();
}
}
#endif
void MainWindow::activateInstance(InstancePtr instance)
{