X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fconfig.h;h=fc6315242b21d084ccdf94c696dbb039296d648e;hp=8b8d7c38ae4d5ea4dd9d5ec4887557846a544ada;hb=89ae13638097f259f3e50b4b61068dd23451107d;hpb=532e7faa6ab37681999d1cbb0e9f8b6978198622 diff --git a/src/lib/config.h b/src/lib/config.h index 8b8d7c38a..fc6315242 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2017 Carl Hetherington This file is part of DCP-o-matic. @@ -47,9 +47,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 default_directory () const { @@ -66,6 +71,9 @@ public: enum Property { USE_ANY_SERVERS, SERVERS, + CINEMAS, + PREVIEW_SOUND, + PREVIEW_SOUND_OUTPUT, OTHER }; @@ -285,6 +293,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; } @@ -297,9 +309,38 @@ public: return _dcp_asset_filename_format; } - /** @param n New number of local encoding threads */ - void set_num_local_encoding_threads (int n) { - maybe_set (_num_local_encoding_threads, n); + bool jump_to_selected () const { + return _jump_to_selected; + } + + enum Nag { + NAG_DKDM_CONFIG, + NAG_ENCRYPTED_METADATA, + 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 preview_sound_output () const { + return _preview_sound_output; + } + + 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) { @@ -345,12 +386,12 @@ public: void add_cinema (boost::shared_ptr c) { _cinemas.push_back (c); - changed (); + changed (CINEMAS); } void remove_cinema (boost::shared_ptr c) { _cinemas.remove (c); - changed (); + changed (CINEMAS); } void set_allowed_dcp_frame_rates (std::list const & r) { @@ -512,6 +553,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); } @@ -531,14 +595,30 @@ public: void add_to_history (boost::filesystem::path p); + void set_jump_to_selected (bool j) { + 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 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 FailedToLoad; void write () const; + void write_config () const; + void write_cinemas () const; void save_template (boost::shared_ptr film, std::string name) const; bool existing_template (std::string name) const; @@ -551,6 +631,7 @@ public: static void drop (); static void restore_defaults (); static bool have_existing (std::string); + static boost::filesystem::path config_path (); private: Config (); @@ -558,23 +639,33 @@ private: void read (); void set_defaults (); void set_kdm_email_to_default (); - void write_config_xml () const; - void write_cinemas_xml () const; + void set_cover_sheet_to_default (); void read_cinemas (cxml::Document const & f); boost::shared_ptr create_certificate_chain (); boost::filesystem::path directory_or (boost::optional dir, boost::filesystem::path a) const; template - 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 + void maybe_set (boost::optional& 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 */ - 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 _default_directory; /** base port number to use for J2K encoding servers; @@ -649,8 +740,15 @@ 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 _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 _preview_sound_output; + std::string _cover_sheet; /** Singleton instance, or 0 */ static Config* _instance;