From 6f4f28928d7fbe6cf65a175fab5632c36824ce04 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 23 Jan 2020 17:05:36 -0600 Subject: [PATCH] Export Dialog: catch major changes, and mark the session dirty. Otherwise changes can be silently lost. --- gtk2_ardour/export_dialog.cc | 22 ++++++++++++++++++++++ gtk2_ardour/export_dialog.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 8e197060b0..4a266d9f2f 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -62,6 +62,7 @@ ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::Ex , list_files_label (_("Some already existing files will be overwritten."), Gtk::ALIGN_RIGHT) , list_files_button (_("List files")) , previous_progress (0) + , _initialized (false) { } ExportDialog::~ExportDialog () @@ -114,9 +115,19 @@ ExportDialog::set_session (ARDOUR::Session* s) channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_realtime_selection)); file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename)); + /* Catch major selection changes, and set the session dirty */ + + preset_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty)); + timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty)); + channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty)); + channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty)); + file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty)); + update_warnings_and_example_filename (); update_realtime_selection (); + _initialized = true; + _session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&ExportDialog::parameter_changed, this, _1), gui_context()); } @@ -227,6 +238,17 @@ ExportDialog::sync_with_manager () update_realtime_selection (); } + +void +ExportDialog::maybe_set_session_dirty () +{ + /* Presumably after all initialization is finished, sync_with_manager means that something important changed. */ + /* Let's prompt the user to save the session; otherwise these Export settings changes would be lost on re-open */ + if (_initialized) { + _session->set_dirty(); + } +} + void ExportDialog::update_warnings_and_example_filename () { diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h index e15a21395e..d2cc5ec719 100644 --- a/gtk2_ardour/export_dialog.h +++ b/gtk2_ardour/export_dialog.h @@ -114,6 +114,8 @@ private: void do_export (); + void maybe_set_session_dirty (); + void update_realtime_selection (); void parameter_changed (std::string const&); @@ -148,6 +150,8 @@ private: float previous_progress; // Needed for gtk bug workaround + bool _initialized; + void soundcloud_upload_progress(double total, double now, std::string title); /* Buttons */