/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 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
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;
void set_use_any_servers (bool u) {
_use_any_servers = u;
- changed ();
+ changed (USE_ANY_SERVERS);
}
bool use_any_servers () const {
/** @param s New list of servers */
void set_servers (std::vector<std::string> s) {
_servers = s;
- changed ();
+ changed (SERVERS);
}
/** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
return _mail_server;
}
+ int mail_port () const {
+ return _mail_port;
+ }
+
std::string mail_user () const {
return _mail_user;
}
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);
}
void add_to_history (boost::filesystem::path p);
- void changed ();
- boost::signals2::signal<void ()> Changed;
+ void changed (Property p = OTHER);
+ boost::signals2::signal<void (Property)> Changed;
void write () const;
int _default_audio_delay;
std::list<boost::shared_ptr<Cinema> > _cinemas;
std::string _mail_server;
+ int _mail_port;
std::string _mail_user;
std::string _mail_password;
std::string _kdm_subject;
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 ());
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);
}
* @brief A dialogue to edit DCP-o-matic configuration.
*/
-#include <iostream>
-#include <boost/lexical_cast.hpp>
-#include <boost/filesystem.hpp>
-#include <wx/stdpaths.h>
-#include <wx/preferences.h>
-#include <wx/filepicker.h>
-#include <wx/spinctrl.h>
-#include <dcp/exceptions.h>
-#include <dcp/signer.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/cross.h"
-#include "lib/exceptions.h"
#include "config_dialog.h"
#include "wx_util.h"
#include "editable_list.h"
#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 <dcp/exceptions.h>
+#include <dcp/signer.h>
+#include <wx/stdpaths.h>
+#include <wx/preferences.h>
+#include <wx/filepicker.h>
+#include <wx/spinctrl.h>
+#include <boost/lexical_cast.hpp>
+#include <boost/filesystem.hpp>
+#include <iostream>
using std::vector;
using std::string;
_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);
_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);
}
case 7:
Config::instance()->set_language ("ru");
break;
+ case 8:
+ Config::instance()->set_language ("pl");
+ break;
}
}
_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);
_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);
_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));
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 ());
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 ()));
}
wxTextCtrl* _mail_server;
+ wxSpinCtrl* _mail_port;
wxTextCtrl* _mail_user;
wxTextCtrl* _mail_password;
wxTextCtrl* _kdm_subject;