projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b7e65ad
)
Use FileDialog for adding content files.
author
Carl Hetherington
<cth@carlh.net>
Fri, 13 Jan 2023 12:57:52 +0000
(13:57 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 13 Jan 2023 23:42:39 +0000
(
00:42
+0100)
src/wx/content_panel.cc
patch
|
blob
|
history
diff --git
a/src/wx/content_panel.cc
b/src/wx/content_panel.cc
index c18520c30b4b677453372736dd78e40f0ba70d70..5bc006e12318a5fcc7af505633baa8907271aefa 100644
(file)
--- a/
src/wx/content_panel.cc
+++ b/
src/wx/content_panel.cc
@@
-22,6
+22,7
@@
#include "audio_panel.h"
#include "content_panel.h"
#include "dcpomatic_button.h"
#include "audio_panel.h"
#include "content_panel.h"
#include "dcpomatic_button.h"
+#include "file_dialog.h"
#include "film_viewer.h"
#include "image_sequence_dialog.h"
#include "text_panel.h"
#include "film_viewer.h"
#include "image_sequence_dialog.h"
#include "text_panel.h"
@@
-579,40
+580,22
@@
ContentPanel::add_file_clicked ()
return;
}
return;
}
- auto path = Config::instance()->initial_path("AddFilesPath");
-
/* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
non-Latin filenames or paths.
*/
/* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
non-Latin filenames or paths.
*/
- auto d
= new wxFileDialog
(
+ auto d
ialog = new FileDialog
(
_splitter,
_("Choose a file or files"),
_splitter,
_("Choose a file or files"),
- std_to_wx(path ? path->string() : home_directory().string()),
- wxT (""),
- wxT ("All files|*.*|Subtitle files|*.srt;*.xml|Audio files|*.wav;*.w64;*.flac;*.aif;*.aiff"),
- wxFD_MULTIPLE | wxFD_CHANGE_DIR
+ wxT("All files|*.*|Subtitle files|*.srt;*.xml|Audio files|*.wav;*.w64;*.flac;*.aif;*.aiff"),
+ wxFD_MULTIPLE | wxFD_CHANGE_DIR,
+ "AddFilesPath"
);
);
-
int const r = d->ShowModal ()
;
+
ScopeGuard sg = [dialog]() { dialog->Destroy(); }
;
- if (r != wxID_OK) {
- d->Destroy ();
- return;
+ if (dialog->show()) {
+ add_files(dialog->paths());
}
}
-
- wxArrayString paths;
- d->GetPaths (paths);
- vector<boost::filesystem::path> path_list;
- for (unsigned int i = 0; i < paths.GetCount(); ++i) {
- path_list.push_back (wx_to_std(paths[i]));
- }
- add_files (path_list);
-
- if (!path_list.empty()) {
- Config::instance()->set_initial_path("AddFilesPath", path_list[0].parent_path());
- }
-
- d->Destroy ();
}
}