summaryrefslogtreecommitdiff
path: root/src/pluginlist.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/pluginlist.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/pluginlist.cpp')
-rw-r--r--src/pluginlist.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 61069c2f..dc2410ee 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -823,9 +823,15 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QAbstractItemView *itemView = qobject_cast<QAbstractItemView*>(obj);
+
+ if (itemView == NULL) {
+ return QObject::eventFilter(obj, event);
+ }
+
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- if ((itemView != NULL) &&
- (keyEvent->modifiers() == Qt::ControlModifier) &&
+
+ // ctrl+up and ctrl+down -> increase or decrease priority of selected plugins
+ if ((keyEvent->modifiers() == Qt::ControlModifier) &&
((keyEvent->key() == Qt::Key_Up) || (keyEvent->key() == Qt::Key_Down))) {
QItemSelectionModel *selectionModel = itemView->selectionModel();
const QSortFilterProxyModel *proxyModel = qobject_cast<const QSortFilterProxyModel*>(selectionModel->model());
@@ -852,6 +858,27 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event)
}
refreshLoadOrder();
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);