Changeset 248 in flair-src for trunk/tools/FlairGCS
- Timestamp:
- Jun 4, 2018, 2:45:37 PM (6 years ago)
- Location:
- trunk/tools/FlairGCS/src
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/ConnectionLayout.h
r247 r248 35 35 36 36 signals: 37 void UDTStats(QString stats );37 void UDTStats(QString stats,bool loosingPackets); 38 38 }; 39 39 -
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) { -
trunk/tools/FlairGCS/src/Manager.h
r247 r248 47 47 QGridLayout *button_layout; 48 48 QStatusBar *status; 49 QIcon icon_ ok,icon_ko;49 QIcon icon_red,icon_green,icon_orange; 50 50 51 51 private slots: … … 56 56 void reset(void); 57 57 void tabBarCurrentChanged(int index); 58 void printUDTStats(QString stats );58 void printUDTStats(QString stats,bool loosingPackets); 59 59 void newFileUI(UDTSOCKET socket); 60 60 void deleteFileUI(void); -
trunk/tools/FlairGCS/src/UdtSocket.cpp
r247 r248 36 36 socketType=unknown; 37 37 total_received=0; 38 pktSndLossTotal=0; 38 39 39 40 bool blocking = false; … … 54 55 udtstats_timer->stop(); 55 56 if(destroySocket) UDT::close(socket); 56 fprintf(stderr,"fin udt\n");57 57 } 58 58 … … 95 95 96 96 }*/ 97 bool loosingPackets=false; 98 if(perf.pktSndLossTotal>pktSndLossTotal) loosingPackets=true; 99 pktSndLossTotal=perf.pktSndLossTotal; 97 100 stats=QString("rx rate %1kB/s, round trip %2ms, lost packets %3").arg(rxRate,0,'f',3).arg(perf.msRTT,0,'f',3).arg(perf.pktSndLossTotal); 98 UDTStats(stats); 99 101 UDTStats(stats,loosingPackets); 100 102 } 101 103 … … 124 126 return; 125 127 } 126 //f fprintf(stderr,stderr,"receiveData %x\n",thread());128 //fprintf(stderr,stderr,"receiveData %x\n",thread()); 127 129 128 130 while (!stop) { -
trunk/tools/FlairGCS/src/UdtSocket.h
r234 r248 31 31 unsigned int total_received; 32 32 QString stats; 33 int pktSndLossTotal; 33 34 34 35 signals: … … 36 37 void newFileUI(UDTSOCKET socket); 37 38 void newConnectionLayout(QString name); 38 void UDTStats(QString stats );39 void UDTStats(QString stats,bool loosingPackets); 39 40 40 41 public slots: -
trunk/tools/FlairGCS/src/file_ui.cpp
r244 r248 45 45 46 46 dialog = new QDialog(); 47 //ffprintf(stderr,stderr,"creator file ui %x\n",thread()); 47 48 48 dialog->setWindowTitle("log files"); 49 49 QGridLayout *main_layout = new QGridLayout(dialog); -
trunk/tools/FlairGCS/src/ressources.qrc
r247 r248 6 6 <file>cross.png</file> 7 7 <file>green.png</file> 8 <file>orange.png</file> 8 9 <file>red.png</file> 9 10 </qresource>
Note:
See TracChangeset
for help on using the changeset viewer.