mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:07:08 +08:00
refs #233 Keyboard key/key list
* helper methods for keylist (key for function) * new Hotkey function (toggle window on top) * improved comparisons for key * unit tests
This commit is contained in:
@@ -30,6 +30,16 @@ namespace BlackMisc
|
||||
return CSequence::contains(&CKeyboardKey::getFunction, function);
|
||||
}
|
||||
|
||||
/*
|
||||
* Key for function
|
||||
*/
|
||||
CKeyboardKey CKeyboardKeyList::keyForFunction(CKeyboardKey::HotkeyFunction function) const
|
||||
{
|
||||
CKeyboardKeyList keys = this->findBy(&CKeyboardKey::getFunction, function);
|
||||
if (keys.isEmpty())
|
||||
return CKeyboardKey(CKeyboardKey::HotkeyNone);
|
||||
else
|
||||
return keys[0];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -56,6 +66,7 @@ namespace BlackMisc
|
||||
if (!this->containsFunction(CKeyboardKey::HotkeyOpacity100)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyOpacity100));
|
||||
if (!this->containsFunction(CKeyboardKey::HotkeyToggleCom1)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom1));
|
||||
if (!this->containsFunction(CKeyboardKey::HotkeyToggleCom2)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom2));
|
||||
if (!this->containsFunction(CKeyboardKey::HotkeyToogleWindowsStayOnTop)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToogleWindowsStayOnTop));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user