- _sound = new wxCheckBox (_panel, wxID_ANY, _("Play sound via"));
- table->Add (_sound, wxGBPosition (r, 0));
- _sound_output = new wxChoice (_panel, wxID_ANY);
- table->Add (_sound_output, wxGBPosition (r, 1));
- ++r;
-
- RtAudio audio (DCPOMATIC_RTAUDIO_API);
- for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
- RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
- if (dev.probed && dev.outputChannels > 0) {
- _sound_output->Append (std_to_wx (dev.name));
- }
- }
-
- _sound->Bind (wxEVT_CHECKBOX, boost::bind (&GeneralPage::sound_changed, this));
- _sound_output->Bind (wxEVT_CHOICE, boost::bind (&GeneralPage::sound_output_changed, this));
- }
-
- void add_update_controls (wxGridBagSizer* table, int& r)
- {
- _check_for_updates = new wxCheckBox (_panel, wxID_ANY, _("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"));
- table->Add (_check_for_test_updates, wxGBPosition (r, 0), wxGBSpan (1, 2));
- ++r;
-
- _check_for_updates->Bind (wxEVT_CHECKBOX, boost::bind (&GeneralPage::check_for_updates_changed, this));
- _check_for_test_updates->Bind (wxEVT_CHECKBOX, boost::bind (&GeneralPage::check_for_test_updates_changed, this));
- }
-
- virtual void config_changed ()
- {
- Config* config = Config::instance ();
-
- checked_set (_set_language, static_cast<bool>(config->language()));
-
- /* Backwards compatibility of config file */
-
- std::map<std::string, std::string> compat_map;
- compat_map["fr"] = "fr_FR";
- compat_map["it"] = "it_IT";
- compat_map["es"] = "es_ES";
- compat_map["sv"] = "sv_SE";
- compat_map["de"] = "de_DE";
- compat_map["nl"] = "nl_NL";
- compat_map["ru"] = "ru_RU";
- compat_map["pl"] = "pl_PL";
- compat_map["da"] = "da_DK";
- compat_map["pt"] = "pt_PT";
- compat_map["sk"] = "sk_SK";
- compat_map["cs"] = "cs_CZ";
- compat_map["uk"] = "uk_UA";
-
- std::string lang = config->language().get_value_or ("en_GB");
- if (compat_map.find (lang) != compat_map.end ()) {
- lang = compat_map[lang];
- }
-
- checked_set (_language, lang);
-
- checked_set (_check_for_updates, config->check_for_updates ());
- checked_set (_check_for_test_updates, config->check_for_test_updates ());
-
- checked_set (_sound, config->sound ());
-
- boost::optional<std::string> const current_so = get_sound_output ();
- boost::optional<std::string> configured_so;
-
- if (config->sound_output()) {
- configured_so = config->sound_output().get();
- } else {
- /* No configured output means we should use the default */
- RtAudio audio (DCPOMATIC_RTAUDIO_API);
- try {
- configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name;
- } catch (RtAudioError& e) {
- /* Probably no audio devices at all */
- }
- }
-
- if (configured_so && current_so != configured_so) {
- /* Update _sound_output with the configured value */
- unsigned int i = 0;
- while (i < _sound_output->GetCount()) {
- if (_sound_output->GetString(i) == std_to_wx(*configured_so)) {
- _sound_output->SetSelection (i);
- break;
- }
- ++i;
- }
- }
-
- setup_sensitivity ();