21#ifndef FG_GUI_AIRCRAFT_MODEL
22#define FG_GUI_AIRCRAFT_MODEL
24#include <QAbstractListModel>
32#include <simgear/package/Delegate.hxx>
33#include <simgear/package/Root.hxx>
34#include <simgear/package/Catalog.hxx>
35#include <simgear/package/Package.hxx>
64Q_DECLARE_METATYPE(simgear::pkg::PackageRef)
80 int rowCount(
const QModelIndex& parent)
const override;
82 QVariant
data(
const QModelIndex& index,
int role)
const override;
84 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
86 QHash<int, QByteArray>
roleNames()
const override;
123 void onScanStarted();
124 void onScanAddedItems(
int count);
125 void onLocalCacheCleared();
139 QVariant dataFromItem(
AircraftItemPtr item,
const DelegateState& state,
int role)
const;
141 QVariant dataFromPackage(
const simgear::pkg::PackageRef& item,
142 const DelegateState& state,
int role)
const;
144 QVariant packageRating(
const simgear::pkg::PackageRef&
p,
int ratingIndex)
const;
145 QVariant packageThumbnail(simgear::pkg::PackageRef
p,
146 const DelegateState& state,
bool download =
true)
const;
148 QVariant packagePreviews(simgear::pkg::PackageRef
p,
const DelegateState &ds)
const;
150 void refreshPackages();
152 void installSucceeded(QModelIndex index);
153 void installFailed(QModelIndex index, simgear::pkg::Delegate::StatusCode reason);
158 QVector<DelegateState> m_delegateStates;
160 simgear::pkg::RootRef m_packageRoot;
161 simgear::pkg::PackageList m_packages;
162 int m_cachedLocalAircraftCount = 0;
const int AircraftVariantCountRole
const int AircraftInstallPercentRole
const int AircraftInstallDownloadedSizeRole
const int AircraftMinVersionRole
const int AircraftRatingRole
const int AircraftIsSeaplaneRole
const int AircraftVariantDescriptionRole
const int AircraftHasRatingsRole
const int AircraftPathRole
const int AircraftPackageIdRole
const int AircraftAuthorsRole
const int AircraftLongDescriptionRole
const int AircraftPrimaryURIRole
const int AircraftPackageProgressRole
const int AircraftPackageRefRole
const int AircraftIsHelicopterRole
const int AircraftStatusRole
const int AircraftURIRole
const int AircraftIsFavouriteRole
const int AircraftPackageSizeRole
const int AircraftVariantRole
const int AircraftPackageStatusRole
QSharedPointer< AircraftItem > AircraftItemPtr
int installedAircraftCount
QModelIndex indexOfAircraftURI(QUrl uri) const
given a -set.xml path, return the corresponding model index, if one exists.
void setPackageRoot(const simgear::pkg::RootRef &root)
bool isIndexRunnable(const QModelIndex &index) const
return if a given aircraft is ready to be run, or not.
int rowCount(const QModelIndex &parent) const override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
void aircraftInstallFailed(QModelIndex index, QString errorMessage)
QHash< int, QByteArray > roleNames() const override
AircraftItemModel(QObject *pr)
AircraftItemModel::AircraftItemModel.
void selectVariantForAircraftURI(QUrl uri)
ensure the appropriate variant index is active in the model, for the corresponding aircraft URI
QVariant data(const QModelIndex &index, int role) const override
void installedAircraftCountChanged()
void aircraftInstallCompleted(QModelIndex index)
QString nameForAircraftURI(QUrl uri) const
Retrieve the display name for an aircraft specified by URI, without changing the current variant stat...
friend class PackageDelegate