diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-02-02 00:43:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-02 00:43:02 +0100 |
| commit | 2395a860a7449c3c45c3b1c7f5be121c99917681 (patch) | |
| tree | 813dccc7a21bf6c739d8a4155d1378c47c4866e1 /src | |
| parent | de9d31d5b2987065f070841e002183a6845b0180 (diff) | |
Remember where the last editor DCP was opened from.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 1 | ||||
| -rw-r--r-- | src/tools/dcpomatic_editor.cc | 23 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 267831341..b4c632ae1 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -201,6 +201,7 @@ Config::set_defaults() _initial_paths["AddDKDMPath"] = boost::none; _initial_paths["SelectCertificatePath"] = boost::none; _initial_paths["AddCombinerInputPath"] = boost::none; + _initial_paths["AddEditorInputPath"] = boost::none; _initial_paths["ExportSubtitlesPath"] = boost::none; _initial_paths["ExportVideoPath"] = boost::none; _initial_paths["DebugLogPath"] = boost::none; diff --git a/src/tools/dcpomatic_editor.cc b/src/tools/dcpomatic_editor.cc index a9b3d881a..a9fc43308 100644 --- a/src/tools/dcpomatic_editor.cc +++ b/src/tools/dcpomatic_editor.cc @@ -21,6 +21,7 @@ #include "wx/about_dialog.h" #include "wx/dcpomatic_spin_ctrl.h" +#include "wx/dir_dialog.h" #include "wx/editable_list.h" #include "wx/i18n_setup.h" #include "wx/id.h" @@ -373,6 +374,8 @@ public: SetIcon(wxIcon(std_to_wx("id"))); #endif + Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this, _1)); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_open, this), ID_file_open); Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_save, this), ID_file_save); Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_exit, this), wxID_EXIT); @@ -412,6 +415,12 @@ public: } private: + void config_changed(Config::Property what) + { + try { + Config::instance()->write_config(); + } catch (exception& e) {} + } void setup_menu (wxMenuBar* m) { @@ -439,22 +448,20 @@ private: void file_open () { - auto d = wxStandardPaths::Get().GetDocumentsDir(); - wxDirDialog dialog(this, _("Select DCP to open"), d, wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST); + DirDialog dialog(this, _("Select DCP to open"), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST, "AddEditorInputPath"); - int r; + bool r; while (true) { - r = dialog.ShowModal(); - if (r == wxID_OK && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { + r = dialog.show(); + if (r && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); } else { break; } } - if (r == wxID_OK) { - boost::filesystem::path const dcp(wx_to_std(dialog.GetPath())); - load_dcp (dcp); + if (r) { + load_dcp(dialog.path()); } } |
