AntiMicroX
joysensorpushbutton.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2022 Max Maisel <max.maisel@posteo.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #pragma once
18 
19 #include "flashbuttonwidget.h"
20 
21 class JoySensor;
22 class QWidget;
23 
28 {
29  Q_OBJECT
30 
31  public:
32  explicit JoySensorPushButton(JoySensor *sensor, bool displayNames, QWidget *parent = nullptr);
33 
34  JoySensor *getSensor() const;
35  void tryFlash();
36 
37  protected:
38  virtual QString generateLabel() override;
39 
40  public slots:
41  void disableFlashes() override;
42  void enableFlashes() override;
43 
44  private slots:
45  void showContextMenu(const QPoint &point);
46 
47  private:
49 };
JoySensorContextMenu::buildMenu
void buildMenu()
Populates the context menu.
Definition: joysensorcontextmenu.cpp:42
JoySensorPushButton::getSensor
JoySensor * getSensor() const
Get the underlying JoySensor object.
Definition: joysensorpushbutton.cpp:44
joysensor.h
JoySensorPushButton::showContextMenu
void showContextMenu(const QPoint &point)
Shows sensor context menu.
Definition: joysensorpushbutton.cpp:85
JoySensorPushButton::enableFlashes
void enableFlashes() override
Enables highlight when the sensor axis is moved.
Definition: joysensorpushbutton.cpp:76
JoySensorPushButton::generateLabel
virtual QString generateLabel() override
Generate the string that will be displayed on the button.
Definition: joysensorpushbutton.cpp:50
FlashButtonWidget
Definition: flashbuttonwidget.h:27
JoySensorPushButton::JoySensorPushButton
JoySensorPushButton(JoySensor *sensor, bool displayNames, QWidget *parent=nullptr)
Definition: joysensorpushbutton.cpp:25
JoySensorPushButton
The central button in a SensorPushButtonGroup.
Definition: joysensorpushbutton.h:27
joysensorpushbutton.h
JoySensor::released
void released(float xaxis, float yaxis, float zaxis)
SENSOR_CENTERED
@ SENSOR_CENTERED
Definition: joysensordirection.h:29
JoySensorPushButton::m_sensor
JoySensor * m_sensor
Definition: joysensorpushbutton.h:48
FlashButtonWidget::refreshLabel
void refreshLabel()
Definition: flashbuttonwidget.cpp:60
FlashButtonWidget::flash
void flash()
Definition: flashbuttonwidget.cpp:44
FlashButtonWidget::ifDisplayNames
bool ifDisplayNames()
Definition: flashbuttonwidget.cpp:128
JoySensor::sensorNameChanged
void sensorNameChanged()
JoySensor::getCurrentDirection
JoySensorDirection getCurrentDirection() const
Returns the current sensor direction.
Definition: joysensor.cpp:252
JoySensorContextMenu
The control stick context menu widget used by SensorPushButtonGroup.
Definition: joysensorcontextmenu.h:29
JoySensorPushButton::tryFlash
void tryFlash()
Highlights the button when sensor is not centered.
Definition: joysensorpushbutton.cpp:96
FlashButtonWidget::unflash
void unflash()
Definition: flashbuttonwidget.cpp:52
joysensorcontextmenu.h
JoySensor
Represents one sensor in a SetJoystick and its connections to other parts of the application....
Definition: joysensor.h:39
JoySensorPushButton::disableFlashes
void disableFlashes() override
Disables highlight when the sensor axis is moved.
Definition: joysensorpushbutton.cpp:66
JoySensor::getSensorName
QString getSensorName() const
Returns the sensor name.
Definition: joysensor.cpp:242
JoySensor::active
void active(float xaxis, float yaxis, float zaxis)
flashbuttonwidget.h
JoySensor::getPartialName
QString getPartialName(bool forceFullFormat=false, bool displayNames=false) const
Get the name of this sensor.
Definition: joysensor.cpp:219