1 // QtLauncher.hxx - GUI launcher dialog using Qt5
3 // Written by James Turner, started December 2014.
5 // Copyright (C) 2014 James Turner <zakalawe@mac.com>
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.
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.
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.
21 #ifndef FG_QTLAUNCHER_HXX
22 #define FG_QTLAUNCHER_HXX
25 #include <QScopedPointer>
26 #include <QStringList>
27 #include <QModelIndex>
32 #include <Airports/airport.hxx>
33 #include <simgear/package/Package.hxx>
34 #include <simgear/package/Catalog.hxx>
41 class AirportSearchModel;
43 class AircraftProxyModel;
44 class AircraftItemModel;
46 class CatalogListModel;
48 class QtLauncher : public QDialog
53 virtual ~QtLauncher();
55 static void initApp(int& argc, char** argv);
57 static bool runLauncherDialog();
63 void onSearchAirports();
65 void onAirportChanged();
67 void onAirportChoiceSelected(const QModelIndex& index);
68 void onAircraftSelected(const QModelIndex& index);
69 void onRequestPackageInstall(const QModelIndex& index);
70 void onCancelDownload(const QModelIndex& index);
72 void onPopupAirportHistory();
73 void onPopupAircraftHistory();
75 void onEditRatingsFilter();
77 void updateAirportDescription();
78 void updateSettingsSummary();
80 void onAirportSearchComplete();
82 void onRembrandtToggled(bool b);
83 void onToggleTerrasync(bool enabled);
85 void onSubsytemIdleTimeout();
89 void onAirportDiagramClicked(FGRunwayRef rwy);
91 void onAircraftInstalledCompleted(QModelIndex index);
92 void onAircraftInstallFailed(QModelIndex index, QString errorMessage);
94 void setAirport(FGAirportRef ref);
97 * Check if the passed index is the selected aircraft, and if so, refresh
98 * the associated UI data
100 void maybeUpdateSelectedAircraft(QModelIndex index);
101 void updateSelectedAircraft();
103 void restoreSettings();
106 QModelIndex proxyIndexForAircraftURI(QUrl uri) const;
107 QModelIndex sourceIndexForAircraftURI(QUrl uri) const;
109 void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
111 simgear::pkg::PackageRef packageForAircraftURI(QUrl uri) const;
113 QScopedPointer<Ui::Launcher> m_ui;
114 AirportSearchModel* m_airportsModel;
115 AircraftProxyModel* m_aircraftProxy;
116 AircraftItemModel* m_aircraftModel;
117 FGAirportRef m_selectedAirport;
119 QUrl m_selectedAircraft;
120 QList<QUrl> m_recentAircraft;
121 QStringList m_recentAirports;
122 QTimer* m_subsystemIdleTimer;
124 int m_ratingFilters[4];
127 #endif // of FG_QTLAUNCHER_HXX