#include "file_picker_ctrl.h"
#include "filter_dialog.h"
#include "full_config_dialog.h"
+#include "kdm_choice.h"
#include "make_chain_dialog.h"
#include "nag_dialog.h"
#include "name_format_editor.h"
#include "password_entry.h"
+#include "send_test_email_dialog.h"
#include "server_dialog.h"
#include "static_text.h"
#include "wx_util.h"
#include "lib/config.h"
#include "lib/cross.h"
#include "lib/dcp_content_type.h"
+#include "lib/emailer.h"
#include "lib/exceptions.h"
#include "lib/filter.h"
#include "lib/log.h"
#include <dcp/certificate_chain.h>
#include <dcp/exceptions.h>
#include <dcp/locale_convert.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
#include <wx/filepicker.h>
#include <wx/preferences.h>
#include <wx/spinctrl.h>
#include <wx/stdpaths.h>
+LIBDCP_ENABLE_WARNINGS
#include <RtAudio.h>
#include <boost/filesystem.hpp>
#include <iostream>
{}
private:
- void setup ()
+ void setup () override
{
auto table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
_automatic_audio_analysis->Bind (wxEVT_CHECKBOX, boost::bind (&FullGeneralPage::automatic_audio_analysis_changed, this));
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Defaults");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("defaults"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
#else
_kdm_directory = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST);
#endif
-
table->Add (_kdm_directory, 1, wxEXPAND);
+ add_label_to_sizer (table, _panel, _("Default KDM type"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _kdm_type = new KDMChoice (_panel);
+ table->Add (_kdm_type, 1, wxEXPAND);
+
+ table->Add (_use_isdcf_name_by_default = new CheckBox(_panel, _("Use ISDCF name by default")), 0, wxALIGN_CENTRE_VERTICAL);
+
_still_length->SetRange (1, 3600);
_still_length->Bind (wxEVT_SPINCTRL, boost::bind (&DefaultsPage::still_length_changed, this));
_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this));
_kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::kdm_directory_changed, this));
+ _kdm_type->Bind (wxEVT_CHOICE, boost::bind(&DefaultsPage::kdm_type_changed, this));
+
+ _use_isdcf_name_by_default->Bind (wxEVT_CHECKBOX, boost::bind(&DefaultsPage::use_isdcf_name_by_default_changed, this));
for (auto i: Ratio::containers()) {
_container->Append (std_to_wx(i->container_nickname()));
}
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
checked_set (_still_length, config->default_still_length ());
_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
_kdm_directory->SetPath (std_to_wx (config->default_kdm_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
+ _kdm_type->set (config->default_kdm_type());
+ checked_set (_use_isdcf_name_by_default, config->use_isdcf_name_by_default());
checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000);
_j2k_bandwidth->SetRange (50, config->maximum_j2k_bandwidth() / 1000000);
checked_set (_dcp_audio_channels, locale_convert<string> (config->default_dcp_audio_channels()));
Config::instance()->set_default_kdm_directory (wx_to_std (_kdm_directory->GetPath ()));
}
+ void kdm_type_changed ()
+ {
+ Config::instance()->set_default_kdm_type(_kdm_type->get());
+ }
+
+ void use_isdcf_name_by_default_changed ()
+ {
+ Config::instance()->set_use_isdcf_name_by_default (_use_isdcf_name_by_default->GetValue());
+ }
+
void still_length_changed ()
{
Config::instance()->set_default_still_length (_still_length->GetValue ());
wxDirPickerCtrl* _directory;
wxDirPickerCtrl* _kdm_directory;
#endif
+ KDMChoice* _kdm_type;
+ wxCheckBox* _use_isdcf_name_by_default;
wxChoice* _container;
wxChoice* _dcp_content_type;
wxChoice* _dcp_audio_channels;
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Servers");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("servers"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
_use_any_servers = new CheckBox (_panel, _("Search network for servers"));
_panel->GetSizer()->Add (_use_any_servers, 0, wxALL, _border);
_use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind(&EncodingServersPage::use_any_servers_changed, this));
}
- void config_changed ()
+ void config_changed () override
{
checked_set (_use_any_servers, Config::instance()->use_any_servers ());
_servers_list->refresh ();
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("TMS");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("tms"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
_upload = new CheckBox (_panel, _("Upload DCP to TMS after creation"));
_panel->GetSizer()->Add (_upload, 0, wxALL | wxEXPAND, _border);
_tms_password->Changed.connect (boost::bind (&TMSPage::tms_password_changed, this));
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Email");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("email"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_password = new PasswordEntry (_panel);
table->Add (_password->get_panel(), 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+ _send_test_email = new Button (_panel, _("Send test email..."));
+ table->Add (_send_test_email);
+
_server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this));
_port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this));
_protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this));
_user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this));
_password->Changed.connect (boost::bind(&EmailPage::password_changed, this));
+ _send_test_email->Bind (wxEVT_BUTTON, boost::bind(&EmailPage::send_test_email_clicked, this));
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
Config::instance()->set_mail_password(_password->get());
}
+ void send_test_email_clicked ()
+ {
+ auto dialog = new SendTestEmailDialog(_panel);
+ auto result = dialog->ShowModal();
+ dialog->Destroy();
+ if (result == wxID_OK) {
+ Emailer emailer(
+ wx_to_std(dialog->from()),
+ { wx_to_std(dialog->to()) },
+ wx_to_std(_("DCP-o-matic test email")),
+ wx_to_std(_("This is a test email from DCP-o-matic."))
+ );
+ auto config = Config::instance();
+ try {
+ emailer.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
+ } catch (NetworkError& e) {
+ error_dialog (_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or("")));
+ return;
+ } catch (std::exception& e) {
+ error_dialog (_panel, _("Test email sending failed."), std_to_wx(e.what()));
+ return;
+ } catch (...) {
+ error_dialog (_panel, _("Test email sending failed."));
+ return;
+ }
+ message_dialog (_panel, _("Test email sent."));
+ }
+ }
+
wxTextCtrl* _server;
wxSpinCtrl* _port;
wxChoice* _protocol;
wxTextCtrl* _user;
PasswordEntry* _password;
+ Button* _send_test_email;
};
#endif
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("KDM Email");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("kdm_email"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_reset_email->Bind (wxEVT_BUTTON, boost::bind (&KDMEmailPage::reset_email, this));
}
- void config_changed ()
+ void config_changed () override
{
- Config* config = Config::instance ();
+ auto config = Config::instance ();
checked_set (_subject, config->kdm_subject ());
checked_set (_from, config->kdm_from ());
#endif
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Notifications");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("notifications"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_reset_email->Enable(s);
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
#endif
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Cover Sheet");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("cover_sheet"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
_cover_sheet = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (-1, 200), wxTE_MULTILINE);
_panel->GetSizer()->Add (_cover_sheet, 0, wxEXPAND | wxALL, _border);
_reset_cover_sheet->Bind (wxEVT_BUTTON, boost::bind (&CoverSheetPage::reset_cover_sheet, this));
}
- void config_changed ()
+ void config_changed () override
{
checked_set (_cover_sheet, Config::instance()->cover_sheet());
}
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Identifiers");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("identifiers"), wxBITMAP_TYPE_PNG);
}
#endif
private:
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_j2k_comment->Bind (wxEVT_TEXT, boost::bind(&IdentifiersPage::j2k_comment_changed, this));
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();
checked_set (_issuer, config->dcp_issuer ());
: Page (panel_size, border)
{}
- wxString GetName () const
+ wxString GetName () const override
{
return _("Advanced");
}
#ifdef DCPOMATIC_OSX
- wxBitmap GetLargeIcon () const
+ wxBitmap GetLargeIcon () const override
{
return wxBitmap(bitmap_path("advanced"), wxBITMAP_TYPE_PNG);
}
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
- void setup ()
+ void setup () override
{
auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
#endif
}
- void config_changed ()
+ void config_changed () override
{
auto config = Config::instance ();