Diffstat (limited to 'noncore/apps/keyz-cfg/zkb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/keyz-cfg/zkb.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index f315d4b..8382615 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp @@ -271,245 +271,245 @@ bool Keymap::filter(int unicode, int keycode, int modifiers, 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()); QWSServer::sendKeyEvent(action->getUnicode(), action->getKeycode(), action->getModifiers(), action->isPressed(), false); } 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); } } return true; } void Keymap::enable() { enabled = true; } void Keymap::disable() { enabled = false; } QStringList Keymap::listStates() { QStringList ret; QMap<QString, State*>::Iterator it; for(it = states.begin(); it != states.end(); ++it) { ret.append(it.key()); } return ret; } State* Keymap::getStateByName(const QString& name) { QMap<QString, State*>::Iterator it = states.find(name); if (it == states.end()) { return 0; } return it.data(); } QStringList Keymap::listLabels() { QStringList ret; for(uint i = 0; i < labelList.count(); i++) { ret.append(*labelList.at(i)); } return ret; } State* Keymap::getStateByLabel(const QString& label) { QMap<QString, QString>::Iterator lit = labels.find(label); State* state = 0; if (lit == labels.end()) { return 0; } QString name = lit.data(); 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); } } -// qDebug("look for: %s\n", (const char*) name.utf8()); +// odebug << "look for: " << (const char*) name.utf8() << "\n" << oendl; QMap<QString, State*>::Iterator sit = states.find(name); if (sit != states.end()) { state = sit.data(); } return state; } bool Keymap::addState(const QString& name, State* state) { if (states.find(name) != states.end()) { return false; } states.insert(name, state); lsmapInSync = false; if (currentState == 0) { setCurrentState(state); } return true; } State* Keymap::getCurrentState() const { return currentState; } QString Keymap::getCurrentLabel() { return currentLabel; } 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(); qDebug("state changed: %s\n", (const char*) currentStateName.utf8()); if (!lsmapInSync) { generateLabelStateMaps(); } QMap<State*, QString>::Iterator tit; tit = stateLabelMap.find(state); if (tit != stateLabelMap.end()) { currentLabel = tit.data(); } else { -// qDebug("no label for: " + currentStateName + "\n"); +// odebug << "no label for: " + currentStateName + "\n" << oendl; currentLabel = ""; } return true; } } return false; } bool Keymap::removeState(const QString& name, bool force) { QMap<QString, State*>::Iterator it = states.find(name); if (it == states.end()) { return false; } 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 (state == currentState) { if (states.begin() != states.end()) { setCurrentState(states.begin().data()); } } states.remove(it); delete state; lsmapInSync = false; return true; } 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()); QWSServer::sendKeyEvent(autoRepeatAction->getUnicode(), autoRepeatAction->getKeycode(), autoRepeatAction->getModifiers(), autoRepeatAction->isPressed(), true); } repeater.start(repeatPeriod, TRUE); } bool Keymap::addLabel(const QString& label, const QString& state, int index) { 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); } lsmapInSync = false; return true; } bool Keymap::removeLabel(const QString& label) { if (labels.find(label) == labels.end()) { return false; } labels.remove(label); labelList.remove(label); lsmapInSync = false; if (label == currentLabel) { currentLabel = ""; } return true; } |