UI: Add Undo/Redo items for adv. audio properties
Rather than forcing the user to close the advanced audio properties window in order to obtain an undo/redo action, use explicit undo/redo actions for each widget change in the advanced audio properties dialog.
This commit is contained in:
parent
ae5ac8fa82
commit
cec8061d83
3 changed files with 138 additions and 62 deletions
|
|
@ -4630,52 +4630,6 @@ void OBSBasic::on_actionAdvAudioProperties_triggered()
|
|||
|
||||
connect(advAudioWindow, SIGNAL(destroyed()), this,
|
||||
SLOT(AdvAudioPropsDestroyed()));
|
||||
|
||||
obs_data_t *wrapper = obs_data_create();
|
||||
|
||||
save_audio_source(1, wrapper);
|
||||
save_audio_source(2, wrapper);
|
||||
save_audio_source(3, wrapper);
|
||||
save_audio_source(4, wrapper);
|
||||
save_audio_source(5, wrapper);
|
||||
save_audio_source(6, wrapper);
|
||||
|
||||
std::string undo_data(obs_data_get_json(wrapper));
|
||||
|
||||
connect(advAudioWindow, &QDialog::finished, [this, undo_data]() {
|
||||
auto undo_redo = [](const std::string &data) {
|
||||
obs_data_t *audio_data =
|
||||
obs_data_create_from_json(data.c_str());
|
||||
|
||||
load_audio_source(1, audio_data);
|
||||
load_audio_source(2, audio_data);
|
||||
load_audio_source(3, audio_data);
|
||||
load_audio_source(4, audio_data);
|
||||
load_audio_source(5, audio_data);
|
||||
load_audio_source(6, audio_data);
|
||||
|
||||
obs_data_release(audio_data);
|
||||
};
|
||||
|
||||
obs_data_t *wrapper = obs_data_create();
|
||||
|
||||
save_audio_source(1, wrapper);
|
||||
save_audio_source(2, wrapper);
|
||||
save_audio_source(3, wrapper);
|
||||
save_audio_source(4, wrapper);
|
||||
save_audio_source(5, wrapper);
|
||||
save_audio_source(6, wrapper);
|
||||
|
||||
std::string redo_data(obs_data_get_json(wrapper));
|
||||
|
||||
if (undo_data.compare(redo_data) != 0)
|
||||
undo_s.add_action(QTStr("Undo.Audio"), undo_redo,
|
||||
undo_redo, undo_data, redo_data);
|
||||
|
||||
obs_data_release(wrapper);
|
||||
});
|
||||
|
||||
obs_data_release(wrapper);
|
||||
}
|
||||
|
||||
void OBSBasic::AdvAudioPropsClicked()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue