summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-06 18:00:53 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-06 18:00:53 +0000
commit7125d8ec2217ae874ce452602465f630f674e786 (patch)
treecb70ee80dbf446a797832ecc2ab2ffa542b00596 /src
parent59602b67d0637817a156b7bd0fc05f96fe41dee5 (diff)
Remove configuration of servers.
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc17
-rw-r--r--src/lib/config.h15
-rw-r--r--src/lib/encoder.cc6
-rw-r--r--src/lib/server.cc30
-rw-r--r--src/lib/server.h6
-rw-r--r--src/lib/server_finder.cc7
-rw-r--r--src/lib/server_finder.h6
-rw-r--r--src/tools/dcpomatic_cli.cc3
-rw-r--r--src/wx/config_dialog.cc32
-rw-r--r--src/wx/config_dialog.h4
-rw-r--r--src/wx/server_dialog.cc78
-rw-r--r--src/wx/server_dialog.h36
-rw-r--r--src/wx/servers_list_dialog.h1
-rw-r--r--src/wx/wscript1
14 files changed, 15 insertions, 227 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 02feecce8..1a7c64405 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -102,11 +102,6 @@ Config::read ()
}
_server_port_base = b.get ();
- list<shared_ptr<cxml::Node> > servers = f.node_children ("Server");
- for (list<shared_ptr<cxml::Node> >::iterator i = servers.begin(); i != servers.end(); ++i) {
- _servers.push_back (ServerDescription (*i));
- }
-
_tms_ip = f.string_child ("TMSIP");
_tms_path = f.string_child ("TMSPath");
_tms_user = f.string_child ("TMSUser");
@@ -197,11 +192,6 @@ Config::read_old_metadata ()
_default_directory = v;
} else if (k == N_("server_port")) {
_server_port_base = atoi (v.c_str ());
- } else if (k == N_("server")) {
- optional<ServerDescription> server = ServerDescription::create_from_metadata (v);
- if (server) {
- _servers.push_back (server.get ());
- }
} else if (k == N_("tms_ip")) {
_tms_ip = v;
} else if (k == N_("tms_path")) {
@@ -293,11 +283,6 @@ Config::write () const
root->add_child("NumLocalEncodingThreads")->add_child_text (lexical_cast<string> (_num_local_encoding_threads));
root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ());
root->add_child("ServerPortBase")->add_child_text (lexical_cast<string> (_server_port_base));
-
- for (vector<ServerDescription>::const_iterator i = _servers.begin(); i != _servers.end(); ++i) {
- i->as_xml (root->add_child ("Server"));
- }
-
root->add_child("TMSIP")->add_child_text (_tms_ip);
root->add_child("TMSPath")->add_child_text (_tms_path);
root->add_child("TMSUser")->add_child_text (_tms_user);
@@ -334,9 +319,7 @@ Config::write () const
root->add_child("KDMFrom")->add_child_text (_kdm_from);
root->add_child("KDMEmail")->add_child_text (_kdm_email);
- std::cout << "dcpomatic: writing configuration to " << file(false).string() << "\n";
doc.write_to_file_formatted (file(false).string ());
- std::cout << "dcpomatic: wrote configuration to " << file(false).string() << "\n";
}
boost::filesystem::path
diff --git a/src/lib/config.h b/src/lib/config.h
index 07b3d6891..0dcfd3f58 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -31,9 +31,7 @@
#include <libdcp/metadata.h>
#include "dci_metadata.h"
#include "colour_conversion.h"
-#include "server.h"
-class ServerDescription;
class Scaler;
class Filter;
class SoundProcessor;
@@ -64,11 +62,6 @@ public:
return _server_port_base;
}
- /** @return J2K encoding servers to use */
- std::vector<ServerDescription> servers () const {
- return _servers;
- }
-
/** @return The IP address of a TMS that we can copy DCPs to */
std::string tms_ip () const {
return _tms_ip;
@@ -160,11 +153,6 @@ public:
_server_port_base = p;
}
- /** @param s New list of servers */
- void set_servers (std::vector<ServerDescription> s) {
- _servers = s;
- }
-
void set_reference_scaler (Scaler const * s) {
_reference_scaler = s;
}
@@ -274,9 +262,6 @@ private:
* this port and the one above it will be used.
*/
int _server_port_base;
-
- /** J2K encoding servers to use */
- std::vector<ServerDescription> _servers;
/** Scaler to use for the "A" part of A/B comparisons */
Scaler const * _reference_scaler;
/** Filters to use for the "A" part of A/B comparisons */
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index ccaeab18c..eb331551f 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -90,12 +90,6 @@ Encoder::process_begin ()
_threads.push_back (new boost::thread (boost::bind (&Encoder::encoder_thread, this, optional<ServerDescription> ())));
}
- vector<ServerDescription> servers = Config::instance()->servers ();
-
- for (vector<ServerDescription>::iterator i = servers.begin(); i != servers.end(); ++i) {
- add_worker_threads (*i);
- }
-
_writer.reset (new Writer (_film, _job));
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 2930e3c4b..1f3f61e42 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -59,36 +59,6 @@ using boost::optional;
using boost::lexical_cast;
using libdcp::Size;
-ServerDescription::ServerDescription (shared_ptr<const cxml::Node> node)
-{
- _host_name = node->string_child ("HostName");
- _threads = node->number_child<int> ("Threads");
-}
-
-void
-ServerDescription::as_xml (xmlpp::Node* root) const
-{
- root->add_child("HostName")->add_child_text (_host_name);
- root->add_child("Threads")->add_child_text (boost::lexical_cast<string> (_threads));
-}
-
-/** Create a server description from a string of metadata returned from as_metadata().
- * @param v Metadata.
- * @return ServerDescription, or 0.
- */
-optional<ServerDescription>
-ServerDescription::create_from_metadata (string v)
-{
- vector<string> b;
- split (b, v, is_any_of (" "));
-
- if (b.size() != 2) {
- return optional<ServerDescription> ();
- }
-
- return ServerDescription (b[0], atoi (b[1].c_str ()));
-}
-
Server::Server (shared_ptr<Log> log, bool verbose)
: _log (log)
, _verbose (verbose)
diff --git a/src/lib/server.h b/src/lib/server.h
index 9be47bd94..a9b4b1c1c 100644
--- a/src/lib/server.h
+++ b/src/lib/server.h
@@ -59,8 +59,6 @@ public:
, _threads (t)
{}
- ServerDescription (boost::shared_ptr<const cxml::Node>);
-
/* Default copy constructor is fine */
/** @return server's host name or IP address in string form */
@@ -81,10 +79,6 @@ public:
_threads = t;
}
- void as_xml (xmlpp::Node *) const;
-
- static boost::optional<ServerDescription> create_from_metadata (std::string);
-
private:
/** server's host name */
std::string _host_name;
diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc
index 56f52b7fc..941caf4d9 100644
--- a/src/lib/server_finder.cc
+++ b/src/lib/server_finder.cc
@@ -34,7 +34,8 @@ using boost::scoped_array;
ServerFinder* ServerFinder::_instance = 0;
ServerFinder::ServerFinder ()
- : _broadcast_thread (0)
+ : _disabled (false)
+ , _broadcast_thread (0)
, _listen_thread (0)
{
_broadcast_thread = new boost::thread (boost::bind (&ServerFinder::broadcast_thread, this));
@@ -103,6 +104,10 @@ ServerFinder::listen_thread ()
void
ServerFinder::connect (boost::function<void (ServerDescription)> fn)
{
+ if (_disabled) {
+ return;
+ }
+
boost::mutex::scoped_lock lm (_mutex);
/* Emit the current list of servers */
diff --git a/src/lib/server_finder.h b/src/lib/server_finder.h
index 04a7786cf..f964d4e1a 100644
--- a/src/lib/server_finder.h
+++ b/src/lib/server_finder.h
@@ -27,6 +27,10 @@ public:
static ServerFinder* instance ();
+ void disable () {
+ _disabled = true;
+ }
+
private:
ServerFinder ();
@@ -34,6 +38,8 @@ private:
void listen_thread ();
boost::signals2::signal<void (ServerDescription)> ServerFound;
+
+ bool _disabled;
/** Thread to periodically issue broadcasts to find encoding servers */
boost::thread* _broadcast_thread;
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc
index 51248fde7..1f3d47fe8 100644
--- a/src/tools/dcpomatic_cli.cc
+++ b/src/tools/dcpomatic_cli.cc
@@ -32,6 +32,7 @@
#include "lib/config.h"
#include "lib/log.h"
#include "lib/ui_signaller.h"
+#include "lib/server_finder.h"
using std::string;
using std::cerr;
@@ -118,7 +119,7 @@ main (int argc, char* argv[])
ui_signaller = new UISignaller ();
if (no_remote) {
- Config::instance()->set_servers (vector<ServerDescription> ());
+ ServerFinder::instance()->disable ();
}
cout << "DCP-o-matic " << dcpomatic_version << " git " << dcpomatic_git_commit;
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 5479c22ce..0428f302f 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -28,7 +28,6 @@
#include <wx/notebook.h>
#include <libdcp/colour_matrix.h>
#include "lib/config.h"
-#include "lib/server.h"
#include "lib/ratio.h"
#include "lib/scaler.h"
#include "lib/filter.h"
@@ -37,7 +36,6 @@
#include "config_dialog.h"
#include "wx_util.h"
#include "filter_dialog.h"
-#include "server_dialog.h"
#include "dir_picker_ctrl.h"
#include "dci_metadata_dialog.h"
#include "preset_colour_conversion_dialog.h"
@@ -58,8 +56,6 @@ 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 ();
@@ -294,34 +290,6 @@ ConfigDialog::make_metadata_panel ()
_creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::creator_changed, this));
}
-static std::string
-server_column (ServerDescription s, int c)
-{
- switch (c) {
- case 0:
- return s.host_name ();
- case 1:
- return lexical_cast<string> (s.threads ());
- }
-
- return "";
-}
-
-void
-ConfigDialog::make_servers_panel ()
-{
- vector<string> columns;
- columns.push_back (wx_to_std (_("IP address")));
- columns.push_back (wx_to_std (_("Threads")));
- _servers_panel = new EditableList<ServerDescription, ServerDialog> (
- _notebook,
- columns,
- boost::bind (&Config::servers, Config::instance()),
- boost::bind (&Config::set_servers, Config::instance(), _1),
- boost::bind (&server_column, _1, _2)
- );
-}
-
void
ConfigDialog::language_changed ()
{
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index b1a59e8b9..2492f4899 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -30,10 +30,8 @@
class DirPickerCtrl;
class wxNotebook;
-class ServerDescription;
class PresetColourConversion;
class PresetColourConversionDialog;
-class ServerDialog;
/** @class ConfigDialog
* @brief A dialogue to edit DCP-o-matic configuration.
@@ -68,7 +66,6 @@ private:
void make_misc_panel ();
void make_tms_panel ();
void make_metadata_panel ();
- void make_servers_panel ();
void make_colour_conversions_panel ();
void make_kdm_email_panel ();
@@ -76,7 +73,6 @@ private:
wxPanel* _misc_panel;
wxPanel* _tms_panel;
EditableList<PresetColourConversion, PresetColourConversionDialog>* _colour_conversions_panel;
- EditableList<ServerDescription, ServerDialog>* _servers_panel;
wxPanel* _metadata_panel;
wxCheckBox* _set_language;
wxChoice* _language;
diff --git a/src/wx/server_dialog.cc b/src/wx/server_dialog.cc
deleted file mode 100644
index c1dbc4bca..000000000
--- a/src/wx/server_dialog.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- 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 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);
-
- add_label_to_sizer (table, this, _("Threads to use"), true);
- _threads = new wxSpinCtrl (this, wxID_ANY);
- table->Add (_threads, 1, wxEXPAND);
-
- _threads->SetRange (0, 256);
-
- 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 (ServerDescription server)
-{
- _host->SetValue (std_to_wx (server.host_name ()));
- _threads->SetValue (server.threads ());
-}
-
-ServerDescription
-ServerDialog::get () const
-{
- ServerDescription server;
- server.set_host_name (wx_to_std (_host->GetValue ()));
- server.set_threads (_threads->GetValue ());
- return server;
-}
-
diff --git a/src/wx/server_dialog.h b/src/wx/server_dialog.h
deleted file mode 100644
index a6f48fe7b..000000000
--- a/src/wx/server_dialog.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- 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>
-#include <wx/spinctrl.h>
-
-class ServerDescription;
-
-class ServerDialog : public wxDialog
-{
-public:
- ServerDialog (wxWindow *);
-
- void set (ServerDescription);
- ServerDescription get () const;
-
-private:
- wxTextCtrl* _host;
- wxSpinCtrl* _threads;
-};
diff --git a/src/wx/servers_list_dialog.h b/src/wx/servers_list_dialog.h
index 63f1cd6a9..27a3c55cb 100644
--- a/src/wx/servers_list_dialog.h
+++ b/src/wx/servers_list_dialog.h
@@ -19,6 +19,7 @@
#include <wx/wx.h>
#include <wx/listctrl.h>
+#include "lib/server.h"
class ServersListDialog : public wxDialog
{
diff --git a/src/wx/wscript b/src/wx/wscript
index c86188c6a..85bb697ab 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -30,7 +30,6 @@ sources = """
properties_dialog.cc
repeat_dialog.cc
screen_dialog.cc
- server_dialog.cc
servers_list_dialog.cc
subtitle_panel.cc
timecode.cc