Changeset 248 in flair-src for trunk/tools/FlairGCS/src/Manager.cpp


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

add orange icon to gcs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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) {
Note: See TracChangeset for help on using the changeset viewer.