1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * BKG 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 |
|
---|
25 | using namespace std;
|
---|
26 |
|
---|
27 | // Main Program
|
---|
28 | /////////////////////////////////////////////////////////////////////////////
|
---|
29 | int main(int argc, char *argv[]) {
|
---|
30 |
|
---|
31 | bool GUIenabled = true;
|
---|
32 | for (int ii = 1; ii < argc; ii++) {
|
---|
33 | if (QString(argv[ii]) == "-nw") {
|
---|
34 | GUIenabled = false;
|
---|
35 | break;
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | bncApp app(argc, argv, GUIenabled);
|
---|
40 |
|
---|
41 | QCoreApplication::setOrganizationName("BKG");
|
---|
42 | QCoreApplication::setOrganizationDomain("www.ifag.de");
|
---|
43 | QCoreApplication::setApplicationName("BKG_NTRIP_Client");
|
---|
44 |
|
---|
45 | if (GUIenabled) {
|
---|
46 | bncWindow* bncWin = new bncWindow();
|
---|
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()));
|
---|
55 | app.connect(caster, SIGNAL(newMessage(const QByteArray&)),
|
---|
56 | &app, SLOT(slotMessage(const QByteArray&)));
|
---|
57 |
|
---|
58 | caster->start();
|
---|
59 |
|
---|
60 | QListIterator<QString> it(settings.value("mountPoints").toStringList());
|
---|
61 | while (it.hasNext()) {
|
---|
62 | QStringList hlp = it.next().split(" ");
|
---|
63 | if (hlp.size() <= 1) continue;
|
---|
64 | QUrl url(hlp[0]);
|
---|
65 | QByteArray format = hlp[1].toAscii();
|
---|
66 | bncGetThread* getThread = new bncGetThread(url, format);
|
---|
67 | app.connect(getThread, SIGNAL(newMessage(const QByteArray&)),
|
---|
68 | &app, SLOT(slotMessage(const QByteArray&)));
|
---|
69 |
|
---|
70 | caster->addGetThread(getThread);
|
---|
71 |
|
---|
72 | getThread->start();
|
---|
73 | }
|
---|
74 | if (caster->numStations() == 0) {
|
---|
75 | return 0;
|
---|
76 | }
|
---|
77 | }
|
---|
78 | return app.exec();
|
---|
79 | }
|
---|