From: Carl Hetherington Date: Mon, 6 Jul 2015 19:42:12 +0000 (+0100) Subject: Merge branch '2.0' of ssh://git.carlh.net/home/carl/git/dcpomatic2 into 2.0 X-Git-Tag: v2.1.19~5 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=43877eccbedc0950ab253e76dd0cea691fd7a4b0;hp=-c;p=dcpomatic.git Merge branch '2.0' of ssh://git.carlh.net/home/carl/git/dcpomatic2 into 2.0 --- 43877eccbedc0950ab253e76dd0cea691fd7a4b0 diff --combined src/lib/config.cc index 657d79b71,16a3849b5..b5e87267a --- a/src/lib/config.cc +++ b/src/lib/config.cc @@@ -75,7 -75,6 +75,7 @@@ Config::set_defaults ( _default_dcp_content_type = DCPContentType::from_isdcf_name ("FTR"); _default_j2k_bandwidth = 100000000; _default_audio_delay = 0; + _mail_port = 25; _check_for_updates = false; _check_for_test_updates = false; _maximum_j2k_bandwidth = 250000000; @@@ -193,7 -192,6 +193,7 @@@ Config::read ( } _mail_server = f.string_child ("MailServer"); + _mail_port = f.optional_number_child ("MailPort").get_value_or (25); _mail_user = f.optional_string_child("MailUser").get_value_or (""); _mail_password = f.optional_string_child("MailPassword").get_value_or (""); _kdm_subject = f.optional_string_child ("KDMSubject").get_value_or (_("KDM delivery: $CPL_NAME")); @@@ -344,7 -342,6 +344,7 @@@ Config::write () cons } root->add_child("MailServer")->add_child_text (_mail_server); + root->add_child("MailPort")->add_child_text (raw_convert (_mail_port)); root->add_child("MailUser")->add_child_text (_mail_user); root->add_child("MailPassword")->add_child_text (_mail_password); root->add_child("KDMSubject")->add_child_text (_kdm_subject); @@@ -410,9 -407,9 +410,9 @@@ Config::drop ( } void - Config::changed () + Config::changed (Property what) { - Changed (); + Changed (what); } void diff --combined src/lib/config.h index a5fdc17c0,ad95bc344..312118a55 --- a/src/lib/config.h +++ b/src/lib/config.h @@@ -1,5 -1,5 +1,5 @@@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington 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 @@@ -59,6 -59,12 +59,12 @@@ public boost::filesystem::path default_directory_or (boost::filesystem::path a) const; + enum Property { + USE_ANY_SERVERS, + SERVERS, + OTHER + }; + /** @return base port number to use for J2K encoding servers */ int server_port_base () const { return _server_port_base; @@@ -66,7 -72,7 +72,7 @@@ void set_use_any_servers (bool u) { _use_any_servers = u; - changed (); + changed (USE_ANY_SERVERS); } bool use_any_servers () const { @@@ -76,7 -82,7 +82,7 @@@ /** @param s New list of servers */ void set_servers (std::vector s) { _servers = s; - changed (); + changed (SERVERS); } /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */ @@@ -157,10 -163,6 +163,10 @@@ return _mail_server; } + int mail_port () const { + return _mail_port; + } + std::string mail_user () const { return _mail_user; } @@@ -328,10 -330,6 +334,10 @@@ maybe_set (_mail_server, s); } + void set_mail_port (int p) { + maybe_set (_mail_port, p); + } + void set_mail_user (std::string u) { maybe_set (_mail_user, u); } @@@ -403,8 -401,8 +409,8 @@@ void add_to_history (boost::filesystem::path p); - void changed (); - boost::signals2::signal Changed; + void changed (Property p = OTHER); + boost::signals2::signal Changed; void write () const; @@@ -466,7 -464,6 +472,7 @@@ private int _default_audio_delay; std::list > _cinemas; std::string _mail_server; + int _mail_port; std::string _mail_user; std::string _mail_password; std::string _kdm_subject; diff --combined src/lib/kdm.cc index f9b21c525,dd20311af..0ded8f2c1 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@@ -254,8 -254,6 +254,6 @@@ email_kdms quickmail_add_bcc (mail, Config::instance()->kdm_bcc().c_str ()); } - quickmail_add_header (mail, "Content-Type: text/plain; charset=UTF-8"); - string body = Config::instance()->kdm_email().c_str(); boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ()); boost::algorithm::replace_all (body, "$START_TIME", start.str ()); @@@ -271,23 -269,19 +269,23 @@@ quickmail_set_body (mail, body.c_str()); quickmail_add_attachment_file (mail, zip_file.string().c_str(), "application/zip"); - int const port = Config::instance()->mail_user().empty() ? 25 : 587; - char const* error = quickmail_send ( mail, Config::instance()->mail_server().c_str(), - port, + Config::instance()->mail_port(), Config::instance()->mail_user().c_str(), Config::instance()->mail_password().c_str() ); if (error) { quickmail_destroy (mail); - throw KDMError (String::compose ("Failed to send KDM email (%1)", error)); + throw KDMError ( + String::compose ( + "Failed to send KDM email to %1 (%2)", + Config::instance()->mail_server(), + error + ) + ); } quickmail_destroy (mail); } diff --combined src/wx/config_dialog.cc index 53ed7c44b,96abe6d69..f744ca83f --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@@ -21,6 -21,23 +21,6 @@@ * @brief A dialogue to edit DCP-o-matic configuration. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "lib/config.h" -#include "lib/ratio.h" -#include "lib/filter.h" -#include "lib/dcp_content_type.h" -#include "lib/log.h" -#include "lib/util.h" -#include "lib/cross.h" -#include "lib/exceptions.h" #include "config_dialog.h" #include "wx_util.h" #include "editable_list.h" @@@ -29,24 -46,6 +29,24 @@@ #include "isdcf_metadata_dialog.h" #include "server_dialog.h" #include "make_signer_chain_dialog.h" +#include "lib/config.h" +#include "lib/ratio.h" +#include "lib/filter.h" +#include "lib/dcp_content_type.h" +#include "lib/log.h" +#include "lib/util.h" +#include "lib/raw_convert.h" +#include "lib/cross.h" +#include "lib/exceptions.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include using std::vector; using std::string; @@@ -162,6 -161,7 +162,7 @@@ private _language->Append (wxT ("Nederlands")); _language->Append (wxT ("Svenska")); _language->Append (wxT ("Русский")); + _language->Append (wxT ("Polski")); table->Add (_language); wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to see language changes)"), false); @@@ -213,6 -213,8 +214,8 @@@ _language->SetSelection (5); } else if (config->language().get_value_or ("") == "ru") { _language->SetSelection (7); + } else if (config->language().get_value_or ("") == "pl") { + checked_set (_language, 8); } else { _language->SetSelection (1); } @@@ -266,6 -268,9 +269,9 @@@ case 7: Config::instance()->set_language ("ru"); break; + case 8: + Config::instance()->set_language ("pl"); + break; } } @@@ -977,16 -982,8 +983,16 @@@ private _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); add_label_to_sizer (table, _panel, _("Outgoing mail server"), true); - _mail_server = new wxTextCtrl (_panel, wxID_ANY); - table->Add (_mail_server, 1, wxEXPAND | wxALL); + { + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _mail_server = new wxTextCtrl (_panel, wxID_ANY); + s->Add (_mail_server, 1, wxEXPAND | wxALL); + add_label_to_sizer (s, _panel, _("port"), false); + _mail_port = new wxSpinCtrl (_panel, wxID_ANY); + _mail_port->SetRange (0, 65535); + s->Add (_mail_port); + table->Add (s, 1, wxEXPAND | wxALL); + } add_label_to_sizer (table, _panel, _("Mail user name"), true); _mail_user = new wxTextCtrl (_panel, wxID_ANY); @@@ -996,6 -993,13 +1002,6 @@@ _mail_password = new wxTextCtrl (_panel, wxID_ANY); table->Add (_mail_password, 1, wxEXPAND | wxALL); - wxStaticText* plain = add_label_to_sizer (table, _panel, _("(password will be stored on disk in plaintext)"), false); - wxFont font = plain->GetFont(); - font.SetStyle (wxFONTSTYLE_ITALIC); - font.SetPointSize (font.GetPointSize() - 1); - plain->SetFont (font); - table->AddSpacer (0); - add_label_to_sizer (table, _panel, _("Subject"), true); _kdm_subject = new wxTextCtrl (_panel, wxID_ANY); table->Add (_kdm_subject, 1, wxEXPAND | wxALL); @@@ -1019,7 -1023,6 +1025,7 @@@ _panel->GetSizer()->Add (_reset_kdm_email, 0, wxEXPAND | wxALL, _border); _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_server_changed, this)); + _mail_port->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&KDMEmailPage::mail_port_changed, this)); _mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_user_changed, this)); _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_password_changed, this)); _kdm_subject->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_subject_changed, this)); @@@ -1035,7 -1038,6 +1041,7 @@@ Config* config = Config::instance (); checked_set (_mail_server, config->mail_server ()); + checked_set (_mail_port, config->mail_port ()); checked_set (_mail_user, config->mail_user ()); checked_set (_mail_password, config->mail_password ()); checked_set (_kdm_subject, config->kdm_subject ()); @@@ -1050,11 -1052,6 +1056,11 @@@ Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ())); } + void mail_port_changed () + { + Config::instance()->set_mail_port (_mail_port->GetValue ()); + } + void mail_user_changed () { Config::instance()->set_mail_user (wx_to_std (_mail_user->GetValue ())); @@@ -1103,7 -1100,6 +1109,7 @@@ } wxTextCtrl* _mail_server; + wxSpinCtrl* _mail_port; wxTextCtrl* _mail_user; wxTextCtrl* _mail_password; wxTextCtrl* _kdm_subject;