/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "check_box.h"
#include "nag_dialog.h"
#include "dcpomatic_button.h"
+#include <iostream>
using std::string;
using std::vector;
using boost::optional;
using boost::shared_ptr;
using boost::function;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
static
bool
languages.push_back (make_pair ("Português do Brasil", "pt_BR"));
languages.push_back (make_pair ("Svenska", "sv_SE"));
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"));
checked_set (_language, languages);
table->Add (_language, wxGBPosition (r, 1));
{
_sound = new CheckBox (_panel, _("Play sound via"));
table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_sound_output = new wxChoice (_panel, wxID_ANY);
- table->Add (_sound_output, wxGBPosition (r, 1));
+ s->Add (_sound_output, 0);
+ _sound_output_details = new wxStaticText (_panel, wxID_ANY, wxT(""));
+ s->Add (_sound_output_details, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+ table->Add (s, wxGBPosition(r, 1));
++r;
+ wxFont font = _sound_output_details->GetFont();
+ font.SetStyle (wxFONTSTYLE_ITALIC);
+ font.SetPointSize (font.GetPointSize() - 1);
+ _sound_output_details->SetFont (font);
+
RtAudio audio (DCPOMATIC_RTAUDIO_API);
for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
}
}
+ RtAudio audio (DCPOMATIC_RTAUDIO_API);
+
+ map<int, wxString> apis;
+ apis[RtAudio::MACOSX_CORE] = _("CoreAudio");
+ apis[RtAudio::WINDOWS_ASIO] = _("ASIO");
+ apis[RtAudio::WINDOWS_DS] = _("Direct Sound");
+ apis[RtAudio::WINDOWS_WASAPI] = _("WASAPI");
+ apis[RtAudio::UNIX_JACK] = _("JACK");
+ apis[RtAudio::LINUX_ALSA] = _("ALSA");
+ apis[RtAudio::LINUX_PULSE] = _("PulseAudio");
+ apis[RtAudio::LINUX_OSS] = _("OSS");
+ apis[RtAudio::RTAUDIO_DUMMY] = _("Dummy");
+
+ int channels = 0;
+ if (configured_so) {
+ for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
+ RtAudio::DeviceInfo info = audio.getDeviceInfo(i);
+ if (info.name == *configured_so && info.outputChannels > 0) {
+ channels = info.outputChannels;
+ }
+ }
+ }
+
+ _sound_output_details->SetLabel (
+ wxString::Format(_("%d channels on %s"), channels, apis[audio.getCurrentApi()])
+ );
+
setup_sensitivity ();
}
int border,
function<void (shared_ptr<dcp::CertificateChain>)> set,
function<shared_ptr<const dcp::CertificateChain> (void)> get,
- function<bool (void)> nag_remake
+ function<bool (void)> nag_alter
)
: wxDialog (parent, wxID_ANY, title)
, _set (set)
, _get (get)
- , _nag_remake (nag_remake)
+ , _nag_alter (nag_alter)
{
wxFont subheading_font (*wxNORMAL_FONT);
subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
void
CertificateChainEditor::remove_certificate ()
{
+ if (_nag_alter()) {
+ /* Cancel was clicked */
+ return;
+ }
+
int i = _certificates->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (i == -1) {
return;
boost::filesystem::path path (wx_to_std(d->GetPath()));
FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (path, errno, false);
+ throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const s = j->certificate (true);
boost::filesystem::path path (wx_to_std(d->GetPath()));
FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (path, errno, false);
+ throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const s = _get()->chain();
intermediate_common_name = i->subject_common_name ();
}
- if (_nag_remake()) {
+ if (_nag_alter()) {
/* Cancel was clicked */
return;
}
shared_ptr<dcp::CertificateChain> (
new dcp::CertificateChain (
openssl_path (),
+ CERTIFICATE_VALIDITY_PERIOD,
d->organisation (),
d->organisational_unit (),
d->root_common_name (),
boost::filesystem::path path (wx_to_std(d->GetPath()));
FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (path, errno, false);
+ throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const s = _get()->key().get ();
_panel, _("Decrypting KDMs"), _border,
bind (&Config::set_decryption_chain, Config::instance (), _1),
bind (&Config::decryption_chain, Config::instance ()),
- bind (&KeysPage::nag_remake_decryption_chain, this)
+ bind (&KeysPage::nag_alter_decryption_chain, this)
);
c->ShowModal();
boost::filesystem::path path (wx_to_std(d->GetPath()));
FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (path, errno, false);
+ throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const chain = Config::instance()->decryption_chain()->chain();
FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "r");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (wx_to_std (d->GetPath ()), errno, OpenFileError::WRITE);
}
string current;
}
bool
-KeysPage::nag_remake_decryption_chain ()
+KeysPage::nag_alter_decryption_chain ()
{
return NagDialog::maybe_nag (
_panel,
- Config::NAG_REMAKE_DECRYPTION_CHAIN,
+ Config::NAG_ALTER_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!"),
true
);
boost::filesystem::path path (wx_to_std(d->GetPath()));
FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (path, errno, false);
+ throw OpenFileError (path, errno, OpenFileError::WRITE);
}
string const s = Config::instance()->decryption_chain()->leaf().certificate (true);