X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fconfig_dialog.cc;h=ccf1202ecd25b3bb30f05f6d9e78682590ed8780;hb=8b2a3f31b6b4238d8534549f495e7276174ddfba;hp=4195aa128880de01777cb28301ec612256b6d6d3;hpb=4eaecb1841d3a80a4f06613ad4c0bd44d89285a9;p=dcpomatic.git diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 4195aa128..ccf1202ec 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -19,7 +19,10 @@ */ #include "config_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "nag_dialog.h" +#include "dcpomatic_button.h" using std::string; using std::vector; @@ -112,7 +115,7 @@ GeneralPage::GeneralPage (wxSize panel_size, int border) void GeneralPage::add_language_controls (wxGridBagSizer* table, int& r) { - _set_language = new wxCheckBox (_panel, wxID_ANY, _("Set language")); + _set_language = new CheckBox (_panel, _("Set language")); table->Add (_set_language, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); _language = new wxChoice (_panel, wxID_ANY); vector > languages; @@ -152,7 +155,7 @@ GeneralPage::add_language_controls (wxGridBagSizer* table, int& r) void GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r) { - _sound = new wxCheckBox (_panel, wxID_ANY, _("Play sound via")); + _sound = new CheckBox (_panel, _("Play sound via")); table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); _sound_output = new wxChoice (_panel, wxID_ANY); table->Add (_sound_output, wxGBPosition (r, 1)); @@ -173,11 +176,11 @@ GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r) void GeneralPage::add_update_controls (wxGridBagSizer* table, int& r) { - _check_for_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for updates on startup")); + _check_for_updates = new CheckBox (_panel, _("Check for updates on startup")); table->Add (_check_for_updates, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; - _check_for_test_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for testing updates on startup")); + _check_for_test_updates = new CheckBox (_panel, _("Check for testing updates on startup")); table->Add (_check_for_test_updates, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; @@ -342,7 +345,7 @@ CertificateChainEditor::CertificateChainEditor ( _sizer = new wxBoxSizer (wxVERTICAL); { - wxStaticText* m = new wxStaticText (this, wxID_ANY, title); + wxStaticText* m = new StaticText (this, title); m->SetFont (subheading_font); _sizer->Add (m, 0, wxALL, border); } @@ -377,11 +380,11 @@ CertificateChainEditor::CertificateChainEditor ( { wxSizer* s = new wxBoxSizer (wxVERTICAL); - _add_certificate = new wxButton (this, wxID_ANY, _("Add...")); + _add_certificate = new Button (this, _("Add...")); s->Add (_add_certificate, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - _remove_certificate = new wxButton (this, wxID_ANY, _("Remove")); + _remove_certificate = new Button (this, _("Remove")); s->Add (_remove_certificate, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - _export_certificate = new wxButton (this, wxID_ANY, _("Export")); + _export_certificate = new Button (this, _("Export")); s->Add (_export_certificate, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); certificates_sizer->Add (s, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP); } @@ -391,24 +394,24 @@ CertificateChainEditor::CertificateChainEditor ( int r = 0; add_label_to_sizer (table, this, _("Leaf private key"), true, wxGBPosition (r, 0)); - _private_key = new wxStaticText (this, wxID_ANY, wxT ("")); + _private_key = new StaticText (this, wxT("")); wxFont font = _private_key->GetFont (); font.SetFamily (wxFONTFAMILY_TELETYPE); _private_key->SetFont (font); table->Add (_private_key, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); - _import_private_key = new wxButton (this, wxID_ANY, _("Import...")); + _import_private_key = new Button (this, _("Import...")); table->Add (_import_private_key, wxGBPosition (r, 2)); - _export_private_key = new wxButton (this, wxID_ANY, _("Export...")); + _export_private_key = new Button (this, _("Export...")); table->Add (_export_private_key, wxGBPosition (r, 3)); ++r; _button_sizer = new wxBoxSizer (wxHORIZONTAL); - _remake_certificates = new wxButton (this, wxID_ANY, _("Re-make certificates and key...")); + _remake_certificates = new Button (this, _("Re-make certificates and key...")); _button_sizer->Add (_remake_certificates, 1, wxRIGHT, border); table->Add (_button_sizer, wxGBPosition (r, 0), wxGBSpan (1, 4)); ++r; - _private_key_bad = new wxStaticText (this, wxID_ANY, _("Leaf private key does not match leaf certificate!")); + _private_key_bad = new StaticText (this, _("Leaf private key does not match leaf certificate!")); font = *wxSMALL_FONT; font.SetWeight (wxFONTWEIGHT_BOLD); _private_key_bad->SetFont (font); @@ -526,9 +529,10 @@ CertificateChainEditor::export_certificate () } if (d->ShowModal () == wxID_OK) { - FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w"); + boost::filesystem::path path (wx_to_std(d->GetPath())); + FILE* f = fopen_boost (path, "w"); if (!f) { - throw OpenFileError (wx_to_std (d->GetPath ()), errno, false); + throw OpenFileError (path, errno, false); } string const s = j->certificate (true); @@ -698,9 +702,10 @@ CertificateChainEditor::export_private_key () ); if (d->ShowModal () == wxID_OK) { - FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w"); + boost::filesystem::path path (wx_to_std(d->GetPath())); + FILE* f = fopen_boost (path, "w"); if (!f) { - throw OpenFileError (wx_to_std (d->GetPath ()), errno, false); + throw OpenFileError (path, errno, false); } string const s = _get()->key().get (); @@ -725,20 +730,20 @@ KeysPage::setup () wxSizer* sizer = _panel->GetSizer(); { - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Decrypting KDMs")); + wxStaticText* m = new StaticText (_panel, _("Decrypting KDMs")); m->SetFont (subheading_font); sizer->Add (m, 0, wxALL, _border); } - wxButton* export_decryption_certificate = new wxButton (_panel, wxID_ANY, _("Export KDM decryption certificate...")); + wxButton* export_decryption_certificate = new Button (_panel, _("Export KDM decryption certificate...")); sizer->Add (export_decryption_certificate, 0, wxLEFT, _border); - wxButton* export_decryption_chain = new wxButton (_panel, wxID_ANY, _("Export KDM decryption chain...")); + wxButton* export_decryption_chain = new Button (_panel, _("Export KDM decryption chain...")); sizer->Add (export_decryption_chain, 0, wxLEFT, _border); - wxButton* export_settings = new wxButton (_panel, wxID_ANY, _("Export all KDM decryption settings...")); + wxButton* export_settings = new Button (_panel, _("Export all KDM decryption settings...")); sizer->Add (export_settings, 0, wxLEFT, _border); - wxButton* import_settings = new wxButton (_panel, wxID_ANY, _("Import all KDM decryption settings...")); + wxButton* import_settings = new Button (_panel, _("Import all KDM decryption settings...")); sizer->Add (import_settings, 0, wxLEFT, _border); - wxButton* decryption_advanced = new wxButton (_panel, wxID_ANY, _("Advanced...")); + wxButton* decryption_advanced = new Button (_panel, _("Advanced...")); sizer->Add (decryption_advanced, 0, wxALL, _border); export_decryption_certificate->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_certificate, this)); @@ -748,12 +753,12 @@ KeysPage::setup () decryption_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::decryption_advanced, this)); { - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Signing DCPs and KDMs")); + wxStaticText* m = new StaticText (_panel, _("Signing DCPs and KDMs")); m->SetFont (subheading_font); sizer->Add (m, 0, wxALL, _border); } - wxButton* signing_advanced = new wxButton (_panel, wxID_ANY, _("Advanced...")); + wxButton* signing_advanced = new Button (_panel, _("Advanced...")); sizer->Add (signing_advanced, 0, wxLEFT, _border); signing_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::signing_advanced, this)); } @@ -793,9 +798,10 @@ KeysPage::export_decryption_chain_and_key () ); if (d->ShowModal () == wxID_OK) { - FILE* f = fopen_boost (path_from_file_dialog (d, "dom"), "w"); + boost::filesystem::path path (wx_to_std(d->GetPath())); + FILE* f = fopen_boost (path, "w"); if (!f) { - throw OpenFileError (wx_to_std (d->GetPath ()), errno, false); + throw OpenFileError (path, errno, false); } string const chain = Config::instance()->decryption_chain()->chain(); @@ -870,9 +876,10 @@ KeysPage::export_decryption_chain () ); if (d->ShowModal () == wxID_OK) { - FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w"); + boost::filesystem::path path (wx_to_std(d->GetPath())); + FILE* f = fopen_boost (path, "w"); if (!f) { - throw OpenFileError (wx_to_std (d->GetPath ()), errno, false); + throw OpenFileError (path, errno, false); } string const s = Config::instance()->decryption_chain()->chain(); @@ -891,14 +898,16 @@ KeysPage::export_decryption_certificate () ); if (d->ShowModal () == wxID_OK) { - FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w"); + boost::filesystem::path path (wx_to_std(d->GetPath())); + FILE* f = fopen_boost (path, "w"); if (!f) { - throw OpenFileError (wx_to_std (d->GetPath ()), errno, false); + throw OpenFileError (path, errno, false); } string const s = Config::instance()->decryption_chain()->leaf().certificate (true); fwrite (s.c_str(), 1, s.length(), f); fclose (f); } + d->Destroy (); }