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:
parent
9ab0f26214
commit
2d84da2f7e
5 changed files with 52 additions and 26 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue