summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-08-03 02:30:20 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-08-04 06:09:48 -0400
commite4418b95fa24f9caea32adfe9d957ce37e46f127 (patch)
tree0c987b752f3c0890ce4fe8a0978bb5cebe1ac65a /src/mainwindow.cpp
parent07f1ac7a96dcf4c91a24bb1d30af92851ecda78f (diff)
moved settings updates to Settings::processUpdates()
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e77d08b1..0618f949 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2280,11 +2280,15 @@ void MainWindow::readSettings(const Settings& settings)
DockFixer::restore(this, settings);
}
-void MainWindow::processUpdates() {
- QSettings settings(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::iniFileName()), QSettings::IniFormat);
- QVersionNumber lastVersion = QVersionNumber::fromString(settings.value("version", "2.1.2").toString()).normalized();
- QVersionNumber currentVersion = QVersionNumber::fromString(m_OrganizerCore.getVersion().displayString()).normalized();
- if (!m_OrganizerCore.settings().directInterface().value("first_start", true).toBool()) {
+void MainWindow::processUpdates(Settings& settings) {
+ const auto earliest = QVersionNumber::fromString("2.1.2").normalized();
+
+ const auto lastVersion = settings.getVersion().value_or(earliest);
+ const auto currentVersion = m_OrganizerCore.getVersion().asQVersionNumber();
+
+ settings.processUpdates(currentVersion, lastVersion);
+
+ if (!settings.getFirstStart()) {
if (lastVersion < QVersionNumber(2, 1, 3)) {
bool lastHidden = true;
for (int i = ModList::COL_GAME; i < ui->modList->model()->columnCount(); ++i) {
@@ -2293,41 +2297,20 @@ void MainWindow::processUpdates() {
lastHidden = hidden;
}
}
+
if (lastVersion < QVersionNumber(2, 1, 6)) {
ui->modList->header()->setSectionHidden(ModList::COL_NOTES, true);
}
- if (lastVersion < QVersionNumber(2, 2, 0)) {
- QSettings &instance = Settings::instance().directInterface();
- instance.beginGroup("Settings");
- instance.remove("steam_password");
- instance.remove("nexus_username");
- instance.remove("nexus_password");
- instance.remove("nexus_login");
- instance.remove("nexus_api_key");
- instance.remove("ask_for_nexuspw");
- instance.remove("nmm_version");
- instance.endGroup();
- instance.beginGroup("Servers");
- instance.remove("");
- instance.endGroup();
- }
+
if (lastVersion < QVersionNumber(2, 2, 1)) {
// hide new columns by default
for (int i=DownloadList::COL_MODNAME; i<DownloadList::COL_COUNT; ++i) {
ui->downloadView->header()->hideSection(i);
}
}
- if (lastVersion < QVersionNumber(2, 2, 2)) {
- QSettings &instance = Settings::instance().directInterface();
-
- // log splitter is gone, it's a dock now
- instance.remove("log_split");
- }
}
- if (currentVersion > lastVersion) {
- //NOP
- } else if (currentVersion < lastVersion) {
+ if (currentVersion < lastVersion) {
const auto text = tr(
"Notice: Your current MO version (%1) is lower than the previously used one (%2). "
"The GUI may not downgrade gracefully, so you may experience oddities. "
@@ -2337,9 +2320,6 @@ void MainWindow::processUpdates() {
log::warn("{}", text);
}
-
- //save version in all case
- settings.setValue("version", currentVersion.toString());
}
void MainWindow::storeSettings(Settings& s) {