diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-08-16 14:32:28 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-08-16 14:32:28 -0500 |
| commit | c27e718fbdb3355bb75a92e8773afebb7d9c69a5 (patch) | |
| tree | 3fb127e98ecbcbad21c28e6e56191f5bce2bf4c0 /src/modlist.cpp | |
| parent | 43b2df9077db98475af6ab613cf7eaf301f84879 (diff) | |
Add "enable/disable selected" to mod list context menu
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 30 |
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 |
