frontend-tools: Automatically select scripts

When script is added, automatically select script. Also when the dialog is opened,
select previous used script.
This commit is contained in:
Clayton Groeneveld 2020-05-11 18:04:11 -05:00
parent 0a700dbc2a
commit a4cfb7ab59

View File

@ -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);
}
}
}