From 13d924ad844ca6b642880910e21c5e322dbc4408 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 25 Sep 2013 00:00:33 +0100 Subject: [PATCH] Allow mail server / KDM from email configuration. --- src/lib/config.cc | 6 ++++++ src/lib/config.h | 18 ++++++++++++++++++ src/wx/config_dialog.cc | 26 ++++++++++++++++++++++++++ src/wx/config_dialog.h | 4 ++++ 4 files changed, 54 insertions(+) diff --git a/src/lib/config.cc b/src/lib/config.cc index 9d2d9d1bf..3a3a87faa 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -139,6 +139,9 @@ Config::read () cinema->read_screens (*i); _cinemas.push_back (cinema); } + + _mail_server = f.string_child ("MailServer"); + _kdm_from = f.string_child ("KDMFrom"); } void @@ -295,6 +298,9 @@ Config::write () const (*i)->as_xml (root->add_child ("Cinema")); } + root->add_child("MailServer")->add_child_text (_mail_server); + root->add_child("KDMFrom")->add_child_text (_kdm_from); + doc.write_to_file_formatted (file(false).string ()); } diff --git a/src/lib/config.h b/src/lib/config.h index 3e8a975d6..8dcb513a5 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -134,6 +134,14 @@ public: return _colour_conversions; } + std::string mail_server () const { + return _mail_server; + } + + std::string kdm_from () const { + return _kdm_from; + } + /** @param n New number of local encoding threads */ void set_num_local_encoding_threads (int n) { _num_local_encoding_threads = n; @@ -228,6 +236,14 @@ public: void set_colour_conversions (std::vector const & c) { _colour_conversions = c; } + + void set_mail_server (std::string s) { + _mail_server = s; + } + + void set_kdm_from (std::string f) { + _kdm_from = f; + } void write () const; @@ -276,6 +292,8 @@ private: int _default_j2k_bandwidth; std::vector _colour_conversions; std::list > _cinemas; + std::string _mail_server; + std::string _kdm_from; /** Singleton instance, or 0 */ static Config* _instance; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index dba83804e..65cc39f24 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -112,6 +112,14 @@ ConfigDialog::make_misc_panel () _num_local_encoding_threads = new wxSpinCtrl (_misc_panel); table->Add (_num_local_encoding_threads, 1); + add_label_to_sizer (table, _misc_panel, _("Outgoing mail server"), true); + _mail_server = new wxTextCtrl (_misc_panel, wxID_ANY); + table->Add (_mail_server, 1, wxEXPAND | wxALL); + + add_label_to_sizer (table, _misc_panel, _("From address for KDM emails"), true); + _kdm_from = new wxTextCtrl (_misc_panel, wxID_ANY); + table->Add (_kdm_from, 1, wxEXPAND | wxALL); + { add_label_to_sizer (table, _misc_panel, _("Default duration of still images"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -175,6 +183,11 @@ ConfigDialog::make_misc_panel () _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ()); _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::num_local_encoding_threads_changed, this)); + _mail_server->SetValue (std_to_wx (config->mail_server ())); + _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_server_changed, this)); + _kdm_from->SetValue (std_to_wx (config->kdm_from ())); + _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::kdm_from_changed, this)); + _default_still_length->SetRange (1, 3600); _default_still_length->SetValue (config->default_still_length ()); _default_still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::default_still_length_changed, this)); @@ -452,3 +465,16 @@ ConfigDialog::make_colour_conversions_panel () boost::bind (&colour_conversion_column, _1) ); } + +void +ConfigDialog::mail_server_changed () +{ + Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ())); +} + + +void +ConfigDialog::kdm_from_changed () +{ + Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ())); +} diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 82c4ee2a0..3df7a6a26 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -59,6 +59,8 @@ private: void issuer_changed (); void creator_changed (); void default_j2k_bandwidth_changed (); + void mail_server_changed (); + void kdm_from_changed (); void setup_language_sensitivity (); @@ -83,6 +85,8 @@ private: wxTextCtrl* _tms_user; wxTextCtrl* _tms_password; wxSpinCtrl* _num_local_encoding_threads; + wxTextCtrl* _mail_server; + wxTextCtrl* _kdm_from; wxSpinCtrl* _default_still_length; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER DirPickerCtrl* _default_directory; -- 2.30.2