Merge branch 'master' into 1.0
authorCarl Hetherington <cth@carlh.net>
Fri, 26 Apr 2013 22:50:43 +0000 (23:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 26 Apr 2013 22:50:43 +0000 (23:50 +0100)
ChangeLog
src/tools/dcpomatic.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index c5df3d2cc34956f3e279cad2d90de2a24ec98dca..129d148e9f76e1fb2cd97cf5afaad7557df44255 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-04-24  Carl Hetherington  <cth@carlh.net>
+
+       * Allow use of existing empty directories for new films (without
+       confirmation) and existing non-empty directories (with confirmation)
+       (#124).
+
 2013-04-26  Carl Hetherington  <cth@carlh.net>
 
        * Version 0.87 released.
index e053da5340d8fc2e45335c610e5b155f3c7cd1d4..4312139f1498a9c19b3e358a87733076045c6b31 100644 (file)
@@ -299,9 +299,17 @@ private:
                
                if (r == wxID_OK) {
 
-                       if (boost::filesystem::exists (d->get_path())) {
-                               error_dialog (this, std_to_wx (String::compose (wx_to_std (_("The directory %1 already exists.")), d->get_path().c_str())));
-                               return;
+                       if (boost::filesystem::exists (d->get_path()) && !boost::filesystem::is_empty(d->get_path())) {
+                               if (!confirm_dialog (
+                                           this,
+                                           std_to_wx (
+                                                   String::compose (wx_to_std (_("The directory %1 already exists and is not empty.  "
+                                                                                 "Are you sure you want to use it?")),
+                                                                    d->get_path().c_str())
+                                                   )
+                                           )) {
+                                       return;
+                               }
                        }
                        
                        maybe_save_then_delete_film ();
index 3dad6e7fd84ea455edc398bd391207ee2c2ecad0..e0d7d843ff51fb31f06881592e670f3adab6dbce 100644 (file)
@@ -63,6 +63,16 @@ error_dialog (wxWindow* parent, wxString m)
        d->Destroy ();
 }
 
+bool
+confirm_dialog (wxWindow* parent, wxString m)
+{
+       wxMessageDialog* d = new wxMessageDialog (parent, m, _("DVD-o-matic"), wxYES_NO | wxICON_QUESTION);
+       int const r = d->ShowModal ();
+       d->Destroy ();
+       return r == wxID_YES;
+}
+       
+
 /** @param s wxWidgets string.
  *  @return Corresponding STL string.
  */
index bff3d7982edf0b74d70d1cb4f6f030b26a9f9d2a..b3ab706df0687eb1810776a8d7d9144ced69e97b 100644 (file)
@@ -31,6 +31,7 @@ class wxGridBagSizer;
  */
 
 extern void error_dialog (wxWindow *, wxString);
+extern bool confirm_dialog (wxWindow *, wxString);
 extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, int prop = 0);
 extern wxStaticText* add_label_to_grid_bag_sizer (wxGridBagSizer *, wxWindow *, wxString, wxGBPosition, wxGBSpan span = wxDefaultSpan);
 extern std::string wx_to_std (wxString);