From 71f9236b03ef8934d28d291f1d9f248137448e72 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 6 May 2025 17:52:51 +0200 Subject: Return std::string rather than wxString from Choice::get_data(). --- src/wx/dcp_panel.cc | 8 ++++---- src/wx/dcpomatic_choice.cc | 5 +++-- src/wx/dcpomatic_choice.h | 2 +- src/wx/metadata_dialog.cc | 5 ++--- src/wx/text_panel.cc | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 8c5b4ec7e..2341bf043 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -186,19 +186,19 @@ DCPPanel::standard_changed() return; } - if (*data == char_to_wx("interop")) { + if (*data == "interop") { _film->set_interop(true); _film->set_limit_to_smpte_bv20(false); _film->set_video_encoding(VideoEncoding::JPEG2000); - } else if (*data == char_to_wx("smpte")) { + } else if (*data == "smpte") { _film->set_interop(false); _film->set_limit_to_smpte_bv20(false); _film->set_video_encoding(VideoEncoding::JPEG2000); - } else if (*data == char_to_wx("smpte-bv20")) { + } else if (*data == "smpte-bv20") { _film->set_interop(false); _film->set_limit_to_smpte_bv20(true); _film->set_video_encoding(VideoEncoding::JPEG2000); - } else if (*data == char_to_wx("mpeg2-interop")) { + } else if (*data == "mpeg2-interop") { _film->set_interop(true); _film->set_video_encoding(VideoEncoding::MPEG2); } diff --git a/src/wx/dcpomatic_choice.cc b/src/wx/dcpomatic_choice.cc index c458296f6..5b3b9fb48 100644 --- a/src/wx/dcpomatic_choice.cc +++ b/src/wx/dcpomatic_choice.cc @@ -141,15 +141,16 @@ Choice::get() const } -optional +optional Choice::get_data() const { + auto index = get(); if (!index) { return {}; } - return dynamic_cast(GetClientObject(*index))->GetData(); + return wx_to_std(dynamic_cast(GetClientObject(*index))->GetData()); } diff --git a/src/wx/dcpomatic_choice.h b/src/wx/dcpomatic_choice.h index fde6a8cbb..84ff45fcf 100644 --- a/src/wx/dcpomatic_choice.h +++ b/src/wx/dcpomatic_choice.h @@ -46,7 +46,7 @@ public: void set_by_data(wxString const& data); void set_by_data(std::string const& data); boost::optional get() const; - boost::optional get_data() const; + boost::optional get_data() const; template void bind(Args... args) { diff --git a/src/wx/metadata_dialog.cc b/src/wx/metadata_dialog.cc index 70f6e8c39..22d43a46e 100644 --- a/src/wx/metadata_dialog.cc +++ b/src/wx/metadata_dialog.cc @@ -129,9 +129,8 @@ MetadataDialog::setup () void MetadataDialog::territory_type_changed() { - auto data = _territory_type->get_data(); - if (data) { - film()->set_territory_type(string_to_territory_type(wx_to_std(data->data()))); + if (auto data = _territory_type->get_data()) { + film()->set_territory_type(string_to_territory_type(*data)); } } diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index f2055a542..7e4ccf5d7 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -491,7 +491,7 @@ TextPanel::current_type () const { if (_type->size()) { if (auto type = _type->get_data()) { - return string_to_text_type(wx_to_std(*type)); + return string_to_text_type(*type); } } -- cgit v1.2.3