From 3dc00922ed528659b577116014289ad1c4bd9c8d Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Tue, 12 Sep 2023 15:08:21 -0500 Subject: [PATCH] Changes for None-type plugin sorting * Display checkboxes for all plugins * Disable checkboxes for force enabled/disabled plugins * Display tooltip data for all plugins regardless of force status --- src/pluginlist.cpp | 113 ++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index d3987e4d0..a63617911 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -1178,7 +1178,9 @@ QVariant PluginList::checkstateData(const QModelIndex& modelIndex) const const int index = modelIndex.row(); if (m_ESPs[index].forceEnabled || m_ESPs[index].forceDisabled) { - return {}; + return Qt::Checked; + } else if (m_ESPs[index].forceDisabled) { + return Qt::Unchecked; } return m_ESPs[index].enabled ? Qt::Checked : Qt::Unchecked; @@ -1246,61 +1248,68 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const if (esp.forceEnabled) { toolTip += "
" + tr("This plugin can't be disabled (enforced by the game).") + ""; - } else { - if (!esp.author.isEmpty()) { - toolTip += "
" + tr("Author") + ": " + TruncateString(esp.author); - } - - if (esp.description.size() > 0) { - toolTip += - "
" + tr("Description") + ": " + TruncateString(esp.description); - } + } - if (esp.masterUnset.size() > 0) { - toolTip += - "
" + tr("Missing Masters") + ": " + "" + - TruncateString( - QStringList(esp.masterUnset.begin(), esp.masterUnset.end()).join(", ")) + - ""; - } + if (!esp.author.isEmpty()) { + toolTip += "
" + tr("Author") + ": " + TruncateString(esp.author); + } - std::set enabledMasters; - std::set_difference(esp.masters.begin(), esp.masters.end(), esp.masterUnset.begin(), - esp.masterUnset.end(), - std::inserter(enabledMasters, enabledMasters.end())); + if (esp.description.size() > 0) { + toolTip += + "
" + tr("Description") + ": " + TruncateString(esp.description); + } - if (!enabledMasters.empty()) { - toolTip += "
" + tr("Enabled Masters") + - ": " + TruncateString(SetJoin(enabledMasters, ", ")); - } + if (esp.masterUnset.size() > 0) { + toolTip += + "
" + tr("Missing Masters") + ": " + "" + + TruncateString( + QStringList(esp.masterUnset.begin(), esp.masterUnset.end()).join(", ")) + + ""; + } + + std::set enabledMasters; + std::set_difference(esp.masters.begin(), esp.masters.end(), esp.masterUnset.begin(), + esp.masterUnset.end(), + std::inserter(enabledMasters, enabledMasters.end())); + + if (!enabledMasters.empty()) { + toolTip += "
" + tr("Enabled Masters") + + ": " + TruncateString(SetJoin(enabledMasters, ", ")); + } + + if (!esp.archives.empty() && esp.archives.size() < 6) { + QString archiveString = + esp.archives.size() < 6 + ? TruncateString( + QStringList(esp.archives.begin(), esp.archives.end()).join(", ")) + + "
" + : ""; + toolTip += "
" + tr("Loads Archives") + ": " + + archiveString + + tr("There are Archives connected to this plugin. Their assets will be " + "added to your game, overwriting in case of conflicts following the " + "plugin order. Loose files will always overwrite assets from " + "Archives. (This flag only checks for Archives from the same mod as " + "the plugin)"); + } - if (!esp.archives.empty()) { - toolTip += - "
" + tr("Loads Archives") + ": " + - TruncateString( - QStringList(esp.archives.begin(), esp.archives.end()).join(", ")) + - "
" + - tr("There are Archives connected to this plugin. Their assets will be " - "added to your game, overwriting in case of conflicts following the " - "plugin order. Loose files will always overwrite assets from " - "Archives. (This flag only checks for Archives from the same mod as " - "the plugin)"); - } + if (esp.hasIni) { + toolTip += "
" + tr("Loads INI settings") + + ": " + "
" + + tr("There is an ini file connected to this plugin. Its settings will " + "be added to your game settings, overwriting in case of conflicts."); + } - if (esp.hasIni) { - toolTip += - "
" + tr("Loads INI settings") + - ": " - "
" + - tr("There is an ini file connected to this plugin. Its settings will " - "be added to your game settings, overwriting in case of conflicts."); - } + if (esp.isLightFlagged && !esp.hasLightExtension) { + toolTip += + "

" + tr("This ESP is flagged as an ESL. It will adhere to the ESP load " + "order but the records will be loaded in ESL space."); + } - if (esp.isLightFlagged && !esp.hasLightExtension) { - toolTip += "

" + - tr("This ESP is flagged as an ESL. It will adhere to the ESP load " - "order but the records will be loaded in ESL space."); - } + if (esp.forceDisabled) { + toolTip += "

" + tr("This game does not currently permit custom plugin " + "loading. There may be manual workarounds."); if (esp.forceDisabled) { toolTip += "

" + tr("This game does not currently permit custom plugin " @@ -1530,8 +1539,8 @@ Qt::ItemFlags PluginList::flags(const QModelIndex& modelIndex) const Qt::ItemFlags result = QAbstractItemModel::flags(modelIndex); if (modelIndex.isValid()) { - if (!m_ESPs[index].forceEnabled) { - result |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; + if (!m_ESPs[index].forceEnabled && !m_ESPs[index].forceDisabled) { + result |= Qt::ItemIsDragEnabled; } if (modelIndex.column() == COL_PRIORITY) { result |= Qt::ItemIsEditable;