From e91eebefbea450a447b44a81dcabcc6ac8000a48 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 24 Aug 2013 22:50:00 +0200 Subject: - 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 --- src/pluginlist.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/pluginlist.cpp') 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(obj); + + if (itemView == NULL) { + return QObject::eventFilter(obj, event); + } + QKeyEvent *keyEvent = static_cast(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(selectionModel->model()); @@ -851,6 +857,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(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; } } -- cgit v1.3.1