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#include "InputIndex.h"
11#include "InputModel.h"
12
13#include <QWidget>
14
15#include "ui_ShortcutView.h"
16
17namespace QGBA {
18
19class InputController;
20
21class ShortcutView : public QWidget {
22Q_OBJECT
23
24public:
25 ShortcutView(QWidget* parent = nullptr);
26 ~ShortcutView();
27
28 void setModel(InputIndex* model);
29 void setInputController(InputController* input);
30
31 const InputIndex* root() { return m_model.inputIndex(); }
32
33protected:
34 virtual bool event(QEvent*) override;
35 virtual void closeEvent(QCloseEvent*) override;
36
37private slots:
38 void load(const QModelIndex&);
39 void clear();
40 void updateButton(int button);
41 void updateAxis(int axis, int direction);
42
43private:
44 Ui::ShortcutView m_ui;
45
46 InputModel m_model;
47 InputController* m_input = nullptr;
48};
49
50}
51
52#endif