diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-01-16 01:44:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-16 21:33:29 +0100 |
| commit | 127bdaa2d8a869112fd6ec908cf115f391dbba24 (patch) | |
| tree | f1878f27421d80694e28b46f4d609ae51ebebc29 /src/wx/file_dialog.cc | |
| parent | c64b6891f6e28c1a7f11871d3dcccdfe75944644 (diff) | |
Remember some more paths when selecting files (#2728).
* export subtitles
* export video
* debug log
* cinema database
* config file
Diffstat (limited to 'src/wx/file_dialog.cc')
| -rw-r--r-- | src/wx/file_dialog.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/wx/file_dialog.cc b/src/wx/file_dialog.cc index bed8b4e0d..5a530359c 100644 --- a/src/wx/file_dialog.cc +++ b/src/wx/file_dialog.cc @@ -27,26 +27,38 @@ #include <vector> +using std::string; using std::vector; using boost::optional; +wxString initial_path( + std::string initial_path_key, + optional<boost::filesystem::path> override_path + ) +{ + if (override_path) { + return std_to_wx(override_path->string()); + } + + return std_to_wx(Config::instance()->initial_path(initial_path_key).get_value_or(home_directory()).string()); +} + + FileDialog::FileDialog( wxWindow* parent, wxString title, wxString allowed, long style, std::string initial_path_key, + boost::optional<std::string> initial_filename, optional<boost::filesystem::path> override_path ) : wxFileDialog( parent, title, - std_to_wx( - override_path.get_value_or( - Config::instance()->initial_path(initial_path_key).get_value_or(home_directory()) - ).string()), - wxEmptyString, + initial_path(initial_path_key, override_path), + std_to_wx(initial_filename.get_value_or("")), allowed, style ) |
