diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-06-21 23:56:13 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-06-21 23:56:13 +0200 |
| commit | df79d429bf1663a0053844b7e98690d2fdfb790d (patch) | |
| tree | 0543748fcf25600505701b769307874324324c06 /src/lib | |
| parent | d0a85f18ad5b0b2eacaa2c7071a0565ce6eb05d2 (diff) | |
Remember the path used for "add files" (#2049).
Also default to the home directory rather than where DoM was run from,
or something equally unhelpful.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 7 | ||||
| -rw-r--r-- | src/lib/config.h | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index ce02b046e..a8653a10c 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -176,6 +176,7 @@ Config::set_defaults () _player_kdm_directory = boost::none; _audio_mapping = boost::none; _custom_languages.clear (); + _add_files_path = boost::none; _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -553,6 +554,8 @@ try } catch (std::runtime_error& e) {} } + _add_files_path = f.optional_string_child("AddFilesPath"); + if (boost::filesystem::exists (_cinemas_file)) { cxml::Document f ("Cinemas"); f.read_file (_cinemas_file); @@ -976,6 +979,10 @@ Config::write_config () const for (auto const& i: _custom_languages) { root->add_child("CustomLanguage")->add_child_text(i.to_string()); } + if (_add_files_path) { + /* [XML] The default path that will be offered in the picker when adding files to a film */ + root->add_child("AddFilesPath")->add_child_text(_add_files_path->string()); + } try { auto const s = doc.write_to_string_formatted (); diff --git a/src/lib/config.h b/src/lib/config.h index 166267124..5b64922e6 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -539,6 +539,10 @@ public: return _custom_languages; } + boost::optional<boost::filesystem::path> add_files_path () const { + return _add_files_path; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -1048,6 +1052,11 @@ public: void add_custom_language (dcp::LanguageTag tag); + void set_add_files_path (boost::filesystem::path p) { + _add_files_path = p; + changed (); + } + void changed (Property p = OTHER); boost::signals2::signal<void (Property)> Changed; /** Emitted if read() failed on an existing Config file. There is nothing @@ -1260,6 +1269,7 @@ private: boost::optional<boost::filesystem::path> _player_kdm_directory; boost::optional<AudioMapping> _audio_mapping; std::vector<dcp::LanguageTag> _custom_languages; + boost::optional<boost::filesystem::path> _add_files_path; static int const _current_version; |
