]> git.mxchange.org Git - flightgear.git/blob - src/GUI/QtLauncher.hxx
Work on new download-dir option
[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 class CatalogListModel;
43
44 class QtLauncher : public QDialog
45 {
46     Q_OBJECT
47 public:
48     QtLauncher();
49     virtual ~QtLauncher();
50
51     static void initApp(int argc, char** argv);
52
53     static bool runLauncherDialog();
54
55 private slots:
56     void onRun();
57     void onQuit();
58
59     void onSearchAirports();
60
61     void onAirportChanged();
62
63     void onAirportChoiceSelected(const QModelIndex& index);
64     void onAircraftSelected(const QModelIndex& index);
65
66     void onPopupAirportHistory();
67     void onPopupAircraftHistory();
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 onAddAircraftPath();
80     void onRemoveAircraftPath();
81
82     void onAddCatalog();
83     void onRemoveCatalog();
84
85     void onRembrandtToggled(bool b);
86     void onToggleTerrasync(bool enabled);
87
88     void onSubsytemIdleTimeout();
89
90     void onChangeDownloadDir();
91     void onClearDownloadDir();
92 private:
93     void setAirport(FGAirportRef ref);
94     void updateSelectedAircraft();
95
96     void restoreSettings();
97     void saveSettings();
98     
99     QModelIndex proxyIndexForAircraftPath(QString path) const;
100     QModelIndex sourceIndexForAircraftPath(QString path) const;
101
102     void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
103
104     QScopedPointer<Ui::Launcher> m_ui;
105     AirportSearchModel* m_airportsModel;
106     AircraftProxyModel* m_aircraftProxy;
107     AircraftItemModel* m_aircraftModel;
108     CatalogListModel* m_catalogsModel;
109
110     FGAirportRef m_selectedAirport;
111
112     QString m_selectedAircraft;
113     QStringList m_recentAircraft,
114         m_recentAirports;
115     QString m_downloadDir;
116     QTimer* m_subsystemIdleTimer;
117
118     int m_ratingFilters[4];
119 };
120
121 #endif // of FG_QTLAUNCHER_HXX