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