Changeset 11052 for code/trunk/src/modules/notifications
- Timestamp:
- Jan 9, 2016, 6:26:20 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
r9667 r11052 101 101 std::stringstream stream; 102 102 stream << this->getPreMessage(); 103 stream << this->bindingNiceifyer(KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand()));103 stream << KeyBinderManager::getInstance().getCurrent()->getBindingReadable(this->getCommand()); 104 104 stream << this->getPostMessage(); 105 105 return *(new std::string(stream.str())); 106 106 } 107 108 /**109 @brief110 Transforms the input binding into a human readable form.111 @param binding112 The binding to be transformed113 @return114 Returns a human readable version of the input binding.115 */116 //TODO: Move to KeyBinderManager...117 const std::string& CommandNotification::bindingNiceifyer(const std::string& binding)118 {119 SubString substring = SubString(binding, ".");120 std::string name;121 std::string group;122 switch(substring.size())123 {124 case 0:125 return binding;126 case 1:127 return binding;128 case 2:129 group = substring[0];130 default:131 name = substring.subSet(1).join(".");132 }133 134 std::stringstream stream;135 if(group.compare("Keys") == 0)136 stream << "Key " << name.substr(3);137 else if(group.compare("MouseButtons") == 0)138 stream << "Mouse " << name;139 else if(group.compare("JoyStickButtons") == 0)140 stream << "Joystick " << name;141 else if(group.compare("JoyStickAxes") == 0)142 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6);143 else if(group.compare("MouseAxes") == 0)144 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis";145 else146 return binding;147 148 return *(new std::string(stream.str()));149 }150 151 107 } -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
r9667 r11052 122 122 void setPostMessage(const std::string& message) 123 123 { this->postMessage_ = message; } 124 125 const std::string& bindingNiceifyer(const std::string& binding); //!< Transforms the input binding into a human readable form.126 127 124 }; 128 125
Note: See TracChangeset
for help on using the changeset viewer.