UI: Add confirmation dialog for resetting properties

This commit is contained in:
derrod
2023-01-29 13:40:59 +01:00
committed by Rodney
parent 8d4a0b3645
commit 644b73eb46
3 changed files with 32 additions and 0 deletions

View File

@@ -301,6 +301,17 @@ void OBSBasicProperties::UpdateProperties(void *data, calldata_t *)
"ReloadProperties");
}
static bool ConfirmReset(QWidget *parent)
{
QMessageBox::StandardButton button;
button = OBSMessageBox::question(parent, QTStr("ConfirmReset.Title"),
QTStr("ConfirmReset.Text"),
QMessageBox::Yes | QMessageBox::No);
return button == QMessageBox::Yes;
}
void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
{
QDialogButtonBox::ButtonRole val = ui->buttonBox->buttonRole(button);
@@ -362,6 +373,9 @@ void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
close();
} else if (val == QDialogButtonBox::ResetRole) {
if (!ConfirmReset(this))
return;
OBSDataAutoRelease settings = obs_source_get_settings(source);
obs_data_clear(settings);