Rename player DCP directory to player content; ignore failures to load directories...
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Oct 2018 22:16:53 +0000 (23:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Oct 2018 22:16:53 +0000 (23:16 +0100)
src/lib/config.cc
src/lib/config.h
src/wx/controls.cc
src/wx/player_config_dialog.cc

index ede0b10..da3ef22 100644 (file)
@@ -167,7 +167,7 @@ Config::set_defaults ()
        _image_display = 0;
        _respect_kdm_validity_periods = true;
        _player_log_file = boost::none;
-       _player_dcp_directory = boost::none;
+       _player_content_directory = boost::none;
        _player_kdm_directory = boost::none;
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        _player_background_image = boost::none;
@@ -515,7 +515,7 @@ try
        _image_display = f.optional_number_child<int>("ImageDisplay").get_value_or(0);
        _respect_kdm_validity_periods = f.optional_bool_child("RespectKDMValidityPeriods").get_value_or(true);
        _player_log_file = f.optional_string_child("PlayerLogFile");
-       _player_dcp_directory = f.optional_string_child("PlayerDCPDirectory");
+       _player_content_directory = f.optional_string_child("PlayerContentDirectory");
        _player_kdm_directory = f.optional_string_child("PlayerKDMDirectory");
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        _player_background_image = f.optional_string_child("PlayerBackgroundImage");
@@ -919,8 +919,8 @@ Config::write_config () const
        if (_player_log_file) {
                root->add_child("PlayerLogFile")->add_child_text(_player_log_file->string());
        }
-       if (_player_dcp_directory) {
-               root->add_child("PlayerDCPDirectory")->add_child_text(_player_dcp_directory->string());
+       if (_player_content_directory) {
+               root->add_child("PlayerContentDirectory")->add_child_text(_player_content_directory->string());
        }
        if (_player_kdm_directory) {
                root->add_child("PlayerKDMDirectory")->add_child_text(_player_kdm_directory->string());
index 011906a..a25dab0 100644 (file)
@@ -77,7 +77,7 @@ public:
                SOUND,
                SOUND_OUTPUT,
                INTERFACE_COMPLEXITY,
-               PLAYER_DCP_DIRECTORY,
+               PLAYER_CONTENT_DIRECTORY,
                HISTORY,
 #ifdef DCPOMATIC_VARIANT_SWAROOP
                PLAYER_BACKGROUND_IMAGE,
@@ -487,8 +487,8 @@ public:
                return _player_log_file;
        }
 
-       boost::optional<boost::filesystem::path> player_dcp_directory () const {
-               return _player_dcp_directory;
+       boost::optional<boost::filesystem::path> player_content_directory () const {
+               return _player_content_directory;
        }
 
        boost::optional<boost::filesystem::path> player_kdm_directory () const {
@@ -947,16 +947,16 @@ public:
                changed ();
        }
 
-       void set_player_dcp_directory (boost::filesystem::path p) {
-               maybe_set (_player_dcp_directory, p, PLAYER_DCP_DIRECTORY);
+       void set_player_content_directory (boost::filesystem::path p) {
+               maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
        }
 
-       void unset_player_dcp_directory () {
-               if (!_player_dcp_directory) {
+       void unset_player_content_directory () {
+               if (!_player_content_directory) {
                        return;
                }
-               _player_dcp_directory = boost::none;
-               changed (PLAYER_DCP_DIRECTORY);
+               _player_content_directory = boost::none;
+               changed (PLAYER_CONTENT_DIRECTORY);
        }
 
        void set_player_kdm_directory (boost::filesystem::path p) {
@@ -1200,7 +1200,7 @@ private:
            in the dual-screen player mode.  DCPs on the list can be loaded
            for playback.
        */
-       boost::optional<boost::filesystem::path> _player_dcp_directory;
+       boost::optional<boost::filesystem::path> _player_content_directory;
        boost::optional<boost::filesystem::path> _player_kdm_directory;
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        boost::optional<boost::filesystem::path> _player_background_image;
index eb70726..074aa82 100644 (file)
@@ -245,7 +245,7 @@ Controls::load_clicked ()
 void
 Controls::config_changed (int property)
 {
-       if (property == Config::PLAYER_DCP_DIRECTORY) {
+       if (property == Config::PLAYER_CONTENT_DIRECTORY) {
                update_dcp_directory ();
        } else {
                setup_sensitivity ();
@@ -615,7 +615,7 @@ Controls::update_dcp_directory ()
 
        _cpl->DeleteAllItems ();
        _cpls.clear ();
-       optional<path> dir = Config::instance()->player_dcp_directory();
+       optional<path> dir = Config::instance()->player_content_directory();
        if (!dir) {
                return;
        }
@@ -633,6 +633,8 @@ Controls::update_dcp_directory ()
                        }
                } catch (boost::filesystem::filesystem_error& e) {
                        /* Never mind */
+               } catch (dcp::DCPReadError& e) {
+                       /* Never mind */
                }
        }
 }
index a131a46..a7f61a3 100644 (file)
@@ -229,9 +229,9 @@ private:
                wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
 
-               add_label_to_sizer (table, _panel, _("DCP directory"), true, wxGBPosition (r, 0));
-               _dcp_directory = new wxDirPickerCtrl (_panel, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
-               table->Add (_dcp_directory, wxGBPosition (r, 1));
+               add_label_to_sizer (table, _panel, _("Content directory"), true, wxGBPosition (r, 0));
+               _content_directory = new wxDirPickerCtrl (_panel, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
+               table->Add (_content_directory, wxGBPosition (r, 1));
                ++r;
 
                add_label_to_sizer (table, _panel, _("KDM directory"), true, wxGBPosition (r, 0));
@@ -246,7 +246,7 @@ private:
                ++r;
 #endif
 
-               _dcp_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::dcp_directory_changed, this));
+               _content_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::content_directory_changed, this));
                _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::kdm_directory_changed, this));
 #ifdef DCPOMATIC_VARIANT_SWAROOP
                _background_image->Bind (wxEVT_FILEPICKER_CHANGED, bind(&LocationsPage::background_image_changed, this));
@@ -257,8 +257,8 @@ private:
        {
                Config* config = Config::instance ();
 
-               if (config->player_dcp_directory()) {
-                       checked_set (_dcp_directory, *config->player_dcp_directory());
+               if (config->player_content_directory()) {
+                       checked_set (_content_directory, *config->player_content_directory());
                }
                if (config->player_kdm_directory()) {
                        checked_set (_kdm_directory, *config->player_kdm_directory());
@@ -270,9 +270,9 @@ private:
 #endif
        }
 
-       void dcp_directory_changed ()
+       void content_directory_changed ()
        {
-               Config::instance()->set_player_dcp_directory(wx_to_std(_dcp_directory->GetPath()));
+               Config::instance()->set_player_content_directory(wx_to_std(_content_directory->GetPath()));
        }
 
        void kdm_directory_changed ()
@@ -287,7 +287,7 @@ private:
        }
 #endif
 
-       wxDirPickerCtrl* _dcp_directory;
+       wxDirPickerCtrl* _content_directory;
        wxDirPickerCtrl* _kdm_directory;
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        FilePickerCtrl* _background_image;