Merge pull request #2907 from cg2121/script-defaults
frontend-tools: Add defaults button to script dialog
This commit is contained in:
commit
c21fd6f275
@ -136,6 +136,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="defaults">
|
||||||
|
<property name="text">
|
||||||
|
<string>Defaults</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="scriptLog">
|
<widget class="QPushButton" name="scriptLog">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -255,6 +255,22 @@ void ScriptsTool::RefreshLists()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptsTool::SetScriptDefaults(const char *path)
|
||||||
|
{
|
||||||
|
for (OBSScript &script : scriptData->scripts) {
|
||||||
|
const char *script_path = obs_script_get_path(script);
|
||||||
|
if (strcmp(script_path, path) == 0) {
|
||||||
|
obs_data_t *settings = obs_script_get_settings(script);
|
||||||
|
obs_data_clear(settings);
|
||||||
|
obs_data_release(settings);
|
||||||
|
|
||||||
|
obs_script_update(script, nullptr);
|
||||||
|
on_reloadScripts_clicked();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptsTool::on_close_clicked()
|
void ScriptsTool::on_close_clicked()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
@ -433,6 +449,16 @@ void ScriptsTool::on_scripts_currentRowChanged(int row)
|
|||||||
ui->description->setText(obs_script_get_description(script));
|
ui->description->setText(obs_script_get_description(script));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptsTool::on_defaults_clicked()
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->scripts->currentItem();
|
||||||
|
if (!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetScriptDefaults(
|
||||||
|
item->data(Qt::UserRole).toString().toUtf8().constData());
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
extern "C" void FreeScripts()
|
extern "C" void FreeScripts()
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
void RemoveScript(const char *path);
|
void RemoveScript(const char *path);
|
||||||
void ReloadScript(const char *path);
|
void ReloadScript(const char *path);
|
||||||
void RefreshLists();
|
void RefreshLists();
|
||||||
|
void SetScriptDefaults(const char *path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_close_clicked();
|
void on_close_clicked();
|
||||||
@ -45,6 +46,7 @@ public slots:
|
|||||||
void on_removeScripts_clicked();
|
void on_removeScripts_clicked();
|
||||||
void on_reloadScripts_clicked();
|
void on_reloadScripts_clicked();
|
||||||
void on_scriptLog_clicked();
|
void on_scriptLog_clicked();
|
||||||
|
void on_defaults_clicked();
|
||||||
|
|
||||||
void on_scripts_currentRowChanged(int row);
|
void on_scripts_currentRowChanged(int row);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user