Check for signer chains containing UTF8-marked strings and offer
[dcpomatic.git] / src / lib / config.h
index dae1924a86c50ea1948e65878f2cf1432a19d511..2fca9699c786006d5819064ecb0acb4b1e5a49c5 100644 (file)
@@ -286,6 +286,10 @@ public:
                return _history;
        }
 
+       std::vector<boost::filesystem::path> player_history () const {
+               return _player_history;
+       }
+
        boost::shared_ptr<DKDMGroup> dkdms () const {
                return _dkdms;
        }
@@ -326,6 +330,7 @@ public:
                NAG_DKDM_CONFIG,
                NAG_ENCRYPTED_METADATA,
                NAG_REMAKE_DECRYPTION_CHAIN,
+               NAG_BAD_SIGNER_CHAIN,
                NAG_COUNT
        };
 
@@ -359,10 +364,25 @@ public:
                return _last_kdm_write_type;
        }
 
+       enum DKDMWriteType {
+               DKDM_WRITE_INTERNAL,
+               DKDM_WRITE_FILE
+       };
+
+       boost::optional<DKDMWriteType> last_dkdm_write_type () const {
+               return _last_dkdm_write_type;
+       }
+
        int frames_in_memory_multiplier () const {
                return _frames_in_memory_multiplier;
        }
 
+       boost::optional<int> decode_reduction () const {
+               return _decode_reduction;
+       }
+
+       /* SET (mostly) */
+
        void set_master_encoding_threads (int n) {
                maybe_set (_master_encoding_threads, n);
        }
@@ -605,6 +625,10 @@ public:
                maybe_set (_last_kdm_write_type, t);
        }
 
+       void set_last_dkdm_write_type (DKDMWriteType t) {
+               maybe_set (_last_dkdm_write_type, t);
+       }
+
        void unset_sound_output () {
                if (!_sound_output) {
                        return;
@@ -634,12 +658,22 @@ public:
                maybe_set (_frames_in_memory_multiplier, m);
        }
 
+       void set_decode_reduction (boost::optional<int> r) {
+               maybe_set (_decode_reduction, r);
+       }
+
        void clear_history () {
                _history.clear ();
                changed ();
        }
 
+       void clear_player_history () {
+               _player_history.clear ();
+               changed ();
+       }
+
        void add_to_history (boost::filesystem::path p);
+       void add_to_player_history (boost::filesystem::path p);
 
        void set_jump_to_selected (bool j) {
                maybe_set (_jump_to_selected, j);
@@ -663,6 +697,10 @@ public:
        static boost::signals2::signal<void ()> FailedToLoad;
        /** Emitted if read() issued a warning which the user might want to know about */
        static boost::signals2::signal<void (std::string)> Warning;
+       /** Emitted if there is a bad certificate in the signer chain.  Handler can call
+        *  true to ask Config to re-create the chain.
+        */
+       static boost::signals2::signal<bool (void)> BadSignerChain;
 
        void write () const;
        void write_config () const;
@@ -695,6 +733,8 @@ private:
        void read_cinemas (cxml::Document const & f);
        boost::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
        boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
+       void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
+       void backup ();
 
        template <class T>
        void maybe_set (T& member, T new_value, Property prop = OTHER) {
@@ -789,6 +829,7 @@ private:
        bool _win32_console;
 #endif
        std::vector<boost::filesystem::path> _history;
+       std::vector<boost::filesystem::path> _player_history;
        boost::shared_ptr<DKDMGroup> _dkdms;
        boost::filesystem::path _cinemas_file;
        bool _show_hints_before_make_dcp;
@@ -805,7 +846,11 @@ private:
        std::string _cover_sheet;
        boost::optional<boost::filesystem::path> _last_player_load_directory;
        boost::optional<KDMWriteType> _last_kdm_write_type;
+       boost::optional<DKDMWriteType> _last_dkdm_write_type;
        int _frames_in_memory_multiplier;
+       boost::optional<int> _decode_reduction;
+
+       static int const _current_version;
 
        /** Singleton instance, or 0 */
        static Config* _instance;