本文整理汇总了C++中Keymap::getActions方法的典型用法代码示例。如果您正苦于以下问题:C++ Keymap::getActions方法的具体用法?C++ Keymap::getActions怎么用?C++ Keymap::getActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keymap
的用法示例。
在下文中一共展示了Keymap::getActions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadKeymap
void RemapDialog::loadKeymap() {
_currentActions.clear();
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) {
// load active keymaps
List<const HardwareKey*> freeKeys(_keymapper->getHardwareKeys());
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps.top();
List<Action*>::iterator actIt;
for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) {
Action *act = *actIt;
ActionInfo info = {act, false, act->description};
_currentActions.push_back(info);
if (act->getMappedKey())
freeKeys.remove(act->getMappedKey());
}
// loop through remaining finding mappings for unmapped keys
if (top.inherit) {
for (int i = activeKeymaps.size() - 2; i >= 0; --i) {
Keymapper::MapRecord mr = activeKeymaps[i];
List<const HardwareKey*>::iterator keyIt = freeKeys.begin();
while (keyIt != freeKeys.end()) {
Action *act = mr.keymap->getMappedAction((*keyIt)->key);
if (act) {
ActionInfo info = {act, true, act->description + " (" + mr.keymap->getName() + ")"};
_currentActions.push_back(info);
freeKeys.erase(keyIt++);
} else {
++keyIt;
}
}
if (mr.inherit == false || freeKeys.empty())
break;
}
}
} else if (_kmPopUp->getSelected() != -1) {
Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
List<Action*>::iterator it;
for (it = km->getActions().begin(); it != km->getActions().end(); ++it) {
ActionInfo info = {*it, false, (*it)->description};
_currentActions.push_back(info);
}
}
// refresh scroll bar
_scrollBar->_currentPos = 0;
_scrollBar->_numEntries = (_currentActions.size() + _colCount - 1) / _colCount;
_scrollBar->recalc();
// force refresh
_topAction = -1;
refreshKeymap();
}
示例2: loadKeymap
void RemapDialog::loadKeymap() {
_currentActions.clear();
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
debug(3, "RemapDialog::loadKeymap active keymaps: %u", activeKeymaps.size());
if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) {
// This is the "effective" view which shows all effective actions:
// - all of the topmost keymap action
// - all mapped actions that are reachable
List<const HardwareInput *> freeInputs(_keymapper->getHardwareInputs());
int topIndex = activeKeymaps.size() - 1;
// This is a WORKAROUND for changing the popup list selected item and changing it back
// to the top entry. Upon changing it back, the top keymap is always "gui".
if (!_topKeymapIsGui && activeKeymaps[topIndex].keymap->getName() == kGuiKeymapName)
--topIndex;
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps[topIndex];
List<Action *>::iterator actIt;
debug(3, "RemapDialog::loadKeymap top keymap: %s", top.keymap->getName().c_str());
for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) {
Action *act = *actIt;
ActionInfo info = {act, false, act->description};
_currentActions.push_back(info);
if (act->getMappedInput())
freeInputs.remove(act->getMappedInput());
}
// loop through remaining finding mappings for unmapped keys
if (top.transparent && topIndex >= 0) {
for (int i = topIndex - 1; i >= 0; --i) {
Keymapper::MapRecord mr = activeKeymaps[i];
debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
List<const HardwareInput *>::iterator inputIt = freeInputs.begin();
const HardwareInput *input = *inputIt;
while (inputIt != freeInputs.end()) {
Action *act = 0;
if (input->type == kHardwareInputTypeKeyboard)
act = mr.keymap->getMappedAction(input->key);
else if (input->type == kHardwareInputTypeGeneric)
act = mr.keymap->getMappedAction(input->inputCode);
if (act) {
ActionInfo info = {act, true, act->description + " (" + mr.keymap->getName() + ")"};
_currentActions.push_back(info);
freeInputs.erase(inputIt);
} else {
++inputIt;
}
}
if (mr.transparent == false || freeInputs.empty())
break;
}
}
} else if (_kmPopUp->getSelected() != -1) {
// This is the regular view of a keymap that isn't the topmost one.
// It shows all of that keymap's actions
Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
List<Action *>::iterator it;
for (it = km->getActions().begin(); it != km->getActions().end(); ++it) {
ActionInfo info = {*it, false, (*it)->description};
_currentActions.push_back(info);
}
}
// refresh scroll bar
_scrollBar->_currentPos = 0;
_scrollBar->_numEntries = _currentActions.size();
_scrollBar->recalc();
// force refresh
_topAction = -1;
refreshKeymap();
}