summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2018-08-16 14:32:28 -0500
committerLostDragonist <lost.dragonist@gmail.com>2018-08-16 14:32:28 -0500
commitc27e718fbdb3355bb75a92e8773afebb7d9c69a5 (patch)
tree3fb127e98ecbcbad21c28e6e56191f5bce2bf4c0 /src/modlist.cpp
parent43b2df9077db98475af6ab613cf7eaf301f84879 (diff)
Add "enable/disable selected" to mod list context menu
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 0d084c22..afed2241 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -1231,3 +1231,33 @@ bool ModList::eventFilter(QObject *obj, QEvent *event)
}
return QAbstractItemModel::eventFilter(obj, event);
}
+
+
+void ModList::enableSelected(const QItemSelectionModel *selectionModel)
+{
+ if (selectionModel->hasSelection()) {
+ bool dirty = false;
+ for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
+ int modID = m_Profile->modIndexByPriority(row.data().toInt());
+ if (!m_Profile->modEnabled(modID)) {
+ m_Profile->setModEnabled(modID, true);
+ emit modlist_changed(row, 0);
+ }
+ }
+ }
+}
+
+
+void ModList::disableSelected(const QItemSelectionModel *selectionModel)
+{
+ if (selectionModel->hasSelection()) {
+ bool dirty = false;
+ for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
+ int modID = m_Profile->modIndexByPriority(row.data().toInt());
+ if (m_Profile->modEnabled(modID)) {
+ m_Profile->setModEnabled(modID, false);
+ emit modlist_changed(row, 0);
+ }
+ }
+ }
+} \ No newline at end of file