From a4cfb7ab596b3bd54d19d8bb6308e0afb4e6929d Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Mon, 11 May 2020 18:04:11 -0500 Subject: [PATCH] frontend-tools: Automatically select scripts When script is added, automatically select script. Also when the dialog is opened, select previous used script. --- UI/frontend-plugins/frontend-tools/scripts.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/UI/frontend-plugins/frontend-tools/scripts.cpp b/UI/frontend-plugins/frontend-tools/scripts.cpp index de4331649..a59ab9858 100644 --- a/UI/frontend-plugins/frontend-tools/scripts.cpp +++ b/UI/frontend-plugins/frontend-tools/scripts.cpp @@ -199,10 +199,19 @@ ScriptsTool::ScriptsTool() : QWidget(nullptr), ui(new Ui_ScriptsTool) propertiesView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->propertiesLayout->addWidget(propertiesView); + + config_t *global_config = obs_frontend_get_global_config(); + int row = + config_get_int(global_config, "scripts-tool", "prevScriptRow"); + ui->scripts->setCurrentRow(row); } ScriptsTool::~ScriptsTool() { + config_t *global_config = obs_frontend_get_global_config(); + config_set_int(global_config, "scripts-tool", "prevScriptRow", + ui->scripts->currentRow()); + delete ui; } @@ -331,6 +340,8 @@ void ScriptsTool::on_addScripts_clicked() obs_script_get_properties(script); obs_properties_apply_settings(prop, settings); obs_properties_destroy(prop); + + ui->scripts->setCurrentItem(item); } } }