AntiMicroX
joysensorbuttonpushbutton.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 JoySensorButton;
22 class QWidget;
23 
28 {
29  Q_OBJECT
30  Q_PROPERTY(bool isflashing READ isButtonFlashing)
31 
32  public:
33  explicit JoySensorButtonPushButton(JoySensorButton *button, bool displayNames, QWidget *parent = nullptr);
34 
36  void tryFlash();
37 
38  protected:
39  virtual QString generateLabel() override;
40 
41  public slots:
42  void disableFlashes() override;
43  void enableFlashes() override;
44 
45  private slots:
46  void showContextMenu(const QPoint &point);
47 
48  private:
50 };
JoySensorButtonPushButton::showContextMenu
void showContextMenu(const QPoint &point)
Shows sensor context menu.
Definition: joysensorbuttonpushbutton.cpp:102
JoyButtonContextMenu::buildMenu
void buildMenu()
Definition: joybuttoncontextmenu.cpp:38
joysensor.h
JoySensorButtonPushButton::generateLabel
virtual QString generateLabel() override
Generate the string that will be displayed on the button.
Definition: joysensorbuttonpushbutton.cpp:77
JoySensorButtonPushButton::JoySensorButtonPushButton
JoySensorButtonPushButton(JoySensorButton *button, bool displayNames, QWidget *parent=nullptr)
Definition: joysensorbuttonpushbutton.cpp:28
FlashButtonWidget
Definition: flashbuttonwidget.h:27
JoyButtonContextMenu
Definition: joybuttoncontextmenu.h:28
FlashButtonWidget::isButtonFlashing
bool isButtonFlashing()
Definition: flashbuttonwidget.cpp:68
JoySensorButtonPushButton
A direction button in the SensorPushButtonGroup.
Definition: joysensorbuttonpushbutton.h:27
JoyButton::getCalculatedActiveZoneSummary
virtual QString getCalculatedActiveZoneSummary()
Definition: joybutton.cpp:1674
JoyButton::getButtonState
bool getButtonState()
Checks if this button is currently active.
Definition: joybutton.cpp:2471
JoySensorButtonPushButton::getButton
JoySensorButton * getButton()
Get the JoySensorButton for this mapping.
Definition: joysensorbuttonpushbutton.cpp:46
joysensorbuttonpushbutton.h
JoyButton::released
void released(int index)
FlashButtonWidget::refreshLabel
void refreshLabel()
Definition: flashbuttonwidget.cpp:60
JoySensorButtonPushButton::enableFlashes
void enableFlashes() override
Enables highlight when the sensor axis is moved.
Definition: joysensorbuttonpushbutton.cpp:64
JoyButton::clicked
void clicked(int index)
FlashButtonWidget::flash
void flash()
Definition: flashbuttonwidget.cpp:44
JoyButton::getActionName
QString getActionName()
Definition: joybutton.cpp:3586
FlashButtonWidget::ifDisplayNames
bool ifDisplayNames()
Definition: flashbuttonwidget.cpp:128
JoySensorButton
Represents a sensor mapping in a SetJoystick.
Definition: joysensorbutton.h:30
JoyButton::propertyUpdated
void propertyUpdated()
JoySensorButtonPushButton::disableFlashes
void disableFlashes() override
Disables highlight when the sensor axis is moved.
Definition: joysensorbuttonpushbutton.cpp:51
FlashButtonWidget::unflash
void unflash()
Definition: flashbuttonwidget.cpp:52
JoySensorButtonPushButton::tryFlash
void tryFlash()
Highlights the button when mapped button is active.
Definition: joysensorbuttonpushbutton.cpp:113
JoySensorButtonPushButton::m_button
JoySensorButton * m_button
Definition: joysensorbuttonpushbutton.h:49
joysensorbutton.h
joybuttoncontextmenu.h
JoySensorButtonPushButton::isflashing
bool isflashing
Definition: joysensorbuttonpushbutton.h:30
JoyButton::activeZoneChanged
void activeZoneChanged()
flashbuttonwidget.h