frontend-tools: Add "Open file location" menu item for scripts

This commit is contained in:
Matt Gajownik 2020-07-30 23:09:34 +10:00
parent c39aef03fe
commit a4bef68b15
3 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,7 @@ RemoveScripts="Remove Scripts"
ReloadScripts="Reload Scripts"
LoadedScripts="Loaded Scripts"
Reload="Reload"
OpenFileLocation="Open file location"
PythonSettings="Python Settings"
PythonSettings.PythonInstallPath32bit="Python Install Path (32bit)"
PythonSettings.PythonInstallPath64bit="Python Install Path (64bit)"

View File

@ -390,6 +390,17 @@ void ScriptsTool::on_reloadScripts_clicked()
on_scripts_currentRowChanged(ui->scripts->currentRow());
}
void ScriptsTool::OpenScriptParentDirectory()
{
QList<QListWidgetItem *> items = ui->scripts->selectedItems();
for (QListWidgetItem *item : items) {
QDir dir(item->data(Qt::UserRole).toString());
dir.cdUp();
QDesktopServices::openUrl(
QUrl::fromLocalFile(dir.absolutePath()));
}
}
void ScriptsTool::on_scripts_customContextMenuRequested(const QPoint &pos)
{
@ -405,6 +416,8 @@ void ScriptsTool::on_scripts_customContextMenuRequested(const QPoint &pos)
popup.addSeparator();
popup.addAction(obs_module_text("Reload"), this,
SLOT(on_reloadScripts_clicked()));
popup.addAction(obs_module_text("OpenFileLocation"), this,
SLOT(OpenScriptParentDirectory()));
popup.addSeparator();
popup.addAction(tr("Remove"), this,
SLOT(on_removeScripts_clicked()));

View File

@ -48,6 +48,8 @@ public slots:
void on_scriptLog_clicked();
void on_defaults_clicked();
void OpenScriptParentDirectory();
void on_scripts_currentRowChanged(int row);
void on_pythonPathBrowse_clicked();