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

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

* empty log message *

File size: 2.0 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * Bernese NTRIP Client
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
22#include "bncapp.h"
23#include "bncwindow.h"
24
25using namespace std;
26
27// Main Program
28/////////////////////////////////////////////////////////////////////////////
29int main(int argc, char *argv[]) {
30
31 bool GUIenabled = true;
32 if (argc > 1 && QString(argv[1]) == "-nw") {
33 GUIenabled = false;
34 }
35
36 bncApp app(argc, argv, GUIenabled);
37
38 QCoreApplication::setOrganizationName("AIUB");
39 QCoreApplication::setOrganizationDomain("www.aiub.unibe.ch");
40 QCoreApplication::setApplicationName("Bernese NTRIP Client");
41
42 if (GUIenabled) {
43 bncWindow* bncWin = new bncWindow();
44 bncWin->show();
45 }
46 else {
47 QSettings settings;
48 bncCaster* caster = new bncCaster(settings.value("outFile").toString(),
49 settings.value("outPort").toInt());
50
51 app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));
52 app.connect(caster, SIGNAL(newMessage(const QByteArray&)),
53 &app, SLOT(slotMessage(const QByteArray&)));
54
55 caster->start();
56
57 QListIterator<QString> it(settings.value("mountPoints").toStringList());
58 while (it.hasNext()) {
59 QStringList hlp = it.next().split(" ");
60 if (hlp.size() <= 1) continue;
61 QUrl url(hlp[0]);
62 QByteArray format = hlp[1].toAscii();
63 bncGetThread* getThread = new bncGetThread(url, format);
64 app.connect(getThread, SIGNAL(newMessage(const QByteArray&)),
65 &app, SLOT(slotMessage(const QByteArray&)));
66
67 caster->addGetThread(getThread);
68
69 getThread->start();
70 }
71 if (caster->numStations() == 0) {
72 return 0;
73 }
74 }
75 return app.exec();
76}
Note: See TracBrowser for help on using the repository browser.