Changeset 2346 for code/branches/questsystem3/src/orxonox/overlays
- Timestamp:
- Dec 5, 2008, 7:38:53 AM (16 years ago)
- Location:
- code/branches/questsystem3/src/orxonox/overlays/notifications
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem3/src/orxonox/overlays/notifications/NotificationManager.cc
r2328 r2346 87 87 updateQueue(); 88 88 89 COUT( 3) << "Notification inserted, title: " << notification->getTitle() << ", message: " << notification->getMessage() << std::endl;89 COUT(4) << "Notification inserted. Title: " << notification->getTitle() << std::endl; 90 90 91 91 return true; … … 104 104 continue; 105 105 106 COUT(3) << "Update, title: " << container->notification->getTitle() << ", message: " << container->notification->getMessage() << std::endl; 107 108 text = text + "\n\n\n------------" + container->notification->getTitle() + "\n\n" + container->notification->getMessage(); 106 text = text + "\n\n\n------------\n\n" + container->notification->getTitle() + "\n\n" + container->notification->getMessage(); 109 107 } 110 111 COUT(3) << "Queue updated: " << text << std::endl;112 108 113 109 NotificationQueue::queue_s->setQueueText(text); 114 110 } 111 112 const std::string & NotificationManager::clipMessage(const std::string & message) 113 { 114 std::string* clippedMessageP = new std::string(); 115 std::string clippedMessage = *clippedMessageP; 116 clippedMessage = ""; 117 std::string tempWord = ""; 118 int wordLength = 0; 119 signed int i = 0; 120 int widthLeft = NotificationQueue::queue_s->getWidth(); 121 while(i < message.length()) 122 { 123 while(i < message.length() && message[i] != ' ' && message[i] != '\n') 124 { 125 tempWord = tempWord + message[i]; 126 i++; 127 wordLength++; 128 } 129 130 if(wordLength <= widthLeft) 131 { 132 clippedMessage = clippedMessage + tempWord + message[i]; 133 widthLeft -= (wordLength+1); 134 wordLength = 0; 135 tempWord = ""; 136 i++; 137 } 138 else 139 { 140 clippedMessage = clippedMessage + '\n' + tempWord + message[i]; 141 widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1); 142 i++; 143 wordLength = 0; 144 tempWord = ""; 145 } 146 } 147 148 return clippedMessage; 149 } 115 150 116 151 } -
code/branches/questsystem3/src/orxonox/overlays/notifications/NotificationManager.h
r2280 r2346 66 66 67 67 static void updateQueue(void); 68 static const std::string & clipMessage(const std::string & message); 68 69 69 70 }; -
code/branches/questsystem3/src/orxonox/overlays/notifications/NotificationQueue.cc
r2287 r2346 53 53 queue_s = this; 54 54 } 55 56 this->length_ = 3; 57 this->width_ = 50; 55 58 } 56 59 … … 65 68 66 69 XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode); 70 XMLPortParam(NotificationQueue, "width", setWidth, getWidth, xmlElement, mode); 67 71 } 68 72 … … 84 88 } 85 89 90 bool NotificationQueue::setWidth(int width) 91 { 92 if(width > 0) 93 { 94 this->width_ = width; 95 return true; 96 } 97 return false; 98 } 99 86 100 void NotificationQueue::setQueueText(const std::string & text) 87 101 { -
code/branches/questsystem3/src/orxonox/overlays/notifications/NotificationQueue.h
r2287 r2346 62 62 int getLength(void) const 63 63 { return this->length_; } 64 int getWidth(void) const 65 { return this->width_; } 64 66 65 67 void setQueueText(const std::string & text); 66 68 bool setLength(int length); 69 bool setWidth(int width); 67 70 68 71 private: 69 72 Ogre::UTFString queueText_; 70 73 int length_; 74 int width_; 71 75 72 76 };
Note: See TracChangeset
for help on using the changeset viewer.