Allow repeat-frame to work with 3D.
[dcpomatic.git] / src / lib / config.h
index abfdba3dd56cd2347022a7aaf4d47e12acfcbecb..970810a7734214a68f3ad39a3d0718c54a94a3d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -40,6 +40,7 @@ class DCPContentType;
 class Ratio;
 class Cinema;
 class Film;
+class DKDMGroup;
 
 /** @class Config
  *  @brief A singleton class holding configuration.
@@ -47,9 +48,14 @@ class Film;
 class Config : public boost::noncopyable
 {
 public:
-       /** @return number of threads to use for J2K encoding on the local machine */
-       int num_local_encoding_threads () const {
-               return _num_local_encoding_threads;
+       /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
+       int master_encoding_threads () const {
+               return _master_encoding_threads;
+       }
+
+       /** @return number of threads which a server should use for J2K encoding on the local machine */
+       int server_encoding_threads () const {
+               return _server_encoding_threads;
        }
 
        boost::optional<boost::filesystem::path> default_directory () const {
@@ -67,7 +73,8 @@ public:
                USE_ANY_SERVERS,
                SERVERS,
                CINEMAS,
-               SOUND_OUTPUT,
+               PREVIEW_SOUND,
+               PREVIEW_SOUND_OUTPUT,
                OTHER
        };
 
@@ -157,6 +164,10 @@ public:
                return _default_container;
        }
 
+       Ratio const * default_scale_to () const {
+               return _default_scale_to;
+       }
+
        DCPContentType const * default_dcp_content_type () const {
                return _default_dcp_content_type;
        }
@@ -271,7 +282,7 @@ public:
                return _history;
        }
 
-       std::vector<dcp::EncryptedKDM> dkdms () const {
+       boost::shared_ptr<DKDMGroup> dkdms () const {
                return _dkdms;
        }
 
@@ -307,13 +318,35 @@ public:
                return _jump_to_selected;
        }
 
-       boost::optional<std::string> sound_output () const {
-               return _sound_output;
+       enum Nag {
+               NAG_DKDM_CONFIG,
+               NAG_ENCRYPTED_METADATA,
+               NAG_REMAKE_DECRYPTION_CHAIN,
+               NAG_COUNT
+       };
+
+       bool nagged (Nag nag) const {
+               return _nagged[nag];
+       }
+
+       bool preview_sound () const {
+               return _preview_sound;
+       }
+
+       std::string cover_sheet () const {
+               return _cover_sheet;
+       }
+
+       boost::optional<std::string> preview_sound_output () const {
+               return _preview_sound_output;
        }
 
-       /** @param n New number of local encoding threads */
-       void set_num_local_encoding_threads (int n) {
-               maybe_set (_num_local_encoding_threads, n);
+       void set_master_encoding_threads (int n) {
+               maybe_set (_master_encoding_threads, n);
+       }
+
+       void set_server_encoding_threads (int n) {
+               maybe_set (_server_encoding_threads, n);
        }
 
        void set_default_directory (boost::filesystem::path d) {
@@ -404,6 +437,10 @@ public:
                maybe_set (_default_container, c);
        }
 
+       void set_default_scale_to (Ratio const * c) {
+               maybe_set (_default_scale_to, c);
+       }
+
        void set_default_dcp_content_type (DCPContentType const * t) {
                maybe_set (_default_dcp_content_type, t);
        }
@@ -511,7 +548,7 @@ public:
        }
 #endif
 
-       void set_dkdms (std::vector<dcp::EncryptedKDM> dkdms) {
+       void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
                _dkdms = dkdms;
                changed ();
        }
@@ -526,18 +563,22 @@ public:
                maybe_set (_confirm_kdm_email, s);
        }
 
-       void set_sound_output (std::string o)
+       void set_preview_sound (bool s) {
+               maybe_set (_preview_sound, s, PREVIEW_SOUND);
+       }
+
+       void set_preview_sound_output (std::string o)
        {
-               maybe_set (_sound_output, o, SOUND_OUTPUT);
+               maybe_set (_preview_sound_output, o, PREVIEW_SOUND_OUTPUT);
        }
 
-       void unset_sound_output ()
+       void unset_preview_sound_output ()
        {
-               if (!_sound_output) {
+               if (!_preview_sound_output) {
                        return;
                }
 
-               _sound_output = boost::none;
+               _preview_sound_output = boost::none;
                changed ();
        }
 
@@ -568,6 +609,16 @@ public:
                maybe_set (_jump_to_selected, j);
        }
 
+       void set_nagged (Nag nag, bool nagged) {
+               maybe_set (_nagged[nag], nagged);
+       }
+
+       void set_cover_sheet (std::string s) {
+               maybe_set (_cover_sheet, s);
+       }
+
+       void reset_cover_sheet ();
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** Emitted if read() failed on an existing Config file.  There is nothing
@@ -590,6 +641,7 @@ public:
        static void drop ();
        static void restore_defaults ();
        static bool have_existing (std::string);
+       static boost::filesystem::path config_path ();
 
 private:
        Config ();
@@ -597,6 +649,7 @@ private:
        void read ();
        void set_defaults ();
        void set_kdm_email_to_default ();
+       void set_cover_sheet_to_default ();
        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;
@@ -619,8 +672,10 @@ private:
                changed (prop);
        }
 
-       /** number of threads to use for J2K encoding on the local machine */
-       int _num_local_encoding_threads;
+       /** number of threads which a master DoM should use for J2K encoding on the local machine */
+       int _master_encoding_threads;
+       /** number of threads which a server should use for J2K encoding on the local machine */
+       int _server_encoding_threads;
        /** default directory to put new films in */
        boost::optional<boost::filesystem::path> _default_directory;
        /** base port number to use for J2K encoding servers;
@@ -652,6 +707,7 @@ private:
        /** Default length of still image content (seconds) */
        int _default_still_length;
        Ratio const * _default_container;
+       Ratio const * _default_scale_to;
        DCPContentType const * _default_dcp_content_type;
        int _default_dcp_audio_channels;
        std::string _dcp_issuer;
@@ -690,7 +746,7 @@ private:
        bool _win32_console;
 #endif
        std::vector<boost::filesystem::path> _history;
-       std::vector<dcp::EncryptedKDM> _dkdms;
+       boost::shared_ptr<DKDMGroup> _dkdms;
        boost::filesystem::path _cinemas_file;
        bool _show_hints_before_make_dcp;
        bool _confirm_kdm_email;
@@ -698,12 +754,12 @@ private:
        dcp::NameFormat _kdm_container_name_format;
        dcp::NameFormat _dcp_metadata_filename_format;
        dcp::NameFormat _dcp_asset_filename_format;
-<<<<<<< 8de6a5d1d054bab25ab0d86bc48442d9d6adb849
        bool _jump_to_selected;
-=======
-       /** name of a specific sound output stream to use for preview */
-       boost::optional<std::string> _sound_output;
->>>>>>> First bits of audio support.
+       bool _nagged[NAG_COUNT];
+       bool _preview_sound;
+       /** name of a specific sound output stream to use for preview, or empty to use the default */
+       boost::optional<std::string> _preview_sound_output;
+       std::string _cover_sheet;
 
        /** Singleton instance, or 0 */
        static Config* _instance;