summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorBrian Munro <brian.alexander.munro@gmail.com>2017-12-05 06:34:47 +0200
committerGitHub <noreply@github.com>2017-12-05 06:34:47 +0200
commitfa598e86dbce096b5439ae704dd18cc5b1289191 (patch)
tree66f9ecd51775c9e184b1679fc2d6fecc74fb1d8a /src/modlist.cpp
parentc64e12a289066c6b4834c43a49ff631a33b2f3ce (diff)
parentffdc5ca7ccb24bc937ed5418b7a6e5a1b7d719dd (diff)
Merge pull request #135 from LePresidente/QT5.7
All changes done for 2.1.0
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index fca98aac..c6341251 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -60,7 +60,7 @@ ModList::ModList(QObject *parent)
, m_FontMetrics(QFont())
, m_DropOnItems(false)
{
- m_ContentIcons[ModInfo::CONTENT_PLUGIN] = std::make_tuple(":/MO/gui/content/plugin", tr("Game plugins (esp/esm)"));
+ m_ContentIcons[ModInfo::CONTENT_PLUGIN] = std::make_tuple(":/MO/gui/content/plugin", tr("Game Plugins (ESP/ESM/ESL)"));
m_ContentIcons[ModInfo::CONTENT_INTERFACE] = std::make_tuple(":/MO/gui/content/interface", tr("Interface"));
m_ContentIcons[ModInfo::CONTENT_MESH] = std::make_tuple(":/MO/gui/content/mesh", tr("Meshes"));
m_ContentIcons[ModInfo::CONTENT_BSA] = std::make_tuple(":/MO/gui/content/bsa", tr("BSA"));
@@ -69,6 +69,7 @@ ModList::ModList(QObject *parent)
m_ContentIcons[ModInfo::CONTENT_SKYPROC] = std::make_tuple(":/MO/gui/content/skyproc", tr("SkyProc Patcher"));
m_ContentIcons[ModInfo::CONTENT_SOUND] = std::make_tuple(":/MO/gui/content/sound", tr("Sound or Music"));
m_ContentIcons[ModInfo::CONTENT_TEXTURE] = std::make_tuple(":/MO/gui/content/texture", tr("Textures"));
+ m_ContentIcons[ModInfo::CONTENT_MCM] = std::make_tuple(":/MO/gui/content/menu", tr("MCM Configuration"));
m_LastCheck.start();
}
@@ -337,6 +338,7 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
int highlight = modInfo->getHighlight();
if (highlight & ModInfo::HIGHLIGHT_IMPORTANT) return QBrush(Qt::darkRed);
else if (highlight & ModInfo::HIGHLIGHT_INVALID) return QBrush(Qt::darkGray);
+ else if (highlight & ModInfo::HIGHLIGHT_PLUGIN) return QBrush(Qt::darkBlue);
} else if (column == COL_VERSION) {
if (!modInfo->getNewestVersion().isValid()) {
return QVariant();
@@ -349,7 +351,9 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
return QVariant();
} else if ((role == Qt::BackgroundRole)
|| (role == ViewMarkingScrollBar::DEFAULT_ROLE)) {
- if (m_Overwrite.find(modIndex) != m_Overwrite.end()) {
+ if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) {
+ return QColor(0, 0, 255, 32);
+ } else if (m_Overwrite.find(modIndex) != m_Overwrite.end()) {
return QColor(0, 255, 0, 32);
} else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) {
return QColor(255, 0, 0, 32);
@@ -684,6 +688,38 @@ int ModList::timeElapsedSinceLastChecked() const
return m_LastCheck.elapsed();
}
+void ModList::highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry)
+{
+ for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
+ ModInfo::getByIndex(i)->setPluginSelected(false);
+ }
+ for (QModelIndex idx : selected.indexes()) {
+ QString modName = idx.data().toString();
+
+ const MOShared::FileEntry::Ptr fileEntry = directoryEntry.findFile(modName.toStdWString());
+ if (fileEntry.get() != nullptr) {
+ QString fileName;
+ bool archive = false;
+ std::vector<int> origins;
+ {
+ std::vector<int> alternatives = fileEntry->getAlternatives();
+ origins.push_back(fileEntry->getOrigin(archive));
+ origins.insert(origins.end(), alternatives.begin(), alternatives.end());
+ }
+ for (int originId : origins) {
+ MOShared::FilesOrigin &origin = directoryEntry.getOriginByID(originId);
+ for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
+ if (ModInfo::getByIndex(i)->internalName() == QString::fromStdWString(origin.getName())) {
+ ModInfo::getByIndex(i)->setPluginSelected(true);
+ break;
+ }
+ }
+ }
+ }
+ }
+ notifyChange(0, rowCount() - 1);
+}
+
IModList::ModStates ModList::state(unsigned int modIndex) const
{
IModList::ModStates result;
@@ -1026,7 +1062,7 @@ QString ModList::getColumnToolTip(int column)
case COL_FLAGS: return tr("Emblemes to highlight things that might require attention.");
case COL_CONTENT: return tr("Depicts the content of the mod:<br>"
"<table cellspacing=7>"
- "<tr><td><img src=\":/MO/gui/content/plugin\" width=32/></td><td>Game plugins (esp/esm)</tr>"
+ "<tr><td><img src=\":/MO/gui/content/plugin\" width=32/></td><td>Game plugins (esp/esm/esl)</tr>"
"<tr><td><img src=\":/MO/gui/content/interface\" width=32/></td><td>Interface</tr>"
"<tr><td><img src=\":/MO/gui/content/mesh\" width=32/></td><td>Meshes</tr>"
"<tr><td><img src=\":/MO/gui/content/bsa\" width=32/></td><td>BSA</tr>"