diff options
| -rw-r--r-- | src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/modlist.cpp | 5 | ||||
| -rw-r--r-- | src/modlist.h | 2 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 11 | ||||
| -rw-r--r-- | src/pluginlist.h | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5b257977..752c5c76 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2341,13 +2341,13 @@ void MainWindow::modlistSelectionChanged(const QModelIndex ¤t, const QMode void MainWindow::modlistSelectionsChanged(const QItemSelection &selected)
{
- m_OrganizerCore.pluginList()->highlightPlugins(selected, *m_OrganizerCore.directoryStructure(), *m_OrganizerCore.currentProfile());
+ m_OrganizerCore.pluginList()->highlightPlugins(ui->modList->selectionModel(), *m_OrganizerCore.directoryStructure(), *m_OrganizerCore.currentProfile());
ui->espList->verticalScrollBar()->repaint();
}
void MainWindow::esplistSelectionsChanged(const QItemSelection &selected)
{
- m_OrganizerCore.modList()->highlightMods(selected, *m_OrganizerCore.directoryStructure());
+ m_OrganizerCore.modList()->highlightMods(ui->espList->selectionModel(), *m_OrganizerCore.directoryStructure());
ui->modList->verticalScrollBar()->repaint();
}
diff --git a/src/modlist.cpp b/src/modlist.cpp index 3f8fa0c0..539ba6fc 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "qtgroupingproxy.h"
#include "viewmarkingscrollbar.h"
#include "modlistsortproxy.h"
+#include "pluginlist.h"
#include "settings.h"
#include "modinforegular.h"
#include <appconfig.h>
@@ -768,12 +769,12 @@ int ModList::timeElapsedSinceLastChecked() const return m_LastCheck.elapsed();
}
-void ModList::highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry)
+void ModList::highlightMods(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry)
{
for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
ModInfo::getByIndex(i)->setPluginSelected(false);
}
- for (QModelIndex idx : selected.indexes()) {
+ for (QModelIndex idx : selection->selectedRows(PluginList::COL_NAME)) {
QString modName = idx.data().toString();
const MOShared::FileEntry::Ptr fileEntry = directoryEntry.findFile(modName.toStdWString());
diff --git a/src/modlist.h b/src/modlist.h index caad8c61..8de08da3 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -118,7 +118,7 @@ public: int timeElapsedSinceLastChecked() const;
- void highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry);
+ void highlightMods(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry);
public:
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index d56a4bde..21e716d3 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -21,6 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settings.h"
#include "scopeguard.h"
#include "modinfo.h"
+#include "modlist.h"
#include "viewmarkingscrollbar.h"
#include <utility.h>
#include <iplugingame.h>
@@ -119,14 +120,16 @@ QString PluginList::getColumnToolTip(int column) }
}
-void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile)
+void PluginList::highlightPlugins(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile)
{
for (auto &esp : m_ESPs) {
esp.m_ModSelected = false;
}
- for (QModelIndex idx : selected.indexes()) {
- ModInfo::Ptr selectedMod = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt());
- if (!selectedMod.isNull() && profile.modEnabled(idx.data(Qt::UserRole + 1).toInt())) {
+ for (QModelIndex idx : selection->selectedRows(ModList::COL_PRIORITY)) {
+ int modPriority = idx.data().toInt();
+ int modIndex = profile.modIndexByPriority(modPriority);
+ ModInfo::Ptr selectedMod = ModInfo::getByIndex(modIndex);
+ if (!selectedMod.isNull() && profile.modEnabled(modIndex)) {
QDir dir(selectedMod->absolutePath());
QStringList plugins = dir.entryList(QStringList() << "*.esp" << "*.esm" << "*.esl");
MOShared::FilesOrigin origin = directoryEntry.getOriginByName(selectedMod->internalName().toStdWString());
diff --git a/src/pluginlist.h b/src/pluginlist.h index 009c9153..f7817c37 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -206,7 +206,7 @@ public: static QString getColumnName(int column);
static QString getColumnToolTip(int column);
- void highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile);
+ void highlightPlugins(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile);
void refreshLoadOrder();
|
