1 | /* -------------------------------------------------------------------------
|
---|
2 | * BKG NTRIP Server
|
---|
3 | * -------------------------------------------------------------------------
|
---|
4 | *
|
---|
5 | * Class: main
|
---|
6 | *
|
---|
7 | * Purpose: Application starts here
|
---|
8 | *
|
---|
9 | * Author: L. Mervart
|
---|
10 | *
|
---|
11 | * Created: 29-Mar-2008
|
---|
12 | *
|
---|
13 | * Changes:
|
---|
14 | *
|
---|
15 | * -----------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 | #include <unistd.h>
|
---|
18 | #include <signal.h>
|
---|
19 | #include <QApplication>
|
---|
20 | #include <iostream>
|
---|
21 |
|
---|
22 | #include "bnsapp.h"
|
---|
23 | #include "bnswindow.h"
|
---|
24 |
|
---|
25 | using namespace std;
|
---|
26 |
|
---|
27 | void catch_signal(int) {
|
---|
28 | cout << "Program Interrupted by Ctrl-C" << endl;
|
---|
29 | ((bnsApp*)qApp)->slotQuit();
|
---|
30 | }
|
---|
31 |
|
---|
32 | // Main Program
|
---|
33 | /////////////////////////////////////////////////////////////////////////////
|
---|
34 | int main(int argc, char *argv[]) {
|
---|
35 |
|
---|
36 | bool GUIenabled = true;
|
---|
37 | for (int ii = 1; ii < argc; ii++) {
|
---|
38 | if (QString(argv[ii]) == "-nw") {
|
---|
39 | GUIenabled = false;
|
---|
40 | break;
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | QCoreApplication::setOrganizationName("BKG");
|
---|
45 | QCoreApplication::setOrganizationDomain("www.bkg.bund.de");
|
---|
46 | QCoreApplication::setApplicationName("BKG_NTRIP_Server");
|
---|
47 |
|
---|
48 | // Default Settings
|
---|
49 | // ----------------
|
---|
50 | QSettings settings;
|
---|
51 | if (settings.allKeys().size() == 0) {
|
---|
52 | settings.setValue("casterHost", "www.euref-ip.net");
|
---|
53 | settings.setValue("casterPort", 2101);
|
---|
54 | }
|
---|
55 |
|
---|
56 | bnsApp app(argc, argv, GUIenabled);
|
---|
57 |
|
---|
58 | // Interactive Mode - open the main window
|
---|
59 | // ---------------------------------------
|
---|
60 | if (GUIenabled) {
|
---|
61 |
|
---|
62 | QString fontString = settings.value("font").toString();
|
---|
63 | if ( !fontString.isEmpty() ) {
|
---|
64 | QFont newFont;
|
---|
65 | if (newFont.fromString(fontString)) {
|
---|
66 | QApplication::setFont(newFont);
|
---|
67 | }
|
---|
68 | }
|
---|
69 |
|
---|
70 | app.setWindowIcon(QPixmap(":ntrip-logo.png"));
|
---|
71 |
|
---|
72 | bnsWindow* bnsWin = new bnsWindow();
|
---|
73 | bnsWin->show();
|
---|
74 | }
|
---|
75 |
|
---|
76 | // Non-Interactive (Batch) Mode
|
---|
77 | // ----------------------------
|
---|
78 | else {
|
---|
79 | exit(0);
|
---|
80 | }
|
---|
81 |
|
---|
82 | // Start the application
|
---|
83 | // ---------------------
|
---|
84 | return app.exec();
|
---|
85 | }
|
---|