本文整理汇总了C++中HotkeyInfo::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ HotkeyInfo::ToString方法的具体用法?C++ HotkeyInfo::ToString怎么用?C++ HotkeyInfo::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HotkeyInfo
的用法示例。
在下文中一共展示了HotkeyInfo::ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnKeyListItemChange
void Hotkeys::OnKeyListItemChange(NMLISTVIEW *lv) {
if (lv->uChanged & LVIF_STATE) {
if (lv->uNewState & LVIS_SELECTED) {
int index = lv->iItem;
#if ENABLE_3RVX_LOG != 0
HotkeyInfo *current = &_keyInfo[index];
CLOG(L"Selecting key combination %d:", index);
QCLOG(L"%s", current->ToString().c_str());
#endif
LoadSelection(index);
}
}
}
示例2: CLOG
std::unordered_map<int, HotkeyInfo> Settings::Hotkeys() {
std::unordered_map<int, HotkeyInfo> keyMappings;
if (_root == NULL) {
return keyMappings;
}
tinyxml2::XMLElement *hotkeys = _root->FirstChildElement("hotkeys");
if (hotkeys == NULL) {
return keyMappings;
}
tinyxml2::XMLElement *hotkey = hotkeys->FirstChildElement("hotkey");
for (; hotkey != NULL; hotkey = hotkey->NextSiblingElement()) {
const char *actionStr = hotkey->Attribute("action");
if (actionStr == NULL) {
CLOG(L"No action provided for hotkey; skipping");
continue;
}
int action = -1;
std::wstring wActionStr = StringUtils::Widen(actionStr);
for (unsigned int i = 0; i < HotkeyInfo::ActionNames.size(); ++i) {
const wchar_t *currentAction = HotkeyInfo::ActionNames[i].c_str();
if (_wcsicmp(wActionStr.c_str(), currentAction) == 0) {
action = i;
break;
}
}
if (action == -1) {
CLOG(L"Hotkey action '%s' not recognized; skipping",
wActionStr.c_str());
continue;
}
int combination = -1;
hotkey->QueryIntAttribute("combination", &combination);
if (combination == -1) {
CLOG(L"No key combination provided for hotkey; skipping");
continue;
}
HotkeyInfo hki;
hki.action = action;
hki.keyCombination = combination;
/* Does this hotkey action have any arguments? */
tinyxml2::XMLElement *arg = hotkey->FirstChildElement("arg");
for (; arg != NULL; arg = arg->NextSiblingElement()) {
const char *argStr = arg->GetText();
hki.args.push_back(StringUtils::Widen(argStr));
}
/* Do a validity check on the finished HKI object */
if (hki.Valid() == false) {
continue;
}
/* Whew, we made it! */
CLOG(L"%s", hki.ToString().c_str());
keyMappings[combination] = hki;
}
return keyMappings;
}