Initial work on removing storage of subtitle times.
[dcpomatic.git] / src / lib / config.h
index 1bdbcb96e284247f30f2020afd56a5fd2e8e59e4..a574cc261a21793a34b8fd7e967aa2c3328b1f6c 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.
 
@@ -67,6 +67,8 @@ public:
                USE_ANY_SERVERS,
                SERVERS,
                CINEMAS,
+               PREVIEW_SOUND,
+               PREVIEW_SOUND_OUTPUT,
                OTHER
        };
 
@@ -286,6 +288,10 @@ public:
                return _confirm_kdm_email;
        }
 
+       dcp::NameFormat kdm_container_name_format () const {
+               return _kdm_container_name_format;
+       }
+
        dcp::NameFormat kdm_filename_format () const {
                return _kdm_filename_format;
        }
@@ -298,6 +304,18 @@ public:
                return _dcp_asset_filename_format;
        }
 
+       bool jump_to_selected () const {
+               return _jump_to_selected;
+       }
+
+       bool preview_sound () const {
+               return _preview_sound;
+       }
+
+       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);
@@ -513,6 +531,29 @@ public:
                maybe_set (_confirm_kdm_email, s);
        }
 
+       void set_preview_sound (bool s) {
+               maybe_set (_preview_sound, s, PREVIEW_SOUND);
+       }
+
+       void set_preview_sound_output (std::string o)
+       {
+               maybe_set (_preview_sound_output, o, PREVIEW_SOUND_OUTPUT);
+       }
+
+       void unset_preview_sound_output ()
+       {
+               if (!_preview_sound_output) {
+                       return;
+               }
+
+               _preview_sound_output = boost::none;
+               changed ();
+       }
+
+       void set_kdm_container_name_format (dcp::NameFormat n) {
+               maybe_set (_kdm_container_name_format, n);
+       }
+
        void set_kdm_filename_format (dcp::NameFormat n) {
                maybe_set (_kdm_filename_format, n);
        }
@@ -532,9 +573,13 @@ public:
 
        void add_to_history (boost::filesystem::path p);
 
+       void set_jump_to_selected (bool j) {
+               maybe_set (_jump_to_selected, j);
+       }
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
-       /** Emitted if ::read() failed on an existing Config file.  There is nothing
+       /** Emitted if read() failed on an existing Config file.  There is nothing
            a listener can do about it: this is just for information.
        */
        static boost::signals2::signal<void ()> FailedToLoad;
@@ -566,12 +611,21 @@ private:
        boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
 
        template <class T>
-       void maybe_set (T& member, T new_value) {
+       void maybe_set (T& member, T new_value, Property prop = OTHER) {
                if (member == new_value) {
                        return;
                }
                member = new_value;
-               changed ();
+               changed (prop);
+       }
+
+       template <class T>
+       void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
+               if (member && member.get() == new_value) {
+                       return;
+               }
+               member = new_value;
+               changed (prop);
        }
 
        /** number of threads to use for J2K encoding on the local machine */
@@ -650,8 +704,13 @@ private:
        bool _show_hints_before_make_dcp;
        bool _confirm_kdm_email;
        dcp::NameFormat _kdm_filename_format;
+       dcp::NameFormat _kdm_container_name_format;
        dcp::NameFormat _dcp_metadata_filename_format;
        dcp::NameFormat _dcp_asset_filename_format;
+       bool _jump_to_selected;
+       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;
 
        /** Singleton instance, or 0 */
        static Config* _instance;