diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-11-30 20:55:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-30 20:55:00 -0600 |
| commit | c55a923bb8b9b66661f32beed8445602400ef318 (patch) | |
| tree | 850ead2730c8ab50babc865a505a513d8fba5f46 /src/modlist.cpp | |
| parent | 7ec0b79eb49a27a3516d799a80d57000cde344da (diff) | |
| parent | 797a007eab2695c231a00240225d77b3a9928992 (diff) | |
Merge pull request #132 from Silarn/mainline_dev
Numerous updates
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 0aea7a98..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/esl)"));
+ 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;
|
