all repos — mgba @ 893fdd383f3f4f59de31ac617bc8a28d3f8059c6

mGBA Game Boy Advance Emulator

src/platform/qt/SensorView.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_SENSOR_VIEW
 7#define QGBA_SENSOR_VIEW
 8
 9#include <QTimer>
10#include <QDialog>
11
12#include <functional>
13
14#include "ui_SensorView.h"
15
16struct mRotationSource;
17
18namespace QGBA {
19
20class ConfigController;
21class GameController;
22class GamepadAxisEvent;
23class InputController;
24
25class SensorView : public QDialog {
26Q_OBJECT
27
28public:
29	SensorView(GameController* controller, InputController* input, QWidget* parent = nullptr);
30
31protected:
32	bool eventFilter(QObject*, QEvent* event) override;
33	bool event(QEvent* event) override;
34
35private slots:
36	void updateSensors();
37	void setLuminanceValue(int);
38	void luminanceValueChanged(int);
39
40private:
41	Ui::SensorView m_ui;
42
43	std::function<void(int)> m_jiggered;
44	GameController* m_controller;
45	InputController* m_input;
46	mRotationSource* m_rotation;
47	QTimer m_timer;
48
49	void jiggerer(QAbstractButton*, void (InputController::*)(int));
50};
51
52}
53
54#endif