Changeset 455 in flair-src for trunk/tools/FlairGCS/src/DataRemote.cpp


Ignore:
Timestamp:
10/04/21 10:03:51 (16 months ago)
Author:
Sanahuja Guillaume
Message:

gcs: add compatibility with programs without nb_buffering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/DataRemote.cpp

    r444 r455  
    1616  receivesize = 0;
    1717  refresh_rate = (double)period / 1000.;
    18   this->nb_buffering=nb_buffering;
     18   
     19   //flair programs without nb buffering have nb_buffering=0, set it to 1 for compatibility
     20    if(nb_buffering==0) {
     21        this->nb_buffering=1;
     22        nbBufferingCompatible=false;
     23    } else {
     24        this->nb_buffering=nb_buffering;
     25        nbBufferingCompatible=true;
     26    }
     27 
    1928 
    2029  connectionLayout()->addDataRemote(this);
     
    3746  setRefreshRate->setEnabled(auto_refresh);
    3847 
    39   menu->addSeparator();
    40   setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering));
     48  //flair programs without nb buffering have nb_buffering=0
     49  if(nbBufferingCompatible) {
     50      menu->addSeparator();
     51      setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering));
     52  }
    4153 
    4254/*  menu->addSeparator();
     
    5264
    5365  action = menu->exec(point);
    54 
     66    if(action==NULL) return action;//setNbBuffering can also be null if in compatibility mode
     67   
    5568  if (action == SetAutoRefresh) {
    5669    SendPeriod(RefreshRate_ms(), SetAutoRefresh->isChecked());
     
    113126void DataRemote::XmlSetup(QDomElement *dom) {
    114127  refresh_rate = dom->attribute("period").toUShort() / 1000.;
    115   nb_buffering = dom->attribute("nb_buf").toUShort();
     128  if(nbBufferingCompatible) nb_buffering = dom->attribute("nb_buf").toUShort();
     129 
    116130  if (dom->attribute("enabled") == "1")
    117131    auto_refresh = true;
Note: See TracChangeset for help on using the changeset viewer.