From 8449388da769c45ef8a441bccdeb062bc96d27ae Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 11 May 2018 23:29:45 +0100 Subject: Simple and optional messagebox notification when jobs finish. --- src/lib/config.cc | 5 +++++ src/lib/config.h | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/config.cc b/src/lib/config.cc index e2f2bbeb9..026c92c83 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -147,6 +147,7 @@ Config::set_defaults () */ _frames_in_memory_multiplier = 3; _decode_reduction = optional(); + _default_notify = false; _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -429,6 +430,7 @@ try } _frames_in_memory_multiplier = f.optional_number_child("FramesInMemoryMultiplier").get_value_or(3); _decode_reduction = f.optional_number_child("DecodeReduction"); + _default_notify = f.optional_bool_child("DefaultNotify").get_value_or(false); /* Replace any cinemas from config.xml with those from the configured file */ if (boost::filesystem::exists (_cinemas_file)) { @@ -745,6 +747,9 @@ Config::write_config () const root->add_child("DecodeReduction")->add_child_text(raw_convert(_decode_reduction.get())); } + /* [XML] DefaultNotify 1 to default jobs to notify when complete, otherwise 0 */ + root->add_child("DefaultNotify")->add_child_text(_default_notify ? "1" : "0"); + try { doc.write_to_file_formatted(config_file().string()); } catch (xmlpp::exception& e) { diff --git a/src/lib/config.h b/src/lib/config.h index c625e9242..1e16fc840 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -381,6 +381,10 @@ public: return _decode_reduction; } + bool default_notify () const { + return _default_notify; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -662,6 +666,10 @@ public: maybe_set (_decode_reduction, r); } + void set_default_notify (bool n) { + maybe_set (_default_notify, n); + } + void clear_history () { _history.clear (); changed (); @@ -723,7 +731,7 @@ public: /** 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 (); static boost::filesystem::path path (std::string file, bool create_directories = true); @@ -850,6 +858,7 @@ private: boost::optional _last_dkdm_write_type; int _frames_in_memory_multiplier; boost::optional _decode_reduction; + bool _default_notify; static int const _current_version; -- cgit v1.2.3