/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
)
, _check_for_updates (false)
, _check_for_test_updates (false)
+ , _maximum_j2k_bandwidth (250000000)
{
_allowed_dcp_frame_rates.push_back (24);
_allowed_dcp_frame_rates.push_back (25);
_check_for_updates = f.optional_bool_child("CheckForUpdates").get_value_or (false);
_check_for_test_updates = f.optional_bool_child("CheckForTestUpdates").get_value_or (false);
+
+ _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
}
void
root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
root->add_child("CheckForTestUpdates")->add_child_text (_check_for_test_updates ? "1" : "0");
+ root->add_child("MaximumJ2KBandwidth")->add_child_text (lexical_cast<string> (_maximum_j2k_bandwidth));
+
doc.write_to_file_formatted (file(false).string ());
}
delete _instance;
_instance = 0;
}
+
+void
+Config::changed ()
+{
+ write ();
+ Changed ();
+}
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
void set_use_any_servers (bool u) {
_use_any_servers = u;
- write ();
+ changed ();
}
bool use_any_servers () const {
/** @param s New list of servers */
void set_servers (std::vector<std::string> s) {
_servers = s;
- write ();
+ changed ();
}
/** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
return _tms_ip;
}
- /** @return The path on a TMS that we should write DCPs to */
+ /** @return The path on a TMS that we should changed DCPs to */
std::string tms_path () const {
return _tms_path;
}
bool check_for_test_updates () const {
return _check_for_test_updates;
}
+
+ int maximum_j2k_bandwidth () const {
+ return _maximum_j2k_bandwidth;
+ }
/** @param n New number of local encoding threads */
void set_num_local_encoding_threads (int n) {
_num_local_encoding_threads = n;
- write ();
+ changed ();
}
void set_default_directory (boost::filesystem::path d) {
_default_directory = d;
- write ();
+ changed ();
}
/** @param p New server port */
void set_server_port_base (int p) {
_server_port_base = p;
- write ();
+ changed ();
}
/** @param i IP address of a TMS that we can copy DCPs to */
void set_tms_ip (std::string i) {
_tms_ip = i;
- write ();
+ changed ();
}
- /** @param p Path on a TMS that we should write DCPs to */
+ /** @param p Path on a TMS that we should changed DCPs to */
void set_tms_path (std::string p) {
_tms_path = p;
- write ();
+ changed ();
}
/** @param u User name to log into the TMS with */
void set_tms_user (std::string u) {
_tms_user = u;
- write ();
+ changed ();
}
/** @param p Password to log into the TMS with */
void set_tms_password (std::string p) {
_tms_password = p;
- write ();
+ changed ();
}
void add_cinema (boost::shared_ptr<Cinema> c) {
_cinemas.push_back (c);
+ changed ();
}
void remove_cinema (boost::shared_ptr<Cinema> c) {
_cinemas.remove (c);
+ changed ();
}
void set_allowed_dcp_frame_rates (std::list<int> const & r) {
_allowed_dcp_frame_rates = r;
- write ();
+ changed ();
}
void set_default_dci_metadata (DCIMetadata d) {
_default_dci_metadata = d;
- write ();
+ changed ();
}
void set_language (std::string l) {
_language = l;
- write ();
+ changed ();
}
void unset_language () {
_language = boost::none;
- write ();
+ changed ();
}
void set_default_still_length (int s) {
_default_still_length = s;
- write ();
+ changed ();
}
void set_default_container (Ratio const * c) {
_default_container = c;
- write ();
+ changed ();
}
void set_default_dcp_content_type (DCPContentType const * t) {
_default_dcp_content_type = t;
- write ();
+ changed ();
}
void set_dcp_metadata (libdcp::XMLMetadata m) {
_dcp_metadata = m;
- write ();
+ changed ();
}
void set_default_j2k_bandwidth (int b) {
_default_j2k_bandwidth = b;
- write ();
+ changed ();
}
void set_default_audio_delay (int d) {
_default_audio_delay = d;
- write ();
+ changed ();
}
void set_colour_conversions (std::vector<PresetColourConversion> const & c) {
_colour_conversions = c;
- write ();
+ changed ();
}
void set_mail_server (std::string s) {
_mail_server = s;
- write ();
+ changed ();
}
void set_mail_user (std::string u) {
_mail_user = u;
- write ();
+ changed ();
}
void set_mail_password (std::string p) {
_mail_password = p;
- write ();
+ changed ();
}
void set_kdm_from (std::string f) {
_kdm_from = f;
- write ();
+ changed ();
}
void set_kdm_email (std::string e) {
_kdm_email = e;
- write ();
+ changed ();
}
void set_check_for_updates (bool c) {
_check_for_updates = c;
- write ();
+ changed ();
}
void set_check_for_test_updates (bool c) {
_check_for_test_updates = c;
- write ();
+ changed ();
}
-
- void write () const;
+ void set_maximum_j2k_bandwidth (int b) {
+ _maximum_j2k_bandwidth = b;
+ changed ();
+ }
+
boost::filesystem::path signer_chain_directory () const;
+ void changed ();
+ boost::signals2::signal<void ()> Changed;
+
static Config* instance ();
static void drop ();
boost::filesystem::path file (bool) const;
void read ();
void read_old_metadata ();
+ void write () const;
/** number of threads to use for J2K encoding on the local machine */
int _num_local_encoding_threads;
/** true to check for updates on startup */
bool _check_for_updates;
bool _check_for_test_updates;
+ /** maximum allowed J2K bandwidth in bits per second */
+ int _maximum_j2k_bandwidth;
/** Singleton instance, or 0 */
static Config* _instance;
add_label_to_sizer (table, panel, _("Threads to use for encoding on this host"), true);
_num_local_encoding_threads = new wxSpinCtrl (panel);
table->Add (_num_local_encoding_threads, 1);
+
+ add_label_to_sizer (table, panel, _("Maximum JPEG2000 bandwidth"), true);
+ _maximum_j2k_bandwidth = new wxSpinCtrl (panel);
+ table->Add (_maximum_j2k_bandwidth, 1);
add_label_to_sizer (table, panel, _("Outgoing mail server"), true);
_mail_server = new wxTextCtrl (panel, wxID_ANY);
_num_local_encoding_threads->SetRange (1, 128);
_num_local_encoding_threads->SetValue (config->num_local_encoding_threads ());
_num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this));
+
+ _maximum_j2k_bandwidth->SetRange (1, 500);
+ _maximum_j2k_bandwidth->SetValue (config->maximum_j2k_bandwidth() / 1000000);
+ _maximum_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::maximum_j2k_bandwidth_changed, this));
_mail_server->SetValue (std_to_wx (config->mail_server ()));
_mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_server_changed, this));
{
Config::instance()->set_num_local_encoding_threads (_num_local_encoding_threads->GetValue ());
}
+
+ void maximum_j2k_bandwidth_changed ()
+ {
+ Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000);
+ }
wxCheckBox* _set_language;
wxChoice* _language;
wxSpinCtrl* _num_local_encoding_threads;
+ wxSpinCtrl* _maximum_j2k_bandwidth;
wxTextCtrl* _mail_server;
wxTextCtrl* _mail_user;
wxTextCtrl* _mail_password;
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
JobManager::instance()->ActiveJobsChanged.connect (
bind (&FilmEditor::active_jobs_changed, this, _1)
);
+
+ Config::instance()->Changed.connect (boost::bind (&FilmEditor::config_changed, this));
SetSizerAndFit (s);
}
}
_audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
- _j2k_bandwidth->SetRange (1, 250);
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
_resolution->Append (_("2K"));
_resolution->Append (_("4K"));
_content->InsertColumn (0, wxT(""));
_content->SetColumnWidth (0, 512);
+#ifdef DCPOMATIC_OSX
+ int const pad = 2;
+#else
+ int const pad = 0;
+#endif
+
wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
_content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
- b->Add (_content_add_file, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_add_file, 1, wxEXPAND | wxALL, pad);
_content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
- b->Add (_content_add_folder, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_add_folder, 1, wxEXPAND | wxALL, pad);
_content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
- b->Add (_content_remove, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_remove, 1, wxEXPAND | wxALL, pad);
_content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
- b->Add (_content_earlier, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_earlier, 1, wxEXPAND | wxALL, pad);
_content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
- b->Add (_content_later, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_later, 1, wxEXPAND | wxALL, pad);
_content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
- b->Add (_content_timeline, 1, wxEXPAND | wxALL, 2);
+ b->Add (_content_timeline, 1, wxEXPAND | wxALL, pad);
s->Add (b, 0, wxALL, 4);
content_selection_changed ();
}
}
+
+void
+FilmEditor::config_changed ()
+{
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+}
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
void setup_content_sensitivity ();
void active_jobs_changed (bool);
+ void config_changed ();
FilmEditorPanel* _video_panel;
FilmEditorPanel* _audio_panel;
Config::instance()->add_cinema (c);
add_cinema (c);
- Config::instance()->write ();
-
d->Destroy ();
}
c.second->email = d->email ();
_targets->SetItemText (c.first, std_to_wx (d->name()));
- Config::instance()->write ();
+ Config::instance()->changed ();
d->Destroy ();
}
Config::instance()->remove_cinema (c.second);
_targets->Delete (c.first);
-
- Config::instance()->write ();
}
void
c->add_screen (s);
add_screen (c, s);
- Config::instance()->write ();
+ Config::instance()->changed ();
d->Destroy ();
}
s.second->certificate = d->certificate ();
_targets->SetItemText (s.first, std_to_wx (d->name()));
- Config::instance()->write ();
+ Config::instance()->changed ();
d->Destroy ();
}
i->second->remove_screen (s.second);
_targets->Delete (s.first);
- Config::instance()->write ();
+ Config::instance()->changed ();
}
list<shared_ptr<Screen> >