summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-26 23:50:43 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-26 23:50:43 +0100
commit28dbf4fd074d2046a3c8ddebac9a537a80fd457a (patch)
treee2bed7c7aed8c74969f1a25d7bdf948815b4b057
parentf861018389acd9d277fe34d7621182b9b54f977f (diff)
parent87a709a4ea5dffaadaf35ef94edb4b578eb3b56c (diff)
Merge branch 'master' into 1.0
-rw-r--r--ChangeLog6
-rw-r--r--src/tools/dcpomatic.cc14
-rw-r--r--src/wx/wx_util.cc10
-rw-r--r--src/wx/wx_util.h1
4 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c5df3d2cc..129d148e9 100644
--- 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.
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index e053da534..4312139f1 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -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 ();
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 3dad6e7fd..e0d7d843f 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -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.
*/
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index bff3d7982..b3ab706df 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -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);