From 36b81b4a7ca4d9760c4fbe79d67c9aed7e0ab6fe Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Mon, 25 May 2020 20:17:21 +0200 Subject: Use ModDataContent to display the tooltip in the header. --- src/modlist.cpp | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 3ace0ed0..e71bff14 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #include "modlist.h" +#include "widgetutility.h" #include "messagedialog.h" #include "qtgroupingproxy.h" #include "viewmarkingscrollbar.h" @@ -670,6 +671,13 @@ QVariant ModList::headerData(int section, Qt::Orientation orientation, return getColumnToolTip(section); } else if (role == Qt::TextAlignmentRole) { return QVariant(Qt::AlignCenter); + } else if (role == MOBase::EnabledColumnRole) { + if (section == COL_CONTENT) { + return !m_Organizer->modDataContents().empty(); + } + else { + return true; + } } } return QAbstractItemModel::headerData(section, orientation, role); @@ -1298,7 +1306,7 @@ QString ModList::getColumnName(int column) } -QString ModList::getColumnToolTip(int column) +QString ModList::getColumnToolTip(int column) const { switch (column) { case COL_NAME: return tr("Name of your mods"); @@ -1310,24 +1318,18 @@ QString ModList::getColumnToolTip(int column) case COL_MODID: return tr("Id of the mod as used on Nexus."); case COL_CONFLICTFLAGS: return tr("Indicators of file conflicts between mods."); case COL_FLAGS: return tr("Emblems to highlight things that might require attention."); - case COL_CONTENT: return tr("Depicts the content of the mod:
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - - "
Game plugins (esp/esm/esl)
Interface
Meshes
BSA
Textures
Sounds
Music
Strings
Scripts (Papyrus)
Script Extender plugins
SkyProc Patcher
Mod Configuration Menu
INI files
ModGroup files
"); + case COL_CONTENT: { + auto& contents = m_Organizer->modDataContents(); + if (contents.empty()) { + return QString(); + } + QString result = tr("Depicts the content of the mod:") + "
" + ""; + for (auto& content : contents) { + result += QString("") + .arg(content.icon()).arg(content.name()); + } + return result + "
%2
"; + }; case COL_INSTALLTIME: return tr("Time this mod was installed"); case COL_NOTES: return tr("User notes about the mod"); default: return tr("unknown"); -- cgit v1.3.1