Changeset 82 in ntrip for trunk/BNC/bncmain.cpp


Ignore:
Timestamp:
Aug 30, 2006, 5:35:40 PM (18 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncmain.cpp

    r59 r82  
    1616 * -----------------------------------------------------------------------*/
    1717
    18 #ifdef WIN32
    19 #include <windows.h>
    20 #endif
    21 
    2218#include <QApplication>
    2319#include <QFile>
    2420#include <iostream>
    2521
     22#include "bncapp.h"
    2623#include "bncwindow.h"
    2724
    2825using namespace std;
    2926
    30 #ifdef WIN32
    31 QFile       logFile("BNC.LOG");
    32 QTextStream logStream;
    33 #endif
    34 
    35 void myMessageOutput(QtMsgType, const char *msg) {
    36 #ifdef WIN32
    37   logStream << msg << endl;
    38   logStream.flush();
    39 #else
    40   cerr << msg << endl;
    41 #endif
    42 }
    43 
     27// Main Program
     28/////////////////////////////////////////////////////////////////////////////
    4429int main(int argc, char *argv[]) {
    4530
     
    4934  }
    5035
    51   QApplication app(argc, argv, GUIenabled);
    52 
    53 #ifdef WIN32
    54   logFile.open(QIODevice::WriteOnly);
    55   logStream.setDevice(&logFile);
    56 #endif
    57   qInstallMsgHandler(myMessageOutput);
     36  bncApp app(argc, argv, GUIenabled);
    5837
    5938  QCoreApplication::setOrganizationName("AIUB");
     
    6140  QCoreApplication::setApplicationName("Bernese NTRIP Client");
    6241
    63   bncWindow* bncWin = 0;
    64 
    6542  if (GUIenabled) {
    66     bncWin = new bncWindow();
     43    bncWindow* bncWin = new bncWindow();
    6744    bncWin->show();
    6845  }
     
    7855
    7956    app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));
     57    app.connect(caster, SIGNAL(newMessage(const QByteArray&)),
     58                &app, SLOT(slotMessage(const QByteArray&)));
    8059
    8160    caster->start();
     
    8463    while (it.hasNext()) {
    8564      QStringList hlp = it.next().split(" ");
     65      if (hlp.size() <= 1) continue;
    8666      QUrl url(hlp[0]);
    8767      QByteArray mountPoint = url.path().mid(1).toAscii();
     
    9272                                                 mountPoint, user, password,
    9373                                                 format);
     74      app.connect(getThread, SIGNAL(newMessage(const QByteArray&)),
     75                  &app, SLOT(slotMessage(const QByteArray&)));
     76
    9477      caster->addGetThread(getThread);
    9578
    9679      getThread->start();
    9780    }
     81    if (caster->nMountPoints() == 0) {
     82      return 0;
     83    }
    9884  }
    9985  return app.exec();
Note: See TracChangeset for help on using the changeset viewer.