all repos — mgba @ e6aa23f19cdfe97161f3696fbb3dbc4e3794edd5

mGBA Game Boy Advance Emulator

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