From c66c2f0cc3371a26edb6cf2198bcc3fc45b26079 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 4 Sep 2022 20:50:06 +0200 Subject: [PATCH] Split up Config::read(). --- src/lib/config.cc | 44 ++++++++++++++++++++++++++++++++------------ src/lib/config.h | 3 +++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/lib/config.cc b/src/lib/config.cc index c9b428571..d9a39077e 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -270,6 +270,15 @@ Config::backup () void Config::read () +{ + read_config(); + read_cinemas(); + read_dkdm_recipients(); +} + + +void +Config::read_config() try { cxml::Document f ("Config"); @@ -597,18 +606,6 @@ try _last_release_notes_version = f.optional_string_child("LastReleaseNotesVersion"); _export.read(f.optional_node_child("Export")); - - if (boost::filesystem::exists (_cinemas_file)) { - cxml::Document f ("Cinemas"); - f.read_file (_cinemas_file); - read_cinemas (f); - } - - if (boost::filesystem::exists (_dkdm_recipients_file)) { - cxml::Document f ("DKDMRecipients"); - f.read_file (_dkdm_recipients_file); - read_dkdm_recipients (f); - } } catch (...) { if (have_existing("config.xml") || have_existing("cinemas.xml") || have_existing("dkdm_recipients.xml")) { @@ -624,6 +621,29 @@ catch (...) { write (); } + +void +Config::read_cinemas() +{ + if (boost::filesystem::exists (_cinemas_file)) { + cxml::Document f ("Cinemas"); + f.read_file (_cinemas_file); + read_cinemas (f); + } +} + + +void +Config::read_dkdm_recipients() +{ + if (boost::filesystem::exists (_dkdm_recipients_file)) { + cxml::Document f ("DKDMRecipients"); + f.read_file (_dkdm_recipients_file); + read_dkdm_recipients (f); + } +} + + /** @return Singleton instance */ Config * Config::instance () diff --git a/src/lib/config.h b/src/lib/config.h index 8f1029910..96016d75b 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -1204,6 +1204,9 @@ public: private: Config (); void read () override; + void read_config(); + void read_cinemas(); + void read_dkdm_recipients(); void set_defaults (); void set_kdm_email_to_default (); void set_notification_email_to_default (); -- 2.30.2