diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-03-09 21:40:10 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-03-09 21:40:10 -0600 |
| commit | abfbf684699d8f14a058ed4648e231024fe3c077 (patch) | |
| tree | f6c3c2943d20044c8987ef4519fe55cec78dd44b /src | |
| parent | d26c4e8ea2c2450b4abedf965803a1046cb55625 (diff) | |
Improve updating mod highlights when no mod is selected
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 21 | ||||
| -rw-r--r-- | src/mainwindow.h | 1 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0bdefe80..9f185349 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -375,7 +375,6 @@ MainWindow::MainWindow(QSettings &initSettings connect(ui->modList, SIGNAL(dropModeUpdate(bool)), m_OrganizerCore.modList(), SLOT(dropModeUpdate(bool))); - connect(ui->modList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(modlistSelectionChanged(QModelIndex,QModelIndex))); connect(m_ModListSortProxy, SIGNAL(filterActive(bool)), this, SLOT(modFilterActive(bool))); connect(m_ModListSortProxy, SIGNAL(layoutChanged()), this, SLOT(updateModCount())); connect(ui->modFilterEdit, SIGNAL(textChanged(QString)), m_ModListSortProxy, SLOT(updateFilter(QString))); @@ -2583,23 +2582,23 @@ void MainWindow::modlistChanged(const QModelIndexList&, int) updateModCount(); } -void MainWindow::modlistSelectionChanged(const QModelIndex ¤t, const QModelIndex&) +void MainWindow::modlistSelectionsChanged(const QItemSelection &selected) { - if (current.isValid()) { - ModInfo::Ptr selectedMod = ModInfo::getByIndex(current.data(Qt::UserRole + 1).toInt()); - m_OrganizerCore.modList()->setOverwriteMarkers(selectedMod->getModOverwrite(), selectedMod->getModOverwritten()); - m_OrganizerCore.modList()->setArchiveOverwriteMarkers(selectedMod->getModArchiveOverwrite(), selectedMod->getModArchiveOverwritten()); - m_OrganizerCore.modList()->setArchiveLooseOverwriteMarkers(selectedMod->getModArchiveLooseOverwrite(), selectedMod->getModArchiveLooseOverwritten()); + if (selected.count()) { + auto selection = selected.last(); + for (auto index : selection.indexes()) { + ModInfo::Ptr selectedMod = ModInfo::getByIndex(index.data(Qt::UserRole + 1).toInt()); + m_OrganizerCore.modList()->setOverwriteMarkers(selectedMod->getModOverwrite(), selectedMod->getModOverwritten()); + m_OrganizerCore.modList()->setArchiveOverwriteMarkers(selectedMod->getModArchiveOverwrite(), selectedMod->getModArchiveOverwritten()); + m_OrganizerCore.modList()->setArchiveLooseOverwriteMarkers(selectedMod->getModArchiveLooseOverwrite(), selectedMod->getModArchiveLooseOverwritten()); + } } else { m_OrganizerCore.modList()->setOverwriteMarkers(std::set<unsigned int>(), std::set<unsigned int>()); m_OrganizerCore.modList()->setArchiveOverwriteMarkers(std::set<unsigned int>(), std::set<unsigned int>()); m_OrganizerCore.modList()->setArchiveLooseOverwriteMarkers(std::set<unsigned int>(), std::set<unsigned int>()); } ui->modList->verticalScrollBar()->repaint(); -} -void MainWindow::modlistSelectionsChanged(const QItemSelection &selected) -{ m_OrganizerCore.pluginList()->highlightPlugins(ui->modList->selectionModel(), *m_OrganizerCore.directoryStructure(), *m_OrganizerCore.currentProfile()); ui->espList->verticalScrollBar()->repaint(); } @@ -5848,7 +5847,7 @@ void MainWindow::nxmTrackedModsAvailable(QVariant userData, QVariant resultData, break; } } - + modInfo->setIsTracked(found); modInfo->saveMeta(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 152591e8..d119f49c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -606,7 +606,6 @@ private slots: void about(); void delayedRemove(); - void modlistSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); void modListSortIndicatorChanged(int column, Qt::SortOrder order); void modListSectionResized(int logicalIndex, int oldSize, int newSize); |
