summaryrefslogtreecommitdiff
path: root/src/editexecutablesdialog.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-06-08 00:30:51 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-06-15 14:40:40 -0400
commit57c7b1568518acefcbcc1801954a62fdc94e3b1c (patch)
tree99b8b51ed60045b6ad299ef745abcf4260552889 /src/editexecutablesdialog.h
parentf60431f92f9475d59a3e2af41c95cc6723892f9a (diff)
moved functionality to CustomOverwrites and ForcedLibraries helper classes
Diffstat (limited to 'src/editexecutablesdialog.h')
-rw-r--r--src/editexecutablesdialog.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 3145c94f..f8382915 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -27,6 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "iplugingame.h"
#include <QTimer>
#include <QAbstractButton>
+#include <optional>
namespace Ui {
class EditExecutablesDialog;
@@ -34,6 +35,44 @@ namespace Ui {
class ModList;
+
+/** helper class to manage custom overwrites within the edit executables
+ * dialog
+ **/
+class CustomOverwrites
+{
+public:
+ void load(Profile* p, const ExecutablesList& exes);
+ std::optional<QString> find(const QString& title) const;
+
+ void set(const QString& title, const QString& mod);
+ void rename(const QString& oldTitle, const QString& newTitle);
+ void remove(const QString& title);
+
+private:
+ std::map<QString, QString> m_map;
+};
+
+
+/** helper class to manage forced libraries within the edit executables dialog
+ **/
+class ForcedLibraries
+{
+public:
+ using list_type = QList<MOBase::ExecutableForcedLoadSetting>;
+
+ void load(Profile* p, const ExecutablesList& exes);
+ std::optional<list_type> find(const QString& title) const;
+
+ void set(const QString& title, const list_type& list);
+ void rename(const QString& oldTitle, const QString& newTitle);
+ void remove(const QString& title);
+
+private:
+ std::map<QString, list_type> m_map;
+};
+
+
/**
* @brief Dialog to manage the list of executables
**/
@@ -81,8 +120,8 @@ private slots:
private:
std::unique_ptr<Ui::EditExecutablesDialog> ui;
ExecutablesList m_executablesList;
- std::map<QString, QString> m_customOverwrites;
- std::map<QString, QList<MOBase::ExecutableForcedLoadSetting>> m_forcedLibraries;
+ CustomOverwrites m_customOverwrites;
+ ForcedLibraries m_forcedLibraries;
Profile *m_profile;
const MOBase::IPluginGame *m_gamePlugin;
bool m_settingUI;