Set up a default KDM write mode and preselect the last used one when re-opening the...
[dcpomatic.git] / src / lib / config.h
index 200857aa9f74be788bbac14089eacda2d41e71c6..a57fbd587e99347c06f804a04a1a80c193323f8b 100644 (file)
@@ -73,8 +73,8 @@ public:
                USE_ANY_SERVERS,
                SERVERS,
                CINEMAS,
-               PREVIEW_SOUND,
-               PREVIEW_SOUND_OUTPUT,
+               SOUND,
+               SOUND_OUTPUT,
                OTHER
        };
 
@@ -329,16 +329,34 @@ public:
                return _nagged[nag];
        }
 
-       bool preview_sound () const {
-               return _preview_sound;
+       bool sound () const {
+               return _sound;
        }
 
        std::string cover_sheet () const {
                return _cover_sheet;
        }
 
-       boost::optional<std::string> preview_sound_output () const {
-               return _preview_sound_output;
+       boost::optional<std::string> sound_output () const {
+               return _sound_output;
+       }
+
+       boost::optional<boost::filesystem::path> last_player_load_directory () const {
+               return _last_player_load_directory;
+       }
+
+       enum KDMWriteType {
+               KDM_WRITE_FLAT,
+               KDM_WRITE_FOLDER,
+               KDM_WRITE_ZIP
+       };
+
+       boost::optional<KDMWriteType> last_kdm_write_type () const {
+               return _last_kdm_write_type;
+       }
+
+       int frames_in_memory_multiplier () const {
+               return _frames_in_memory_multiplier;
        }
 
        void set_master_encoding_threads (int n) {
@@ -563,22 +581,28 @@ public:
                maybe_set (_confirm_kdm_email, s);
        }
 
-       void set_preview_sound (bool s) {
-               maybe_set (_preview_sound, s, PREVIEW_SOUND);
+       void set_sound (bool s) {
+               maybe_set (_sound, s, SOUND);
+       }
+
+       void set_sound_output (std::string o) {
+               maybe_set (_sound_output, o, SOUND_OUTPUT);
        }
 
-       void set_preview_sound_output (std::string o)
-       {
-               maybe_set (_preview_sound_output, o, PREVIEW_SOUND_OUTPUT);
+       void set_last_player_load_directory (boost::filesystem::path d) {
+               maybe_set (_last_player_load_directory, d);
        }
 
-       void unset_preview_sound_output ()
-       {
-               if (!_preview_sound_output) {
+       void set_last_kdm_write_type (KDMWriteType t) {
+               maybe_set (_last_kdm_write_type, t);
+       }
+
+       void unset_sound_output () {
+               if (!_sound_output) {
                        return;
                }
 
-               _preview_sound_output = boost::none;
+               _sound_output = boost::none;
                changed ();
        }
 
@@ -598,6 +622,10 @@ public:
                maybe_set (_dcp_asset_filename_format, n);
        }
 
+       void set_frames_in_memory_multiplier (int m) {
+               maybe_set (_frames_in_memory_multiplier, m);
+       }
+
        void clear_history () {
                _history.clear ();
                changed ();
@@ -625,10 +653,14 @@ public:
            a listener can do about it: this is just for information.
        */
        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;
 
        void write () const;
        void write_config () const;
        void write_cinemas () const;
+       void link (boost::filesystem::path new_file) const;
+       void copy_and_link (boost::filesystem::path new_file) const;
 
        void save_template (boost::shared_ptr<const Film> film, std::string name) const;
        bool existing_template (std::string name) const;
@@ -641,12 +673,11 @@ public:
        static void drop ();
        static void restore_defaults ();
        static bool have_existing (std::string);
-       static boost::filesystem::path config_path ();
+       static boost::filesystem::path config_file ();
 
 private:
        Config ();
        static boost::filesystem::path path (std::string file, bool create_directories = true);
-       static boost::filesystem::path target (boost::filesystem::path file);
        void read ();
        void set_defaults ();
        void set_kdm_email_to_default ();
@@ -757,10 +788,13 @@ private:
        dcp::NameFormat _dcp_asset_filename_format;
        bool _jump_to_selected;
        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;
+       bool _sound;
+       /** name of a specific sound output stream to use, or empty to use the default */
+       boost::optional<std::string> _sound_output;
        std::string _cover_sheet;
+       boost::optional<boost::filesystem::path> _last_player_load_directory;
+       boost::optional<KDMWriteType> _last_kdm_write_type;
+       int _frames_in_memory_multiplier;
 
        /** Singleton instance, or 0 */
        static Config* _instance;