Return std::string rather than wxString from Choice::get_data().
authorCarl Hetherington <cth@carlh.net>
Tue, 6 May 2025 15:52:51 +0000 (17:52 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 7 May 2025 23:29:35 +0000 (01:29 +0200)
src/wx/dcp_panel.cc
src/wx/dcpomatic_choice.cc
src/wx/dcpomatic_choice.h
src/wx/metadata_dialog.cc
src/wx/text_panel.cc

index 8c5b4ec7e32882fbbb33bf0ce89315ef3cefb205..2341bf043d97b3159c57a63eef158eb3d98b0b41 100644 (file)
@@ -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);
        }
index c458296f6ede242b773f82f8af92f86b7449d84a..5b3b9fb48b751ed5865b1ead0891e76604104faa 100644 (file)
@@ -141,15 +141,16 @@ Choice::get() const
 }
 
 
-optional<wxString>
+optional<string>
 Choice::get_data() const
 {
+
        auto index = get();
        if (!index) {
                return {};
        }
 
-       return dynamic_cast<wxStringClientData*>(GetClientObject(*index))->GetData();
+       return wx_to_std(dynamic_cast<wxStringClientData*>(GetClientObject(*index))->GetData());
 }
 
 
index fde6a8cbbe462931ef0e62f4aec7048e1a3b7758..84ff45fcf10559d0e02c936e6d01121656c56c76 100644 (file)
@@ -46,7 +46,7 @@ public:
        void set_by_data(wxString const& data);
        void set_by_data(std::string const& data);
        boost::optional<int> get() const;
-       boost::optional<wxString> get_data() const;
+       boost::optional<std::string> get_data() const;
 
        template <typename... Args>
        void bind(Args... args) {
index 70f6e8c398fb1046250b4c102af3583f0146149c..22d43a46ef1737add687d76ee0306ea8e7f7a7db 100644 (file)
@@ -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));
        }
 }
 
index f2055a542fedba83045c2f431b3052b6e6417655..7e4ccf5d7e11aed726601c96d5e814c766ca122f 100644 (file)
@@ -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);
                }
        }