1 // QtLauncher_private.hxx - GUI launcher dialog using Qt5
3 // Written by James Turner, started October 2015.
5 // Copyright (C) 2015 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_PRIVATE_HXX
22 #define FG_QTLAUNCHER_PRIVATE_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();
57 // run is used when the launcher is invoked before the main app is
61 // apply is used in-app, where we must set properties and trigger
62 // a reset; setting command line options won't help us.
67 void onSearchAirports();
69 void onLocationChanged();
71 void onAirportChoiceSelected(const QModelIndex& index);
72 void onAircraftSelected(const QModelIndex& index);
73 void onRequestPackageInstall(const QModelIndex& index);
74 void onCancelDownload(const QModelIndex& index);
76 void onPopupAirportHistory();
77 void onPopupAircraftHistory();
79 void onEditRatingsFilter();
81 void updateLocationDescription();
82 void updateSettingsSummary();
84 void onAirportSearchComplete();
86 void onRembrandtToggled(bool b);
87 void onToggleTerrasync(bool enabled);
89 void onSubsytemIdleTimeout();
93 void onAirportDiagramClicked(FGRunwayRef rwy);
94 void onOffsetBearingTrueChanged(bool on);
96 void onOffsetDataChanged();
97 void onOffsetRadioToggled(bool on);
99 void onAircraftInstalledCompleted(QModelIndex index);
100 void onAircraftInstallFailed(QModelIndex index, QString errorMessage);
102 void setLocationOptions();
103 void setBaseLocation(FGPositionedRef ref);
106 * Check if the passed index is the selected aircraft, and if so, refresh
107 * the associated UI data
109 void maybeUpdateSelectedAircraft(QModelIndex index);
110 void updateSelectedAircraft();
112 void restoreSettings();
115 QModelIndex proxyIndexForAircraftURI(QUrl uri) const;
116 QModelIndex sourceIndexForAircraftURI(QUrl uri) const;
118 void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
120 simgear::pkg::PackageRef packageForAircraftURI(QUrl uri) const;
122 QScopedPointer<Ui::Launcher> m_ui;
123 AirportSearchModel* m_airportsModel;
124 AircraftProxyModel* m_aircraftProxy;
125 AircraftItemModel* m_aircraftModel;
126 FGPositionedRef m_location;
128 QUrl m_selectedAircraft;
129 QList<QUrl> m_recentAircraft;
130 QVector<PositionedID> m_recentAirports;
131 QTimer* m_subsystemIdleTimer;
134 int m_ratingFilters[4];
137 #endif // of FG_QTLAUNCHER_PRIVATE_HXX