Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
mainobject.h
Go to the documentation of this file.
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // mainobject.h
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 #ifndef MAINOBJECT_H
10 #define MAINOBJECT_H
11 
12 #include <QtCore/QObject>
13 
14 
15 #include <QSystemTrayIcon>
16 #include <QAction>
17 #include <QMenu>
18 #include <QMenuBar>
19 #include <QLabel>
20 #include <QWidgetAction>
21 
22 #include "xobjects/xsettings.h"
23 
25 class XSettingsModel;
26 
27 #include "xobjects/xprocess.h"
28 class XProcess;
29 
30 
31 
33 class LauncherWindow;
34 
35 #include "mpmap/mpmapwidget.h"
36 #include "mpmap/mpmapxwidget.h"
37 #include "logs/viewlogswidget.h"
38 #include "props/propstreewidget.h"
40 
41 //class MpMapWidget;
42 //class MpMapXWidget;
43 class ViewLogsWidget;
44 class PropsTreeWidget;
45 class FgxDebugWidget;
46 
47 
48 /*! \class MainObject
49  * \brief The MainObject is an extended QObject, and the main "controller" for FGx
50  *
51  * This was bad naming but a "main object" created when the app starts in the backgound
52  * and is passed around as a "state machine" of sorts.
53  *
54  * Child "background" in memory containers are
55  *
56  *
57  * It is only via an icon in the QSystemTrayIcon ie TaskBar
58  * All widgets are children to this object and are hidden (at the moment)
59  *
60  * MainObject also controls the starting and stopping of processes// TBC
61  *
62  * @author: Peter Morgan
63  * @author: Yves Sablonier
64  */
65 
66 class MainObject : public QObject
67 {
68 Q_OBJECT
69 public:
70  explicit MainObject(QObject *parent = 0);
71  ~MainObject();
72 
73  static int runningOs();
74 
75  bool debug_mode;
76 
77  static QString log_file_path();
78 
79  QString data_file(QString file_name);
80  QString default_file(QString file_name);
81 
82  static QString temp_dir();
83  static QString temp_dir(QString append_path);
84 
87 
88  /* \brief Instance of LauncherWindow */
90  //MpMapWidget *mpMapWidget;
91  //MpMapXWidget *mpMapXWidget;
92 
96 
99 
100 
101  QSystemTrayIcon *trayIcon;
102  QMenu *popupMenu;
103 
104  QWidgetAction *actionCallsign;
106 
107  QAction *actionLauncher;
108  QAction *actionMpMap;
111 
112  QAction *actionViewLogs;
115 
116  QAction *actionQuit;
117 
118  QString get_fgfs_command();
119  QStringList get_fgfs_args();
120  QStringList get_env();
121 
122 signals:
123  void show_settings(int);
124  void reload_paths();
125  void on_debug_mode(bool enabled);
126  void setx(QString option, bool enabled, QString value);
127 
128 public slots:
129 
130  void initialize();
131 
132  void on_tray_icon(QSystemTrayIcon::ActivationReason reason);
133 
134  void on_launcher();
135  void on_browsermap();
136  void on_properties_browser();
137 
138  void on_view_logs();
139  void clear_log(QString log_name);
140  void add_log(QString log_name, QString data);
141 
142  void start_all();
143  void start_fgfs();
144  void start_terrasync();
145  void stop_all();
146 
147  void on_quit();
148 
149  void on_view_fgx_debug();
150  void set_debug_mode(bool);
151 
152  void on_action_open_url(QAction*);
153 
154  void on_about_qt();
155  void on_about_fgx();
156 
157  void on_upx(QString option, bool enabled, QString value);
158 
159 };
160 
161 
162 
163 
164 
165 #endif // MAINOBJECT_H
QString default_file(QString file_name)
void on_view_fgx_debug()
Definition: mainobject.cpp:347
void on_properties_browser()
Definition: mainobject.cpp:248
QAction * actionPropsBrowser
Definition: mainobject.h:109
QSystemTrayIcon * trayIcon
Definition: mainobject.h:101
static QString log_file_path()
Log File.
Definition: mainobject.cpp:388
void clear_log(QString log_name)
Definition: mainobject.cpp:272
QWidgetAction * actionCallsign
Definition: mainobject.h:104
The XSettings is an extended QSetttings, but also includes most to the FGx configuration.
Definition: xsettings.h:15
XProcess * processFgFs
Definition: mainobject.h:97
QStringList get_env()
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:66
static int runningOs()
What OS is running.
Definition: mainobject.cpp:367
ViewLogsWidget * viewLogsWidget
Definition: mainobject.h:93
void on_upx(QString option, bool enabled, QString value)
Definition: mainobject.cpp:478
void on_about_fgx()
Definition: mainobject.cpp:454
void setx(QString option, bool enabled, QString value)
The XSettingsModel is an extended QStandardItemModel, and the main "setting and state" for FGx...
static QString temp_dir()
location if temp directoty , os specific
Definition: mainobject.cpp:414
QAction * actionMpMap
Definition: mainobject.h:108
QStringList get_fgfs_args()
XProcess * processTerraSync
Definition: mainobject.h:98
QAction * actionViewLogs
Definition: mainobject.h:112
void initialize()
Definition: mainobject.cpp:215
QAction * actionLauncher
Definition: mainobject.h:107
QAction * actionSetupWizard
Definition: mainobject.h:110
bool debug_mode
Definition: mainobject.h:75
void on_about_qt()
Definition: mainobject.cpp:466
PropsTreeWidget * propertiesBrowser
Definition: mainobject.h:94
void stop_all()
Definition: mainobject.cpp:296
void on_quit()
Definition: mainobject.cpp:329
The LauncherWindow is raised and controlled by MainObject.
QString data_file(QString file_name)
Path to a data file eg data_file("airports.txt")
Definition: mainobject.cpp:438
FgxDebugWidget * fgxDebugWidget
Definition: mainobject.h:95
void set_debug_mode(bool)
Definition: mainobject.cpp:353
QAction * actionQuit
Definition: mainobject.h:116
XSettingsModel * X
Definition: mainobject.h:86
void on_browsermap()
Definition: mainobject.cpp:237
QString get_fgfs_command()
void on_action_open_url(QAction *)
Definition: mainobject.cpp:471
void on_launcher()
Definition: mainobject.cpp:223
void start_all()
Definition: mainobject.cpp:284
LauncherWindow * launcherWindow
Definition: mainobject.h:89
void start_fgfs()
Definition: mainobject.cpp:309
MainObject(QObject *parent=0)
Definition: mainobject.cpp:30
QMenu * popupMenu
Definition: mainobject.h:102
void on_tray_icon(QSystemTrayIcon::ActivationReason reason)
Definition: mainobject.cpp:256
void on_debug_mode(bool enabled)
void reload_paths()
QAction * actionBrowserMap
Definition: mainobject.h:114
XSettings * settings
Definition: mainobject.h:85
void start_terrasync()
Definition: mainobject.cpp:316
void add_log(QString log_name, QString data)
Definition: mainobject.cpp:276
QAction * actionViewFgxDebug
Definition: mainobject.h:113
void show_settings(int)
QLabel * lblCallsign
Definition: mainobject.h:105
void on_view_logs()
Definition: mainobject.cpp:268