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