source: ntrip/trunk/BNC/bncmain.cpp@ 101

Last change on this file since 101 was 100, checked in by mervart, 18 years ago

* empty log message *

File size: 2.1 KB
RevLine 
[35]1
2/* -------------------------------------------------------------------------
[93]3 * BKG NTRIP Client
[35]4 * -------------------------------------------------------------------------
5 *
6 * Class: main
7 *
8 * Purpose: Application starts here
9 *
10 * Author: L. Mervart
11 *
12 * Created: 24-Dec-2005
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <QApplication>
19#include <QFile>
20#include <iostream>
21
[82]22#include "bncapp.h"
[35]23#include "bncwindow.h"
24
25using namespace std;
26
[82]27// Main Program
28/////////////////////////////////////////////////////////////////////////////
[35]29int main(int argc, char *argv[]) {
30
31 bool GUIenabled = true;
[100]32 for (int ii = 1; ii < argc; ii++) {
33 if (QString(argv[ii]) == "-nw") {
34 GUIenabled = false;
35 break;
36 }
[35]37 }
38
[82]39 bncApp app(argc, argv, GUIenabled);
[35]40
[93]41 QCoreApplication::setOrganizationName("BKG");
42 QCoreApplication::setOrganizationDomain("www.ifag.de");
43 QCoreApplication::setApplicationName("BKG_NTRIP_Client");
[35]44
45 if (GUIenabled) {
[82]46 bncWindow* bncWin = new bncWindow();
[35]47 bncWin->show();
48 }
49 else {
50 QSettings settings;
51 bncCaster* caster = new bncCaster(settings.value("outFile").toString(),
52 settings.value("outPort").toInt());
53
54 app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));
[82]55 app.connect(caster, SIGNAL(newMessage(const QByteArray&)),
56 &app, SLOT(slotMessage(const QByteArray&)));
[35]57
58 caster->start();
59
60 QListIterator<QString> it(settings.value("mountPoints").toStringList());
61 while (it.hasNext()) {
[59]62 QStringList hlp = it.next().split(" ");
[82]63 if (hlp.size() <= 1) continue;
[59]64 QUrl url(hlp[0]);
[88]65 QByteArray format = hlp[1].toAscii();
66 bncGetThread* getThread = new bncGetThread(url, format);
[82]67 app.connect(getThread, SIGNAL(newMessage(const QByteArray&)),
68 &app, SLOT(slotMessage(const QByteArray&)));
69
[35]70 caster->addGetThread(getThread);
71
72 getThread->start();
73 }
[88]74 if (caster->numStations() == 0) {
[82]75 return 0;
76 }
[35]77 }
78 return app.exec();
79}
Note: See TracBrowser for help on using the repository browser.