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