From 028c8eafa982a5b126544f733880dd7711e0786a Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sun, 8 Oct 2023 04:17:07 -0500 Subject: Additional overlay plugin support * Add isOverlayFlagged to IPluginList * Further notate plugin list * Rename to match xEdit / Wrye / LOOT * Update counter --- src/pluginlist.cpp | 27 ++++++++++++++++++++------- src/pluginlist.h | 4 ++-- src/pluginlistproxy.cpp | 5 +++++ src/pluginlistproxy.h | 1 + src/pluginlistview.cpp | 16 +++++++++++++--- 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 7b732af8..489e312b 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -1006,13 +1006,13 @@ bool PluginList::isLightFlagged(const QString& name) const } } -bool PluginList::isOverrideFlagged(const QString& name) const +bool PluginList::isOverlayFlagged(const QString& name) const { auto iter = m_ESPsByName.find(name); if (iter == m_ESPsByName.end()) { return false; } else { - return m_ESPs[iter->second].isOverrideFlagged; + return m_ESPs[iter->second].isOverlayFlagged; } } @@ -1093,7 +1093,7 @@ void PluginList::generatePluginIndexes() .arg((numESLs) % 4096, 3, 16, QChar('0')) .toUpper(); ++numESLs; - } else if (overridePluginsSupported && m_ESPs[i].isOverrideFlagged) { + } else if (overridePluginsSupported && m_ESPs[i].isOverlayFlagged) { m_ESPs[i].index = QString(""); ++numSkipped; } else { @@ -1233,6 +1233,8 @@ QVariant PluginList::fontData(const QModelIndex& modelIndex) const result.setWeight(QFont::Bold); } else if (m_ESPs[index].isLightFlagged) { result.setItalic(true); + } else if (m_ESPs[index].isOverlayFlagged) { + result.setUnderline(true); } return result; @@ -1327,6 +1329,13 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const .arg(type); } + if (esp.isOverlayFlagged) { + toolTip += + "

" + tr("This plugin is flagged as an overlay plugin. It contains only " + "modified records and will overlay those changes onto the " + "existing records in memory. It takes no memory space."); + } + if (esp.forceDisabled) { toolTip += "

" + tr("This game does not currently permit custom plugin " "loading. There may be manual workarounds."); @@ -1447,6 +1456,10 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const result.append(":/MO/gui/awaiting"); } + if (esp.isOverlayFlagged) { + result.append(":/MO/gui/instance_switch"); + } + if (info && !info->loot.dirty.empty()) { result.append(":/MO/gui/edit_clear"); } @@ -1759,7 +1772,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn bool forceDisabled, const QString& originName, const QString& fullPath, bool hasIni, std::set archives, bool lightSupported, - bool overrideSupported) + bool overlaySupported) : name(name), fullPath(fullPath), enabled(forceLoaded), forceLoaded(forceLoaded), forceEnabled(forceEnabled), forceDisabled(forceDisabled), priority(0), loadOrder(-1), originName(originName), hasIni(hasIni), @@ -1771,9 +1784,9 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn hasMasterExtension = (extension == "esm"); hasLightExtension = lightSupported && (extension == "esl"); isMasterFlagged = file.isMaster(); - isOverrideFlagged = overrideSupported && file.isOverride(); + isOverlayFlagged = overlaySupported && file.isOverlay(); isLightFlagged = - lightSupported && !isOverrideFlagged && file.isLight(overrideSupported); + lightSupported && !isOverlayFlagged && file.isLight(overlaySupported); author = QString::fromLatin1(file.author().c_str()); description = QString::fromLatin1(file.description().c_str()); @@ -1786,7 +1799,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn hasMasterExtension = false; hasLightExtension = false; isMasterFlagged = false; - isOverrideFlagged = false; + isOverlayFlagged = false; isLightFlagged = false; } } diff --git a/src/pluginlist.h b/src/pluginlist.h index db32d911..10bb3997 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -241,7 +241,7 @@ public: bool hasLightExtension(const QString& name) const; bool isMasterFlagged(const QString& name) const; bool isLightFlagged(const QString& name) const; - bool isOverrideFlagged(const QString& name) const; + bool isOverlayFlagged(const QString& name) const; boost::signals2::connection onRefreshed(const std::function& callback); boost::signals2::connection @@ -333,7 +333,7 @@ private: bool hasLightExtension; bool isMasterFlagged; bool isLightFlagged; - bool isOverrideFlagged; + bool isOverlayFlagged; bool modSelected; QString author; QString description; diff --git a/src/pluginlistproxy.cpp b/src/pluginlistproxy.cpp index e5fa5e01..a056a38d 100644 --- a/src/pluginlistproxy.cpp +++ b/src/pluginlistproxy.cpp @@ -118,3 +118,8 @@ bool PluginListProxy::isLightFlagged(const QString& name) const { return m_Proxied->isLightFlagged(name); } + +bool PluginListProxy::isOverlayFlagged(const QString& name) const +{ + return m_Proxied->isOverlayFlagged(name); +} diff --git a/src/pluginlistproxy.h b/src/pluginlistproxy.h index 63602043..98e62475 100644 --- a/src/pluginlistproxy.h +++ b/src/pluginlistproxy.h @@ -33,6 +33,7 @@ public: bool hasLightExtension(const QString& name) const override; bool isMasterFlagged(const QString& name) const override; bool isLightFlagged(const QString& name) const override; + bool isOverlayFlagged(const QString& name) const override; private: friend class OrganizerProxy; diff --git a/src/pluginlistview.cpp b/src/pluginlistview.cpp index 3c2bf000..28f77821 100644 --- a/src/pluginlistview.cpp +++ b/src/pluginlistview.cpp @@ -58,9 +58,11 @@ void PluginListView::updatePluginCount() { int activeMasterCount = 0; int activeLightMasterCount = 0; + int activeOverlayCount = 0; int activeRegularCount = 0; int masterCount = 0; int lightMasterCount = 0; + int overlayCount = 0; int regularCount = 0; int activeVisibleCount = 0; @@ -78,6 +80,10 @@ void PluginListView::updatePluginCount() masterCount++; activeMasterCount += active; activeVisibleCount += visible && active; + } else if (list->isOverlayFlagged(plugin)) { + overlayCount++; + activeOverlayCount += active; + activeVisibleCount += visible && active; } else { regularCount++; activeRegularCount += active; @@ -85,8 +91,9 @@ void PluginListView::updatePluginCount() } } - int activeCount = activeMasterCount + activeLightMasterCount + activeRegularCount; - int totalCount = masterCount + lightMasterCount + regularCount; + int activeCount = activeMasterCount + activeLightMasterCount + activeOverlayCount + + activeRegularCount; + int totalCount = masterCount + lightMasterCount + overlayCount + regularCount; ui.counter->display(activeVisibleCount); ui.counter->setToolTip( @@ -99,6 +106,7 @@ void PluginListView::updatePluginCount() "ESMs+ESPs:%9 %10" "ESLs:%5 %6" + "Overlay:%11 %12" "") .arg(activeCount) .arg(totalCount) @@ -109,7 +117,9 @@ void PluginListView::updatePluginCount() .arg(activeRegularCount) .arg(regularCount) .arg(activeMasterCount + activeRegularCount) - .arg(masterCount + regularCount)); + .arg(masterCount + regularCount) + .arg(activeOverlayCount) + .arg(overlayCount)); } void PluginListView::onFilterChanged(const QString& filter) -- cgit v1.3.1