]> git.mxchange.org Git - flightgear.git/blob - src/GUI/QtLauncher.hxx
Aircraft path support in the Qt launcher
[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 #include <QTimer>
29
30 #include <Airports/airport.hxx>
31
32 namespace Ui
33 {
34     class Launcher;
35 }
36
37 class AirportSearchModel;
38 class QModelIndex;
39 class AircraftProxyModel;
40 class AircraftItemModel;
41 class QCheckBox;
42
43 class QtLauncher : public QDialog
44 {
45     Q_OBJECT
46 public:
47     QtLauncher();
48     virtual ~QtLauncher();
49
50     static void initApp(int argc, char** argv);
51
52     static bool runLauncherDialog();
53
54 private slots:
55     void onRun();
56     void onQuit();
57
58     void onSearchAirports();
59
60     void onAirportChanged();
61
62     void onAirportChoiceSelected(const QModelIndex& index);
63     void onAircraftSelected(const QModelIndex& index);
64
65     void onPopupAirportHistory();
66     void onPopupAircraftHistory();
67
68     void onOpenCustomAircraftDir();
69
70     void onEditRatingsFilter();
71
72     void updateAirportDescription();
73     void updateSettingsSummary();
74
75     void onAirportSearchComplete();
76
77     void onAddSceneryPath();
78     void onRemoveSceneryPath();
79
80     void onAddAircraftPath();
81     void onRemoveAircraftPath();
82
83
84     void onRembrandtToggled(bool b);
85
86     void onSubsytemIdleTimeout();
87 private:
88     void setAirport(FGAirportRef ref);
89     void updateSelectedAircraft();
90
91     void restoreSettings();
92     void saveSettings();
93     
94     QModelIndex proxyIndexForAircraftPath(QString path) const;
95     QModelIndex sourceIndexForAircraftPath(QString path) const;
96
97     void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
98
99     QScopedPointer<Ui::Launcher> m_ui;
100     AirportSearchModel* m_airportsModel;
101     AircraftProxyModel* m_aircraftProxy;
102     AircraftItemModel* m_aircraftModel;
103     
104     FGAirportRef m_selectedAirport;
105
106     QString m_selectedAircraft;
107     QStringList m_recentAircraft,
108         m_recentAirports;
109     QString m_customAircraftDir;
110     QTimer* m_subsystemIdleTimer;
111
112     int m_ratingFilters[4];
113 };
114
115 #endif // of FG_QTLAUNCHER_HXX