summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-08-24 22:50:00 +0200
committerTannin <devnull@localhost>2013-08-24 22:50:00 +0200
commite91eebefbea450a447b44a81dcabcc6ac8000a48 (patch)
tree25a6e1674f859249699d8242b7a611ae9d627890 /src/modlist.cpp
parent87f4e2df260e502bce61783a66e062af1b46e789 (diff)
- download size is now displayed
- multiple esps/mods can now be enabled/disabled at once using space - bugfix: fomod installer didn't compile because of changes to condition checking - bugfix: broken inverse virtual name resolution in case of non-default mod directory
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 9c537300..a08162e7 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -801,6 +801,26 @@ bool ModList::eventFilter(QObject *obj, QEvent *event)
removeRow(rows[0].data(Qt::UserRole + 1).toInt(), QModelIndex());
}
return true;
+ } else if (keyEvent->key() == Qt::Key_Space) {
+ QItemSelectionModel *selectionModel = itemView->selectionModel();
+ const QSortFilterProxyModel *proxyModel = qobject_cast<const QSortFilterProxyModel*>(selectionModel->model());
+
+ QModelIndex minRow, maxRow;
+ foreach (QModelIndex idx, selectionModel->selectedRows()) {
+ if (proxyModel != NULL) {
+ idx = proxyModel->mapToSource(idx);
+ }
+ if (!minRow.isValid() || (idx.row() < minRow.row())) {
+ minRow = idx;
+ }
+ if (!maxRow.isValid() || (idx.row() > maxRow.row())) {
+ maxRow = idx;
+ }
+ int oldState = idx.data(Qt::CheckStateRole).toInt();
+ setData(idx, oldState == Qt::Unchecked ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
+ }
+ emit dataChanged(minRow, maxRow);
+ return true;
}
}
return QObject::eventFilter(obj, event);