X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fconfig.h;h=1e16fc840a607814bd8fcef1891151cb2918a569;hb=8449388da769c45ef8a441bccdeb062bc96d27ae;hp=f2d224898fce5e3f45ff2bf0d7862c9f0be51aac;hpb=bb80004d3201047a33dd251ea6c3f6de2b47cb3b;p=dcpomatic.git diff --git a/src/lib/config.h b/src/lib/config.h index f2d224898..1e16fc840 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington 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. @@ -72,8 +73,8 @@ public: USE_ANY_SERVERS, SERVERS, CINEMAS, - PREVIEW_SOUND, - PREVIEW_SOUND_OUTPUT, + SOUND, + SOUND_OUTPUT, OTHER }; @@ -163,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; } @@ -191,6 +196,10 @@ public: return _default_interop; } + bool default_upload_after_make_dcp () { + return _default_upload_after_make_dcp; + } + void set_default_kdm_directory (boost::filesystem::path d) { if (_default_kdm_directory && _default_kdm_directory.get() == d) { return; @@ -277,7 +286,11 @@ public: return _history; } - std::vector dkdms () const { + std::vector player_history () const { + return _player_history; + } + + boost::shared_ptr dkdms () const { return _dkdms; } @@ -315,6 +328,9 @@ public: enum Nag { NAG_DKDM_CONFIG, + NAG_ENCRYPTED_METADATA, + NAG_REMAKE_DECRYPTION_CHAIN, + NAG_BAD_SIGNER_CHAIN, NAG_COUNT }; @@ -322,14 +338,55 @@ public: return _nagged[nag]; } - bool preview_sound () const { - return _preview_sound; + bool sound () const { + return _sound; } - boost::optional preview_sound_output () const { - return _preview_sound_output; + std::string cover_sheet () const { + return _cover_sheet; } + boost::optional sound_output () const { + return _sound_output; + } + + boost::optional last_player_load_directory () const { + return _last_player_load_directory; + } + + enum KDMWriteType { + KDM_WRITE_FLAT, + KDM_WRITE_FOLDER, + KDM_WRITE_ZIP + }; + + boost::optional last_kdm_write_type () const { + return _last_kdm_write_type; + } + + enum DKDMWriteType { + DKDM_WRITE_INTERNAL, + DKDM_WRITE_FILE + }; + + boost::optional last_dkdm_write_type () const { + return _last_dkdm_write_type; + } + + int frames_in_memory_multiplier () const { + return _frames_in_memory_multiplier; + } + + boost::optional decode_reduction () const { + return _decode_reduction; + } + + bool default_notify () const { + return _default_notify; + } + + /* SET (mostly) */ + void set_master_encoding_threads (int n) { maybe_set (_master_encoding_threads, n); } @@ -426,6 +483,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); } @@ -454,6 +515,10 @@ public: maybe_set (_default_interop, i); } + void set_default_upload_after_make_dcp (bool u) { + maybe_set (_default_upload_after_make_dcp, u); + } + void set_mail_server (std::string s) { maybe_set (_mail_server, s); } @@ -533,7 +598,7 @@ public: } #endif - void set_dkdms (std::vector dkdms) { + void set_dkdms (boost::shared_ptr dkdms) { _dkdms = dkdms; changed (); } @@ -548,22 +613,32 @@ 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 set_last_dkdm_write_type (DKDMWriteType t) { + maybe_set (_last_dkdm_write_type, t); + } + + void unset_sound_output () { + if (!_sound_output) { return; } - _preview_sound_output = boost::none; + _sound_output = boost::none; changed (); } @@ -583,12 +658,30 @@ public: maybe_set (_dcp_asset_filename_format, n); } + void set_frames_in_memory_multiplier (int m) { + maybe_set (_frames_in_memory_multiplier, m); + } + + void set_decode_reduction (boost::optional r) { + maybe_set (_decode_reduction, r); + } + + void set_default_notify (bool n) { + maybe_set (_default_notify, n); + } + void clear_history () { _history.clear (); changed (); } + void clear_player_history () { + _player_history.clear (); + changed (); + } + void add_to_history (boost::filesystem::path p); + void add_to_player_history (boost::filesystem::path p); void set_jump_to_selected (bool j) { maybe_set (_jump_to_selected, j); @@ -598,16 +691,30 @@ public: 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 a listener can do about it: this is just for information. */ static boost::signals2::signal FailedToLoad; + /** Emitted if read() issued a warning which the user might want to know about */ + static boost::signals2::signal Warning; + /** Emitted if there is a bad certificate in the signer chain. Handler can call + * true to ask Config to re-create the chain. + */ + static boost::signals2::signal BadSignerChain; 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 film, std::string name) const; bool existing_template (std::string name) const; @@ -620,7 +727,10 @@ 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 (); + + /** If set, this overrides the standard path (in home, Library, AppData or wherever) for config.xml and cinemas.xml */ + static boost::optional override_path; private: Config (); @@ -628,9 +738,12 @@ 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 create_certificate_chain (); boost::filesystem::path directory_or (boost::optional dir, boost::filesystem::path a) const; + void add_to_history_internal (std::vector& h, boost::filesystem::path p); + void backup (); template void maybe_set (T& member, T new_value, Property prop = OTHER) { @@ -685,6 +798,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; @@ -696,6 +810,7 @@ private: the home directory will be offered. */ boost::optional _default_kdm_directory; + bool _default_upload_after_make_dcp; std::list > _cinemas; std::string _mail_server; int _mail_port; @@ -723,7 +838,8 @@ private: bool _win32_console; #endif std::vector _history; - std::vector _dkdms; + std::vector _player_history; + boost::shared_ptr _dkdms; boost::filesystem::path _cinemas_file; bool _show_hints_before_make_dcp; bool _confirm_kdm_email; @@ -733,9 +849,18 @@ 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 _preview_sound_output; + bool _sound; + /** name of a specific sound output stream to use, or empty to use the default */ + boost::optional _sound_output; + std::string _cover_sheet; + boost::optional _last_player_load_directory; + boost::optional _last_kdm_write_type; + boost::optional _last_dkdm_write_type; + int _frames_in_memory_multiplier; + boost::optional _decode_reduction; + bool _default_notify; + + static int const _current_version; /** Singleton instance, or 0 */ static Config* _instance;