Add free-text notes field to cinemas and screens.
authorCarl Hetherington <cth@carlh.net>
Wed, 27 Apr 2016 00:50:00 +0000 (01:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 29 Apr 2016 21:51:18 +0000 (22:51 +0100)
ChangeLog
src/lib/cinema.cc
src/lib/cinema.h
src/lib/screen.cc
src/lib/screen.h
src/wx/cinema_dialog.cc
src/wx/cinema_dialog.h
src/wx/screen_dialog.cc
src/wx/screen_dialog.h
src/wx/screens_panel.cc

index 75a3e19711116cc320d84b199bb4dda8cce549b0..b6a27637273f1f9b60064aa1ebe0571bb85fe765 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-04-27  Carl Hetherington  <cth@carlh.net>
 
+       * Add free-text notes field to cinemas and screens.
+
        * Request confirmation before resetting preferences (#867).
 
 2016-04-29  Carl Hetherington  <cth@carlh.net>
index e9a7dce6882e08f52722e7733ea05071d6b88443..6e651dc764d467d64f98424cb1ff5cb19301ffed 100644 (file)
@@ -32,6 +32,7 @@ using boost::shared_ptr;
 
 Cinema::Cinema (cxml::ConstNodePtr node)
        : name (node->string_child ("Name"))
+       , notes (node->optional_string_child("Notes").get_value_or(""))
 {
        BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Email")) {
                emails.push_back (i->content ());
@@ -67,6 +68,8 @@ Cinema::as_xml (xmlpp::Element* parent) const
                parent->add_child("Email")->add_child_text (i);
        }
 
+       parent->add_child("Notes")->add_child_text (notes);
+
        parent->add_child("UTCOffsetHour")->add_child_text (dcp::raw_convert<string> (_utc_offset_hour));
        parent->add_child("UTCOffsetMinute")->add_child_text (dcp::raw_convert<string> (_utc_offset_minute));
 
index 70508f23321d4a233e7bed4ffc8d62ef095d2eff..db0c7fac79a075142c7b9103b22af1b750e9a58b 100644 (file)
@@ -39,9 +39,10 @@ class Screen;
 class Cinema : public boost::enable_shared_from_this<Cinema>
 {
 public:
-       Cinema (std::string const & n, std::list<std::string> const & e, int utc_offset_hour, int utc_offset_minute)
-               : name (n)
+       Cinema (std::string const & name_, std::list<std::string> const & e, std::string notes_, int utc_offset_hour, int utc_offset_minute)
+               : name (name_)
                , emails (e)
+               , notes (notes_)
                , _utc_offset_hour (utc_offset_hour)
                , _utc_offset_minute (utc_offset_minute)
        {}
@@ -60,6 +61,7 @@ public:
 
        std::string name;
        std::list<std::string> emails;
+       std::string notes;
 
        int utc_offset_hour () const {
                return _utc_offset_hour;
index 159c4326bc5b08e7e4ad26af87cffd7f54391efe..96a59236d82a565612c384865fb26da628056efd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -22,7 +22,8 @@
 #include <boost/foreach.hpp>
 
 Screen::Screen (cxml::ConstNodePtr node)
-       : name (node->string_child ("Name"))
+       : name (node->string_child("Name"))
+       , notes (node->optional_string_child("Notes").get_value_or (""))
 {
        if (node->optional_string_child ("Certificate")) {
                recipient = dcp::Certificate (node->string_child ("Certificate"));
@@ -43,6 +44,8 @@ Screen::as_xml (xmlpp::Element* parent) const
                parent->add_child("Recipient")->add_child_text (recipient->certificate (true));
        }
 
+       parent->add_child("Notes")->add_child_text (notes);
+
        BOOST_FOREACH (dcp::Certificate const & i, trusted_devices) {
                parent->add_child("TrustedDevice")->add_child_text (i.certificate (true));
        }
index 0ae4835446187616a8f927387de244a6eb41ca8b..5b875b388baa60bd5d86b193e988073224010a06 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -45,6 +45,7 @@ public:
 
        boost::shared_ptr<Cinema> cinema;
        std::string name;
+       std::string notes;
        boost::optional<dcp::Certificate> recipient;
        std::vector<dcp::Certificate> trusted_devices;
 };
index df56b9cbee224cab31ed1d9a21fbb756cef97779..debc0679595653dc8ed72848119e23b760ddc171 100644 (file)
@@ -37,7 +37,7 @@ column (string s)
        return s;
 }
 
-CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<string> emails, int utc_offset_hour, int utc_offset_minute)
+CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<string> emails, string notes, int utc_offset_hour, int utc_offset_minute)
        : wxDialog (parent, wxID_ANY, title)
 {
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
@@ -56,6 +56,11 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<
        sizer->Add (_utc_offset, wxGBPosition (r, 1));
        ++r;
 
+       add_label_to_sizer (sizer, this, _("Notes"), true, wxGBPosition (r, 0));
+       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx (notes), wxDefaultPosition, wxSize (500, -1));
+       sizer->Add (_notes, wxGBPosition (r, 1));
+       ++r;
+
        add_label_to_sizer (sizer, this, _("Email addresses for KDM delivery"), false, wxGBPosition (r, 0), wxGBSpan (1, 2));
        ++r;
 
@@ -166,3 +171,9 @@ CinemaDialog::utc_offset_minute () const
 
        return _offsets[sel].minute;
 }
+
+string
+CinemaDialog::notes () const
+{
+       return wx_to_std (_notes->GetValue ());
+}
index 187bd11f22948a7ae08b2fa4d8010435b2d8e170..7323f78890ef900a531b918af9667e4124fe03fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -32,11 +32,13 @@ public:
                wxString,
                std::string name = "",
                std::list<std::string> emails = std::list<std::string> (),
