mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-07-29 00:26:14 -04:00
UI: Add confirmation dialog for resetting properties
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user