projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4790b63
)
Cleanup: rename some methods in FilePickerCtrl and use boost::filesystem::path more.
author
Carl Hetherington
<cth@carlh.net>
Mon, 15 Jan 2024 23:33:05 +0000
(
00:33
+0100)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 16 Jan 2024 20:33:29 +0000
(21:33 +0100)
src/wx/export_subtitles_dialog.cc
patch
|
blob
|
history
src/wx/export_video_file_dialog.cc
patch
|
blob
|
history
src/wx/file_picker_ctrl.cc
patch
|
blob
|
history
src/wx/file_picker_ctrl.h
patch
|
blob
|
history
src/wx/full_config_dialog.cc
patch
|
blob
|
history
src/wx/player_config_dialog.cc
patch
|
blob
|
history
src/wx/wx_util.cc
patch
|
blob
|
history
diff --git
a/src/wx/export_subtitles_dialog.cc
b/src/wx/export_subtitles_dialog.cc
index 3c32fae536f900ef1934da7c7e80ae24cd48e765..ade58b3fb06c871a7df18b1b12406ed9dccb7261 100644
(file)
--- a/
src/wx/export_subtitles_dialog.cc
+++ b/
src/wx/export_subtitles_dialog.cc
@@
-97,7
+97,7
@@
boost::filesystem::path
ExportSubtitlesDialog::path () const
{
if (_file->IsEnabled()) {
ExportSubtitlesDialog::path () const
{
if (_file->IsEnabled()) {
- wxFileName fn
(_file->GetPath(
));
+ wxFileName fn
(std_to_wx(_file->path().string()
));
fn.SetExt (_interop ? "xml" : "mxf");
return wx_to_std (fn.GetFullPath());
}
fn.SetExt (_interop ? "xml" : "mxf");
return wx_to_std (fn.GetFullPath());
}
diff --git
a/src/wx/export_video_file_dialog.cc
b/src/wx/export_video_file_dialog.cc
index 208481225d09a5642ef169f882af06dc382587c1..8b01282b659cdbd848b6efa0b8ead841dc18b54b 100644
(file)
--- a/
src/wx/export_video_file_dialog.cc
+++ b/
src/wx/export_video_file_dialog.cc
@@
-97,7
+97,7
@@
ExportVideoFileDialog::ExportVideoFileDialog (wxWindow* parent, string name)
so disable its check and the caller will have to do it themselves.
*/
_file = new FilePickerCtrl (this, _("Select output file"), format_filters[0], false, false);
so disable its check and the caller will have to do it themselves.
*/
_file = new FilePickerCtrl (this, _("Select output file"), format_filters[0], false, false);
- _file->
SetPath
(_initial_name);
+ _file->
set_path
(_initial_name);
add (_file);
for (int i = 0; i < FORMATS; ++i) {
add (_file);
for (int i = 0; i < FORMATS; ++i) {
@@
-167,8
+167,8
@@
ExportVideoFileDialog::format_changed ()
{
auto const selection = _format->GetSelection();
DCPOMATIC_ASSERT (selection >= 0 && selection < FORMATS);
{
auto const selection = _format->GetSelection();
DCPOMATIC_ASSERT (selection >= 0 && selection < FORMATS);
- _file->
SetWildcard
(format_filters[selection]);
- _file->
SetPath
(_initial_name);
+ _file->
set_wildcard
(format_filters[selection]);
+ _file->
set_path
(_initial_name);
_x264_crf->Enable (formats[selection] == ExportFormat::H264_AAC);
for (int i = 0; i < 2; ++i) {
_x264_crf_label[i]->Enable(formats[selection] == ExportFormat::H264_AAC);
_x264_crf->Enable (formats[selection] == ExportFormat::H264_AAC);
for (int i = 0; i < 2; ++i) {
_x264_crf_label[i]->Enable(formats[selection] == ExportFormat::H264_AAC);
@@
-180,7
+180,7
@@
ExportVideoFileDialog::format_changed ()
boost::filesystem::path
ExportVideoFileDialog::path () const
{
boost::filesystem::path
ExportVideoFileDialog::path () const
{
- wxFileName fn
(_file->GetPath(
));
+ wxFileName fn
(std_to_wx(_file->path().string()
));
fn.SetExt (format_extensions[_format->GetSelection()]);
return wx_to_std (fn.GetFullPath());
}
fn.SetExt (format_extensions[_format->GetSelection()]);
return wx_to_std (fn.GetFullPath());
}
diff --git
a/src/wx/file_picker_ctrl.cc
b/src/wx/file_picker_ctrl.cc
index 4bb6518efc2fe33a91ac26812a701a5fba9bd55e..07424e74cd82182cc9670c411eea98dbb7a6a0f8 100644
(file)
--- a/
src/wx/file_picker_ctrl.cc
+++ b/
src/wx/file_picker_ctrl.cc
@@
-55,13
+55,14
@@
FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wild
_file->Bind (wxEVT_BUTTON, boost::bind (&FilePickerCtrl::browse_clicked, this));
}
_file->Bind (wxEVT_BUTTON, boost::bind (&FilePickerCtrl::browse_clicked, this));
}
+
void
void
-FilePickerCtrl::
SetPath (wxString p
)
+FilePickerCtrl::
set_path(boost::filesystem::path path
)
{
{
- _path = p;
+ _path = p
ath
;
- if (!_path.
IsEmpty
()) {
- _file->SetLabel(std_to_wx(
filesystem::path(wx_to_std(_path))
.filename().string()));
+ if (!_path.
empty
()) {
+ _file->SetLabel(std_to_wx(
_path
.filename().string()));
} else {
_file->SetLabel (_("(None)"));
}
} else {
_file->SetLabel (_("(None)"));
}
@@
-70,12
+71,14
@@
FilePickerCtrl::SetPath (wxString p)
GetEventHandler()->ProcessEvent (ev);
}
GetEventHandler()->ProcessEvent (ev);
}
-wxString
-FilePickerCtrl::GetPath () const
+
+boost::filesystem::path
+FilePickerCtrl::path() const
{
return _path;
}
{
return _path;
}
+
void
FilePickerCtrl::browse_clicked ()
{
void
FilePickerCtrl::browse_clicked ()
{
@@
-84,14
+87,14
@@
FilePickerCtrl::browse_clicked ()
style |= wxFD_OVERWRITE_PROMPT;
}
wxFileDialog dialog(this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
style |= wxFD_OVERWRITE_PROMPT;
}
wxFileDialog dialog(this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style);
- dialog.SetPath(
_path
);
+ dialog.SetPath(
std_to_wx(_path.string())
);
if (dialog.ShowModal() == wxID_OK) {
if (dialog.ShowModal() == wxID_OK) {
-
SetPath(dialog.GetPath(
));
+
set_path(boost::filesystem::path(wx_to_std(dialog.GetPath())
));
}
}
void
}
}
void
-FilePickerCtrl::
SetWildcard
(wxString w)
+FilePickerCtrl::
set_wildcard
(wxString w)
{
_wildcard = w;
}
{
_wildcard = w;
}
diff --git
a/src/wx/file_picker_ctrl.h
b/src/wx/file_picker_ctrl.h
index df7226655ecbb75fd69b47b97a514aea4b678923..2411254faa53c0c385164ad3f0eeb168f364e692 100644
(file)
--- a/
src/wx/file_picker_ctrl.h
+++ b/
src/wx/file_picker_ctrl.h
@@
-18,25
+18,28
@@
*/
*/
+
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
LIBDCP_ENABLE_WARNINGS
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
LIBDCP_ENABLE_WARNINGS
+#include <boost/filesystem.hpp>
+
class FilePickerCtrl : public wxPanel
{
public:
FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard, bool open, bool warn_overwrite);
class FilePickerCtrl : public wxPanel
{
public:
FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard, bool open, bool warn_overwrite);
-
wxString GetPath
() const;
- void
SetPath (wxString
);
- void
SetWildcard
(wxString);
+
boost::filesystem::path path
() const;
+ void
set_path(boost::filesystem::path path
);
+ void
set_wildcard
(wxString);
private:
void browse_clicked ();
wxButton* _file;
private:
void browse_clicked ();
wxButton* _file;
-
wxString
_path;
+
boost::filesystem::path
_path;
wxSizer* _sizer;
wxString _prompt;
wxString _wildcard;
wxSizer* _sizer;
wxString _prompt;
wxString _wildcard;
diff --git
a/src/wx/full_config_dialog.cc
b/src/wx/full_config_dialog.cc
index 2d4679611c9f6981332636fbee39a282af830d84..f7945a44a4404f1076e2f9f3334d0068ebe2e238 100644
(file)
--- a/
src/wx/full_config_dialog.cc
+++ b/
src/wx/full_config_dialog.cc
@@
-216,7
+216,7
@@
private:
void config_file_changed ()
{
auto config = Config::instance();
void config_file_changed ()
{
auto config = Config::instance();
-
boost::filesystem::path new_file = wx_to_std(_config_file->GetPath()
);
+
auto const new_file = _config_file->path(
);
if (new_file == config->config_read_file()) {
return;
}
if (new_file == config->config_read_file()) {
return;
}
@@
-240,7
+240,7
@@
private:
void cinemas_file_changed ()
{
void cinemas_file_changed ()
{
- Config::instance()->set_cinemas_file
(wx_to_std (_cinemas_file->GetPath ()
));
+ Config::instance()->set_cinemas_file
(_cinemas_file->path(
));
}
void default_add_file_location_changed()
}
void default_add_file_location_changed()
diff --git
a/src/wx/player_config_dialog.cc
b/src/wx/player_config_dialog.cc
index 5ac1fe28d2f75760a1c3bd6e72442458d9d97cd2..512c64c91314157093116fa9c0a0d045f7f2e010 100644
(file)
--- a/
src/wx/player_config_dialog.cc
+++ b/
src/wx/player_config_dialog.cc
@@
-208,7
+208,7
@@
private:
void debug_log_file_changed ()
{
void debug_log_file_changed ()
{
- Config::instance()->set_player_debug_log_file(
wx_to_std(_debug_log_file->GetPath()
));
+ Config::instance()->set_player_debug_log_file(
_debug_log_file->path(
));
}
wxChoice* _player_mode;
}
wxChoice* _player_mode;
diff --git
a/src/wx/wx_util.cc
b/src/wx/wx_util.cc
index 5f5a96a46a6f956cfcf30ebbfd7ea78762d8de6c..c0f90bd251083676377928818d39d1795c81aa0a 100644
(file)
--- a/
src/wx/wx_util.cc
+++ b/
src/wx/wx_util.cc
@@
-222,14
+222,14
@@
string_client_data (wxClientData* o)
void
checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
{
void
checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
{
- if (widget->
GetPath() != std_to_wx (value.string())
) {
+ if (widget->
path() != value
) {
if (value.empty()) {
/* Hack to make wxWidgets clear the control when we are passed
an empty value.
*/
value = " ";
}
if (value.empty()) {
/* Hack to make wxWidgets clear the control when we are passed
an empty value.
*/
value = " ";
}
- widget->
SetPath (std_to_wx (value.string())
);
+ widget->
set_path(value
);
}
}
}
}