*/
-#include "config_dialog.h"
-#include "static_text.h"
+
+#include "audio_mapping_view.h"
#include "check_box.h"
-#include "nag_dialog.h"
+#include "config_dialog.h"
#include "dcpomatic_button.h"
-#include "audio_mapping_view.h"
+#include "nag_dialog.h"
+#include "static_text.h"
+#include <dcp/file.h>
#include <dcp/raw_convert.h>
-#include <iostream>
-using std::string;
-using std::vector;
-using std::pair;
+
+using std::function;
using std::make_pair;
-using std::map;
using std::make_shared;
+using std::map;
+using std::pair;
+using std::shared_ptr;
+using std::string;
+using std::vector;
using boost::bind;
using boost::optional;
-using std::shared_ptr;
-using std::function;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
+
static
bool
do_nothing ()
languages.push_back (make_pair("Português europeu", "pt_PT"));
languages.push_back (make_pair("Português do Brasil", "pt_BR"));
languages.push_back (make_pair("Svenska", "sv_SE"));
+ languages.push_back (make_pair("Slovenščina", "sl_SI"));
languages.push_back (make_pair("Slovenský jazyk", "sk_SK"));
// languages.push_back (make_pair("Türkçe", "tr_TR"));
languages.push_back (make_pair("українська мова", "uk_UA"));
+ languages.push_back (make_pair("Magyar nyelv", "hu_HU"));
checked_set (_language, languages);
table->Add (_language, wxGBPosition (r, 1));
++r;
if (path.extension() != ".pem") {
path += ".pem";
}
- auto f = fopen_boost (path, "w");
+ dcp::File f(path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const s = j->certificate (true);
- checked_fwrite (s.c_str(), s.length(), f, path);
- fclose (f);
+ f.checked_write(s.c_str(), s.length());
}
d->Destroy ();
}
if (path.extension() != ".pem") {
path += ".pem";
}
- auto f = fopen_boost (path, "w");
+ dcp::File f(path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
auto const s = _get()->chain();
- checked_fwrite (s.c_str(), s.length(), f, path);
- fclose (f);
+ f.checked_write (s.c_str(), s.length());
}
d->Destroy ();
if (path.extension() != ".pem") {
path += ".pem";
}
- auto f = fopen_boost (path, "w");
+ dcp::File f(path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
auto const s = _get()->key().get ();
- checked_fwrite (s.c_str(), s.length(), f, path);
- fclose (f);
+ f.checked_write(s.c_str(), s.length());
}
d->Destroy ();
}
sizer->Add (m, 0, wxALL | wxEXPAND, _border);
}
- auto buttons = new wxBoxSizer (wxVERTICAL);
+ auto kdm_buttons = new wxBoxSizer (wxVERTICAL);
auto export_decryption_certificate = new Button (_panel, _("Export KDM decryption leaf certificate..."));
- buttons->Add (export_decryption_certificate, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+ kdm_buttons->Add (export_decryption_certificate, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
auto export_settings = new Button (_panel, _("Export all KDM decryption settings..."));
- buttons->Add (export_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+ kdm_buttons->Add (export_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
auto import_settings = new Button (_panel, _("Import all KDM decryption settings..."));
- buttons->Add (import_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+ kdm_buttons->Add (import_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
auto decryption_advanced = new Button (_panel, _("Advanced..."));
- buttons->Add (decryption_advanced, 0);
+ kdm_buttons->Add (decryption_advanced, 0);
- sizer->Add (buttons, 0, wxLEFT, _border);
+ sizer->Add (kdm_buttons, 0, wxLEFT, _border);
export_decryption_certificate->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_certificate, this));
export_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain_and_key, this));
sizer->Add (m, 0, wxALL | wxEXPAND, _border);
}
+ auto signing_buttons = new wxBoxSizer (wxVERTICAL);
+
auto signing_advanced = new Button (_panel, _("Advanced..."));
- sizer->Add (signing_advanced, 0, wxLEFT | wxBOTTOM, _border);
+ signing_buttons->Add (signing_advanced, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+ auto remake_signing = new Button (_panel, _("Re-make certificates and key..."));
+ signing_buttons->Add (remake_signing, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+
+ sizer->Add (signing_buttons, 0, wxLEFT, _border);
+
signing_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::signing_advanced, this));
+ remake_signing->Bind (wxEVT_BUTTON, bind(&KeysPage::remake_signing, this));
}
+
+void
+KeysPage::remake_signing ()
+{
+ auto d = new MakeChainDialog (_panel, Config::instance()->signer_chain());
+
+ if (d->ShowModal () == wxID_OK) {
+ Config::instance()->set_signer_chain(d->get());
+ }
+}
+
+
void
KeysPage::decryption_advanced ()
{
if (d->ShowModal () == wxID_OK) {
boost::filesystem::path path (wx_to_std(d->GetPath()));
- auto f = fopen_boost (path, "w");
+ dcp::File f(path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
auto const chain = Config::instance()->decryption_chain()->chain();
- checked_fwrite (chain.c_str(), chain.length(), f, path);
- optional<string> const key = Config::instance()->decryption_chain()->key();
+ f.checked_write (chain.c_str(), chain.length());
+ auto const key = Config::instance()->decryption_chain()->key();
DCPOMATIC_ASSERT (key);
- checked_fwrite (key->c_str(), key->length(), f, path);
- fclose (f);
+ f.checked_write(key->c_str(), key->length());
}
d->Destroy ();
if (d->ShowModal () == wxID_OK) {
auto new_chain = make_shared<dcp::CertificateChain>();
- FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "r");
+ dcp::File f(wx_to_std(d->GetPath()), "r");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, OpenFileError::WRITE);
+ throw OpenFileError (f.path(), errno, OpenFileError::WRITE);
}
string current;
- while (!feof (f)) {
+ while (!f.eof()) {
char buffer[128];
- if (fgets (buffer, 128, f) == 0) {
+ if (f.gets(buffer, 128) == 0) {
break;
}
current += buffer;
current = "";
}
}
- fclose (f);
if (new_chain->chain_valid() && new_chain->private_key_valid()) {
Config::instance()->set_decryption_chain (new_chain);
if (path.extension() != ".pem") {
path += ".pem";
}
- auto f = fopen_boost (path, "w");
+ dcp::File f(path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
auto const s = Config::instance()->decryption_chain()->leaf().certificate (true);
- checked_fwrite (s.c_str(), s.length(), f, path);
- fclose (f);
+ f.checked_write(s.c_str(), s.length());
}
d->Destroy ();
wxBitmap
LocationsPage::GetLargeIcon () const
{
- return wxBitmap(bitmap_path("locations"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(bitmap_path("locations.png"), wxBITMAP_TYPE_PNG);
}
#endif