diff options
| author | Tannin <sherb@gmx.net> | 2016-03-02 21:22:26 +0100 |
|---|---|---|
| committer | Tannin <sherb@gmx.net> | 2016-03-02 21:22:26 +0100 |
| commit | 0899724d901669512d607434d95630035f1d20b8 (patch) | |
| tree | 777f091c0938d43c9762f932dc9de76999537b1d /src | |
| parent | 53d978974040c34f6818e03e6dbf0d8d6f8acb3f (diff) | |
profile- and group-dropdown no longer switch by mouse-wheel. Plus fixed refreshing of right-hand side tabs
Diffstat (limited to 'src')
| -rw-r--r-- | src/eventfilter.cpp | 33 | ||||
| -rw-r--r-- | src/eventfilter.h | 44 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 22 |
3 files changed, 92 insertions, 7 deletions
diff --git a/src/eventfilter.cpp b/src/eventfilter.cpp new file mode 100644 index 00000000..69327f79 --- /dev/null +++ b/src/eventfilter.cpp @@ -0,0 +1,33 @@ +/* +Copyright (C) 2016 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include "eventfilter.h" + +EventFilter::EventFilter(QObject *parent, + const EventFilter::HandlerFunc &handler) + : QObject(parent) + , m_Handler(handler) +{ +} + +bool EventFilter::eventFilter(QObject *obj, QEvent *event) +{ + return m_Handler(obj, event); +} diff --git a/src/eventfilter.h b/src/eventfilter.h new file mode 100644 index 00000000..2400a853 --- /dev/null +++ b/src/eventfilter.h @@ -0,0 +1,44 @@ +/* +Copyright (C) 2016 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Mod Organizer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + + +#include <QObject> +#include <functional> + + +class EventFilter : public QObject { + + Q_OBJECT + + typedef std::function<bool (QObject*, QEvent*)> HandlerFunc; + +public: + + EventFilter(QObject *parent, const HandlerFunc &handler); + + virtual bool eventFilter(QObject *obj , QEvent *event) override; + +private: + + HandlerFunc m_Handler; + +}; + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index db7bd682..05000761 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -74,6 +74,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "safewritefile.h"
#include "nxmaccessmanager.h"
#include "appconfig.h"
+#include "eventfilter.h"
#include <utility.h>
#include <dataarchives.h>
#include <bsainvalidation.h>
@@ -290,6 +291,17 @@ MainWindow::MainWindow(QSettings &initSettings ui->savegameList->installEventFilter(this);
ui->savegameList->setMouseTracking(true);
+ // don't allow mouse wheel to switch grouping, too many people accidentally
+ // turn on grouping and then don't understand what happened
+
+ EventFilter *noWheel
+ = new EventFilter(this, [](QObject *, QEvent *event) -> bool {
+ return event->type() == QEvent::Wheel;
+ });
+
+ ui->groupCombo->installEventFilter(noWheel);
+ ui->profileBox->installEventFilter(noWheel);
+
connect(ui->savegameList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(saveSelectionChanged(QListWidgetItem*)));
connect(ui->modList, SIGNAL(dropModeUpdate(bool)), m_OrganizerCore.modList(), SLOT(dropModeUpdate(bool)));
@@ -1064,9 +1076,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) void MainWindow::updateTo(QTreeWidgetItem *subTree, const std::wstring &directorySoFar, const DirectoryEntry &directoryEntry, bool conflictsOnly)
{
{
- std::vector<FileEntry::Ptr> files = directoryEntry.getFiles();
- for (auto iter = files.begin(); iter != files.end(); ++iter) {
- FileEntry::Ptr current = *iter;
+ for (const FileEntry::Ptr current : directoryEntry.getFiles()) {
if (conflictsOnly && (current->getAlternatives().size() == 0)) {
continue;
}
@@ -1476,12 +1486,10 @@ void MainWindow::on_tabWidget_currentChanged(int index) if (index == 0) {
m_OrganizerCore.refreshESPList();
} else if (index == 1) {
- m_OrganizerCore.refreshBSAList();
- } else if (index == 2) {
refreshDataTree();
- } else if (index == 3) {
+ } else if (index == 2) {
refreshSaveList();
- } else if (index == 4) {
+ } else if (index == 3) {
ui->downloadView->scrollToBottom();
}
}
|
