]> git.mxchange.org Git - flightgear.git/blob - src/GUI/QtLauncher.hxx
Refactor aircraft helper classes
[flightgear.git] / src / GUI / QtLauncher.hxx
1 // QtLauncher.hxx - GUI launcher dialog using Qt5
2 //
3 // Written by James Turner, started December 2014.
4 //
5 // Copyright (C) 2014 James Turner <zakalawe@mac.com>
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 #ifndef FG_QTLAUNCHER_HXX
22 #define FG_QTLAUNCHER_HXX
23
24 #include <QDialog>
25 #include <QScopedPointer>
26 #include <QStringList>
27 #include <QModelIndex>
28
29 #include <Airports/airport.hxx>
30
31 namespace Ui
32 {
33     class Launcher;
34 }
35
36 class AirportSearchModel;
37 class QModelIndex;
38 class AircraftProxyModel;
39 class QCheckBox;
40
41 class QtLauncher : public QDialog
42 {
43     Q_OBJECT
44 public:
45     QtLauncher();
46     virtual ~QtLauncher();
47
48     static void initApp(int argc, char** argv);
49
50     static bool runLauncherDialog();
51
52 private slots:
53     void onRun();
54     void onQuit();
55
56     void onSearchAirports();
57
58     void onAirportChanged();
59
60     void onAirportChoiceSelected(const QModelIndex& index);
61     void onAircraftSelected(const QModelIndex& index);
62
63     void onPopupAirportHistory();
64     void onPopupAircraftHistory();
65
66     void onOpenCustomAircraftDir();
67
68     void onEditRatingsFilter();
69
70     void updateAirportDescription();
71     void updateSettingsSummary();
72
73     void onAirportSearchComplete();
74
75     void onAddSceneryPath();
76     void onRemoveSceneryPath();
77
78     void onRembrandtToggled(bool b);
79 private:
80     void setAirport(FGAirportRef ref);
81     void updateSelectedAircraft();
82
83     void restoreSettings();
84     void saveSettings();
85     
86     QModelIndex proxyIndexForAircraftPath(QString path) const;
87     QModelIndex sourceIndexForAircraftPath(QString path) const;
88
89     void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
90
91     QScopedPointer<Ui::Launcher> m_ui;
92     AirportSearchModel* m_airportsModel;
93     AircraftProxyModel* m_aircraftProxy;
94
95     FGAirportRef m_selectedAirport;
96
97     QString m_selectedAircraft;
98     QStringList m_recentAircraft,
99         m_recentAirports;
100     QString m_customAircraftDir;
101
102     int m_ratingFilters[4];
103 };
104
105 #endif // of FG_QTLAUNCHER_HXX