MCPcopy Create free account
hub / github.com/Zalafina/QKeyMapper / detectMappingStartKey

Method detectMappingStartKey

QKeyMapper/qkeymapper_worker.cpp:16315–16364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16313}
16314
16315bool QKeyMapper_Worker::detectMappingStartKey(const QString &keycodeString, int keyupdown)
16316{
16317 bool detected = false;
16318 bool passthrough = false;
16319 QString mappingswitchKey = QKeyMapper::s_MappingStartKeyString;
16320 if (mappingswitchKey.startsWith(PREFIX_PASSTHROUGH)) {
16321 passthrough = true;
16322 mappingswitchKey.remove(0, 1);
16323 }
16324 QStringList keys = mappingswitchKey.split(SEPARATOR_PLUS);
16325 bool allKeysPressed = true;
16326 bool combinationKey = (keys.size() > 1) ? true : false;
16327 QList<int> pressedCombinationRealKeysOrder;
16328
16329 for (const QString &key : std::as_const(keys))
16330 {
16331 int index = pressedRealKeysListRemoveMultiInput.indexOf(key);
16332 if (index < 0)
16333 {
16334 allKeysPressed = false;
16335 break;
16336 }
16337 else {
16338 pressedCombinationRealKeysOrder.append(index);
16339 }
16340 }
16341
16342 if (combinationKey) {
16343 bool keyorder_increasing = isKeyOrderIncreasing(pressedCombinationRealKeysOrder);
16344 if (!keyorder_increasing) {
16345 allKeysPressed = false;
16346 }
16347 }
16348
16349 if (KEY_DOWN == keyupdown && allKeysPressed && mappingswitchKey.contains(keycodeString))
16350 {
16351#ifdef DEBUG_LOGOUT_ON
16352 qDebug() << "[detectMappingSwitchKey]" << "MappingStartKey Activated ->" << mappingswitchKey;
16353#endif
16354 emit QKeyMapper::getInstance()->HotKeyMappingStart_Signal(mappingswitchKey);
16355 if (passthrough) {
16356 detected = false;
16357 }
16358 else {
16359 detected = true;
16360 }
16361 }
16362
16363 return detected;
16364}
16365
16366bool QKeyMapper_Worker::detectMappingStopKey(const QString &keycodeString, int keyupdown)
16367{

Callers

nothing calls this directly

Calls 3

removeMethod · 0.80
sizeMethod · 0.80
containsMethod · 0.80

Tested by

no test coverage detected