src/platform/qt/ShortcutView.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_SHORTCUT_VIEW
7#define QGBA_SHORTCUT_VIEW
8
9#include "GamepadAxisEvent.h"
10
11#include <QWidget>
12
13#include "ui_ShortcutView.h"
14
15namespace QGBA {
16
17class InputController;
18class ShortcutController;
19
20class ShortcutView : public QWidget {
21Q_OBJECT
22
23public:
24 ShortcutView(QWidget* parent = nullptr);
25
26 void setController(ShortcutController* controller);
27 void setInputController(InputController* input);
28
29protected:
30 virtual bool eventFilter(QObject* obj, QEvent* event) override;
31 virtual bool event(QEvent*) override;
32 virtual void closeEvent(QCloseEvent*) override;
33
34private slots:
35 void load(const QModelIndex&);
36 void clear();
37 void updateKey(const QKeySequence&);
38 void updateButton(int button);
39 void updateAxis(int axis, int direction);
40
41private:
42 Ui::ShortcutView m_ui;
43
44 ShortcutController* m_controller;
45 InputController* m_input;
46};
47
48}
49
50#endif