From 0c66eff01358e75ff524f395aeb634ec34a47313 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 13 Jan 2023 20:40:24 +0100 Subject: Add options for where the add files dialog starts (#2413). --- src/lib/config.cc | 13 +++++++++++++ src/lib/config.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'src/lib') diff --git a/src/lib/config.cc b/src/lib/config.cc index e3325859f..2db50d687 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -153,6 +153,7 @@ Config::set_defaults () _sound_output = optional (); _last_kdm_write_type = KDM_WRITE_FLAT; _last_dkdm_write_type = DKDM_WRITE_INTERNAL; + _default_add_file_location = DefaultAddFileLocation::SAME_AS_LAST_TIME; /* 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 @@ -620,6 +621,14 @@ try _main_divider_sash_position = f.optional_number_child("MainDividerSashPosition"); _main_content_divider_sash_position = f.optional_number_child("MainContentDividerSashPosition"); + if (auto loc = f.optional_string_child("DefaultAddFileLocation")) { + if (*loc == "last") { + _default_add_file_location = DefaultAddFileLocation::SAME_AS_LAST_TIME; + } else if (*loc == "project") { + _default_add_file_location = DefaultAddFileLocation::SAME_AS_PROJECT; + } + } + _export.read(f.optional_node_child("Export")); } catch (...) { @@ -1097,6 +1106,10 @@ Config::write_config () const root->add_child("MainContentDividerSashPosition")->add_child_text(raw_convert(*_main_content_divider_sash_position)); } + root->add_child("DefaultAddFileLocation")->add_child_text( + _default_add_file_location == DefaultAddFileLocation::SAME_AS_LAST_TIME ? "last" : "project" + ); + _export.write(root->add_child("Export")); auto target = config_write_file(); diff --git a/src/lib/config.h b/src/lib/config.h index b6a1a535d..a816cd89b 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -603,6 +603,15 @@ public: return _main_content_divider_sash_position; } + enum class DefaultAddFileLocation { + SAME_AS_LAST_TIME, + SAME_AS_PROJECT + }; + + DefaultAddFileLocation default_add_file_location() const { + return _default_add_file_location; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -1172,6 +1181,10 @@ public: maybe_set(_main_content_divider_sash_position, position); } + void set_default_add_file_location(DefaultAddFileLocation location) { + maybe_set(_default_add_file_location, location); + } + void changed (Property p = OTHER); boost::signals2::signal Changed; /** Emitted if read() failed on an existing Config file. There is nothing @@ -1408,6 +1421,7 @@ private: boost::optional _last_release_notes_version; boost::optional _main_divider_sash_position; boost::optional _main_content_divider_sash_position; + DefaultAddFileLocation _default_add_file_location; ExportConfig _export; -- cgit v1.2.3