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