frontend-tools: Add context menu to Scripts list
This commit is contained in:
parent
3107eda0d2
commit
c39aef03fe
@ -32,6 +32,7 @@ AddScripts="Add Scripts"
|
||||
RemoveScripts="Remove Scripts"
|
||||
ReloadScripts="Reload Scripts"
|
||||
LoadedScripts="Loaded Scripts"
|
||||
Reload="Reload"
|
||||
PythonSettings="Python Settings"
|
||||
PythonSettings.PythonInstallPath32bit="Python Install Path (32bit)"
|
||||
PythonSettings.PythonInstallPath64bit="Python Install Path (64bit)"
|
||||
|
@ -41,6 +41,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="scripts">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QUrl>
|
||||
#include <QDesktopServices>
|
||||
|
||||
@ -389,6 +390,30 @@ void ScriptsTool::on_reloadScripts_clicked()
|
||||
on_scripts_currentRowChanged(ui->scripts->currentRow());
|
||||
}
|
||||
|
||||
void ScriptsTool::on_scripts_customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
|
||||
QListWidgetItem *item = ui->scripts->itemAt(pos);
|
||||
|
||||
QMenu popup(this);
|
||||
|
||||
obs_frontend_push_ui_translation(obs_module_get_string);
|
||||
|
||||
popup.addAction(tr("Add"), this, SLOT(on_addScripts_clicked()));
|
||||
|
||||
if (item) {
|
||||
popup.addSeparator();
|
||||
popup.addAction(obs_module_text("Reload"), this,
|
||||
SLOT(on_reloadScripts_clicked()));
|
||||
popup.addSeparator();
|
||||
popup.addAction(tr("Remove"), this,
|
||||
SLOT(on_removeScripts_clicked()));
|
||||
}
|
||||
obs_frontend_pop_ui_translation();
|
||||
|
||||
popup.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ScriptsTool::on_scriptLog_clicked()
|
||||
{
|
||||
scriptLogWindow->show();
|
||||
|
@ -54,4 +54,5 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void on_description_linkActivated(const QString &link);
|
||||
void on_scripts_customContextMenuRequested(const QPoint &pos);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user