mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-20 05:01:51 -04:00
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:
1 parent
ae5ac8fa82
commit
cec8061d83
3 files changed
+138
-62
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user