summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-14 11:39:10 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-14 11:39:10 +0000
commitf60d6f84708e2ff568089732cb9fbdbdc8cef3db (patch)
tree7cd71914258671bdd4ffedf974ad40faef15519c /src/wx
parent0eed8c6c205fe85fb1094d7a9b0a2f3d7eeeb698 (diff)
Add server configuration back in.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/config_dialog.cc41
-rw-r--r--src/wx/config_dialog.h6
-rw-r--r--src/wx/server_dialog.cc69
-rw-r--r--src/wx/server_dialog.h32
-rw-r--r--src/wx/wscript1
5 files changed, 149 insertions, 0 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 114f20aee..71a0f505f 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -39,6 +39,7 @@
#include "dir_picker_ctrl.h"
#include "dci_metadata_dialog.h"
#include "preset_colour_conversion_dialog.h"
+#include "server_dialog.h"
using std::vector;
using std::string;
@@ -56,6 +57,8 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
make_misc_panel ();
_notebook->AddPage (_misc_panel, _("Miscellaneous"), true);
+ make_servers_panel ();
+ _notebook->AddPage (_servers_panel, _("Encoding servers"), false);
make_colour_conversions_panel ();
_notebook->AddPage (_colour_conversions_panel, _("Colour conversions"), false);
make_metadata_panel ();
@@ -290,6 +293,44 @@ ConfigDialog::make_metadata_panel ()
_creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::creator_changed, this));
}
+static string
+server_column (string s)
+{
+ return s;
+}
+
+void
+ConfigDialog::make_servers_panel ()
+{
+ _servers_panel = new wxPanel (_notebook);
+ wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+ _servers_panel->SetSizer (s);
+
+ _use_any_servers = new wxCheckBox (_servers_panel, wxID_ANY, _("Use all servers"));
+ s->Add (_use_any_servers, 0, wxALL, DCPOMATIC_SIZER_X_GAP);
+
+ vector<string> columns;
+ columns.push_back (wx_to_std (_("IP address / host name")));
+ _servers_list = new EditableList<std::string, ServerDialog> (
+ _servers_panel,
+ columns,
+ boost::bind (&Config::servers, Config::instance()),
+ boost::bind (&Config::set_servers, Config::instance(), _1),
+ boost::bind (&server_column, _1)
+ );
+
+ s->Add (_servers_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
+
+ _use_any_servers->SetValue (Config::instance()->use_any_servers ());
+ _use_any_servers->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::use_any_servers_changed, this));
+}
+
+void
+ConfigDialog::use_any_servers_changed ()
+{
+ Config::instance()->set_use_any_servers (_use_any_servers->GetValue ());
+}
+
void
ConfigDialog::language_changed ()
{
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index 2492f4899..3a196cce3 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -32,6 +32,7 @@ class DirPickerCtrl;
class wxNotebook;
class PresetColourConversion;
class PresetColourConversionDialog;
+class ServerDialog;
/** @class ConfigDialog
* @brief A dialogue to edit DCP-o-matic configuration.
@@ -60,10 +61,12 @@ private:
void mail_server_changed ();
void kdm_from_changed ();
void kdm_email_changed ();
+ void use_any_servers_changed ();
void setup_language_sensitivity ();
void make_misc_panel ();
+ void make_servers_panel ();
void make_tms_panel ();
void make_metadata_panel ();
void make_colour_conversions_panel ();
@@ -71,6 +74,7 @@ private:
wxNotebook* _notebook;
wxPanel* _misc_panel;
+ wxPanel* _servers_panel;
wxPanel* _tms_panel;
EditableList<PresetColourConversion, PresetColourConversionDialog>* _colour_conversions_panel;
wxPanel* _metadata_panel;
@@ -97,5 +101,7 @@ private:
wxSpinCtrl* _default_j2k_bandwidth;
wxPanel* _kdm_email_panel;
wxTextCtrl* _kdm_email;
+ wxCheckBox* _use_any_servers;
+ EditableList<std::string, ServerDialog>* _servers_list;
};
diff --git a/src/wx/server_dialog.cc b/src/wx/server_dialog.cc
new file mode 100644
index 000000000..04da9ad7d
--- /dev/null
+++ b/src/wx/server_dialog.cc
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2012 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "lib/server.h"
+#include "server_dialog.h"
+#include "wx_util.h"
+
+using std::string;
+using boost::shared_ptr;
+
+ServerDialog::ServerDialog (wxWindow* parent)
+ : wxDialog (parent, wxID_ANY, _("Server"))
+{
+ wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ table->AddGrowableCol (1, 1);
+
+ wxClientDC dc (parent);
+ /* XXX: bit of a mystery why we need such a long string here */
+ wxSize size = dc.GetTextExtent (wxT ("255.255.255.255.255.255.255.255"));
+ size.SetHeight (-1);
+
+ wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST);
+ wxArrayString list;
+
+ add_label_to_sizer (table, this, _("Host name or IP address"), true);
+ _host = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, size);
+ table->Add (_host, 1, wxEXPAND | wxALL);
+
+ wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+ overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+
+ wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+ if (buttons) {
+ overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+
+ SetSizer (overall_sizer);
+ overall_sizer->Layout ();
+ overall_sizer->SetSizeHints (this);
+}
+
+void
+ServerDialog::set (string server)
+{
+ _host->SetValue (std_to_wx (server));
+}
+
+string
+ServerDialog::get () const
+{
+ return wx_to_std (_host->GetValue ());
+}
+
diff --git a/src/wx/server_dialog.h b/src/wx/server_dialog.h
new file mode 100644
index 000000000..9d758d7c0
--- /dev/null
+++ b/src/wx/server_dialog.h
@@ -0,0 +1,32 @@
+/*
+ Copyright (C) 2012 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/wx.h>
+
+class ServerDialog : public wxDialog
+{
+public:
+ ServerDialog (wxWindow *);
+
+ void set (std::string);
+ std::string get () const;
+
+private:
+ wxTextCtrl* _host;
+};
diff --git a/src/wx/wscript b/src/wx/wscript
index 85bb697ab..c86188c6a 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -30,6 +30,7 @@ sources = """
properties_dialog.cc
repeat_dialog.cc
screen_dialog.cc
+ server_dialog.cc
servers_list_dialog.cc
subtitle_panel.cc
timecode.cc