Changeset 5528 in ntrip for trunk


Ignore:
Timestamp:
Nov 6, 2013, 2:57:57 PM (11 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bnccaster.cpp

    r5527 r5528  
    6060// Constructor
    6161////////////////////////////////////////////////////////////////////////////
    62 bncCaster::bncCaster(const QString& outFileName, int port) {
     62bncCaster::bncCaster() {
    6363
    6464  bncSettings settings;
     
    6767          BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    6868
    69   if ( !outFileName.isEmpty() ) {
    70     QString lName = outFileName;
    71     expandEnvVar(lName);
    72     _outFile = new QFile(lName);
    73     if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
    74       _outFile->open(QIODevice::WriteOnly | QIODevice::Append);
    75     }
    76     else {
    77       _outFile->open(QIODevice::WriteOnly);
    78     }
    79     _out = new QTextStream(_outFile);
    80     _out->setRealNumberNotation(QTextStream::FixedNotation);
    81   }
    82   else {
    83     _outFile = 0;
    84     _out     = 0;
    85   }
    86 
    87   _port = port;
     69  _outFile = 0;
     70  _out     = 0;
     71  reopenOutFile();
     72
     73  _port = settings.value("outPort").toInt();
    8874
    8975  if (_port != 0) {
     
    178164
    179165  QMutexLocker locker(&_mutex);
     166
     167  reopenOutFile();
    180168
    181169  unsigned index = 0;
     
    561549  }
    562550}
     551
     552//
     553////////////////////////////////////////////////////////////////////////////
     554void bncCaster::reopenOutFile() {
     555
     556  bncSettings settings;
     557
     558  QString outFileName = settings.value("outFile").toString();
     559  if ( !outFileName.isEmpty() ) {
     560    expandEnvVar(outFileName);
     561    if (!_outFile || _outFile->fileName() != outFileName) {
     562      delete _out;
     563      delete _outFile;
     564      _outFile = new QFile(outFileName);
     565      if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
     566        _outFile->open(QIODevice::WriteOnly | QIODevice::Append);
     567      }
     568      else {
     569        _outFile->open(QIODevice::WriteOnly);
     570      }
     571      _out = new QTextStream(_outFile);
     572      _out->setRealNumberNotation(QTextStream::FixedNotation);
     573    }
     574  }
     575  else {
     576    delete _out;     _out     = 0;
     577    delete _outFile; _outFile = 0;
     578  }
     579}
     580
  • trunk/BNC/src/bnccaster.h

    r5524 r5528  
    4141
    4242 public:
    43    bncCaster(const QString& outFileName, int port);
     43   bncCaster();
    4444   ~bncCaster();
    4545   void addGetThread(bncGetThread* getThread, bool noNewThread = false);
     
    6666   void dumpEpochs(long minTime, long maxTime);
    6767   static int myWrite(QTcpSocket* sock, const char* buf, int bufLen);
     68   void reopenOutFile();
    6869
    6970   QFile*                   _outFile;
  • trunk/BNC/src/bncmain.cpp

    r5264 r5528  
    193193    bncEphUploadCaster* casterEph = new bncEphUploadCaster(); (void) casterEph;
    194194   
    195     bncCaster* caster = new bncCaster(settings.value("outFile").toString(),
    196                                       settings.value("outPort").toInt());
     195    bncCaster* caster = new bncCaster();
    197196   
    198197    BNC_CORE->setCaster(caster);
  • trunk/BNC/src/bncwindow.cpp

    r5376 r5528  
    20552055  enableStartStop();
    20562056
    2057   _caster = new bncCaster(_outFileLineEdit->text(),
    2058                           _outPortLineEdit->text().toInt());
     2057  _caster = new bncCaster();
    20592058
    20602059  BNC_CORE->setPort(_outEphPortLineEdit->text().toInt());
Note: See TracChangeset for help on using the changeset viewer.