mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-02-28 12:28:38 -05:00
UI: Add "Defaults" button to filters/properties windows
This adds a "Defaults" button in the source and filter properties, which will clear and reset all settings. Closes jp9000/obs-studio#875
This commit is contained in:
@@ -49,8 +49,9 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
||||
int cy = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow",
|
||||
"cy");
|
||||
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Cancel);
|
||||
buttonBox->addButton(QTStr("OK"), QDialogButtonBox::AcceptRole);
|
||||
buttonBox->addButton(QTStr("Cancel"), QDialogButtonBox::RejectRole);
|
||||
buttonBox->addButton(QTStr("Defaults"), QDialogButtonBox::ResetRole);
|
||||
buttonBox->setObjectName(QStringLiteral("buttonBox"));
|
||||
|
||||
if (cx > 400 && cy > 400)
|
||||
@@ -158,9 +159,8 @@ void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
|
||||
|
||||
if (view->DeferUpdate())
|
||||
view->UpdateSettings();
|
||||
}
|
||||
|
||||
if (val == QDialogButtonBox::RejectRole) {
|
||||
} else if (val == QDialogButtonBox::RejectRole) {
|
||||
obs_data_t *settings = obs_source_get_settings(source);
|
||||
obs_data_clear(settings);
|
||||
obs_data_release(settings);
|
||||
@@ -171,6 +171,16 @@ void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
|
||||
obs_source_update(source, oldSettings);
|
||||
|
||||
close();
|
||||
|
||||
} else if (val == QDialogButtonBox::ResetRole) {
|
||||
obs_data_t *settings = obs_source_get_settings(source);
|
||||
obs_data_clear(settings);
|
||||
obs_data_release(settings);
|
||||
|
||||
if (!view->DeferUpdate())
|
||||
obs_source_update(source, nullptr);
|
||||
|
||||
view->RefreshProperties();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user