C++11 and whitespace cleanups.
[dcpomatic.git] / src / lib / config.h
index 19e05608c5e7a0116c7b73d62b3ecae6ca03ab67..29f401755b06cf814db5c1cb2207848099053d9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
  *  @brief Class holding configuration.
  */
 
+
 #ifndef DCPOMATIC_CONFIG_H
 #define DCPOMATIC_CONFIG_H
 
-#include "types.h"
-#include "state.h"
+
 #include "audio_mapping.h"
+#include "state.h"
+#include "types.h"
 #include <dcp/name_format.h>
 #include <dcp/certificate_chain.h>
 #include <dcp/encrypted_kdm.h>
 #include <boost/filesystem.hpp>
 #include <vector>
 
+
+class Cinema;
 class CinemaSoundProcessor;
 class DCPContentType;
-class Ratio;
-class Cinema;
-class Film;
 class DKDMGroup;
 class DKDMRecipient;
+class Film;
+class Ratio;
+
+
+extern void save_all_config_as_zip (boost::filesystem::path zip_file);
+
 
 /** @class Config
  *  @brief A singleton class holding configuration.
@@ -140,11 +147,11 @@ public:
                return _tms_password;
        }
 
-       std::list<std::shared_ptr<Cinema> > cinemas () const {
+       std::list<std::shared_ptr<Cinema>> cinemas () const {
                return _cinemas;
        }
 
-       std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
+       std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
                return _dkdm_recipients;
        }
 
@@ -397,11 +404,12 @@ public:
                NAG_DKDM_CONFIG,
                NAG_ENCRYPTED_METADATA,
                NAG_ALTER_DECRYPTION_CHAIN,
-               NAG_BAD_SIGNER_CHAIN,
+               NAG_BAD_SIGNER_CHAIN_UTF8,
                NAG_IMPORT_DECRYPTION_CHAIN,
                NAG_DELETE_DKDM,
                NAG_32_ON_64,
                NAG_TOO_MANY_DROPPED_FRAMES,
+               NAG_BAD_SIGNER_CHAIN_VALIDITY,
                NAG_COUNT
        };
 
@@ -543,6 +551,23 @@ public:
                return _add_files_path;
        }
 
+       bool use_isdcf_name_by_default () const {
+               return _use_isdcf_name_by_default;
+       }
+
+       bool write_kdms_to_disk () const {
+               return _write_kdms_to_disk;
+       }
+
+       bool email_kdms () const {
+               return _email_kdms;
+       }
+
+       dcp::Formulation default_kdm_type () const {
+               return _default_kdm_type;
+       }
+
+
        /* SET (mostly) */
 
        void set_master_encoding_threads (int n) {
@@ -1047,6 +1072,22 @@ public:
                changed ();
        }
 
+       void set_use_isdcf_name_by_default (bool use) {
+               maybe_set (_use_isdcf_name_by_default, use);
+       }
+
+       void set_write_kdms_to_disk (bool write) {
+               maybe_set (_write_kdms_to_disk, write);
+       }
+
+       void set_email_kdms (bool email) {
+               maybe_set (_email_kdms, email);
+       }
+
+       void set_default_kdm_type (dcp::Formulation type) {
+               maybe_set (_default_kdm_type, type);
+       }
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** Emitted if read() failed on an existing Config file.  There is nothing
@@ -1059,9 +1100,10 @@ public:
         *  true to ask Config to solve the problem (by discarding and recreating the bad thing)
         */
        enum BadReason {
-               BAD_SIGNER_UTF8_STRINGS,     ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
-               BAD_SIGNER_INCONSISTENT,     ///< signer chain is somehow inconsistent
-               BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
+               BAD_SIGNER_UTF8_STRINGS,      ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
+               BAD_SIGNER_INCONSISTENT,      ///< signer chain is somehow inconsistent
+               BAD_DECRYPTION_INCONSISTENT,  ///< KDM decryption chain is somehow inconsistent
+               BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
        };
 
        static boost::signals2::signal<bool (BadReason)> Bad;
@@ -1082,6 +1124,8 @@ public:
        void rename_template (std::string old_name, std::string new_name) const;
        void delete_template (std::string name) const;
 
+       boost::optional<BadReason> check_certificates () const;
+
        static Config* instance ();
        static void drop ();
        static void restore_defaults ();
@@ -1178,8 +1222,8 @@ private:
        */
        boost::optional<boost::filesystem::path> _default_kdm_directory;
        bool _upload_after_make_dcp;
-       std::list<std::shared_ptr<Cinema> > _cinemas;
-       std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
+       std::list<std::shared_ptr<Cinema>> _cinemas;
+       std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
        std::string _mail_server;
        int _mail_port;
        EmailProtocol _mail_protocol;
@@ -1259,6 +1303,10 @@ private:
        boost::optional<AudioMapping> _audio_mapping;
        std::vector<dcp::LanguageTag> _custom_languages;
        boost::optional<boost::filesystem::path> _add_files_path;
+       bool _use_isdcf_name_by_default;
+       bool _write_kdms_to_disk;
+       bool _email_kdms;
+       dcp::Formulation _default_kdm_type;
 
        static int const _current_version;