diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-07-08 00:37:33 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-07-08 00:37:33 +0200 |
| commit | cf7b5fd94e50f740ab93f52343610d01c80ac6d5 (patch) | |
| tree | fadbed8aa857175165779483bd66a00b203d3094 | |
| parent | 97193e96c637ca92eeaf6e72ee38aa628308973b (diff) | |
Take account of changes to default directory for new DCPs (#2058).
Instead of always using the last directory in the new film dialog,
only use it when it was explicitly changed by the user.
| -rw-r--r-- | src/wx/film_name_location_dialog.cc | 12 | ||||
| -rw-r--r-- | src/wx/film_name_location_dialog.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc index e0e407c06..516ed86ae 100644 --- a/src/wx/film_name_location_dialog.cc +++ b/src/wx/film_name_location_dialog.cc @@ -48,15 +48,14 @@ FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title #ifdef DCPOMATIC_USE_OWN_PICKER _folder = new DirPickerCtrl (this); + _folder->Changed.connect (bind(&FilmNameLocationDialog::folder_changed, this)); #else _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); + _folder->Bind (wxEVT_DIRPICKER_CHANGED, bind(&FilmNameLocationDialog::folder_changed, this)); #endif - if (!_directory) { - _directory = Config::instance()->default_directory_or(wx_to_std(wxStandardPaths::Get().GetDocumentsDir())); - } - - _folder->SetPath (std_to_wx(_directory.get().string())); + auto dir = _directory.get_value_or(Config::instance()->default_directory_or(wx_to_std(wxStandardPaths::Get().GetDocumentsDir()))); + _folder->SetPath (std_to_wx(dir.string())); add (_folder); if (offer_templates) { @@ -102,7 +101,8 @@ FilmNameLocationDialog::use_template_clicked () } -FilmNameLocationDialog::~FilmNameLocationDialog () +void +FilmNameLocationDialog::folder_changed () { _directory = wx_to_std (_folder->GetPath()); } diff --git a/src/wx/film_name_location_dialog.h b/src/wx/film_name_location_dialog.h index 09b426e6b..29fcd3384 100644 --- a/src/wx/film_name_location_dialog.h +++ b/src/wx/film_name_location_dialog.h @@ -35,7 +35,6 @@ class FilmNameLocationDialog : public TableDialog { public: FilmNameLocationDialog (wxWindow *, wxString title, bool offer_templates); - ~FilmNameLocationDialog (); boost::filesystem::path path () const; bool check_path (); @@ -44,6 +43,7 @@ public: private: void use_template_clicked (); void setup_sensitivity (); + void folder_changed (); wxTextCtrl* _name; #ifdef DCPOMATIC_USE_OWN_PICKER |
