2 Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "monitor_dialog.h"
23 #include "lib/encode_server.h"
24 #include <dcp/locale_convert.h>
27 using dcp::locale_convert;
28 using boost::shared_ptr;
29 using boost::optional;
31 MonitorDialog::MonitorDialog (wxWindow* parent)
32 : TableDialog (parent, _("Device"), 2, 1, true)
34 add (_("Manufacturer ID"), true);
35 _manufacturer_id = add (new wxTextCtrl(this, wxID_ANY, wxT("")));
36 add (_("Manufacturer product code"), true);
37 _manufacturer_product_code = add (new wxTextCtrl(this, wxID_ANY, wxT("")));
38 add (_("Serial number"), true);
39 _serial_number = add (new wxTextCtrl(this, wxID_ANY, wxT("")));
40 add (_("Week of manufacture"), true);
41 _week_of_manufacture = add (new wxTextCtrl(this, wxID_ANY, wxT("")));
42 add (_("Year of manufacture"), true);
43 _year_of_manufacture = add (new wxTextCtrl(this, wxID_ANY, wxT("")));
47 _manufacturer_id->SetFocus ();
51 MonitorDialog::set (Monitor monitor)
53 _manufacturer_id->SetValue (std_to_wx(monitor.manufacturer_id));
54 _manufacturer_product_code->SetValue (std_to_wx(locale_convert<string>(monitor.manufacturer_product_code)));
55 _serial_number->SetValue (std_to_wx(locale_convert<string>(monitor.serial_number)));
56 _week_of_manufacture->SetValue (std_to_wx(locale_convert<string>(monitor.week_of_manufacture)));
57 _year_of_manufacture->SetValue (std_to_wx(locale_convert<string>(monitor.year_of_manufacture)));
61 MonitorDialog::get () const
64 m.manufacturer_id = wx_to_std (_manufacturer_id->GetValue());
65 m.manufacturer_product_code = locale_convert<uint16_t>(wx_to_std(_manufacturer_product_code->GetValue()));
66 m.serial_number = locale_convert<uint32_t>(wx_to_std(_serial_number->GetValue()));
67 m.week_of_manufacture = locale_convert<uint8_t>(wx_to_std(_week_of_manufacture->GetValue()));
68 m.year_of_manufacture = locale_convert<uint8_t>(wx_to_std (_year_of_manufacture->GetValue()));