Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
main.cpp
Go to the documentation of this file.
1 // ____
2 // ,,-''' `'''--. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
3 // ,' `. FGx FlightGear Launcher
4 // ,' \ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
5 // ,' / ' (c) 2010-2013
6 // / ,---[ || Yves Sablonier, Pete Morgan
7 // | _,.--| / \ Geoff McLane
8 // | .-'' ' /' ,',-._
9 // | '---...--'''_.']-' `.. General Public Licence,
10 // | _,.-:.-' '-. Version 2 (GNU GPLv2)
11 // `.____,,....--=::.--' ,,'
12 // -\''' _,' This program is free software
13 // `._ ,' You can redistribute it
14 // `._ _,' and/or modify it under the terms
15 // ``------' of the GNU General Public Licence
16 // as published by the Free Software
17 // Foundation. This program is distributed in the hope it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 // ***********************************************************************
22 
23 
24 #include <QApplication>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <QFile>
28 #include <QTextStream>
29 #include <QFontDatabase>
30 #include <QSettings>
31 
32 
33 #include "xobjects/mainobject.h"
34 #include "utilities/utilities.h"
35 #include "xobjects/xsettings.h"
36 
37 // Global Message handler
38 // All debug messages are send here for processing to
39 // log files, console and alike
40 void fgxErrorMessage(QtMsgType type, const char *msg)
41 {
42  QString m = msg;
43  switch (type)
44  {
45  case QtDebugMsg:
46  outLog("*** FGx debug: "+m+" ***\n",0);
47  break;
48  case QtWarningMsg:
49  outLog("*** FGx warning: "+m+" ***\n",0);
50  break;
51  case QtCriticalMsg:
52  outLog("*** FGx critical: "+m+" ***\n",0);
53  break;
54  case QtFatalMsg:
55  outLog("*** FGx fatal: "+m+" ***\n",0);
56  abort();
57  break;
58  }
59 }
60 
61 int main( int argc, char* argv[])
62 {
63 
64  QApplication app(argc, argv);
65  QApplication::setOrganizationName(APP_ORG);
66  QApplication::setOrganizationDomain(APP_DOMAIN);
67  QApplication::setApplicationName(APP_SHORT);
68 
69  // from /version file via cmake
70  QApplication::setApplicationVersion(APP_VERSION);
71 
72 
73  //== Starts the application here
74  MainObject mainObject;
75 
76  QSettings startsettings;
77 
78  //* check for dev_mode, install message handler
79  if( XSettings::dev_mode() == false ){
80  //qInstallMsgHandler(fgxErrorMessage);
81  }
82 
83 
84  return app.exec();
85 
86 
87 }
88 
89 
90 
91 
92 
93 
static bool dev_mode()
The "Special Developer Flag".
Definition: xsettings.cpp:138
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:66
void fgxErrorMessage(QtMsgType type, const char *msg)
Definition: main.cpp:40
int main(int argc, char *argv[])
Definition: main.cpp:61