| 179 | } |
| 180 | |
| 181 | void HotKeyManager::loadXml(MyGUI::xml::ElementPtr _node, std::string_view /*_file*/, MyGUI::Version /*_version*/) |
| 182 | { |
| 183 | MyGUI::xml::ElementEnumerator node = _node->getElementEnumerator(); |
| 184 | while (node.next("Command")) |
| 185 | { |
| 186 | HotKeyCommand command; |
| 187 | |
| 188 | MyGUI::xml::ElementEnumerator nodeCommand = node->getElementEnumerator(); |
| 189 | while (nodeCommand.next()) |
| 190 | { |
| 191 | if (nodeCommand->getName() == "Name") |
| 192 | { |
| 193 | command.setCommand(nodeCommand->getContent()); |
| 194 | } |
| 195 | /*else if (nodeCommand->getName() == "Pressed") |
| 196 | { |
| 197 | command.setPressed(MyGUI::utility::parseValue<bool>(nodeCommand->getContent())); |
| 198 | }*/ |
| 199 | else if (nodeCommand->getName() == "KeyCode") |
| 200 | { |
| 201 | MapKeys::const_iterator item = mKeyNames.find(nodeCommand->getContent()); |
| 202 | if (item != mKeyNames.end()) |
| 203 | { |
| 204 | command.setKey((*item).second); |
| 205 | } |
| 206 | else |
| 207 | { |
| 208 | // log |
| 209 | } |
| 210 | } |
| 211 | else if (nodeCommand->getName() == "Modifier") |
| 212 | { |
| 213 | command.setShift(nodeCommand->getContent().find("Shift") != std::string::npos); |
| 214 | command.setControl(nodeCommand->getContent().find("Control") != std::string::npos); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | addCommand(command); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | void HotKeyManager::addCommand(HotKeyCommand& _command) |
| 223 | { |
nothing calls this directly
no test coverage detected