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());
}
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) {
{
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);
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());
}
_file->Bind (wxEVT_BUTTON, boost::bind (&FilePickerCtrl::browse_clicked, this));
}
+
void
-FilePickerCtrl::SetPath (wxString p)
+FilePickerCtrl::set_path(boost::filesystem::path path)
{
- _path = p;
+ _path = path;
- 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)"));
}
GetEventHandler()->ProcessEvent (ev);
}
-wxString
-FilePickerCtrl::GetPath () const
+
+boost::filesystem::path
+FilePickerCtrl::path() const
{
return _path;
}
+
void
FilePickerCtrl::browse_clicked ()
{
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) {
- SetPath(dialog.GetPath());
+ set_path(boost::filesystem::path(wx_to_std(dialog.GetPath())));
}
}
void
-FilePickerCtrl::SetWildcard (wxString w)
+FilePickerCtrl::set_wildcard(wxString w)
{
_wildcard = w;
}
*/
+
#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);
- 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;
- wxString _path;
+ boost::filesystem::path _path;
wxSizer* _sizer;
wxString _prompt;
wxString _wildcard;
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;
}
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 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;
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 = " ";
}
- widget->SetPath (std_to_wx (value.string()));
+ widget->set_path(value);
}
}