summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 1ea2a612..f58473e9 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -178,6 +178,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <stdexcept>
#include <sstream>
#include <utility>
+#include <iterator>
#ifdef TEST_MODELS
#include "modeltest.h"
@@ -461,6 +462,7 @@ MainWindow::MainWindow(Settings &settings
resetActionIcons();
updatePluginCount();
updateModCount();
+ processUpdates();
}
void MainWindow::setupModList()
@@ -504,7 +506,7 @@ void MainWindow::setupModList()
ModConflictIconDelegate* conflictFlagDelegate = new ModConflictIconDelegate(
- ui->modList, ModList::COL_CONFLICTFLAGS, 120);
+ ui->modList, ModList::COL_CONFLICTFLAGS, 80);
connect(
ui->modList->header(), SIGNAL(sectionResized(int, int, int)),
@@ -2228,7 +2230,8 @@ void MainWindow::readSettings()
}
}
-void MainWindow::processUpdates(Settings& settings) {
+void MainWindow::processUpdates() {
+ auto& settings = m_OrganizerCore.settings();
const auto earliest = QVersionNumber::fromString("2.1.2").normalized();
const auto lastVersion = settings.version().value_or(earliest);
@@ -2237,15 +2240,6 @@ void MainWindow::processUpdates(Settings& settings) {
settings.processUpdates(currentVersion, lastVersion);
if (!settings.firstStart()) {
- if (lastVersion < QVersionNumber(2, 1, 3)) {
- bool lastHidden = true;
- for (int i = ModList::COL_GAME; i < ui->modList->model()->columnCount(); ++i) {
- bool hidden = ui->modList->header()->isSectionHidden(i);
- ui->modList->header()->setSectionHidden(i, lastHidden);
- lastHidden = hidden;
- }
- }
-
if (lastVersion < QVersionNumber(2, 1, 6)) {
ui->modList->header()->setSectionHidden(ModList::COL_NOTES, true);
}
@@ -2258,11 +2252,28 @@ void MainWindow::processUpdates(Settings& settings) {
}
if (lastVersion < QVersionNumber(2, 2, 2)) {
- bool lastHidden = true;
- for (int i = ModList::COL_CONFLICTFLAGS; i < ui->modList->model()->columnCount(); ++i) {
- bool hidden = ui->modList->header()->isSectionHidden(i);
- ui->modList->header()->setSectionHidden(i, lastHidden);
- lastHidden = hidden;
+ int pos1 = ui->modList->columnViewportPosition(ModList::COL_FLAGS);
+ int pos2 = 0;
+ if (pos1) {
+ ui->modList->showColumn(ModList::COL_CONFLICTFLAGS);
+ pos2 = ui->modList->columnViewportPosition(ModList::COL_CONFLICTFLAGS);
+ ui->modList->header()->moveSection(
+ ui->modList->header()->visualIndexAt(pos2),
+ ui->modList->header()->visualIndexAt(pos1)
+ );
+ }
+ }
+ } else {
+ { // Move conflict flags
+ int pos1 = ui->modList->columnViewportPosition(ModList::COL_FLAGS);
+ int pos2 = 0;
+ if (pos1) {
+ ui->modList->showColumn(ModList::COL_CONFLICTFLAGS);
+ pos2 = ui->modList->columnViewportPosition(ModList::COL_CONFLICTFLAGS);
+ ui->modList->header()->moveSection(
+ ui->modList->header()->visualIndexAt(pos2),
+ ui->modList->header()->visualIndexAt(pos1)
+ );
}
}
}