13
0

Export Dialog: catch major changes, and mark the session dirty. Otherwise changes can be silently lost.

This commit is contained in:
Ben Loftis 2020-01-23 17:05:36 -06:00
parent 1c97cdb33d
commit 6f4f28928d
2 changed files with 26 additions and 0 deletions

View File

@ -62,6 +62,7 @@ ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::Ex
, list_files_label (_("<span color=\"#ffa755\">Some already existing files will be overwritten.</span>"), Gtk::ALIGN_RIGHT) , list_files_label (_("<span color=\"#ffa755\">Some already existing files will be overwritten.</span>"), Gtk::ALIGN_RIGHT)
, list_files_button (_("List files")) , list_files_button (_("List files"))
, previous_progress (0) , previous_progress (0)
, _initialized (false)
{ } { }
ExportDialog::~ExportDialog () ExportDialog::~ExportDialog ()
@ -114,9 +115,19 @@ ExportDialog::set_session (ARDOUR::Session* s)
channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_realtime_selection)); 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)); 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_warnings_and_example_filename ();
update_realtime_selection (); update_realtime_selection ();
_initialized = true;
_session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&ExportDialog::parameter_changed, this, _1), gui_context()); _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 (); 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 void
ExportDialog::update_warnings_and_example_filename () ExportDialog::update_warnings_and_example_filename ()
{ {

View File

@ -114,6 +114,8 @@ private:
void do_export (); void do_export ();
void maybe_set_session_dirty ();
void update_realtime_selection (); void update_realtime_selection ();
void parameter_changed (std::string const&); void parameter_changed (std::string const&);
@ -148,6 +150,8 @@ private:
float previous_progress; // Needed for gtk bug workaround float previous_progress; // Needed for gtk bug workaround
bool _initialized;
void soundcloud_upload_progress(double total, double now, std::string title); void soundcloud_upload_progress(double total, double now, std::string title);
/* Buttons */ /* Buttons */