summaryrefslogtreecommitdiff
path: root/src/lib/config.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-17 00:03:43 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-17 00:03:43 +0000
commitdd353e14791138fc44b55b6f234567d706d313ff (patch)
tree129fd07a8d93fc9930181e53ebf1b78f614af3b2 /src/lib/config.cc
parent0ca36c0d2b238a9e2165b5d113c22f144835a672 (diff)
Add recent files list to player.
Diffstat (limited to 'src/lib/config.cc')
-rw-r--r--src/lib/config.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 9106a9559..e5fd9d17a 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -309,11 +309,14 @@ try
_win32_console = f.optional_bool_child ("Win32Console").get_value_or (false);
#endif
- list<cxml::NodePtr> his = f.node_children ("History");
BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("History")) {
_history.push_back (i->content ());
}
+ BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("PlayerHistory")) {
+ _player_history.push_back (i->content ());
+ }
+
cxml::NodePtr signer = f.optional_node_child ("Signer");
if (signer) {
shared_ptr<dcp::CertificateChain> c (new dcp::CertificateChain ());
@@ -632,6 +635,10 @@ Config::write_config () const
root->add_child("History")->add_child_text (i.string ());
}
+ BOOST_FOREACH (boost::filesystem::path i, _player_history) {
+ root->add_child("PlayerHistory")->add_child_text (i.string ());
+ }
+
/* [XML] DKDMGroup A group of DKDMs, each with a <code>Name</code> attribute, containing other <code>&lt;DKDMGroup&gt;</code>
or <code>&lt;DKDM&gt;</code> tags.
*/
@@ -799,12 +806,24 @@ Config::set_cover_sheet_to_default ()
void
Config::add_to_history (boost::filesystem::path p)
{
+ add_to_history_internal (_history, p);
+}
+
+void
+Config::add_to_player_history (boost::filesystem::path p)
+{
+ add_to_history_internal (_player_history, p);
+}
+
+void
+Config::add_to_history_internal (vector<boost::filesystem::path>& h, boost::filesystem::path p)
+{
/* Remove existing instances of this path in the history */
- _history.erase (remove (_history.begin(), _history.end(), p), _history.end ());
+ h.erase (remove (h.begin(), h.end(), p), h.end ());
- _history.insert (_history.begin (), p);
- if (_history.size() > HISTORY_SIZE) {
- _history.pop_back ();
+ h.insert (h.begin (), p);
+ if (h.size() > HISTORY_SIZE) {
+ h.pop_back ();
}
changed ();