Changeset 248 in flair-src for trunk/tools/FlairGCS/src/Manager.cpp
- Timestamp:
- 06/04/18 14:45:37 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/Manager.cpp
r247 r248 37 37 qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui?? 38 38 this->name = name; 39 //f fprintf(stderr,stderr,"Manager %x\n",thread());39 //fprintf(stderr,stderr,"Manager %x\n",thread()); 40 40 setWindowTitle(name); 41 41 … … 97 97 98 98 99 icon_ok = QIcon(":green.png"); 100 icon_ko = QIcon(":red.png"); 99 icon_green = QIcon(":green.png"); 100 icon_red = QIcon(":red.png"); 101 icon_orange = QIcon(":orange.png"); 101 102 102 103 … … 108 109 Manager::~Manager() { 109 110 for (int i = 0; i < connections.count(); i++) { 110 connections.at(i).socket->kill(); 111 connections.at(i).socket->thread()->wait(); 111 if(connections.at(i).socket!=NULL) { 112 connections.at(i).socket->kill(); 113 connections.at(i).socket->thread()->wait(); 114 } 112 115 } 113 116 … … 146 149 147 150 ConnectionLayout *newLayout = new ConnectionLayout(udtSocket, name); 148 connect(udtSocket, SIGNAL(UDTStats(QString )), newLayout, SIGNAL(UDTStats(QString)));//connection in 2 steps to get udtsocket as sender149 connect(newLayout, SIGNAL(UDTStats(QString )), this, SLOT(printUDTStats(QString)));151 connect(udtSocket, SIGNAL(UDTStats(QString,bool)), newLayout, SIGNAL(UDTStats(QString,bool)));//connection in 2 steps to get udtsocket as sender 152 connect(newLayout, SIGNAL(UDTStats(QString,bool)), this, SLOT(printUDTStats(QString,bool))); 150 153 connect(udtSocket, SIGNAL(dataReady(char *, int)), newLayout,SLOT(receive(char *, int)),Qt::BlockingQueuedConnection); 151 154 connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *))); … … 170 173 } 171 174 if (connections.count() == 2) { 172 tabBar->addTab(icon_ ok,hiddenTabName);175 tabBar->addTab(icon_green,hiddenTabName); 173 176 currentTab = 0; 174 177 } 175 178 if (connections.count() > 1) { 176 tabBar->addTab(icon_ ok,name);179 tabBar->addTab(icon_green,name); 177 180 } 178 181 } 179 182 180 183 void Manager::udtSocketDestroyed(QObject *obj) { 181 fprintf(stderr,"sockets -1\n");182 184 //mark socket as not valid, it can be a connection lost 183 185 //in this case we keep the layout for reading, and mark it as problematic 184 fprintf(stderr,"change icon\n");185 186 for(int i=0;i<connections.count();i++) { 186 187 if(connections.at(i).socket==(UdtSocket *)obj) { 187 188 connections[i].socket=NULL; 189 tabBar->setTabIcon(i,icon_red); 188 190 break; 189 191 } … … 192 194 193 195 void Manager::layoutDestroyed(QObject *obj) { 194 fprintf(stderr,"layout -1\n");195 196 //remove the connection, it comes from a proper close 196 197 int index=-1; … … 240 241 } 241 242 242 void Manager::printUDTStats(QString stats ) {243 void Manager::printUDTStats(QString stats,bool loosingPackets) { 243 244 int index = -1; 244 245 for(int i=0;i<connections.count();i++) { … … 250 251 251 252 if(index==-1) return; 253 254 if(!loosingPackets) { 255 tabBar->setTabIcon(index,icon_green); 256 } else { 257 tabBar->setTabIcon(index,icon_orange); 258 } 252 259 253 260 if (tabBar->count() == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.