AntiMicroX
simplekeygrabberbutton.h
Go to the documentation of this file.
1 /* antimicrox Gamepad to KB+M event mapper
2  * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3  * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef SIMPLEKEYGRABBERBUTTON_H
20 #define SIMPLEKEYGRABBERBUTTON_H
21 
22 #include "joybuttonslot.h"
23 
24 #include <QPushButton>
25 
26 class QKeyEvent;
27 class QEvent;
28 class QWidget;
29 
30 class SimpleKeyGrabberButton : public QPushButton
31 {
32  Q_OBJECT
33 
34  public:
35  explicit SimpleKeyGrabberButton(QWidget *parent = nullptr);
36 
37  void setValue(int value, int alias,
42  void setValues(QString value, QList<JoyButtonSlot *> *jbtn,
46  void setValue(JoyButtonSlot *jbS);
47  bool isEdited();
48  bool isGrabbing();
49 
50  protected:
51  virtual void keyPressEvent(QKeyEvent *event);
52  virtual bool eventFilter(QObject *obj, QEvent *event);
53 
54  signals:
55  void buttonCodeChanged(int value);
56 
57  public slots:
58  void refreshButtonLabel();
59 
60  private:
63  bool edited;
65 };
66 
67 Q_DECLARE_METATYPE(SimpleKeyGrabberButton *)
68 
69 #endif // SIMPLEKEYGRABBERBUTTON_H
JoyButtonSlot::setTextData
void setTextData(QString textData)
Definition: joybuttonslot.cpp:383
JoyButtonSlot::getSlotString
QString getSlotString()
Definition: joybuttonslot.cpp:157
SimpleKeyGrabberButton::buttonslot
JoyButtonSlot buttonslot
Definition: simplekeygrabberbutton.h:64
SimpleKeyGrabberButton::isGrabbing
bool isGrabbing()
Definition: simplekeygrabberbutton.cpp:334
SimpleKeyGrabberButton::getValueNonPointer
JoyButtonSlot & getValueNonPointer()
Definition: simplekeygrabberbutton.cpp:322
antkeymapper.h
JoyButtonSlot::JoyMouseButton
@ JoyMouseButton
Definition: joybuttonslot.h:45
X11KeyCodeToX11KeySym
int X11KeyCodeToX11KeySym(int keycode)
Definition: event.cpp:745
SimpleKeyGrabberButton::grabbingWheel
bool grabbingWheel
Definition: simplekeygrabberbutton.h:62
SimpleKeyGrabberButton::isEdited
bool isEdited()
Definition: simplekeygrabberbutton.cpp:332
SimpleKeyGrabberButton::edited
bool edited
Definition: simplekeygrabberbutton.h:63
SimpleKeyGrabberButton
Definition: simplekeygrabberbutton.h:30
SimpleKeyGrabberButton::setValues
void setValues(QString value, JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyMix)
Definition: simplekeygrabberbutton.cpp:281
keysymToKeyString
QString keysymToKeyString(int keysym, int alias)
Definition: event.cpp:763
winextras.h
QtKeyMapperBase::returnQtKey
virtual int returnQtKey(int key, int scancode=0)
Definition: qtkeymapperbase.cpp:32
SimpleKeyGrabberButton::refreshButtonLabel
void refreshButtonLabel()
Definition: simplekeygrabberbutton.cpp:326
JoyButtonSlot::setMixSlots
void setMixSlots(QList< JoyButtonSlot * > *slots)
Definition: joybuttonslot.cpp:463
SimpleKeyGrabberButton::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Definition: simplekeygrabberbutton.cpp:47
joybuttonslot.h
JoyButtonSlot::JoyMix
@ JoyMix
Definition: joybuttonslot.h:59
JoyButtonSlot
Represents action which can be performed after pressing button.
Definition: joybuttonslot.h:37
BaseEventHandler
Base class for input event handlers.
Definition: baseeventhandler.h:32
AntKeyMapper::returnVirtualKey
int returnVirtualKey(int qkey)
Definition: antkeymapper.cpp:104
eventhandlerfactory.h
JoyButtonSlot::JoyKeyboard
@ JoyKeyboard
Definition: joybuttonslot.h:44
SimpleKeyGrabberButton::grabNextAction
bool grabNextAction
Definition: simplekeygrabberbutton.h:61
AntKeyMapper::getInstance
static AntKeyMapper * getInstance(QString handler="")
Definition: antkeymapper.cpp:80
SimpleKeyGrabberButton::buttonCodeChanged
void buttonCodeChanged(int value)
BACKEND_ELSE_IF
#define BACKEND_ELSE_IF
Definition: eventhandlerfactory.h:69
WinExtras::correctVirtualKey
static unsigned int correctVirtualKey(unsigned int scancode, unsigned int virtualkey)
Obtain a more specific virtual key (unsigned int) for a key grab event.
Definition: winextras.cpp:164
event.h
JoyButtonSlot::JoyTextEntry
@ JoyTextEntry
Definition: joybuttonslot.h:57
SimpleKeyGrabberButton::getValue
JoyButtonSlot * getValue()
Definition: simplekeygrabberbutton.cpp:320
EventHandlerFactory::handler
BaseEventHandler * handler()
Definition: eventhandlerfactory.cpp:95
QtKeyMapperBase
Definition: qtkeymapperbase.h:25
SimpleKeyGrabberButton::SimpleKeyGrabberButton
SimpleKeyGrabberButton(QWidget *parent=nullptr)
Definition: simplekeygrabberbutton.cpp:38
JoyButtonSlot::setSlotMode
void setSlotMode(JoySlotInputAction selectedMode)
Definition: joybuttonslot.cpp:112
JoyButtonSlot::JoyExecute
@ JoyExecute
Definition: joybuttonslot.h:58
JoyButtonSlot::JoyLoadProfile
@ JoyLoadProfile
Definition: joybuttonslot.h:55
JoyButtonSlot::setSlotCode
void setSlotCode(int code)
Definition: joybuttonslot.cpp:86
SimpleKeyGrabberButton::eventFilter
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: simplekeygrabberbutton.cpp:55
EventHandlerFactory::getInstance
static EventHandlerFactory * getInstance(QString handler="")
Definition: eventhandlerfactory.cpp:71
SimpleKeyGrabberButton::setValue
void setValue(int value, int alias, JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard)
Definition: simplekeygrabberbutton.cpp:240
BaseEventHandler::getIdentifier
virtual QString getIdentifier()=0
JoyButtonSlot::JoySlotInputAction
JoySlotInputAction
Definition: joybuttonslot.h:42
number
it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License If the distribution and or use of the Library is restricted in certain countries either by patents or by copyrighted the original copyright holder who places the Library under this License may add an geographical distribution limitation excluding those so that distribution is permitted only in or among countries not thus excluded In such this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the Lesser General Public License from time to time Such new versions will be similar in spirit to the present but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Library specifies a version number of this License which applies to it and any later you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Library does not specify a license version number
Definition: lgpl-2.1.txt:423
AntKeyMapper::getNativeKeyMapper
QtKeyMapperBase * getNativeKeyMapper() const
Definition: antkeymapper.cpp:108
simplekeygrabberbutton.h
AntKeyMapper::returnQtKey
int returnQtKey(int key, int scancode=0)
Definition: antkeymapper.cpp:102