From 43b2df9077db98475af6ab613cf7eaf301f84879 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 16 Aug 2018 13:55:32 -0500 Subject: Add "enable/disable selected" to plugin list context menu --- src/pluginlist.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 323cd98f..18e40a6e 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -289,6 +289,47 @@ void PluginList::enableESP(const QString &name, bool enable) } } +void PluginList::enableSelected(const QItemSelectionModel *selectionModel) +{ + if (selectionModel->hasSelection()){ + bool dirty = false; + for (auto row : selectionModel->selectedRows(COL_PRIORITY)) { + int rowPriority = row.data().toInt(); + for (int i = 0; i < m_ESPs.size(); i++) { + if (m_ESPs[i].m_Priority == rowPriority) { + if (!m_ESPs[i].m_Enabled) { + m_ESPs[i].m_Enabled = true; + dirty = true; + } + + break; + } + } + } + if (dirty) emit writePluginsList(); + } +} + +void PluginList::disableSelected(const QItemSelectionModel *selectionModel) +{ + if (selectionModel->hasSelection()){ + bool dirty = false; + for (auto row : selectionModel->selectedRows(COL_PRIORITY)) { + int rowPriority = row.data().toInt(); + for (int i = 0; i < m_ESPs.size(); i++) { + if (m_ESPs[i].m_Priority == rowPriority) { + if (!m_ESPs[i].m_ForceEnabled && m_ESPs[i].m_Enabled) { + m_ESPs[i].m_Enabled = false; + dirty = true; + } + break; + } + } + } + if (dirty) emit writePluginsList(); + } +} + void PluginList::enableAll() { -- cgit v1.3.1