diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pluginlist.cpp | 76 | ||||
| -rw-r--r-- | src/pluginlist.h | 8 |
2 files changed, 49 insertions, 35 deletions
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 91352167..1a780584 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -204,12 +204,12 @@ void PluginList::refresh(const QString& profileName, continue; } - bool forceEnabled = Settings::instance().game().forceEnableCoreFiles() && - (primaryPlugins.contains(filename, Qt::CaseInsensitive) || - enabledPlugins.contains(filename, Qt::CaseInsensitive)); + bool forceLoaded = Settings::instance().game().forceEnableCoreFiles() && + primaryPlugins.contains(filename, Qt::CaseInsensitive); + bool forceEnabled = enabledPlugins.contains(filename, Qt::CaseInsensitive); bool forceDisabled = m_GamePlugin->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::None && - !forceEnabled; + !forceLoaded && !forceEnabled; bool archive = false; try { @@ -238,8 +238,8 @@ void PluginList::refresh(const QString& profileName, originName = modInfo->name(); } - m_ESPs.push_back(ESPInfo(filename, forceEnabled, forceDisabled, originName, - ToQString(current->getFullPath()), hasIni, + m_ESPs.push_back(ESPInfo(filename, forceLoaded, forceEnabled, forceDisabled, + originName, ToQString(current->getFullPath()), hasIni, loadedArchives, lightPluginsAreSupported, overridePluginsAreSupported)); m_ESPs.rbegin()->priority = -1; @@ -397,6 +397,7 @@ void PluginList::enableESP(const QString& name, bool enable) if (iter != m_ESPsByName.end()) { auto enabled = m_ESPs[iter->second].enabled; m_ESPs[iter->second].enabled = (enable && !m_ESPs[iter->second].forceDisabled) || + m_ESPs[iter->second].forceLoaded || m_ESPs[iter->second].forceEnabled; emit writePluginsList(); @@ -423,7 +424,8 @@ void PluginList::setEnabled(const QModelIndexList& indices, bool enabled) { QStringList dirty; for (auto& idx : indices) { - if (m_ESPs[idx.row()].forceEnabled || m_ESPs[idx.row()].forceDisabled) + if (m_ESPs[idx.row()].forceLoaded || m_ESPs[idx.row()].forceEnabled || + m_ESPs[idx.row()].forceDisabled) continue; if (m_ESPs[idx.row()].enabled != enabled) { m_ESPs[idx.row()].enabled = enabled; @@ -441,7 +443,7 @@ void PluginList::setEnabledAll(bool enabled) { QStringList dirty; for (ESPInfo& info : m_ESPs) { - if (info.forceEnabled || info.forceDisabled) + if (info.forceLoaded || info.forceEnabled || info.forceDisabled) continue; if (info.enabled != enabled) { info.enabled = enabled; @@ -459,7 +461,7 @@ void PluginList::sendToPriority(const QModelIndexList& indices, int newPriority) { std::vector<int> pluginsToMove; for (auto& idx : indices) { - if (!m_ESPs[idx.row()].forceEnabled) { + if (!m_ESPs[idx.row()].forceLoaded) { pluginsToMove.push_back(idx.row()); } } @@ -610,7 +612,7 @@ void PluginList::readLockedOrderFrom(const QString& fileName) int pluginIndex = it->second; // Do not allow locking forced plugins - if (m_ESPs[pluginIndex].forceEnabled) { + if (m_ESPs[pluginIndex].forceLoaded) { continue; } @@ -630,14 +632,14 @@ void PluginList::readLockedOrderFrom(const QString& fileName) }; // See if we can just set the given priority - if (!m_ESPs[m_ESPsByPriority.at(priority)].forceEnabled && !alreadyLocked()) { + if (!m_ESPs[m_ESPsByPriority.at(priority)].forceLoaded && !alreadyLocked()) { m_LockedOrder[pluginName] = priority; continue; } // Find the next higher priority we can set the plugin to while (++priority < m_ESPs.size()) { - if (!m_ESPs[m_ESPsByPriority.at(priority)].forceEnabled && !alreadyLocked()) { + if (!m_ESPs[m_ESPsByPriority.at(priority)].forceLoaded && !alreadyLocked()) { m_LockedOrder[pluginName] = priority; break; } @@ -757,7 +759,7 @@ bool PluginList::isESPLocked(int index) const void PluginList::lockESPIndex(int index, bool lock) { if (lock) { - if (!m_ESPs.at(index).forceEnabled) + if (!m_ESPs.at(index).forceLoaded) m_LockedOrder[getName(index)] = m_ESPs.at(index).loadOrder; else return; @@ -868,7 +870,7 @@ void PluginList::setState(const QString& name, PluginStates state) if (iter != m_ESPsByName.end()) { m_ESPs[iter->second].enabled = (state == IPluginList::STATE_ACTIVE && !m_ESPs[iter->second].forceDisabled) || - m_ESPs[iter->second].forceEnabled; + m_ESPs[iter->second].forceLoaded || m_ESPs[iter->second].forceEnabled; } else { log::warn("Plugin not found: {}", name); } @@ -1183,7 +1185,7 @@ QVariant PluginList::checkstateData(const QModelIndex& modelIndex) const { const int index = modelIndex.row(); - if (m_ESPs[index].forceEnabled) { + if (m_ESPs[index].forceLoaded || m_ESPs[index].forceEnabled) { return Qt::Checked; } else if (m_ESPs[index].forceDisabled) { return Qt::Unchecked; @@ -1196,7 +1198,7 @@ QVariant PluginList::foregroundData(const QModelIndex& modelIndex) const { const int index = modelIndex.row(); - if ((modelIndex.column() == COL_NAME) && m_ESPs[index].forceEnabled) { + if ((modelIndex.column() == COL_NAME) && m_ESPs[index].forceLoaded) { return QBrush(Qt::gray); } @@ -1255,6 +1257,12 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const toolTip += "<b>" + tr("Origin") + "</b>: " + esp.originName; + if (esp.forceLoaded) { + toolTip += "<br><b><i>" + + tr("This plugin can't be disabled or moved (enforced by the game).") + + "</i></b>"; + } + if (esp.forceEnabled) { toolTip += "<br><b><i>" + tr("This plugin can't be disabled (enforced by the game).") + "</i></b>"; @@ -1487,8 +1495,9 @@ bool PluginList::setData(const QModelIndex& modIndex, const QVariant& value, int bool result = false; if (role == Qt::CheckStateRole) { - m_ESPs[modIndex.row()].enabled = - value.toInt() == Qt::Checked || m_ESPs[modIndex.row()].forceEnabled; + m_ESPs[modIndex.row()].enabled = value.toInt() == Qt::Checked || + m_ESPs[modIndex.row()].forceLoaded || + m_ESPs[modIndex.row()].forceEnabled; m_LastCheck.restart(); emit dataChanged(modIndex, modIndex); @@ -1545,12 +1554,13 @@ Qt::ItemFlags PluginList::flags(const QModelIndex& modelIndex) const Qt::ItemFlags result = QAbstractItemModel::flags(modelIndex); if (modelIndex.isValid()) { - if (!m_ESPs[index].forceEnabled && !m_ESPs[index].forceDisabled) { - result |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; - } - if (modelIndex.column() == COL_PRIORITY) { + if (!m_ESPs[index].forceLoaded && !m_ESPs[index].forceDisabled) + result |= Qt::ItemIsDragEnabled; + if (!m_ESPs[index].forceLoaded && !m_ESPs[index].forceEnabled && + !m_ESPs[index].forceDisabled) + result |= Qt::ItemIsUserCheckable; + if (modelIndex.column() == COL_PRIORITY) result |= Qt::ItemIsEditable; - } result &= ~Qt::ItemIsDropEnabled; } else { result |= Qt::ItemIsDropEnabled; @@ -1588,7 +1598,7 @@ void PluginList::setPluginPriority(int row, int& newPriority, bool isForced) } // also don't allow "regular" esms to be moved above primary plugins while ((newPriorityTemp < static_cast<int>(m_ESPsByPriority.size() - 1)) && - (m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).forceEnabled)) { + (m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).forceLoaded)) { ++newPriorityTemp; } } @@ -1658,7 +1668,7 @@ void PluginList::changePluginPriority(std::vector<int> rows, int newPriority) // don't try to move plugins before force-enabled plugins for (std::vector<ESPInfo>::const_iterator iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { - if (iter->forceEnabled) { + if (iter->forceLoaded) { newPriority = std::max(newPriority, iter->priority + 1); } maxPriority = std::max(maxPriority, iter->priority + 1); @@ -1744,13 +1754,15 @@ QModelIndex PluginList::parent(const QModelIndex&) const return QModelIndex(); } -PluginList::ESPInfo::ESPInfo(const QString& name, bool enabled, bool forceDisabled, - const QString& originName, const QString& fullPath, - bool hasIni, std::set<QString> archives, - bool lightSupported, bool overrideSupported) - : name(name), fullPath(fullPath), enabled(enabled), forceEnabled(enabled), - forceDisabled(forceDisabled), priority(0), loadOrder(-1), originName(originName), - hasIni(hasIni), archives(archives.begin(), archives.end()), modSelected(false) +PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEnabled, + bool forceDisabled, const QString& originName, + const QString& fullPath, bool hasIni, + std::set<QString> archives, bool lightSupported, + bool overrideSupported) + : name(name), fullPath(fullPath), enabled(forceLoaded), forceLoaded(forceLoaded), + forceEnabled(forceEnabled), forceDisabled(forceDisabled), priority(0), + loadOrder(-1), originName(originName), hasIni(hasIni), + archives(archives.begin(), archives.end()), modSelected(false) { try { ESP::File file(ToWString(fullPath)); diff --git a/src/pluginlist.h b/src/pluginlist.h index 0c53fc25..db32d911 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -313,13 +313,15 @@ signals: private: struct ESPInfo { - ESPInfo(const QString& name, bool enabled, bool forceDisabled, - const QString& originName, const QString& fullPath, bool hasIni, - std::set<QString> archives, bool lightSupported, bool overrideSupported); + ESPInfo(const QString& name, bool forceLoaded, bool forceEnabled, + bool forceDisabled, const QString& originName, const QString& fullPath, + bool hasIni, std::set<QString> archives, bool lightSupported, + bool overrideSupported); QString name; QString fullPath; bool enabled; + bool forceLoaded; bool forceEnabled; bool forceDisabled; int priority; |
