diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-31 23:03:03 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:18 +0100 |
| commit | 399ff3fcf7920adec128d30f3c97a7636a6f10be (patch) | |
| tree | e69ae1ae362cfc2aef2c91231b712db0b6c890b5 /src/pluginlist.cpp | |
| parent | 91081315cf7b654f5defe855dea3dc1f71b0962c (diff) | |
Minor clean for plugin list.
Diffstat (limited to 'src/pluginlist.cpp')
| -rw-r--r-- | src/pluginlist.cpp | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index f6a52a80..a2e485ee 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -349,43 +349,24 @@ void PluginList::setEnabled(const QModelIndexList& indices, bool enabled) }
if (!dirty.isEmpty()) {
emit writePluginsList();
- pluginStatesChanged(dirty, IPluginList::PluginState::STATE_ACTIVE);
+ pluginStatesChanged(dirty,
+ enabled ? IPluginList::PluginState::STATE_ACTIVE : IPluginList::PluginState::STATE_INACTIVE);
}
}
-void PluginList::enableAll()
+void PluginList::setEnabledAll(bool enabled)
{
- if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really enable all plugins?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- QStringList dirty;
- for (ESPInfo &info : m_ESPs) {
- if (!info.enabled) {
- info.enabled = true;
- dirty.append(info.name);
- }
- }
- if (!dirty.isEmpty()) {
- emit writePluginsList();
- pluginStatesChanged(dirty, IPluginList::PluginState::STATE_ACTIVE);
+ QStringList dirty;
+ for (ESPInfo &info : m_ESPs) {
+ if (info.enabled != enabled) {
+ info.enabled = enabled;
+ dirty.append(info.name);
}
}
-}
-
-void PluginList::disableAll()
-{
- if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really disable all plugins?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- QStringList dirty;
- for (ESPInfo &info : m_ESPs) {
- if (!info.forceEnabled && info.enabled) {
- info.enabled = false;
- dirty.append(info.name);
- }
- }
- if (!dirty.isEmpty()) {
- emit writePluginsList();
- pluginStatesChanged(dirty, IPluginList::PluginState::STATE_INACTIVE);
- }
+ if (!dirty.isEmpty()) {
+ emit writePluginsList();
+ pluginStatesChanged(dirty,
+ enabled ? IPluginList::PluginState::STATE_ACTIVE : IPluginList::PluginState::STATE_INACTIVE);
}
}
@@ -404,7 +385,7 @@ void PluginList::sendToPriority(const QModelIndexList& indices, int newPriority) void PluginList::shiftPluginsPriority(const QModelIndexList& indices, int offset)
{
- // retrieve the mod index and sort them by priority to avoid issue
+ // retrieve the plugin index and sort them by priority to avoid issue
// when moving them
std::vector<int> allIndex;
for (auto& idx : indices) {
|
