]> git.mxchange.org Git - flightgear.git/blob - src/GUI/QtLauncher_private.hxx
Work on LocationWidget for Qt launcher
[flightgear.git] / src / GUI / QtLauncher_private.hxx
1 // QtLauncher_private.hxx - GUI launcher dialog using Qt5
2 //
3 // Written by James Turner, started October 2015.
4 //
5 // Copyright (C) 2015 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_PRIVATE_HXX
22 #define FG_QTLAUNCHER_PRIVATE_HXX
23
24 #include <QDialog>
25 #include <QScopedPointer>
26 #include <QStringList>
27 #include <QModelIndex>
28 #include <QTimer>
29 #include <QUrl>
30
31 #include <simgear/package/Package.hxx>
32 #include <simgear/package/Catalog.hxx>
33
34 namespace Ui
35 {
36     class Launcher;
37 }
38
39 class QModelIndex;
40 class AircraftProxyModel;
41 class AircraftItemModel;
42 class QCheckBox;
43 class CatalogListModel;
44
45 class QtLauncher : public QDialog
46 {
47     Q_OBJECT
48 public:
49     QtLauncher();
50     virtual ~QtLauncher();
51
52     void setInAppMode();
53 private slots:
54     // run is used when the launcher is invoked before the main app is
55     // started
56     void onRun();
57
58     // apply is used in-app, where we must set properties and trigger
59     // a reset; setting command line options won't help us.
60     void onApply();
61     
62     void onQuit();
63
64
65     void onAircraftSelected(const QModelIndex& index);
66     void onRequestPackageInstall(const QModelIndex& index);
67     void onCancelDownload(const QModelIndex& index);
68
69     void onPopupAircraftHistory();
70
71     void onEditRatingsFilter();
72
73     void updateSettingsSummary();
74
75
76     void onRembrandtToggled(bool b);
77     void onToggleTerrasync(bool enabled);
78
79     void onSubsytemIdleTimeout();
80
81     void onEditPaths();
82
83
84     void onAircraftInstalledCompleted(QModelIndex index);
85     void onAircraftInstallFailed(QModelIndex index, QString errorMessage);
86 private:
87
88     /**
89      * Check if the passed index is the selected aircraft, and if so, refresh
90      * the associated UI data
91      */
92     void maybeUpdateSelectedAircraft(QModelIndex index);
93     void updateSelectedAircraft();
94
95     void restoreSettings();
96     void saveSettings();
97
98     QModelIndex proxyIndexForAircraftURI(QUrl uri) const;
99     QModelIndex sourceIndexForAircraftURI(QUrl uri) const;
100
101     void setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const;
102
103     simgear::pkg::PackageRef packageForAircraftURI(QUrl uri) const;
104
105     QScopedPointer<Ui::Launcher> m_ui;
106     AircraftProxyModel* m_aircraftProxy;
107     AircraftItemModel* m_aircraftModel;
108
109     QUrl m_selectedAircraft;
110     QList<QUrl> m_recentAircraft;
111     QTimer* m_subsystemIdleTimer;
112     bool m_inAppMode;
113
114     int m_ratingFilters[4];
115 };
116
117 #endif // of FG_QTLAUNCHER_PRIVATE_HXX