mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08: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:
@@ -87,6 +87,15 @@ OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_)
|
||||
SLOT(EffectFilterNameEdited(QWidget*,
|
||||
QAbstractItemDelegate::EndEditHint)));
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Close),
|
||||
SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Reset)->setText(
|
||||
QTStr("Defaults"));
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Reset),
|
||||
SIGNAL(clicked()), this, SLOT(ResetFilters()));
|
||||
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
bool audio = (flags & OBS_SOURCE_AUDIO) != 0;
|
||||
bool audioOnly = (flags & OBS_SOURCE_VIDEO) == 0;
|
||||
@@ -573,6 +582,7 @@ void OBSBasicFilters::on_moveAsyncFilterDown_clicked()
|
||||
void OBSBasicFilters::on_asyncFilters_GotFocus()
|
||||
{
|
||||
UpdatePropertiesView(ui->asyncFilters->currentRow(), true);
|
||||
isAsync = true;
|
||||
}
|
||||
|
||||
void OBSBasicFilters::on_asyncFilters_currentRowChanged(int row)
|
||||
@@ -614,6 +624,7 @@ void OBSBasicFilters::on_moveEffectFilterDown_clicked()
|
||||
void OBSBasicFilters::on_effectFilters_GotFocus()
|
||||
{
|
||||
UpdatePropertiesView(ui->effectFilters->currentRow(), false);
|
||||
isAsync = false;
|
||||
}
|
||||
|
||||
void OBSBasicFilters::on_effectFilters_currentRowChanged(int row)
|
||||
@@ -739,3 +750,23 @@ void OBSBasicFilters::EffectFilterNameEdited(QWidget *editor,
|
||||
FilterNameEdited(editor, ui->effectFilters);
|
||||
UNUSED_PARAMETER(endHint);
|
||||
}
|
||||
|
||||
void OBSBasicFilters::ResetFilters()
|
||||
{
|
||||
QListWidget *list = isAsync ? ui->asyncFilters : ui->effectFilters;
|
||||
int row = list->currentRow();
|
||||
|
||||
OBSSource filter = GetFilter(row, isAsync);
|
||||
|
||||
if (!filter)
|
||||
return;
|
||||
|
||||
obs_data_t *settings = obs_source_get_settings(filter);
|
||||
obs_data_clear(settings);
|
||||
obs_data_release(settings);
|
||||
|
||||
if (!view->DeferUpdate())
|
||||
obs_source_update(filter, nullptr);
|
||||
|
||||
view->RefreshProperties();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user