#include "screen.h"
#include <libxml++/libxml++.h>
+#include <boost/foreach.hpp>
Screen::Screen (cxml::ConstNodePtr node)
: name (node->string_child ("Name"))
} else if (node->optional_string_child ("Recipient")) {
recipient = dcp::Certificate (node->string_child ("Recipient"));
}
+
+ BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children ("TrustedDevice")) {
+ trusted_devices.push_back (dcp::Certificate (i->content ()));
+ }
}
void
if (recipient) {
parent->add_child("Recipient")->add_child_text (recipient->certificate (true));
}
+
+ BOOST_FOREACH (dcp::Certificate const & i, trusted_devices) {
+ parent->add_child("TrustedDevice")->add_child_text (i.certificate (true));
+ }
}
class Screen
{
public:
- Screen (std::string const & n, boost::optional<dcp::Certificate> rec)
+ Screen (std::string const & n, boost::optional<dcp::Certificate> rec, std::vector<dcp::Certificate> td)
: name (n)
, recipient (rec)
+ , trusted_devices (td)
{}
Screen (cxml::ConstNodePtr);
boost::shared_ptr<Cinema> cinema;
std::string name;
boost::optional<dcp::Certificate> recipient;
+ std::vector<dcp::Certificate> trusted_devices;
};
return c.thumbprint ();
}
-ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, optional<dcp::Certificate> recipient)
+ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, optional<dcp::Certificate> recipient, vector<dcp::Certificate> trusted_devices)
: wxDialog (parent, wxID_ANY, std_to_wx (title))
, _recipient (recipient)
+ , _trusted_devices (trusted_devices)
{
wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (overall_sizer);
class ScreenDialog : public wxDialog
{
public:
- ScreenDialog (wxWindow *, std::string, std::string name = "", boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate> ());
+ ScreenDialog (
+ wxWindow *,
+ std::string,
+ std::string name = "",
+ boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate> (),
+ std::vector<dcp::Certificate> d = std::vector<dcp::Certificate> ()
+ );
std::string name () const;
boost::optional<dcp::Certificate> recipient () const;
+ std::vector<dcp::Certificate> trusted_devices () {
+ return _trusted_devices;
+ }
private:
void get_recipient_from_file ();
void setup_sensitivity ();
void set_recipient (boost::optional<dcp::Certificate>);
- std::vector<dcp::Certificate> trusted_devices () {
- return _trusted_devices;
- }
-
void set_trusted_devices (std::vector<dcp::Certificate> d) {
_trusted_devices = d;
}
return;
}
- shared_ptr<Screen> s (new Screen (d->name(), d->recipient()));
+ shared_ptr<Screen> s (new Screen (d->name(), d->recipient(), d->trusted_devices()));
c->add_screen (s);
add_screen (c, s);
pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
- ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->recipient);
+ ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->recipient, s.second->trusted_devices);
if (d->ShowModal () == wxID_OK) {
s.second->name = d->name ();
s.second->recipient = d->recipient ();
+ s.second->trusted_devices = d->trusted_devices ();
_targets->SetItemText (s.first, std_to_wx (d->name()));
Config::instance()->changed ();
}