/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "make_chain_dialog.h"
#include "email_dialog.h"
#include "name_format_editor.h"
+#include "nag_dialog.h"
#include "lib/config.h"
#include "lib/ratio.h"
#include "lib/filter.h"
using boost::optional;
using dcp::locale_convert;
+static
+void
+do_nothing ()
+{
+
+}
+
class Page
{
public:
++r;
add_label_to_sizer (table, _panel, _("Cinema and screen database file"), true, wxGBPosition (r, 0));
- _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml");
+ _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml", true);
table->Add (_cinemas_file, wxGBPosition (r, 1));
++r;
_container = new wxChoice (_panel, wxID_ANY);
table->Add (_container);
+ add_label_to_sizer (table, _panel, _("Default scale-to"), true);
+ _scale_to = new wxChoice (_panel, wxID_ANY);
+ table->Add (_scale_to);
+
add_label_to_sizer (table, _panel, _("Default content type"), true);
_dcp_content_type = new wxChoice (_panel, wxID_ANY);
table->Add (_dcp_content_type);
_container->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::container_changed, this));
+ _scale_to->Append (_("Guess from content"));
+
+ for (size_t i = 0; i < ratios.size(); ++i) {
+ _scale_to->Append (std_to_wx (ratios[i]->nickname ()));
+ }
+
+ _scale_to->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::scale_to_changed, this));
+
vector<DCPContentType const *> const ct = DCPContentType::all ();
for (size_t i = 0; i < ct.size(); ++i) {
_dcp_content_type->Append (std_to_wx (ct[i]->pretty_name ()));
if (ratios[i] == config->default_container ()) {
_container->SetSelection (i);
}
+ if (ratios[i] == config->default_scale_to ()) {
+ _scale_to->SetSelection (i + 1);
+ }
+ }
+
+ if (!config->default_scale_to()) {
+ _scale_to->SetSelection (0);
}
vector<DCPContentType const *> const ct = DCPContentType::all ();
Config::instance()->set_default_container (ratio[_container->GetSelection()]);
}
+ void scale_to_changed ()
+ {
+ int const s = _scale_to->GetSelection ();
+ if (s == 0) {
+ Config::instance()->set_default_scale_to (0);
+ } else {
+ vector<Ratio const *> ratio = Ratio::all ();
+ Config::instance()->set_default_scale_to (ratio[s - 1]);
+ }
+ }
+
void dcp_content_type_changed ()
{
vector<DCPContentType const *> ct = DCPContentType::all ();
wxDirPickerCtrl* _kdm_directory;
#endif
wxChoice* _container;
+ wxChoice* _scale_to;
wxChoice* _dcp_content_type;
wxChoice* _dcp_audio_channels;
wxChoice* _standard;
wxString title,
int border,
function<void (shared_ptr<dcp::CertificateChain>)> set,
- function<shared_ptr<const dcp::CertificateChain> (void)> get
+ function<shared_ptr<const dcp::CertificateChain> (void)> get,
+ function<void (void)> nag_remake
)
: wxPanel (parent)
, _set (set)
, _get (get)
+ , _nag_remake (nag_remake)
{
wxFont subheading_font (*wxNORMAL_FONT);
subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
intermediate_common_name = i->subject_common_name ();
}
+ _nag_remake ();
+
MakeChainDialog* d = new MakeChainDialog (
this,
subject_organization_name,
shared_ptr<dcp::CertificateChain> _chain;
boost::function<void (shared_ptr<dcp::CertificateChain>)> _set;
boost::function<shared_ptr<const dcp::CertificateChain> (void)> _get;
+ boost::function<void (void)> _nag_remake;
};
class KeysPage : public StandardPage
_signer = new CertificateChainEditor (
_panel, _("Signing DCPs and KDMs"), _border,
boost::bind (&Config::set_signer_chain, Config::instance (), _1),
- boost::bind (&Config::signer_chain, Config::instance ())
+ boost::bind (&Config::signer_chain, Config::instance ()),
+ boost::bind (&do_nothing)
);
_panel->GetSizer()->Add (_signer);
_decryption = new CertificateChainEditor (
- _panel, _("Decrypting DCPs"), _border,
+ _panel, _("Decrypting KDMs"), _border,
boost::bind (&Config::set_decryption_chain, Config::instance (), _1),
- boost::bind (&Config::decryption_chain, Config::instance ())
+ boost::bind (&Config::decryption_chain, Config::instance ()),
+ boost::bind (&KeysPage::nag_remake_decryption_chain, this)
);
_panel->GetSizer()->Add (_decryption);
- _export_decryption_certificate = new wxButton (_decryption, wxID_ANY, _("Export DCP decryption\ncertificate..."));
+ _export_decryption_certificate = new wxButton (_decryption, wxID_ANY, _("Export KDM decryption\ncertificate..."));
_decryption->add_button (_export_decryption_certificate);
- _export_decryption_chain = new wxButton (_decryption, wxID_ANY, _("Export DCP decryption\nchain..."));
+ _export_decryption_chain = new wxButton (_decryption, wxID_ANY, _("Export KDM decryption\nchain..."));
_decryption->add_button (_export_decryption_chain);
_export_decryption_certificate->Bind (wxEVT_BUTTON, boost::bind (&KeysPage::export_decryption_certificate, this));
_decryption->config_changed ();
}
+ void nag_remake_decryption_chain ()
+ {
+ NagDialog::maybe_nag (
+ _panel,
+ Config::NAG_REMAKE_DECRYPTION_CHAIN,
+ _("If you continue with this operation you will no longer be able to use any DKDMs that you have created. Also, any KDMs that have been sent to you will become useless. Proceed with caution!")
+ );
+ }
+
CertificateChainEditor* _signer;
CertificateChainEditor* _decryption;
wxButton* _export_decryption_certificate;
wxButton* _reset_kdm_email;
};
+class CoverSheetPage : public StandardPage
+{
+public:
+
+ CoverSheetPage (wxSize panel_size, int border)
+#ifdef DCPOMATIC_OSX
+ /* We have to force both width and height of this one */
+ : StandardPage (wxSize (480, 128), border)
+#else
+ : StandardPage (panel_size, border)
+#endif
+ {}
+
+ wxString GetName () const
+ {
+ return _("Cover Sheet");
+ }
+
+#ifdef DCPOMATIC_OSX
+ wxBitmap GetLargeIcon () const
+ {
+ return wxBitmap ("cover_sheet", wxBITMAP_TYPE_PNG_RESOURCE);
+ }
+#endif
+
+private:
+ void setup ()
+ {
+ _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 = new wxButton (_panel, wxID_ANY, _("Reset to default text"));
+ _panel->GetSizer()->Add (_reset_cover_sheet, 0, wxEXPAND | wxALL, _border);
+
+ _cover_sheet->Bind (wxEVT_TEXT, boost::bind (&CoverSheetPage::cover_sheet_changed, this));
+ _reset_cover_sheet->Bind (wxEVT_BUTTON, boost::bind (&CoverSheetPage::reset_cover_sheet, this));
+ }
+
+ void config_changed ()
+ {
+ checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+ }
+
+ void cover_sheet_changed ()
+ {
+ if (_cover_sheet->GetValue().IsEmpty ()) {
+ /* Sometimes we get sent an erroneous notification that the cover sheet
+ is empty; I don't know why.
+ */
+ return;
+ }
+ Config::instance()->set_cover_sheet (wx_to_std (_cover_sheet->GetValue ()));
+ }
+
+ void reset_cover_sheet ()
+ {
+ Config::instance()->reset_cover_sheet ();
+ checked_set (_cover_sheet, Config::instance()->cover_sheet ());
+ }
+
+ wxTextCtrl* _cover_sheet;
+ wxButton* _reset_cover_sheet;
+};
+
+
/** @class AdvancedPage
* @brief Advanced page of the preferences dialog.
*/
e->AddPage (new KeysPage (ps, border));
e->AddPage (new TMSPage (ps, border));
e->AddPage (new KDMEmailPage (ps, border));
+ e->AddPage (new CoverSheetPage (ps, border));
e->AddPage (new AdvancedPage (ps, border));
return e;
}