From: Carl Hetherington Date: Wed, 7 Jul 2021 22:37:33 +0000 (+0200) Subject: Take account of changes to default directory for new DCPs (#2058). X-Git-Tag: v2.15.156~8 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=cf7b5fd94e50f740ab93f52343610d01c80ac6d5 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. --- 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