From b6b01a52db1877b16531137289641fb9be9833aa Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 2 Aug 2019 23:24:27 -0400
Subject: removed mentions of QSettings from main.cpp added necessary member
functions in Settings
---
src/mainwindow.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'src/mainwindow.cpp')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 28405819..7f7ded80 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -291,7 +291,7 @@ public:
};
-MainWindow::MainWindow(QSettings &initSettings
+MainWindow::MainWindow(Settings &settings
, OrganizerCore &organizerCore
, PluginContainer &pluginContainer
, QWidget *parent)
@@ -540,8 +540,8 @@ MainWindow::MainWindow(QSettings &initSettings
connect(&m_SaveMetaTimer, SIGNAL(timeout()), this, SLOT(saveModMetas()));
m_SaveMetaTimer.start(5000);
- setCategoryListVisible(initSettings.value("categorylist_visible", true).toBool());
- FileDialogMemory::restore(initSettings);
+ setCategoryListVisible(settings.isCategoryListVisible());
+ FileDialogMemory::restore(settings.directInterface());
fixCategories();
--
cgit v1.3.1
From 07f1ac7a96dcf4c91a24bb1d30af92851ecda78f Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sat, 3 Aug 2019 01:55:21 -0400
Subject: split into GeometrySettings removed most of storeSettings() from
OrganizerCore: QSettings handles saving by itself, no need for that removed
topLevelSplitter from ui, unused since the log widget is in a dock removed
QSettings from MainWindow::readSettings() replaced return values for some of
the new getters in Settings to std::optional
---
src/executableslist.cpp | 9 ++-
src/executableslist.h | 5 +-
src/filedialogmemory.cpp | 8 ++-
src/filedialogmemory.h | 5 +-
src/iuserinterface.h | 4 +-
src/main.cpp | 96 +++++++++++++++----------
src/mainwindow.cpp | 116 ++++++++++++++----------------
src/mainwindow.h | 4 +-
src/mainwindow.ui | 5 --
src/organizercore.cpp | 90 +++++-------------------
src/organizercore.h | 4 --
src/settings.cpp | 180 +++++++++++++++++++++++++++++++++++++++++++----
src/settings.h | 55 ++++++++++++---
13 files changed, 359 insertions(+), 222 deletions(-)
(limited to 'src/mainwindow.cpp')
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index 3f76bb6f..2b3219df 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see .
#include "iplugingame.h"
#include "utility.h"
+#include "settings.h"
#include
#include
@@ -64,7 +65,7 @@ bool ExecutablesList::empty() const
return m_Executables.empty();
}
-void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
+void ExecutablesList::load(const MOBase::IPluginGame* game, const Settings& s)
{
log::debug("loading executables");
@@ -74,6 +75,8 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
// executables from 2.2.0, see upgradeFromCustom()
bool needsUpgrade = false;
+ auto& settings = const_cast(s.directInterface());
+
int numCustomExecutables = settings.beginReadArray("customExecutables");
for (int i = 0; i < numCustomExecutables; ++i) {
settings.setArrayIndex(i);
@@ -108,8 +111,10 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
dump();
}
-void ExecutablesList::store(QSettings& settings)
+void ExecutablesList::store(Settings& s)
{
+ auto& settings = s.directInterface();
+
settings.remove("customExecutables");
settings.beginWriteArray("customExecutables");
diff --git a/src/executableslist.h b/src/executableslist.h
index eda2034e..23cf3cfe 100644
--- a/src/executableslist.h
+++ b/src/executableslist.h
@@ -29,6 +29,7 @@ along with Mod Organizer. If not, see .
#include
namespace MOBase { class IPluginGame; class ExecutableInfo; }
+class Settings;
/*!
* @brief Information about an executable
@@ -103,7 +104,7 @@ public:
/**
* @brief initializes the list from the settings and the given plugin
**/
- void load(const MOBase::IPluginGame* game, QSettings& settings);
+ void load(const MOBase::IPluginGame* game, const Settings& settings);
/**
* @brief re-adds all the executables from the plugin and renames existing
@@ -114,7 +115,7 @@ public:
/**
* @brief writes the current list to the settings
*/
- void store(QSettings& settings);
+ void store(Settings& settings);
/**
* @brief get an executable by name
diff --git a/src/filedialogmemory.cpp b/src/filedialogmemory.cpp
index 308a175e..48828563 100644
--- a/src/filedialogmemory.cpp
+++ b/src/filedialogmemory.cpp
@@ -27,8 +27,10 @@ FileDialogMemory::FileDialogMemory()
}
-void FileDialogMemory::save(QSettings &settings)
+void FileDialogMemory::save(Settings& s)
{
+ auto& settings = s.directInterface();
+
settings.remove("recentDirectories");
settings.beginWriteArray("recentDirectories");
int index = 0;
@@ -42,8 +44,10 @@ void FileDialogMemory::save(QSettings &settings)
}
-void FileDialogMemory::restore(QSettings &settings)
+void FileDialogMemory::restore(const Settings& s)
{
+ auto& settings = const_cast(s.directInterface());
+
int size = settings.beginReadArray("recentDirectories");
for (int i = 0; i < size; ++i) {
settings.setArrayIndex(i);
diff --git a/src/filedialogmemory.h b/src/filedialogmemory.h
index 1a72b289..d214a8e6 100644
--- a/src/filedialogmemory.h
+++ b/src/filedialogmemory.h
@@ -23,7 +23,6 @@ along with Mod Organizer. If not, see .
#include