2018-03-11 11:49:38 +00:00
|
|
|
#ifndef RECENTAIRCRAFTMODEL_HXX
|
|
|
|
#define RECENTAIRCRAFTMODEL_HXX
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QUrl>
|
|
|
|
|
|
|
|
// forward decls
|
|
|
|
class AircraftItemModel;
|
|
|
|
|
|
|
|
class RecentAircraftModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-04-16 14:13:06 +00:00
|
|
|
|
|
|
|
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
|
2018-03-11 11:49:38 +00:00
|
|
|
public:
|
|
|
|
RecentAircraftModel(AircraftItemModel *acModel, QObject* pr = nullptr);
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent) const override;
|
|
|
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
QUrl mostRecent() const;
|
|
|
|
|
|
|
|
void insert(QUrl aircraftUrl);
|
|
|
|
|
|
|
|
void saveToSettings();
|
|
|
|
|
|
|
|
Q_INVOKABLE QUrl uriAt(int index) const;
|
2018-04-16 14:13:06 +00:00
|
|
|
|
|
|
|
bool isEmpty() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void isEmptyChanged();
|
|
|
|
|
2018-03-11 11:49:38 +00:00
|
|
|
private:
|
|
|
|
AircraftItemModel* m_aircraftModel;
|
|
|
|
QList<QUrl> m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECENTAIRCRAFTMODEL_HXX
|