Display the rating agency name rather than the URL (if we have it).
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Aug 2022 20:56:34 +0000 (22:56 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Aug 2022 20:56:43 +0000 (22:56 +0200)
src/wx/metadata_dialog.cc
src/wx/metadata_dialog.h

index 0028b0cbb91173bf3ebfd2e92816dc0bf34efb09..b1c58a27e96616b0c4a92a80046a7e96263bc494 100644 (file)
@@ -45,7 +45,9 @@ MetadataDialog::MetadataDialog (wxWindow* parent, weak_ptr<Film> weak_film)
        : wxDialog (parent, wxID_ANY, _("Metadata"))
        , WeakFilm (weak_film)
 {
-
+       for (auto system: dcp::rating_systems()) {
+               _rating_system_agency_to_name[system.agency] = system.name;
+       }
 }
 
 
@@ -195,8 +197,12 @@ MetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
                columns,
                boost::bind(&MetadataDialog::ratings, this),
                boost::bind(&MetadataDialog::set_ratings, this, _1),
-               [](dcp::Rating r, int c) {
+               [this](dcp::Rating r, int c) {
                        if (c == 0) {
+                               auto iter = _rating_system_agency_to_name.find(r.agency);
+                               if (iter != _rating_system_agency_to_name.end()) {
+                                       return iter->second;
+                               }
                                return r.agency;
                        }
                        return r.label;
index 591ef3db44b3d0db62f814d8019fd326ec9f0623..ea7233cbb1f3b12bfd6086abc78ce3dde33fc493 100644 (file)
@@ -31,6 +31,7 @@
 LIBDCP_DISABLE_WARNINGS
 #include <wx/wx.h>
 LIBDCP_ENABLE_WARNINGS
+#include <unordered_map>
 
 
 class Button;
@@ -53,6 +54,7 @@ protected:
        virtual void setup_sensitivity ();
 
        EditableList<dcp::Rating, RatingDialog>* _ratings;
+       std::unordered_map<std::string, std::string> _rating_system_agency_to_name;
 
 private:
        void sign_language_video_language_changed ();