Changeset 248 in flair-src


Ignore:
Timestamp:
Jun 4, 2018, 2:45:37 PM (3 years ago)
Author:
Sanahuja Guillaume
Message:

add orange icon to gcs

Location:
trunk/tools/FlairGCS/src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/ConnectionLayout.h

    r247 r248  
    3535
    3636signals:
    37   void UDTStats(QString stats); 
     37  void UDTStats(QString stats,bool loosingPackets); 
    3838};
    3939
  • trunk/tools/FlairGCS/src/Manager.cpp

    r247 r248  
    3737  qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui??
    3838  this->name = name;
    39 //ffprintf(stderr,stderr,"Manager %x\n",thread());
     39//fprintf(stderr,stderr,"Manager %x\n",thread());
    4040  setWindowTitle(name);
    4141
     
    9797
    9898 
    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");
    101102 
    102103 
     
    108109Manager::~Manager() {
    109110  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    }
    112115  }
    113116
     
    146149 
    147150  ConnectionLayout *newLayout = new ConnectionLayout(udtSocket, name);
    148   connect(udtSocket, SIGNAL(UDTStats(QString)), newLayout, SIGNAL(UDTStats(QString)));//connection in 2 steps to get udtsocket as sender
    149   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)));
    150153  connect(udtSocket, SIGNAL(dataReady(char *, int)), newLayout,SLOT(receive(char *, int)),Qt::BlockingQueuedConnection);
    151154  connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *)));
     
    170173  }
    171174  if (connections.count() == 2) {
    172     tabBar->addTab(icon_ok,hiddenTabName);
     175    tabBar->addTab(icon_green,hiddenTabName);
    173176    currentTab = 0;
    174177  }
    175178  if (connections.count() > 1) {
    176     tabBar->addTab(icon_ok,name);
     179    tabBar->addTab(icon_green,name);
    177180  }
    178181}
    179182
    180183void Manager::udtSocketDestroyed(QObject *obj) {
    181   fprintf(stderr,"sockets -1\n");
    182184  //mark socket as not valid, it can be a connection lost
    183185  //in this case we keep the layout for reading, and mark it as problematic
    184   fprintf(stderr,"change icon\n");
    185186  for(int i=0;i<connections.count();i++) {
    186187    if(connections.at(i).socket==(UdtSocket *)obj) {
    187188      connections[i].socket=NULL;
     189      tabBar->setTabIcon(i,icon_red);
    188190      break;
    189191    }
     
    192194
    193195void Manager::layoutDestroyed(QObject *obj) {
    194   fprintf(stderr,"layout -1\n");
    195196  //remove the connection, it comes from a proper close
    196197  int index=-1;
     
    240241}
    241242
    242 void Manager::printUDTStats(QString stats) {
     243void Manager::printUDTStats(QString stats,bool loosingPackets) {
    243244  int index = -1;
    244245  for(int i=0;i<connections.count();i++) {
     
    250251 
    251252  if(index==-1) return;
     253 
     254  if(!loosingPackets) {
     255    tabBar->setTabIcon(index,icon_green);
     256  } else {
     257    tabBar->setTabIcon(index,icon_orange);
     258  }
    252259 
    253260  if (tabBar->count() == 0) {
  • trunk/tools/FlairGCS/src/Manager.h

    r247 r248  
    4747  QGridLayout *button_layout;
    4848  QStatusBar *status;
    49   QIcon icon_ok,icon_ko;
     49  QIcon icon_red,icon_green,icon_orange;
    5050
    5151private slots:
     
    5656  void reset(void);
    5757  void tabBarCurrentChanged(int index);
    58   void printUDTStats(QString stats);
     58  void printUDTStats(QString stats,bool loosingPackets);
    5959  void newFileUI(UDTSOCKET socket);
    6060  void deleteFileUI(void);
  • trunk/tools/FlairGCS/src/UdtSocket.cpp

    r247 r248  
    3636  socketType=unknown;
    3737  total_received=0;
     38  pktSndLossTotal=0;
    3839 
    3940  bool blocking = false;
     
    5455  udtstats_timer->stop();
    5556  if(destroySocket) UDT::close(socket);
    56 fprintf(stderr,"fin udt\n");
    5757}
    5858
     
    9595     
    9696  }*/
     97  bool loosingPackets=false;
     98  if(perf.pktSndLossTotal>pktSndLossTotal) loosingPackets=true;
     99  pktSndLossTotal=perf.pktSndLossTotal;
    97100  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);
    100102}
    101103
     
    124126    return;
    125127  }
    126   //ffprintf(stderr,stderr,"receiveData %x\n",thread());
     128  //fprintf(stderr,stderr,"receiveData %x\n",thread());
    127129 
    128130  while (!stop) {
  • trunk/tools/FlairGCS/src/UdtSocket.h

    r234 r248  
    3131  unsigned int total_received;
    3232  QString stats;
     33  int pktSndLossTotal;
    3334
    3435signals:
     
    3637  void newFileUI(UDTSOCKET socket);
    3738  void newConnectionLayout(QString name);
    38   void UDTStats(QString stats);
     39  void UDTStats(QString stats,bool loosingPackets);
    3940
    4041public slots:
  • trunk/tools/FlairGCS/src/file_ui.cpp

    r244 r248  
    4545   
    4646  dialog = new QDialog();
    47 //ffprintf(stderr,stderr,"creator file ui %x\n",thread());
     47
    4848  dialog->setWindowTitle("log files");
    4949  QGridLayout *main_layout = new QGridLayout(dialog);
  • trunk/tools/FlairGCS/src/ressources.qrc

    r247 r248  
    66  <file>cross.png</file>
    77  <file>green.png</file>
     8  <file>orange.png</file>
    89  <file>red.png</file>
    910</qresource>
Note: See TracChangeset for help on using the changeset viewer.