From 2b64a84d39eeed5681d0ee5068c7d11a01527750 Mon Sep 17 00:00:00 2001 From: alwin Date: Mon, 28 Feb 2005 09:40:30 +0000 Subject: other keymapping tool - not working this moment, I have to check it out - the reason is that the config file is somewhat easier to understand than from zkbapplet and has a nice config tool. Please don't put it into any repositories this moment. --- (limited to 'noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h') diff --git a/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h new file mode 100644 index 0000000..a99c181 --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h @@ -0,0 +1,80 @@ +#ifndef _KEY_MODIFIERS_H_ +#define _KEY_MODIFIERS_H_ + +#include +#include +#include +#include + +#include +#include "ConfigEx.h" + +struct ModifierInfo { +public: + ModifierInfo(const QString& tp, int code, int mask, bool mode) + { + type = tp; + keycode = code; + keymask = mask; + pressed = false; + toggled = false; + toggle_mode = mode; + } + QString type; + int keycode; + int keymask; + bool pressed; + bool toggled; + bool toggle_mode; +private: +} ; + +class KeyModifiers : public QObject +{ + Q_OBJECT +public: + typedef QValueList ModifierList; + + KeyModifiers(); + virtual ~KeyModifiers(); + void addType(const QString& type); + ModifierInfo* assign(const QString& type, int keycode, + int keymask = 0, bool toggle = false); + void assignRelease(int keycode); + void assignRelease(ModifierInfo* info, int keycode); + void setToggle(); + void setToggle(ModifierInfo* info); + + bool isToggled(); + void resetStates(); + void keepToggles(); + + bool pressKey(int keycode, int modifiers); + void releaseKey(int keycode); + int getState(); + int getState(int modifiers, bool reset = false); + int getMask(const QString& type); + int getModifiers(int modifiers); + + bool isModifier(int keycode); + + void statistics(); + + void reset(); +public slots: + void resetToggles(); +private: + QMap m_types; + int m_bitmask; + ModifierList m_modifiers; + QMap m_releasekeys; + ModifierList m_togglekeys; + ModifierInfo* m_info; + QTimer* m_pTimer; + int m_timeout; + + void clear(); + void init(); +}; + +#endif /* _KEY_MODIFIERS_H_ */ -- cgit v0.9.0.2