Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins updates #1907

Merged
merged 3 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions src/pluginlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,16 @@ bool PluginList::isOverlayFlagged(const QString& name) const
}
}

bool PluginList::hasNoRecords(const QString& name) const
{
auto iter = m_ESPsByName.find(name);
if (iter == m_ESPsByName.end()) {
return false;
} else {
return m_ESPs[iter->second].hasNoRecords;
}
}

boost::signals2::connection PluginList::onPluginStateChanged(
const std::function<void(const std::map<QString, PluginStates>&)>& func)
{
Expand Down Expand Up @@ -1093,9 +1103,12 @@ void PluginList::generatePluginIndexes()
.arg((numESLs) % 4096, 3, 16, QChar('0'))
.toUpper();
++numESLs;
} else if (overridePluginsSupported && m_ESPs[i].isOverlayFlagged) {
m_ESPs[i].index = QString("XX");
++numSkipped;
// This logic may still be used if overlay plugins are fixed to longer consume a
// load order slot
//
//} else if (overridePluginsSupported && m_ESPs[i].isOverlayFlagged) {
// m_ESPs[i].index = QString("XX");
// ++numSkipped;
} else {
m_ESPs[i].index =
QString("%1").arg(l - numESLs - numSkipped, 2, 16, QChar('0')).toUpper();
Expand Down Expand Up @@ -1233,10 +1246,11 @@ 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);
}

if (m_ESPs[index].hasNoRecords)
result.setStrikeOut(true);

return result;
}

Expand Down Expand Up @@ -1329,11 +1343,20 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const
.arg(type);
}

if (esp.isOverlayFlagged) {
toolTip +=
"<br><br>" + 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.");
// This logic may still be used if overlay plugins are fixed to longer consume a load
// order slot
//
// if (esp.isOverlayFlagged) {
// toolTip +=
// "<br><br>" + 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.hasNoRecords) {
toolTip += "<br><br>" + tr("This is a dummy plugin. It contains no records and is "
"typically used to load a paired archive file.");
}

if (esp.forceDisabled) {
Expand Down Expand Up @@ -1787,6 +1810,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn
isOverlayFlagged = overlaySupported && file.isOverlay();
isLightFlagged =
lightSupported && !isOverlayFlagged && file.isLight(overlaySupported);
hasNoRecords = file.isDummy();

author = QString::fromLatin1(file.author().c_str());
description = QString::fromLatin1(file.description().c_str());
Expand All @@ -1801,6 +1825,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn
isMasterFlagged = false;
isOverlayFlagged = false;
isLightFlagged = false;
hasNoRecords = false;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/pluginlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class PluginList : public QAbstractItemModel
bool isMasterFlagged(const QString& name) const;
bool isLightFlagged(const QString& name) const;
bool isOverlayFlagged(const QString& name) const;
bool hasNoRecords(const QString& name) const;

boost::signals2::connection onRefreshed(const std::function<void()>& callback);
boost::signals2::connection
Expand Down Expand Up @@ -334,6 +335,7 @@ public slots:
bool isMasterFlagged;
bool isLightFlagged;
bool isOverlayFlagged;
bool hasNoRecords;
bool modSelected;
QString author;
QString description;
Expand Down
5 changes: 5 additions & 0 deletions src/pluginlistproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ bool PluginListProxy::isOverlayFlagged(const QString& name) const
{
return m_Proxied->isOverlayFlagged(name);
}

bool PluginListProxy::hasNoRecords(const QString& name) const
{
return m_Proxied->hasNoRecords(name);
}
1 change: 1 addition & 0 deletions src/pluginlistproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class PluginListProxy : public MOBase::IPluginList
bool isMasterFlagged(const QString& name) const override;
bool isLightFlagged(const QString& name) const override;
bool isOverlayFlagged(const QString& name) const override;
bool hasNoRecords(const QString& name) const override;

private:
friend class OrganizerProxy;
Expand Down