From 4d4f25d1774659e0dfae8e60e13c494cab0f0a44 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Mon, 5 Aug 2019 13:10:21 -0400 Subject: moved getting and setting executables to Settings --- src/settings.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index cfc5c1d7..a8dcfa39 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #include "settings.h" #include "serverinfo.h" +#include "executableslist.h" #include "appconfig.h" #include #include @@ -803,6 +804,49 @@ void Settings::setRecentDirectories(const std::map& map) m_Settings.endArray(); } +std::vector> Settings::getExecutables() const +{ + const int count = m_Settings.beginReadArray("customExecutables"); + std::vector> v; + + for (int i=0; i map; + + const auto keys = m_Settings.childKeys(); + for (auto&& key : keys) { + map[key] = m_Settings.value(key); + } + + v.push_back(map); + } + + m_Settings.endArray(); + + return v; +} + +void Settings::setExecutables(const std::vector>& v) +{ + m_Settings.remove("customExecutables"); + m_Settings.beginWriteArray("customExecutables"); + + int i = 0; + + for (const auto& map : v) { + m_Settings.setArrayIndex(i); + + for (auto&& p : map) { + m_Settings.setValue(p.first, p.second); + } + + ++i; + } + + m_Settings.endArray(); +} + GeometrySettings& Settings::geometry() { return m_Geometry; -- cgit v1.3.1