diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-01-04 21:26:18 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-01-04 21:26:18 +0000 |
| commit | 9ccaee9ed18688b3862b8b7fb7e73b69e71568e3 (patch) | |
| tree | ccea84223b46ae1bb8dfc9d362d2d6e8ace52d0a /src/lib | |
| parent | e21611dbada74946fcdb037386f0e58fad8fc97e (diff) | |
Set up a default KDM write mode and preselect the last used one when re-opening the KDM window (#1137).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 23 | ||||
| -rw-r--r-- | src/lib/config.h | 15 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 48568975e..2a8a3cc89 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -128,6 +128,7 @@ Config::set_defaults () } _sound = false; _sound_output = optional<string> (); + _last_kdm_write_type = KDM_WRITE_FLAT; /* I think the scaling factor here should be the ratio of the longest frame encode time to the shortest; if the thread count is T, longest time is L @@ -366,6 +367,15 @@ try _cover_sheet = f.optional_string_child("CoverSheet").get(); } _last_player_load_directory = f.optional_string_child("LastPlayerLoadDirectory"); + if (f.optional_string_child("LastKDMWriteType")) { + if (f.optional_string_child("LastKDMWriteType").get() == "flat") { + _last_kdm_write_type = KDM_WRITE_FLAT; + } else if (f.optional_string_child("LastKDMWriteType").get() == "folder") { + _last_kdm_write_type = KDM_WRITE_FOLDER; + } else if (f.optional_string_child("LastKDMWriteType").get() == "zip") { + _last_kdm_write_type = KDM_WRITE_ZIP; + } + } _frames_in_memory_multiplier = f.optional_number_child<int>("FramesInMemoryMultiplier").get_value_or(3); /* Replace any cinemas from config.xml with those from the configured file */ @@ -647,6 +657,19 @@ Config::write_config () const if (_last_player_load_directory) { root->add_child("LastPlayerLoadDirectory")->add_child_text(_last_player_load_directory->string()); } + if (_last_kdm_write_type) { + switch (_last_kdm_write_type.get()) { + case KDM_WRITE_FLAT: + root->add_child("LastKDMWriteType")->add_child_text("flat"); + break; + case KDM_WRITE_FOLDER: + root->add_child("LastKDMWriteType")->add_child_text("folder"); + break; + case KDM_WRITE_ZIP: + root->add_child("LastKDMWriteType")->add_child_text("zip"); + break; + } + } /* [XML] FramesInMemoryMultiplier value to multiply the encoding threads count by to get the maximum number of frames to be held in memory at once. */ diff --git a/src/lib/config.h b/src/lib/config.h index afa362a4c..a57fbd587 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -345,6 +345,16 @@ public: 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; } @@ -583,6 +593,10 @@ public: maybe_set (_last_player_load_directory, d); } + void set_last_kdm_write_type (KDMWriteType t) { + maybe_set (_last_kdm_write_type, t); + } + void unset_sound_output () { if (!_sound_output) { return; @@ -779,6 +793,7 @@ private: 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 */ |
