From b16a0ab3d94fad599347098e79e4a8131de08efa Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Fri, 20 Oct 2017 23:16:04 -0500 Subject: Add ESL flag type detection * ESL files can be sorted like ESMs * ESL files are displayed italicized but not bold --- src/pluginlist.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/pluginlist.h') diff --git a/src/pluginlist.h b/src/pluginlist.h index 78623cae..aaa45bc1 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -213,6 +213,7 @@ public: virtual int loadOrder(const QString &name) const; virtual bool onRefreshed(const std::function &callback); virtual bool isMaster(const QString &name) const; + virtual bool isLight(const QString &name) const; virtual QStringList masters(const QString &name) const; virtual QString origin(const QString &name) const; virtual void setLoadOrder(const QStringList &pluginList) override; @@ -275,6 +276,7 @@ private: FILETIME m_Time; QString m_OriginName; bool m_IsMaster; + bool m_IsLight; QString m_Author; QString m_Description; bool m_HasIni; -- cgit v1.3.1 From eaeb48d745d74857d47da5d66d82fea005a16555 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 21 Oct 2017 22:43:45 -0500 Subject: Correctly render the modindex for ESLs --- src/pluginlist.cpp | 20 +++++++++++++++++--- src/pluginlist.h | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/pluginlist.h') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 2a252d27..f1e28cb2 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -102,7 +102,7 @@ QString PluginList::getColumnToolTip(int column) case COL_NAME: return tr("Name of your mods"); case COL_PRIORITY: return tr("Load priority of your mod. The higher, the more \"important\" it is and thus " "overwrites data from plugins with lower priority."); - case COL_MODINDEX: return tr("The modindex determins the formids of objects originating from this mods."); + case COL_MODINDEX: return tr("The modindex determines the formids of objects originating from this mods."); default: return tr("unknown"); } } @@ -713,7 +713,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if ((role == Qt::DisplayRole) || (role == Qt::EditRole)) { switch (modelIndex.column()) { - case COL_NAME: { + case COL_NAME: { return m_ESPs[index].m_Name; } break; case COL_PRIORITY: { @@ -723,7 +723,21 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if (m_ESPs[index].m_LoadOrder == -1) { return QString(); } else { - return QString("%1").arg(m_ESPs[index].m_LoadOrder, 2, 16, QChar('0')).toUpper(); + int numESLs = 0; + std::vector sortESPs(m_ESPs); + std::sort(sortESPs.begin(), sortESPs.end()); + for (auto sortedESP: sortESPs) { + if (sortedESP.m_LoadOrder == m_ESPs[index].m_LoadOrder) + break; + if (sortedESP.m_IsLight && sortedESP.m_LoadOrder != -1) + ++numESLs; + } + if (m_ESPs[index].m_IsLight) { + int ESLpos = 254 + (numESLs+1 / 4096); + return QString("%1").arg(ESLpos, 2, 16, QChar('0')).toUpper(); + } else { + return QString("%1").arg(m_ESPs[index].m_LoadOrder - numESLs, 2, 16, QChar('0')).toUpper(); + } } } break; default: { diff --git a/src/pluginlist.h b/src/pluginlist.h index aaa45bc1..e98f5c41 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -282,6 +282,10 @@ private: bool m_HasIni; std::set m_Masters; mutable std::set m_MasterUnset; + bool operator < (const ESPInfo& str) const + { + return (m_LoadOrder < str.m_LoadOrder); + } }; struct AdditionalInfo { -- cgit v1.3.1