author | ar <ar> | 2004-05-27 22:04:46 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-27 22:04:46 (UTC) |
commit | 4f7c3c4d0d634706d13950b3827714b168e279e3 (patch) (side-by-side diff) | |
tree | 2df448e7a4dcd538c26365873e194be2b55e83b7 /noncore/apps/keyz-cfg | |
parent | 46f81a089ba8febdb79e0d150b69f74bb1ea7d18 (diff) | |
download | opie-4f7c3c4d0d634706d13950b3827714b168e279e3.zip opie-4f7c3c4d0d634706d13950b3827714b168e279e3.tar.gz opie-4f7c3c4d0d634706d13950b3827714b168e279e3.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | noncore/apps/keyz-cfg/zkb.cpp | 716 |
1 files changed, 358 insertions, 358 deletions
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index 58bde2a..c9e1dc5 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp @@ -1,2 +1,6 @@ #include "zkb.h" + +/* OPIE */ +#include <opie2/odebug.h> + #include <stdio.h> @@ -8,3 +12,3 @@ Action::Action():state(0), keycode(0), unicode(0), flags(0) { Action::Action(State* s, ushort kc, ushort uni, int f): - state(s), keycode(kc), unicode(uni), flags(f) { + state(s), keycode(kc), unicode(uni), flags(f) { } @@ -15,3 +19,3 @@ Action::~Action() { State* Action::getState() const { - return state; + return state; } @@ -19,4 +23,4 @@ State* Action::getState() const { void Action::setState(State* s) { - state = s; - setDefined(true); + state = s; + setDefined(true); } @@ -24,3 +28,3 @@ void Action::setState(State* s) { bool Action::hasEvent() const { - return flags & Event; + return flags & Event; } @@ -28,11 +32,11 @@ bool Action::hasEvent() const { void Action::setEvent(bool e) { - flags = (flags & ~Event) | ((e) ? Event : 0); + flags = (flags & ~Event) | ((e) ? Event : 0); - if (e) { - setDefined(true); - } else { - if (state == 0) { - setDefined(false); - } - } + if (e) { + setDefined(true); + } else { + if (state == 0) { + setDefined(false); + } + } } @@ -40,3 +44,3 @@ void Action::setEvent(bool e) { bool Action::isDefined() const { - return flags & Defined; + return flags & Defined; } @@ -44,3 +48,3 @@ bool Action::isDefined() const { void Action::setDefined(bool d) { - flags = (flags & ~Defined) | ((d) ? Defined : 0); + flags = (flags & ~Defined) | ((d) ? Defined : 0); } @@ -48,3 +52,3 @@ void Action::setDefined(bool d) { int Action::getKeycode() const { - return keycode; + return keycode; } @@ -52,4 +56,4 @@ int Action::getKeycode() const { void Action::setKeycode(int c) { - keycode = (ushort) c; - setEvent(true); + keycode = (ushort) c; + setEvent(true); } @@ -57,3 +61,3 @@ void Action::setKeycode(int c) { int Action::getUnicode() const { - return unicode; + return unicode; } @@ -61,4 +65,4 @@ int Action::getUnicode() const { void Action::setUnicode(int u) { - unicode = (ushort) u; - setEvent(true); + unicode = (ushort) u; + setEvent(true); } @@ -66,20 +70,20 @@ void Action::setUnicode(int u) { int Action::getModifiers() const { - int ret = 0; - if (flags & Shift_Mod) { - ret |= Qt::ShiftButton; - } + int ret = 0; + if (flags & Shift_Mod) { + ret |= Qt::ShiftButton; + } - if (flags & Ctrl_Mod) { - ret |= Qt::ControlButton; - } + if (flags & Ctrl_Mod) { + ret |= Qt::ControlButton; + } - if (flags & Alt_Mod) { - ret |= Qt::AltButton; - } + if (flags & Alt_Mod) { + ret |= Qt::AltButton; + } - if (flags & Keypad_Mod) { - ret |= Qt::Keypad; - } + if (flags & Keypad_Mod) { + ret |= Qt::Keypad; + } - return ret; + return ret; } @@ -87,22 +91,22 @@ int Action::getModifiers() const { void Action::setModifiers(int m) { - int n = 0; + int n = 0; - if (m & Qt::ShiftButton) { - n |= Shift_Mod; - } + if (m & Qt::ShiftButton) { + n |= Shift_Mod; + } - if (m & Qt::ControlButton) { - n |= Ctrl_Mod; - } + if (m & Qt::ControlButton) { + n |= Ctrl_Mod; + } - if (m & Qt::AltButton) { - n |= Alt_Mod; - } + if (m & Qt::AltButton) { + n |= Alt_Mod; + } - if (m & Qt::Keypad) { - n |= Keypad_Mod; - } + if (m & Qt::Keypad) { + n |= Keypad_Mod; + } - flags = flags & ~Mod_Bits | n; - setEvent(true); + flags = flags & ~Mod_Bits | n; + setEvent(true); } @@ -110,3 +114,3 @@ void Action::setModifiers(int m) { bool Action::isPressed() const { - return (flags & Press) != 0; + return (flags & Press) != 0; } @@ -114,4 +118,4 @@ bool Action::isPressed() const { void Action::setPressed(bool p) { - flags = (flags & ~Press) | ((p) ? Press : 0); - setEvent(true); + flags = (flags & ~Press) | ((p) ? Press : 0); + setEvent(true); } @@ -119,3 +123,3 @@ void Action::setPressed(bool p) { bool Action::isAutorepeat() const { - return (flags & Autorepeat) != 0; + return (flags & Autorepeat) != 0; } @@ -123,4 +127,4 @@ bool Action::isAutorepeat() const { void Action::setAutorepeat(bool p) { - flags = (flags & ~Autorepeat) | ((p) ? Autorepeat : 0); - setEvent(true); + flags = (flags & ~Autorepeat) | ((p) ? Autorepeat : 0); + setEvent(true); } @@ -129,14 +133,14 @@ void Action::setAutorepeat(bool p) { const short State::x1[] = { /* from 0x20 to 0x5f */ - 31, 0, 28, 3, 5, 6, 9, 28, /* 0x20 - 0x27 */ - 11, 26, 10, 13, 26, 1, 29, 27, /* 0x28 - 0x2f */ - 15, 16, 22, 4, 17, 19, 24, 20, /* 0x30 - 0x37 */ - 8, 14, 29, 26, 29, 12, 32, 27, /* 0x38 - 0x3f */ - 18, 0, 1, 2, 3, 4, 5, 6, /* 0x40 - 0x47 */ - 7, 8, 9, 10, 11, 12, 13, 14, /* 0x48 - 0x4f */ - 15, 16, 17, 18, 19, 20, 21, 22, /* 0x50 - 0x57 */ - 23, 24, 25, 30, -1, 26, 28, 7, /* 0x58 - 0x5f */ - 31, -1, -1, -1, -1, -1, -1, -1, /* 0x60 - 0x67 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x68 - 0x6f */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x70 - 0x77 */ - -1, -1, -1, 29, 31, 32, 32, 28, /* 0x78 - 0x7f */ + 31, 0, 28, 3, 5, 6, 9, 28, /* 0x20 - 0x27 */ + 11, 26, 10, 13, 26, 1, 29, 27, /* 0x28 - 0x2f */ + 15, 16, 22, 4, 17, 19, 24, 20, /* 0x30 - 0x37 */ + 8, 14, 29, 26, 29, 12, 32, 27, /* 0x38 - 0x3f */ + 18, 0, 1, 2, 3, 4, 5, 6, /* 0x40 - 0x47 */ + 7, 8, 9, 10, 11, 12, 13, 14, /* 0x48 - 0x4f */ + 15, 16, 17, 18, 19, 20, 21, 22, /* 0x50 - 0x57 */ + 23, 24, 25, 30, -1, 26, 28, 7, /* 0x58 - 0x5f */ + 31, -1, -1, -1, -1, -1, -1, -1, /* 0x60 - 0x67 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x68 - 0x6f */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x70 - 0x77 */ + -1, -1, -1, 29, 31, 32, 32, 28, /* 0x78 - 0x7f */ }; @@ -144,17 +148,17 @@ const short State::x1[] = { /* from 0x20 to 0x5f */ const short State::x2[] = { /* from 0x1000 to 0x1057*/ - 42, 36, -1, 30, 32, -1, -1, -1, /* 0x1000 - 0x1007 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1008 - 0x100f */ - -1, -1, 44, 45, 46, 47, -1, -1, /* 0x1010 - 0x1017 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1018 - 0x101f */ - 33, 35, 34, -1, 36, 27, -1, -1, /* 0x1020 - 0x1027 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1028 - 0x102f */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1030 - 0x1037 */ - 37, 38, 40, 39, 41, -1, -1, -1, /* 0x1038 - 0x103f */ - -1, -1, -1, -1, -1, 35, -1, -1, /* 0x1040 - 0x1047 */ - -1, -1, -1, -1, -1, 48, -1, -1, /* 0x1048 - 0x104f */ - 43, 49, 50, -1, -1, -1, -1, -1, /* 0x1050 - 0x1057 */ + 42, 36, -1, 30, 32, -1, -1, -1, /* 0x1000 - 0x1007 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1008 - 0x100f */ + -1, -1, 44, 45, 46, 47, -1, -1, /* 0x1010 - 0x1017 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1018 - 0x101f */ + 33, 35, 34, -1, 36, 27, -1, -1, /* 0x1020 - 0x1027 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1028 - 0x102f */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1030 - 0x1037 */ + 37, 38, 40, 39, 41, -1, -1, -1, /* 0x1038 - 0x103f */ + -1, -1, -1, -1, -1, 35, -1, -1, /* 0x1040 - 0x1047 */ + -1, -1, -1, -1, -1, 48, -1, -1, /* 0x1048 - 0x104f */ + 43, 49, 50, -1, -1, -1, -1, -1, /* 0x1050 - 0x1057 */ }; - + State::State(State* p):parent(p), keys(0) { - keys = new Action[Key_Max * 2 + 1]; + keys = new Action[Key_Max * 2 + 1]; } @@ -162,5 +166,5 @@ State::State(State* p):parent(p), keys(0) { State::State(const State& s) { - parent = s.parent; - keys = new Action[Key_Max * 2 + 1]; - memcpy(keys, s.keys, sizeof(Action) * (Key_Max * 2 + 1)); + parent = s.parent; + keys = new Action[Key_Max * 2 + 1]; + memcpy(keys, s.keys, sizeof(Action) * (Key_Max * 2 + 1)); } @@ -168,5 +172,5 @@ State::State(const State& s) { State::~State() { - if (keys!=0) { - delete [] keys; - } + if (keys!=0) { + delete [] keys; + } } @@ -174,19 +178,19 @@ State::~State() { Action* State::get(int keycode, bool pressed, bool follow) const { - Action* ret = 0; - int n = translateKeycode(keycode); + Action* ret = 0; + int n = translateKeycode(keycode); - if (n != -1 && keys != 0) { - if (pressed) { - n += Key_Max; - } - ret = &keys[n]; - } + if (n != -1 && keys != 0) { + if (pressed) { + n += Key_Max; + } + ret = &keys[n]; + } - if (ret==0 || !ret->isDefined()) { - if (follow && parent!=0) { - ret = parent->get(keycode, pressed, follow); - } - } + if (ret==0 || !ret->isDefined()) { + if (follow && parent!=0) { + ret = parent->get(keycode, pressed, follow); + } + } - return ret; + return ret; } @@ -194,14 +198,14 @@ Action* State::get(int keycode, bool pressed, bool follow) const { bool State::set(int keycode, bool pressed, Action& action) { - int n = translateKeycode(keycode); + int n = translateKeycode(keycode); - if (n==-1 || keys==0) { - return false; - } + if (n==-1 || keys==0) { + return false; + } - if (pressed) { - n += Key_Max + 1; - } + if (pressed) { + n += Key_Max + 1; + } - keys[n] = action; - return true; + keys[n] = action; + return true; } @@ -209,3 +213,3 @@ bool State::set(int keycode, bool pressed, Action& action) { State* State::getParent() const { - return parent; + return parent; } @@ -213,3 +217,3 @@ State* State::getParent() const { void State::setParent(State* s) { - parent = s; + parent = s; } @@ -217,19 +221,19 @@ void State::setParent(State* s) { int State::translateKeycode(int keycode) const { - if (keycode < 0x20) { - return -1; - } + if (keycode < 0x20) { + return -1; + } - if (keycode < 0x80) { - return x1[keycode - 0x20]; - } + if (keycode < 0x80) { + return x1[keycode - 0x20]; + } - if (keycode < 0x1000) { - return -1; - } + if (keycode < 0x1000) { + return -1; + } - if (keycode < 0x1057) { - return x2[keycode - 0x1000]; - } + if (keycode < 0x1057) { + return x2[keycode - 0x1000]; + } - return -1; + return -1; } @@ -238,5 +242,5 @@ int State::translateKeycode(int keycode) const { Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(this) { - repeatDelay=400; - repeatPeriod=80; - connect(&repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); + repeatDelay=400; + repeatPeriod=80; + connect(&repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); } @@ -244,7 +248,7 @@ Keymap::Keymap():enabled(true), currentState(0), autoRepeatAction(0), repeater(t Keymap::~Keymap() { - QMap<QString, State*>::Iterator it; - for(it = states.begin(); it != states.end(); ++it) { - delete it.data(); - } - states.clear(); + QMap<QString, State*>::Iterator it; + for(it = states.begin(); it != states.end(); ++it) { + delete it.data(); + } + states.clear(); } @@ -252,55 +256,53 @@ Keymap::~Keymap() { bool Keymap::filter(int unicode, int keycode, int modifiers, - bool isPress, bool autoRepeat) { + bool isPress, bool autoRepeat) { - qDebug("filter: >>> unicode=%x, keycode=%x, modifiers=%x, " - "ispressed=%x\n", unicode, keycode, modifiers, isPress); + odebug << "filter: >>> unicode=" << unicode << ", keycode=" << keycode + << ", modifiers=" << modifiers << ", ispressed=" << isPress << oendl; - if (!enabled) { - return false; - } + if (!enabled) { + return false; + } - // the second check is workaround to make suspend work if - // the user pressed it right after he did resume. for some - // reason the event sent by qt has autoRepeat true in this - // case - if (autoRepeat && keycode != 4177) { - return true; - } + // the second check is workaround to make suspend work if + // the user pressed it right after he did resume. for some + // reason the event sent by qt has autoRepeat true in this + // case + if (autoRepeat && keycode != 4177) { + return true; + } - (void) unicode; (void) modifiers; + (void) unicode; (void) modifiers; - Action* action = currentState->get(keycode, isPress, true); - if (action==0 || !action->isDefined()) { - return true; - } + Action* action = currentState->get(keycode, isPress, true); + if (action==0 || !action->isDefined()) { + return true; + } - if (action->hasEvent()) { - qDebug("filter:<<< unicode=%x, keycode=%x, modifiers=%x, " - "ispressed=%x\n", action->getUnicode(), - action->getKeycode(), action->getModifiers(), - action->isPressed()); + if (action->hasEvent()) { + odebug << "filter:<<< unicode=" << action->getUnicode() << ", keycode=" << action->getKeycode() + << ", modifiers=" << action->getModifiers() << ", ispressed=" << action->isPressed() << oendl; - QWSServer::sendKeyEvent(action->getUnicode(), - action->getKeycode(), action->getModifiers(), - action->isPressed(), false); - } + QWSServer::sendKeyEvent(action->getUnicode(), + action->getKeycode(), action->getModifiers(), + action->isPressed(), false); + } - if (action->isAutorepeat()) { - autoRepeatAction = action; - repeater.start(repeatDelay, TRUE); - } else { - autoRepeatAction = 0; - } + if (action->isAutorepeat()) { + autoRepeatAction = action; + repeater.start(repeatDelay, TRUE); + } else { + autoRepeatAction = 0; + } - State* nstate = action->getState(); - if (nstate != 0) { - setCurrentState(nstate); - QString lbl = getCurrentLabel(); - if (!lbl.isEmpty()) { - emit stateChanged(lbl); - } - } + State* nstate = action->getState(); + if (nstate != 0) { + setCurrentState(nstate); + QString lbl = getCurrentLabel(); + if (!lbl.isEmpty()) { + emit stateChanged(lbl); + } + } - return true; + return true; } @@ -308,3 +310,3 @@ bool Keymap::filter(int unicode, int keycode, int modifiers, void Keymap::enable() { - enabled = true; + enabled = true; } @@ -312,3 +314,3 @@ void Keymap::enable() { void Keymap::disable() { - enabled = false; + enabled = false; } @@ -316,10 +318,10 @@ void Keymap::disable() { QStringList Keymap::listStates() { - QStringList ret; + QStringList ret; - QMap<QString, State*>::Iterator it; - for(it = states.begin(); it != states.end(); ++it) { - ret.append(it.key()); - } + QMap<QString, State*>::Iterator it; + for(it = states.begin(); it != states.end(); ++it) { + ret.append(it.key()); + } - return ret; + return ret; } @@ -327,9 +329,9 @@ QStringList Keymap::listStates() { State* Keymap::getStateByName(const QString& name) { - QMap<QString, State*>::Iterator it = states.find(name); + QMap<QString, State*>::Iterator it = states.find(name); - if (it == states.end()) { - return 0; - } + if (it == states.end()) { + return 0; + } - return it.data(); + return it.data(); } @@ -337,9 +339,9 @@ State* Keymap::getStateByName(const QString& name) { QStringList Keymap::listLabels() { - QStringList ret; + QStringList ret; - for(uint i = 0; i < labelList.count(); i++) { - ret.append(*labelList.at(i)); - } + for(uint i = 0; i < labelList.count(); i++) { + ret.append(*labelList.at(i)); + } - return ret; + return ret; } @@ -347,28 +349,28 @@ QStringList Keymap::listLabels() { State* Keymap::getStateByLabel(const QString& label) { - QMap<QString, QString>::Iterator lit = labels.find(label); - State* state = 0; + QMap<QString, QString>::Iterator lit = labels.find(label); + State* state = 0; - if (lit == labels.end()) { - return 0; - } + if (lit == labels.end()) { + return 0; + } - QString name = lit.data(); + QString name = lit.data(); - int n = name.find(":*"); - if (n>=0 && n==(int)(name.length()-2)) { - name=name.left(name.length() - 1); + int n = name.find(":*"); + if (n>=0 && n==(int)(name.length()-2)) { + name=name.left(name.length() - 1); - n = currentStateName.findRev(":"); - if (n >= 0) { - name += currentStateName.mid(n+1); - } - } + n = currentStateName.findRev(":"); + if (n >= 0) { + name += currentStateName.mid(n+1); + } + } -// odebug << "look for: " << name.utf8() << "\n" << oendl; - QMap<QString, State*>::Iterator sit = states.find(name); - if (sit != states.end()) { - state = sit.data(); - } +// odebug << "look for: " << name.utf8() << "\n" << oendl; + QMap<QString, State*>::Iterator sit = states.find(name); + if (sit != states.end()) { + state = sit.data(); + } - return state; + return state; } @@ -376,14 +378,14 @@ State* Keymap::getStateByLabel(const QString& label) { bool Keymap::addState(const QString& name, State* state) { - if (states.find(name) != states.end()) { - return false; - } + if (states.find(name) != states.end()) { + return false; + } - states.insert(name, state); - lsmapInSync = false; + states.insert(name, state); + lsmapInSync = false; - if (currentState == 0) { - setCurrentState(state); - } + if (currentState == 0) { + setCurrentState(state); + } - return true; + return true; } @@ -391,3 +393,3 @@ bool Keymap::addState(const QString& name, State* state) { State* Keymap::getCurrentState() const { - return currentState; + return currentState; } @@ -395,3 +397,3 @@ State* Keymap::getCurrentState() const { QString Keymap::getCurrentLabel() { - return currentLabel; + return currentLabel; } @@ -399,30 +401,29 @@ QString Keymap::getCurrentLabel() { bool Keymap::setCurrentState(State* state) { - QMap<QString, State*>::Iterator it; - for(it = states.begin(); it != states.end(); ++it) { - State* s = it.data(); - if (s == state) { - currentState = s; - currentStateName = it.key(); + QMap<QString, State*>::Iterator it; + for(it = states.begin(); it != states.end(); ++it) { + State* s = it.data(); + if (s == state) { + currentState = s; + currentStateName = it.key(); - qDebug("state changed: %s\n", (const char*) - currentStateName.utf8()); + odebug << "state changed: " << (const char*)currentStateName.utf8() << oendl; - if (!lsmapInSync) { - generateLabelStateMaps(); - } + if (!lsmapInSync) { + generateLabelStateMaps(); + } - QMap<State*, QString>::Iterator tit; - tit = stateLabelMap.find(state); - if (tit != stateLabelMap.end()) { - currentLabel = tit.data(); - } else { -// odebug << "no label for: " + currentStateName + "\n" << oendl; - currentLabel = ""; - } + QMap<State*, QString>::Iterator tit; + tit = stateLabelMap.find(state); + if (tit != stateLabelMap.end()) { + currentLabel = tit.data(); + } else { +// odebug << "no label for: " + currentStateName + "\n" << oendl; + currentLabel = ""; + } - return true; - } - } + return true; + } + } - return false; + return false; } @@ -430,33 +431,33 @@ bool Keymap::setCurrentState(State* state) { bool Keymap::removeState(const QString& name, bool force) { - QMap<QString, State*>::Iterator it = states.find(name); + QMap<QString, State*>::Iterator it = states.find(name); - if (it == states.end()) { - return false; - } + if (it == states.end()) { + return false; + } - State* state = it.data(); - QList<Action> acts = findStateUsage(state); + State* state = it.data(); + QList<Action> acts = findStateUsage(state); - if (!acts.isEmpty()) { - if (!force) { - return false; - } else { - for(Action* a = acts.first(); a != 0; a = acts.next()) { - a->setState(0); - } - } - } + if (!acts.isEmpty()) { + if (!force) { + return false; + } else { + for(Action* a = acts.first(); a != 0; a = acts.next()) { + a->setState(0); + } + } + } - if (state == currentState) { - if (states.begin() != states.end()) { - setCurrentState(states.begin().data()); - } - } + if (state == currentState) { + if (states.begin() != states.end()) { + setCurrentState(states.begin().data()); + } + } - states.remove(it); - delete state; + states.remove(it); + delete state; - lsmapInSync = false; + lsmapInSync = false; - return true; + return true; } @@ -464,16 +465,15 @@ bool Keymap::removeState(const QString& name, bool force) { void Keymap::autoRepeat() { - if (autoRepeatAction != 0) { - qDebug("filter:<<< unicode=%x, keycode=%x, modifiers=%x, " - "ispressed=%x\n", autoRepeatAction->getUnicode(), - autoRepeatAction->getKeycode(), - autoRepeatAction->getModifiers(), - autoRepeatAction->isPressed()); + if (autoRepeatAction != 0) { + odebug << "filter:<<< unicode=" << autoRepeatAction->getUnicode() + << ", keycode=" << autoRepeatAction->getKeycode() + << ", modifiers=" << autoRepeatAction->getModifiers() + << "ispressed=" << autoRepeatAction->isPressed() << oendl; - QWSServer::sendKeyEvent(autoRepeatAction->getUnicode(), - autoRepeatAction->getKeycode(), - autoRepeatAction->getModifiers(), - autoRepeatAction->isPressed(), true); - } + QWSServer::sendKeyEvent(autoRepeatAction->getUnicode(), + autoRepeatAction->getKeycode(), + autoRepeatAction->getModifiers(), + autoRepeatAction->isPressed(), true); + } - repeater.start(repeatPeriod, TRUE); + repeater.start(repeatPeriod, TRUE); } @@ -481,17 +481,17 @@ void Keymap::autoRepeat() { bool Keymap::addLabel(const QString& label, const QString& state, int index) { - if (labels.find(label) != labels.end()) { - return false; - } + if (labels.find(label) != labels.end()) { + return false; + } - labels.insert(label, state); - const QString& l = labels.find(label).key(); - if (index == -1) { - labelList.append(l); - } else { - labelList.insert(labelList.at(index), l); - } + labels.insert(label, state); + const QString& l = labels.find(label).key(); + if (index == -1) { + labelList.append(l); + } else { + labelList.insert(labelList.at(index), l); + } - lsmapInSync = false; + lsmapInSync = false; - return true; + return true; } @@ -500,15 +500,15 @@ bool Keymap::removeLabel(const QString& label) { - if (labels.find(label) == labels.end()) { - return false; - } + if (labels.find(label) == labels.end()) { + return false; + } - labels.remove(label); - labelList.remove(label); - lsmapInSync = false; + labels.remove(label); + labelList.remove(label); + lsmapInSync = false; - if (label == currentLabel) { - currentLabel = ""; - } + if (label == currentLabel) { + currentLabel = ""; + } - return true; + return true; } @@ -516,3 +516,3 @@ bool Keymap::removeLabel(const QString& label) { int Keymap::getAutorepeatDelay() const { - return repeatDelay; + return repeatDelay; } @@ -520,3 +520,3 @@ int Keymap::getAutorepeatDelay() const { void Keymap::setAutorepeatDelay(int n) { - repeatDelay = n; + repeatDelay = n; } @@ -524,3 +524,3 @@ void Keymap::setAutorepeatDelay(int n) { int Keymap::getAutorepeatPeriod() const { - return repeatPeriod; + return repeatPeriod; } @@ -528,3 +528,3 @@ int Keymap::getAutorepeatPeriod() const { void Keymap::setAutorepeatPeriod(int n) { - repeatPeriod = n; + repeatPeriod = n; } @@ -532,22 +532,22 @@ void Keymap::setAutorepeatPeriod(int n) { QList<Action> Keymap::findStateUsage(State* s) { - QList<Action> ret; + QList<Action> ret; - QMap<QString, State*>::Iterator it; - for(it = states.begin(); it != states.end(); ++it) { - State* state = it.data(); + QMap<QString, State*>::Iterator it; + for(it = states.begin(); it != states.end(); ++it) { + State* state = it.data(); - for(int i = 0; i < 0x1100; i++) { - Action* action = state->get(i, false); - if (action!=0 && action->getState()==s) { - ret.append(action); - } + for(int i = 0; i < 0x1100; i++) { + Action* action = state->get(i, false); + if (action!=0 && action->getState()==s) { + ret.append(action); + } - action = state->get(i, true); - if (action!=0 && action->getState()==s) { - ret.append(action); - } - } - } + action = state->get(i, true); + if (action!=0 && action->getState()==s) { + ret.append(action); + } + } + } - return ret; + return ret; } @@ -555,35 +555,35 @@ QList<Action> Keymap::findStateUsage(State* s) { void Keymap::generateLabelStateMaps() { - stateLabelMap.clear(); - - QMap<QString, QString>::Iterator lit; - for(lit = labels.begin(); lit != labels.end(); ++lit) { - QString label = lit.key(); - QString name = lit.data(); - - bool wc = false; - int n = name.find("*"); - if (n>=0 && n==(int)(name.length()-1)) { - name=name.left(name.length() - 1); - wc = true; - } - - QMap<QString, State*>::Iterator sit; - for(sit = states.begin(); sit != states.end(); ++sit) { - QString sname = sit.key(); - State* state = sit.data(); - - if (sname.length() < name.length()) { - continue; - } - - if (sname.left(name.length()) == name) { - if (wc || sname.length()==name.length()) { - stateLabelMap.insert(state, label); - } - - } - } - } - - lsmapInSync = true; + stateLabelMap.clear(); + + QMap<QString, QString>::Iterator lit; + for(lit = labels.begin(); lit != labels.end(); ++lit) { + QString label = lit.key(); + QString name = lit.data(); + + bool wc = false; + int n = name.find("*"); + if (n>=0 && n==(int)(name.length()-1)) { + name=name.left(name.length() - 1); + wc = true; + } + + QMap<QString, State*>::Iterator sit; + for(sit = states.begin(); sit != states.end(); ++sit) { + QString sname = sit.key(); + State* state = sit.data(); + + if (sname.length() < name.length()) { + continue; + } + + if (sname.left(name.length()) == name) { + if (wc || sname.length()==name.length()) { + stateLabelMap.insert(state, label); + } + + } + } + } + + lsmapInSync = true; } |