all repos — mgba @ 4d49aa095b000f2f869d53d7e1c0f527d6858e88

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