1 #ifndef DEFAULTAIRCRAFTLOCATOR_HXX 2 #define DEFAULTAIRCRAFTLOCATOR_HXX 3 4 #include <string> 5 #include <simgear/misc/sg_path.hxx> 6 7 #include <Main/AircraftDirVisitorBase.hxx> 8 9 #include <QAbstractListModel> 10 11 namespace flightgear 12 { 13 14 std::string defaultAirportICAO(); 15 16 string_list defaultSplashScreenPaths(); 17 18 /** 19 * we don't want to rely on the main AircraftModel threaded scan, to find the 20 * default aircraft, so we do a synchronous scan here, on the assumption that 21 * FG_DATA/Aircraft only contains a handful of entries. 22 */ 23 class DefaultAircraftLocator : public AircraftDirVistorBase 24 { 25 public: 26 DefaultAircraftLocator(); 27 28 SGPath foundPath() const; 29 30 private: 31 virtual VisitResult visit(const SGPath& p) override; 32 33 std::string _aircraftId; 34 SGPath _foundPath; 35 }; 36 37 class WeatherScenariosModel : public QAbstractListModel 38 { 39 Q_OBJECT 40 public: 41 WeatherScenariosModel(QObject* pr = nullptr); 42 43 int rowCount(const QModelIndex& index) const override; 44 45 QVariant data(const QModelIndex& index, int role) const override; 46 47 QHash<int, QByteArray> roleNames() const override; 48 49 Q_INVOKABLE QString metarForItem(quint32 index) const; 50 51 Q_INVOKABLE QString nameForItem(quint32 index) const; 52 53 Q_INVOKABLE QString descriptionForItem(quint32 index) const; 54 55 Q_INVOKABLE QStringList localWeatherData(quint32 index) const; 56 private: 57 struct WeatherScenario 58 { 59 QString name; 60 QString description; 61 QString metar; 62 QString localWeatherTileType; 63 QString localWeatherTileManagement; 64 }; 65 66 std::vector<WeatherScenario> m_scenarios; 67 68 enum { 69 NameRole = Qt::UserRole + 1, 70 DescriptionRole, 71 MetarRole, 72 }; 73 }; 74 75 } 76 77 #endif // DEFAULTAIRCRAFTLOCATOR_HXX 78