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>
31 #include <simgear/package/Package.hxx>
32 #include <simgear/package/Catalog.hxx>
40 class AircraftProxyModel;
41 class AircraftItemModel;
43 class CatalogListModel;
45 class QtLauncher : public QDialog
50 virtual ~QtLauncher();
54 // run is used when the launcher is invoked before the main app is
58 // apply is used in-app, where we must set properties and trigger
59 // a reset; setting command line options won't help us.
65 void onAircraftSelected(const QModelIndex& index);
66 void onRequestPackageInstall(const QModelIndex& index);
67 void onCancelDownload(const QModelIndex& index);
69 void onPopupAircraftHistory();
71 void onEditRatingsFilter();
73 void updateSettingsSummary();
76 void onRembrandtToggled(bool b);
77 void onToggleTerrasync(bool enabled);
79 void onSubsytemIdleTimeout();
84 void onAircraftInstalledCompleted(QModelIndex index);
85 void onAircraftInstallFailed(QModelIndex index, QString errorMessage);
89 * Check if the passed index is the selected aircraft, and if so, refresh
90 * the associated UI data
92 void maybeUpdateSelectedAircraft(QModelIndex index);
93 void updateSelectedAircraft();
95 void restoreSettings();
98 QModelIndex proxyIndexForAircraftURI(QUrl uri) const;
99 QModelIndex sourceIndexForAircraftURI(QUrl uri) const;
101 void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
103 simgear::pkg::PackageRef packageForAircraftURI(QUrl uri) const;
105 QScopedPointer<Ui::Launcher> m_ui;
106 AircraftProxyModel* m_aircraftProxy;
107 AircraftItemModel* m_aircraftModel;
109 QUrl m_selectedAircraft;
110 QList<QUrl> m_recentAircraft;
111 QTimer* m_subsystemIdleTimer;
114 int m_ratingFilters[4];
117 #endif // of FG_QTLAUNCHER_PRIVATE_HXX