瀏覽代碼

frontend-tools: Automatically select scripts

When script is added, automatically select script. Also when the dialog is opened,
select previous used script.
Clayton Groeneveld 5 年之前
父節點
當前提交
a4cfb7ab59
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      UI/frontend-plugins/frontend-tools/scripts.cpp

+ 11 - 0
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);
 		}
 	}
 }