-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
279 lines (205 loc) · 7.05 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/**
Copyright (C) 2012-2020 Matteo Pasotti <[email protected]>
This file is part of yaflight - Cross platform YaFlight
yaflight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
yaflight is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QResource>
#include <QMessageBox>
#include <QProcess>
#include <QByteArray>
#include <QStringList>
#include <QDir>
#include <QHash>
#include <QHashIterator>
#include <QObject>
#include <QResizeEvent>
#include <QStringListModel>
#include <QStandardItemModel>
#include <QWebFrame>
#include <QFileDialog>
#include <QTimer>
#include <QTranslator>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QBitmap>
#include "logger.h"
#include "fgenvironment.h"
#include "aircraftdetailsdialog.h"
#include "dialogappsettings.h"
#include "imagepreview.h"
#include "aircraft.h"
#include "airport.h"
#include "surfacecode.h"
#include "shouldercode.h"
#include "runwaydetailsdialog.h"
#include "mpmdialog.h"
#include "dialogmpdetails.h"
#include "settings.h"
#include "appsettings.h"
#include "helpdialog.h"
#include "apt_dat.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void closeEvent(QCloseEvent *event);
void on_btnExit_clicked();
void on_pbtLaunch_clicked();
void readAircrafts();
void read_ts_output();
void procReadAircraftsFinished(int, QProcess::ExitStatus);
void proc_ts_finished(int, QProcess::ExitStatus);
void on_cboAircrafts_currentIndexChanged(const QString &arg1);
void on_btnAircraftInfo_clicked();
void expOptsUnexpanded();
void expOptsExpanded();
void on_pbtSaveConf_clicked();
void on_pbtLoadConf_clicked();
void on_btnRefreshAirportList_clicked();
void on_ckbFilterInstalled_toggled(bool checked);
void on_tbvAirports_clicked(const QModelIndex &index);
void on_hzsTurbulence_valueChanged(int value);
void on_cboWindowGeometries_currentIndexChanged(const QString &arg1);
void on_cboFailures_currentIndexChanged(const QString &arg1);
void on_cboDayTime_currentIndexChanged(const QString &arg1);
void on_cboSeason_currentIndexChanged(const QString &arg1);
void on_dialHeading_valueChanged(int value);
void on_btnGoToMap_clicked();
void on_btnAboutQt_clicked();
void on_cboRunway_currentIndexChanged(const QString &arg1);
void on_btnRunwayInfo_clicked();
void on_btnAdd_clicked();
void on_btnDel_clicked();
void hndl_tmr_procfgfs();
void hndl_tmr_procts();
void hndl_tmr_update_map_with_plane();
void on_ckbInAir_toggled(bool checked);
void on_cboControlMode_currentIndexChanged(const QString &arg1);
void on_btnRecreateAiportsIndex_clicked();
void on_pbtSearchAirport_clicked();
void verify_updates(QNetworkReply *reply);
void on_pbtSpecifyMPPorts_clicked();
void on_spboxHeading_valueChanged(QString value);
void on_pbtTerraSyncStartStop_clicked();
void on_pbtOpenMPMap_clicked();
void on_pbtMPHostnameContextualHelp_clicked();
void on_pbtWeatherContextualHelp_clicked();
void on_pbtFindNext_clicked();
void on_pbtInstallModel_clicked();
void yainstall_proc_finished();
void on_pbtDeselectAllScenarios_clicked();
//void paintEvent(QPaintEvent* event);
void on_cboTheme_currentTextChanged(const QString &arg1);
void completedAptCache();
void updateCacheProgress(int currLine, int lineCount);
protected:
//void resizeEvent(QResizeEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void setup_about_box();
private:
// ----- app -----
Ui::MainWindow *ui;
QPoint dragPosition; // used to move the frameless window
int _mainWindowMaxHeight, _mainWindowMinHeight;
int posX, posY;
void toggleLoadingBarVisible();
void setup_default_paths();
Logger *log;
//QNetworkAccessManager *mgr;
void check_updates();
//void setup_mpmap_viewer();
MPMDialog *mpmdiag;
HelpDialog *hpdiag;
void showHelp(QString url);
QList<QStandardItem *> searchFoundAirports;
int searchFoundAirportsIndex;
//void follow_pilot_on_mpmap();
void populate_combo_aircrafts();
void populate_scenarios();
// custom shape
QRegion getRegion() const;
void updateMask();
void populate_yaflight_theme_list();
// ----- processes -----
QProcess *procFGFS;
QProcess *procTerraSync;
QProcess *procYaInstall;
bool proc_fgfs_is_running;
bool proc_ts_is_running;
QTimer *tmrProcFGFS;
QTimer *tmrProcTS;
QTimer *tmrProcCoords;
void startTerraSync();
void stopTerraSync();
// ----- aircrafts -----
QStringList aircrafts;
// hash key --> aircraft name (unique)
// hash value --> aircraft dir (multiple)
QHash<QString,QString> hashOfAircrafts;
QHash<QString, QString> getListOfAircrafts();
void refreshListOfAircrafts();
void drawThumbnail(QString dir);
Aircraft *ac;
// ----- airports -----
QHash<QString, QStringList> collect_all_airports();
QStringList collect_all_airports_dir();
void setup_airport_list();
QList<Runway *> ap_runways;
Runway *currentRunway;
QModelIndex lastAirportIndex;
// ----- settings -----
Settings *curr_settings;
appsettings *appsett;
QStringList collectLaunchSettings();
void loadSettings(QString confFile, bool appStart=false);
bool saveSettings(QString confFile);
void add_scenery_path(QString sceneryPath);
QString lastResolutionSelected;
QString lastFailureSelected;
QString lastSeasonSelected;
QString lastDayTimeSelected;
QString lastAirport;
QString lastLongitude;
QString lastLatitude;
QString lastHeading;
QString lastControlModeSelected;
QString lastAircraft;
QString lastPortIn;
QString lastPortOut;
float lastTurbulence;
FGEnvironment *fgenv;
void check_mp_ports_values();
// ----- flags -----
bool just_started;
// ----- web service -----
void update_latlonhead(QString lat, QString lon, QString heading);
double convert_dialhead_to_azimuth(double head);
void place_aircraft_on_map_reading_table();
void place_aircraft_on_map_reading_settings();
void center_mpmap_at_coords();
bool eventFilter(QObject * obj, QEvent * event);
void change_selected_coords();
// ----- threads -----
APT_dat aptdat;
};
#endif // MAINWINDOW_H