summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-25 00:48:11 +0100
committerCarl Hetherington <cth@carlh.net>2016-04-25 00:48:11 +0100
commit7a4c9163bec16052219b7aae551266d8369475f5 (patch)
tree901e47151ed5b341485510bb448343afc637dea7
parent2bfbf1b834639984fcf5f850b72c4dca608ee60f (diff)
Add cancel button to quit-dialog (#847).
-rw-r--r--ChangeLog3
-rw-r--r--src/tools/dcpomatic.cc34
2 files changed, 36 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d2b7505ed..61746665f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-04-25 Carl Hetherington <cth@carlh.net>
+ * Add cancel option to confirmation dialogue when closing
+ the program (#847).
+
* Move the reel markers to the top of the timeline (#846).
2016-04-22 c.hetherington <cth@carlh.net>
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 6a94c4583..5676e6e57 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -693,13 +693,45 @@ private:
return;
}
+ if (_film && _film->dirty ()) {
+
+ wxMessageDialog* dialog = new wxMessageDialog (
+ 0,
+ wxString::Format (_("Save changes to film \"%s\" before closing?"), std_to_wx (_film->name()).data()),
+ /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current
+ /// project (Film) has been changed since it was last saved.
+ _("Film changed"),
+ wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_QUESTION
+ );
+
+ dialog->SetYesNoCancelLabels (
+ _("Save film and close"), _("Close without saving film"), _("Don't close")
+ );
+
+ int const r = dialog->ShowModal ();
+ dialog->Destroy ();
+
+ switch (r) {
+ case wxID_NO:
+ /* Don't save and carry on to close */
+ break;
+ case wxID_YES:
+ /* Save and carry on to close */
+ _film->write_metadata ();
+ break;
+ case wxID_CANCEL:
+ /* Veto the event and stop */
+ ev.Veto ();
+ return;
+ }
+ }
+
/* We don't want to hear about any more configuration changes, since they
cause the File menu to be altered, which itself will be deleted around
now (without, as far as I can see, any way for us to find out).
*/
_config_changed_connection.disconnect ();
- maybe_save_then_delete_film ();
ev.Skip ();
}