Changeset 2783 for code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc
- Timestamp:
- Mar 13, 2009, 3:39:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc
r2779 r2783 59 59 @brief 60 60 Destructor. 61 @todo62 I'm pretty sure that there are some thing that have to be distroyed.63 61 */ 64 62 NotificationQueue::~NotificationQueue() 65 63 { 66 64 this->targets_.clear(); 65 this->clear(); 67 66 } 68 67 … … 76 75 RegisterObject(NotificationQueue); 77 76 78 this->setDefaults();79 77 this->size_ = 0; 80 78 this->tickTime_ = 0.0; … … 107 105 SUPER(NotificationQueue, XMLPort, xmlElement, mode); 108 106 107 this->setDefaults(); 108 109 109 XMLPortParam(NotificationQueue, "maxSize", setMaxSize, getMaxSize, xmlElement, mode); 110 110 XMLPortParam(NotificationQueue, "notificationLength", setNotificationLength, getNotificationLength, xmlElement, mode); … … 135 135 { 136 136 this->removeContainer(*it); 137 this->scroll(Vector2(0.0,-(1.1*this->getFontSize()))); 137 138 it = this->containers_.begin(); //TDO: Needed? 138 139 } … … 176 177 this->addNotification(notification, time); 177 178 178 //TDO: Position!179 180 179 std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it; 181 180 while(this->getSize() > this->getMaxSize()) … … 183 182 it = this->containers_.begin(); 184 183 this->removeContainer(*it); 184 this->scroll(Vector2(0.0,-(1.1*this->getFontSize()))); 185 185 } 186 186 … … 241 241 /** 242 242 @brief 243 Returns all targets concatinated as string, with kommas (',') as seperators. 244 @return 245 Returns all targets concatinated as string, with kommas (',') as seperators. 246 @todo 247 Where is the string deleted? 248 */ 249 const std::string & NotificationQueue::getTargets() const 250 { 251 std::string* pTemp = new std::string(""); 243 Produces all targets concatinated as string, with kommas (',') as seperators. 244 @param string 245 Pointer to a string which will be used by the method to fill with the concatination of the targets. 246 @return 247 Returns true if successful. 248 */ 249 bool NotificationQueue::getTargets(std::string* string) const 250 { 251 if(string == NULL) 252 { 253 COUT(4) << "Input string must have memory allocated." << std::endl; 254 return false; 255 } 256 string->clear(); 252 257 bool first = true; 253 258 for(std::set<std::string>::iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets. … … 255 260 if(!first) 256 261 { 257 * pTemp+= ",";262 *string += ","; 258 263 } 259 264 else … … 261 266 first = false; 262 267 } 263 * pTemp+= *it;264 } 265 266 return *pTemp;268 *string += *it; 269 } 270 271 return true; 267 272 } 268 273 … … 278 283 bool NotificationQueue::setTargets(const std::string & targets) 279 284 { 285 this->targets_.clear(); 286 280 287 std::string* pTemp; 281 288 unsigned int index = 0; … … 283 290 { 284 291 pTemp = new std::string(""); 285 while( targets[index] != ',' && targets[index] != ' ' && index < targets.size())292 while(index < targets.size() && targets[index] != ',' && targets[index] != ' ') 286 293 { 287 294 *pTemp += targets[index]; 288 295 index++; 289 296 } 297 index++; 290 298 this->targets_.insert(*pTemp); 291 299 } … … 331 339 return true; 332 340 } 333 341 342 void NotificationQueue::scroll(const Vector2 pos) 343 { 344 for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Scroll each overlay. 345 { 346 it->second->overlay->scroll(pos); 347 } 348 } 349 334 350 /** 335 351 @brief … … 358 374 this->insertElement(container->overlay, container->name); 359 375 this->size_= this->size_+1; 376 377 container->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*(this->getSize()-1))); 360 378 } 361 379
Note: See TracChangeset
for help on using the changeset viewer.