FlightGear next
AddOnsController.hxx
Go to the documentation of this file.
1#ifndef ADDONSCONTROLLER_HXX
2#define ADDONSCONTROLLER_HXX
3
4#include <QObject>
5#include <QStringList>
6
7#include "AddonsModel.hxx"
8#include "PathListModel.hxx"
9
12class LaunchConfig;
13
14#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
15Q_MOC_INCLUDE("CatalogListModel.hxx")
16#endif
17
18class AddOnsController : public QObject
19{
20 Q_OBJECT
21
22 Q_PROPERTY(PathListModel* aircraftPaths READ aircraftPaths CONSTANT)
23 Q_PROPERTY(PathListModel* sceneryPaths READ sceneryPaths CONSTANT)
24 Q_PROPERTY(QStringList modulePaths READ modulePaths WRITE setModulePaths NOTIFY modulePathsChanged)
25
26 Q_PROPERTY(CatalogListModel* catalogs READ catalogs CONSTANT)
27 Q_PROPERTY(AddonsModel* modules READ modules NOTIFY modulesChanged)
31
32public:
33 explicit AddOnsController(LauncherMainWindow *parent, LaunchConfig* config);
34
37 QStringList modulePaths() const;
38
40 { return m_catalogs; }
41
43 { return m_addonsModuleModel; }
44
45 Q_INVOKABLE QString addAircraftPath() const;
46 Q_INVOKABLE QString addSceneryPath() const;
47 Q_INVOKABLE QString addAddOnModulePath() const;
48
49 // we would ideally do this in-page, but needs some extra work
50 Q_INVOKABLE QString installCustomScenery();
51
52 Q_INVOKABLE void openDirectory(QString path);
53
55
56 bool showNoOfficialHangar() const;
57
58 Q_INVOKABLE void officialCatalogAction(QString s);
59
60 bool havePathsFromCommandLine() const;
61signals:
64
67
68public slots:
69 void setModulePaths(QStringList modulePaths);
70 void setAddons(AddonsModel* addons);
71 void onAddonsChanged(void);
72
73 void collectArgs();
74
75private:
76 void setLocalAircraftPaths();
77 bool shouldShowOfficialCatalogMessage() const;
78 void onCatalogsChanged();
79
80 LauncherMainWindow* m_launcher;
81 CatalogListModel* m_catalogs = nullptr;
82 AddonsModel* m_addonsModuleModel = nullptr;
83 LaunchConfig* m_config = nullptr;
84
85 PathListModel* m_aircraftPaths = nullptr;
86 PathListModel* m_sceneryPaths = nullptr;
87 QStringList m_addonModulePaths;
88};
89
90#endif // ADDONSCONTROLLER_HXX
CatalogListModel * catalogs
void setAddons(AddonsModel *addons)
Q_INVOKABLE QString addAircraftPath() const
Q_INVOKABLE QString addSceneryPath() const
Q_INVOKABLE QString addAddOnModulePath() const
Q_INVOKABLE void officialCatalogAction(QString s)
PathListModel * sceneryPaths
void isOfficialHangarRegisteredChanged()
Q_INVOKABLE void openDirectory(QString path)
AddOnsController(LauncherMainWindow *parent, LaunchConfig *config)
AddonsModel * modules
void setModulePaths(QStringList modulePaths)
bool isOfficialHangarRegistered()
void modulePathsChanged(QStringList modulePaths)
Q_INVOKABLE QString installCustomScenery()
void showNoOfficialHangarChanged()
AddonsModel * modules() const
PathListModel * aircraftPaths