+               std::string notes = "",
                int utc_offset_hour = 0,
                int utc_offset_minute = 0
                );
 
        std::string name () const;
+       std::string notes () const;
        std::list<std::string> emails () const;
        int utc_offset_hour () const;
        int utc_offset_minute () const;
@@ -46,6 +48,7 @@ private:
        void set_emails (std::vector<std::string>);
 
        wxTextCtrl* _name;
+       wxTextCtrl* _notes;
        EditableList<std::string, EmailDialog>* _email_list;
        std::vector<std::string> _emails;
        wxChoice* _utc_offset;
index ddedb71ecc351bdaae0697ce58eb3193fad201cd..5afb50a2a3a7bb5b61688a0606b183f9818390ae 100644 (file)
@@ -50,7 +50,9 @@ public:
        }
 };
 
-ScreenDialog::ScreenDialog (wxWindow* parent, wxString title, string name, optional<dcp::Certificate> recipient, vector<dcp::Certificate> trusted_devices)
+ScreenDialog::ScreenDialog (
+       wxWindow* parent, wxString title, string name, string notes, optional<dcp::Certificate> recipient, vector<dcp::Certificate> trusted_devices
+       )
        : wxDialog (parent, wxID_ANY, title)
        , _recipient (recipient)
        , _trusted_devices (trusted_devices)
@@ -66,6 +68,11 @@ ScreenDialog::ScreenDialog (wxWindow* parent, wxString title, string name, optio
        _sizer->Add (_name, wxGBPosition (r, 1));
        ++r;
 
+       add_label_to_sizer (_sizer, this, _("Notes"), true, wxGBPosition (r, 0));
+       _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx (notes), wxDefaultPosition, wxSize (320, -1));
+       _sizer->Add (_notes, wxGBPosition (r, 1));
+       ++r;
+
         wxClientDC dc (this);
        wxFont font = _name->GetFont ();
        font.SetFamily (wxFONTFAMILY_TELETYPE);
@@ -127,6 +134,12 @@ ScreenDialog::name () const
        return wx_to_std (_name->GetValue());
 }
 
+string
+ScreenDialog::notes () const
+{
+       return wx_to_std (_notes->GetValue());
+}
+
 optional<dcp::Certificate>
 ScreenDialog::recipient () const
 {
index 5b786f6c16bc14c560cf11d00500e98484836698..6740b35a3b8557d0058723803c6c514514930047 100644 (file)
@@ -33,11 +33,13 @@ public:
                wxWindow *,
                wxString,
                std::string name = "",
+               std::string notes = "",
                boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate> (),
                std::vector<dcp::Certificate> d = std::vector<dcp::Certificate> ()
                );
 
        std::string name () const;
+       std::string notes () const;
        boost::optional<dcp::Certificate> recipient () const;
        std::vector<dcp::Certificate> trusted_devices () {
                return _trusted_devices;
@@ -56,6 +58,7 @@ private:
 
        wxGridBagSizer* _sizer;
        wxTextCtrl* _name;
+       wxTextCtrl* _notes;
        wxStaticText* _recipient_thumbprint;
        wxButton* _get_recipient_from_file;
        wxButton* _download_recipient;
index 8eb8ba6707cda10a8ac184950f190b174da1ff8d..03c07e1c89728e22a4377c568edfca1c9c2a14c4 100644 (file)
@@ -148,7 +148,7 @@ ScreensPanel::add_cinema_clicked ()
 {
        CinemaDialog* d = new CinemaDialog (this, _("Add Cinema"));
        if (d->ShowModal () == wxID_OK) {
-               shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->utc_offset_hour(), d->utc_offset_minute()));
+               shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute()));
                Config::instance()->add_cinema (c);
                add_cinema (c);
        }
@@ -166,12 +166,13 @@ ScreensPanel::edit_cinema_clicked ()
        pair<wxTreeItemId, shared_ptr<Cinema> > c = *_selected_cinemas.begin();
 
        CinemaDialog* d = new CinemaDialog (
-               this, _("Edit cinema"), c.second->name, c.second->emails, c.second->utc_offset_hour(), c.second->utc_offset_minute()
+               this, _("Edit cinema"), c.second->name, c.second->emails, c.second->notes, c.second->utc_offset_hour(), c.second->utc_offset_minute()
                );
 
        if (d->ShowModal () == wxID_OK) {
                c.second->name = d->name ();
                c.second->emails = d->emails ();
+               c.second->notes = d->notes ();
                c.second->set_utc_offset_hour (d->utc_offset_hour ());
                c.second->set_utc_offset_minute (d->utc_offset_minute ());
                _targets->SetItemText (c.first, std_to_wx (d->name()));
@@ -227,9 +228,10 @@ ScreensPanel::edit_screen_clicked ()
 
        pair<wxTreeItemId, shared_ptr<Screen> > s = *_selected_screens.begin();
 
-       ScreenDialog* d = new ScreenDialog (this, _("Edit screen"), s.second->name, s.second->recipient, s.second->trusted_devices);
+       ScreenDialog* d = new ScreenDialog (this, _("Edit screen"), s.second->name, s.second->notes, s.second->recipient, s.second->trusted_devices);
        if (d->ShowModal () == wxID_OK) {
                s.second->name = d->name ();
+               s.second->notes = d->notes ();
                s.second->recipient = d->recipient ();
                s.second->trusted_devices = d->trusted_devices ();
                _targets->SetItemText (s.first, std_to_wx (d->name()));