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 <QApplication>
|
---|
18 |
|
---|
19 | using namespace std;
|
---|
20 |
|
---|
21 | void catch_signal(int) {
|
---|
22 | cout << "Program Interrupted by Ctrl-C" << endl;
|
---|
23 | ((bncApp*)qApp)->slotQuit();
|
---|
24 | }
|
---|
25 |
|
---|
26 | // Main Program
|
---|
27 | /////////////////////////////////////////////////////////////////////////////
|
---|
28 | int main(int argc, char *argv[]) {
|
---|
29 |
|
---|
30 | bool GUIenabled = true;
|
---|
31 | for (int ii = 1; ii < argc; ii++) {
|
---|
32 | if (QString(argv[ii]) == "-nw") {
|
---|
33 | GUIenabled = false;
|
---|
34 | break;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | QCoreApplication::setOrganizationName("BKG");
|
---|
39 | QCoreApplication::setOrganizationDomain("www.bkg.bund.de");
|
---|
40 | QCoreApplication::setApplicationName("BKG_NTRIP_Server");
|
---|
41 |
|
---|
42 | // Default Settings
|
---|
43 | // ----------------
|
---|
44 | QSettings settings;
|
---|
45 | if (settings.allKeys().size() == 0) {
|
---|
46 | settings.setValue("casterHost", "www.euref-ip.net");
|
---|
47 | settings.setValue("casterPort", 2101);
|
---|
48 | }
|
---|
49 |
|
---|
50 | bncApp app(argc, argv, GUIenabled);
|
---|
51 |
|
---|
52 | // Interactive Mode - open the main window
|
---|
53 | // ---------------------------------------
|
---|
54 | if (GUIenabled) {
|
---|
55 |
|
---|
56 | QString fontString = settings.value("font").toString();
|
---|
57 | if ( !fontString.isEmpty() ) {
|
---|
58 | QFont newFont;
|
---|
59 | if (newFont.fromString(fontString)) {
|
---|
60 | QApplication::setFont(newFont);
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 | app.setWindowIcon(QPixmap(":ntrip-logo.png"));
|
---|
65 |
|
---|
66 | bncWindow* bncWin = new bncWindow();
|
---|
67 | bncWin->show();
|
---|
68 | }
|
---|
69 |
|
---|
70 | // Non-Interactive (Batch) Mode
|
---|
71 | // ----------------------------
|
---|
72 | else {
|
---|
73 | exit(0);
|
---|
74 | }
|
---|
75 |
|
---|
76 | // Start the application
|
---|
77 | // ---------------------
|
---|
78 | return app.exec();
|
---|
79 | }
|
---|