ckb-next
v0.2.8 at branch master
ckb-next driver for corsair devices
|
#include <src/ckb/keyaction.h>
Public Types | |
enum | Type { UNBOUND, NORMAL, SPECIAL } |
Public Member Functions | |
KeyAction (const QString &action, QObject *parent=0) | |
QString | value () const |
operator QString () const | |
KeyAction (QObject *parent=0) | |
QString | friendlyName (const KeyMap &map) const |
QString | driverName () const |
QString | macroFullLine () const |
macroFullLine If a macro command and a macro definition exists for the given key, returns the complete string except the leading "$" (the $ may confuse some caller). More... | |
bool | isValidMacro () const |
isValidMacro checks whether a keyAction contains a valid macro. This is done easily: If the macro action starts with $macro: and has five elements, delimited by ":", we may assume, that is a structural correct macro action. If it has 4 entries only, it is an older definition and ok also. More... | |
QStringList | macroLine () const |
macroLine returns all interresting content for a macro definition. More... | |
QString | macroContent () const |
macroContent returns the macro key definition only (the second part of the macro action). More... | |
QString | macroTiming () const |
macroTiming returns the macro key definition with original timing infos (the fifth and up to now last part of the macro action). If the implementation does not know anything about delays and has no 5th part, return first part. More... | |
void | macroDisplay () |
Debug output for invalid macro Definitions. More... | |
Type | type () const |
bool | isUnbound () const |
bool | isNormal () const |
bool | isSpecial () const |
bool | isMedia () const |
bool | isProgram () const |
bool | isAnim () const |
bool | isMacro () const |
bool | isDPI () const |
bool | isMouse () const |
QString | specialInfo (int ¶meter) const |
int | programInfo (QString &onPress, QString &onRelease) const |
int | dpiInfo (QPoint &custom) const |
QUuid | animInfo (bool &onlyOnce, bool &stopOnRelease) const |
void | keyEvent (KbBind *bind, bool down) |
void | keyRelease (KbBind *bind) |
void | adjustDisplay () |
~KeyAction () | |
Static Public Member Functions | |
static QString | noAction () |
static QString | defaultAction (const QString &key, KeyMap::Model model) |
static QString | modeAction (int mode) |
static QString | dpiAction (int level, int customX=0, int customY=0) |
static QString | lightAction (int type=LIGHT_UP_WRAP) |
static QString | lockAction (int type=LOCK_TOGGLE) |
static QString | programAction (const QString &onPress, const QString &onRelease, int stop) |
static QString | animAction (const QUuid &guid, bool onlyOnce, bool stopOnRelease) |
static QString | macroAction (QString macroDef) |
well documented in cpp file More... | |
Static Public Attributes | |
static const int | MODE_PREV = -2 |
static const int | MODE_NEXT = -1 |
static const int | MODE_PREV_WRAP = -4 |
static const int | MODE_NEXT_WRAP = -3 |
static const int | DPI_CYCLE_UP = -4 |
static const int | DPI_CYCLE_DOWN = -3 |
static const int | DPI_UP = -2 |
static const int | DPI_DOWN = -1 |
static const int | DPI_SNIPER = 0 |
static const int | DPI_CUSTOM = 6 |
static const int | LIGHT_UP = 0 |
static const int | LIGHT_DOWN = 1 |
static const int | LIGHT_UP_WRAP = 2 |
static const int | LIGHT_DOWN_WRAP = 3 |
static const int | LOCK_TOGGLE = 0 |
static const int | LOCK_ON = 1 |
static const int | LOCK_OFF = 2 |
static const int | PROGRAM_PR_MULTI = 0x04 |
static const int | PROGRAM_PR_INDEF = 0x00 |
static const int | PROGRAM_PR_KRSTOP = 0x01 |
static const int | PROGRAM_PR_KPSTOP = 0x02 |
static const int | PROGRAM_RE_MULTI = 0x40 |
static const int | PROGRAM_RE_INDEF = 0x00 |
static const int | PROGRAM_RE_KPSTOP = 0x20 |
Private Member Functions | |
void | operator= (const KeyAction &rhs) |
ccMSC: Don't copy key actions (the old one needs to be deleted first) frickler24: statement left as described, but copying is done in KbBind copy constructor More... | |
KeyAction (const KeyAction &rhs) | |
Private Attributes | |
QString | _value |
QProcess * | preProgram |
QProcess * | relProgram |
quint64 | sniperValue |
Definition at line 13 of file keyaction.h.
enum KeyAction::Type |
Enumerator | |
---|---|
UNBOUND | |
NORMAL | |
SPECIAL |
Definition at line 146 of file keyaction.h.
KeyAction::KeyAction | ( | const QString & | action, |
QObject * | parent = 0 |
||
) |
Definition at line 22 of file keyaction.cpp.
|
explicit |
Definition at line 27 of file keyaction.cpp.
KeyAction::~KeyAction | ( | ) |
|
inlineprivate |
Definition at line 187 of file keyaction.h.
void KeyAction::adjustDisplay | ( | ) |
Definition at line 464 of file keyaction.cpp.
Referenced by keyEvent().
|
static |
Definition at line 184 of file keyaction.cpp.
References ANIM_KRSTOP, and ANIM_ONCE.
Referenced by RebindWidget::applyChanges().
QUuid KeyAction::animInfo | ( | bool & | onlyOnce, |
bool & | stopOnRelease | ||
) | const |
Definition at line 225 of file keyaction.cpp.
References _value, ANIM_KRSTOP, ANIM_ONCE, and isAnim().
Referenced by keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 44 of file keyaction.cpp.
References KeyMap::GLAIVE, and KeyMap::HARPOON.
Referenced by KbBind::bindAction(), KbBind::defaultAction(), and KbBind::save().
|
static |
Definition at line 162 of file keyaction.cpp.
References DPI_CUSTOM.
Referenced by RebindWidget::applyChanges().
int KeyAction::dpiInfo | ( | QPoint & | custom | ) | const |
Definition at line 211 of file keyaction.cpp.
References _value, DPI_CUSTOM, and isDPI().
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
QString KeyAction::driverName | ( | ) | const |
Definition at line 239 of file keyaction.cpp.
References _value, and isSpecial().
Referenced by KbBind::update().
QString KeyAction::friendlyName | ( | const KeyMap & | map | ) | const |
Definition at line 84 of file keyaction.cpp.
References _value, DPI_CUSTOM, DPI_CYCLE_DOWN, DPI_CYCLE_UP, DPI_DOWN, DPI_SNIPER, DPI_UP, dpiInfo(), KeyMap::friendlyName(), KeyMap::layout(), LIGHT_DOWN, LIGHT_DOWN_WRAP, LIGHT_UP, LIGHT_UP_WRAP, LOCK_OFF, LOCK_ON, LOCK_TOGGLE, MODE_NEXT, MODE_NEXT_WRAP, MODE_PREV, and MODE_PREV_WRAP.
|
inline |
Definition at line 159 of file keyaction.h.
References _value.
Referenced by animInfo(), and RebindWidget::setSelection().
|
inline |
Definition at line 162 of file keyaction.h.
References _value.
Referenced by dpiInfo(), isMouse(), and RebindWidget::setSelection().
|
inline |
Definition at line 160 of file keyaction.h.
References _value.
Referenced by isValidMacro(), macroDisplay(), and macroFullLine().
|
inline |
|
inline |
Definition at line 163 of file keyaction.h.
References _value, isDPI(), and isNormal().
Referenced by RebindWidget::setSelection().
|
inline |
Definition at line 153 of file keyaction.h.
References NORMAL, and type().
Referenced by isMouse(), and RebindWidget::setSelection().
|
inline |
Definition at line 158 of file keyaction.h.
References _value.
Referenced by programInfo(), and RebindWidget::setSelection().
|
inline |
Definition at line 154 of file keyaction.h.
References SPECIAL, and type().
Referenced by driverName(), keyEvent(), and RebindWidget::setSelection().
|
inline |
Definition at line 152 of file keyaction.h.
References type(), and UNBOUND.
|
inline |
Definition at line 55 of file keyaction.h.
References _value, and isMacro().
Referenced by macroContent(), macroDisplay(), macroLine(), macroTiming(), RebindWidget::setSelection(), and KbBind::update().
void KeyAction::keyEvent | ( | KbBind * | bind, |
bool | down | ||
) |
Definition at line 245 of file keyaction.cpp.
References _value, adjustDisplay(), anim, animInfo(), KbPerf::baseDpiIdx(), KbProfile::currentMode(), Kb::currentProfile(), KbBind::devParent(), KbLight::dimming(), KbPerf::DPI_COUNT, DPI_CUSTOM, DPI_CYCLE_DOWN, DPI_CYCLE_UP, DPI_DOWN, DPI_SNIPER, DPI_UP, KbPerf::dpiCycleDown(), KbPerf::dpiCycleUp(), KbPerf::dpiDown(), dpiInfo(), KbPerf::dpiUp(), KbLight::findAnim(), KbProfile::indexOf(), KbAnim::isActive(), isSpecial(), KbBind::light(), LIGHT_DOWN, LIGHT_DOWN_WRAP, LIGHT_UP, LIGHT_UP_WRAP, LOCK_OFF, LOCK_ON, LOCK_TOGGLE, KbLight::MAX_DIM, MODE_NEXT, MODE_NEXT_WRAP, MODE_PREV, MODE_PREV_WRAP, KbProfile::modeCount(), KbProfile::modes(), KbBind::perf(), KbPerf::popDpi(), preProgram, PROGRAM_PR_KPSTOP, PROGRAM_PR_KRSTOP, PROGRAM_PR_MULTI, PROGRAM_RE_KPSTOP, PROGRAM_RE_MULTI, programInfo(), KbPerf::pushDpi(), KbPerf::pushSniper(), relProgram, Kb::setCurrentMode(), sniperValue, KbAnim::stop(), KbAnim::trigger(), and KbBind::winLock().
Referenced by KbBind::keyEvent().
void KeyAction::keyRelease | ( | KbBind * | bind | ) |
|
static |
Definition at line 169 of file keyaction.cpp.
Referenced by RebindWidget::applyChanges().
|
static |
Definition at line 173 of file keyaction.cpp.
Referenced by RebindWidget::applyChanges().
|
static |
KeyAction::macroAction is called when applying changes on a macro definition. macroAction ist called while being in the macro pane and clicking Apply with something in the Macro Text Box. It tags that input with "$macro:" for further recognition.
macroDef | holds the String containing parts 2-5 of a complete macro definition. |
Definition at line 523 of file keyaction.cpp.
Referenced by RebindWidget::applyChanges().
|
inline |
Definition at line 86 of file keyaction.h.
References _value, and isValidMacro().
Referenced by RebindWidget::setSelection(), and KbBind::update().
void KeyAction::macroDisplay | ( | ) |
KeyAction::macroDisplay is just for debugging. It shows the content of the key action and some other info.
General Info on KeyAction::_value for macros: That string consists of 4 elements, all delimited by ":".
Definition at line 456 of file keyaction.cpp.
References _value, isMacro(), and isValidMacro().
Referenced by RebindWidget::setSelection().
|
inline |
Definition at line 43 of file keyaction.h.
References _value, and isMacro().
|
inline |
Definition at line 73 of file keyaction.h.
References _value, and isValidMacro().
Referenced by RebindWidget::setSelection().
|
inline |
Definition at line 98 of file keyaction.h.
References _value, and isValidMacro().
Referenced by RebindWidget::setSelection().
|
static |
Definition at line 158 of file keyaction.cpp.
Referenced by RebindWidget::applyChanges().
|
inlinestatic |
Definition at line 25 of file keyaction.h.
|
inline |
|
inlineprivate |
Definition at line 186 of file keyaction.h.
|
static |
Definition at line 177 of file keyaction.cpp.
Referenced by RebindWidget::applyChanges().
int KeyAction::programInfo | ( | QString & | onPress, |
QString & | onRelease | ||
) | const |
Definition at line 199 of file keyaction.cpp.
References _value, and isProgram().
Referenced by keyEvent(), and RebindWidget::setSelection().
QString KeyAction::specialInfo | ( | int & | parameter | ) | const |
Definition at line 189 of file keyaction.cpp.
References _value.
Referenced by RebindWidget::setSelection().
KeyAction::Type KeyAction::type | ( | ) | const |
Definition at line 14 of file keyaction.cpp.
References _value, NORMAL, SPECIAL, and UNBOUND.
Referenced by isNormal(), isSpecial(), isUnbound(), KbBindWidget::on_copyButton_clicked(), and KbBindWidget::on_resetButton_clicked().
|
inline |
Definition at line 19 of file keyaction.h.
References _value.
Referenced by KbBind::action(), KbBind::KbBind(), KbBind::save(), and KbBind::update().
|
private |
Definition at line 189 of file keyaction.h.
Referenced by animInfo(), dpiInfo(), driverName(), friendlyName(), isAnim(), isDPI(), isMacro(), isMedia(), isMouse(), isProgram(), isValidMacro(), keyEvent(), macroContent(), macroDisplay(), macroFullLine(), macroLine(), macroTiming(), operator QString(), programInfo(), specialInfo(), type(), and value().
|
static |
Definition at line 128 of file keyaction.h.
Referenced by dpiAction(), dpiInfo(), friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 126 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 126 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 127 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 128 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 127 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 131 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 132 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 131 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 132 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 135 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 135 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 135 of file keyaction.h.
Referenced by friendlyName(), and keyEvent().
|
static |
Definition at line 122 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 123 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 122 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 123 of file keyaction.h.
Referenced by friendlyName(), keyEvent(), and RebindWidget::setSelection().
|
private |
Definition at line 192 of file keyaction.h.
Referenced by keyEvent(), and ~KeyAction().
|
static |
Definition at line 138 of file keyaction.h.
|
static |
Definition at line 138 of file keyaction.h.
Referenced by keyEvent().
|
static |
Definition at line 138 of file keyaction.h.
Referenced by keyEvent().
|
static |
Definition at line 138 of file keyaction.h.
Referenced by RebindWidget::applyChanges(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 139 of file keyaction.h.
Referenced by RebindWidget::applyChanges(), and RebindWidget::setSelection().
|
static |
Definition at line 139 of file keyaction.h.
Referenced by RebindWidget::applyChanges(), keyEvent(), and RebindWidget::setSelection().
|
static |
Definition at line 139 of file keyaction.h.
Referenced by RebindWidget::applyChanges(), keyEvent(), and RebindWidget::setSelection().
|
private |
Definition at line 193 of file keyaction.h.
Referenced by keyEvent(), and ~KeyAction().
|
private |
Definition at line 196 of file keyaction.h.
Referenced by keyEvent().