23#include <QAbstractListModel>
26#include <QStandardPaths>
29#include "geomaps/VAC.h"
123 [[nodiscard]]
bool isEmpty()
const {
return m_isEmpty.value(); }
135 [[nodiscard]] QList<GeoMaps::VAC>
vacs()
const {
return m_rows; }
148 [[nodiscard]]
int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
158 [[nodiscard]] QVariant
data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
164 [[nodiscard]] QHash<int, QByteArray>
roleNames()
const override;
226 Q_INVOKABLE
void remove(
const QString& name);
236 [[nodiscard]] Q_INVOKABLE QString
rename(
const QString& oldName,
const QString& newName);
247 [[nodiscard]] Q_INVOKABLE QVector<GeoMaps::VAC>
vacs4Point(
const QGeoCoordinate& position);
279 void updateCollections();
287 QString absolutePathForVac(
const QString& name);
290 void setManualVacs(
const QVector<GeoMaps::VAC>&
vacs);
293 void setCollectionVacs(
const QVector<GeoMaps::VAC>&
vacs);
307 QVector<GeoMaps::VAC> m_vacs;
308 QVector<GeoMaps::VAC> m_collectionVacs;
311 QVector<GeoMaps::VAC> m_rows;
317 QString m_vacDirectory {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/VAC"_s};
318 QString m_cacheDirectory {QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u
"/VAC"_s};
319 QString m_dataFileName {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/VAC.data"_s};
323 QTimer m_updateCollectionsTimer;
Library of visual approach charts.
QBindable< bool > bindableIsEmpty() const
Getter function for property of the same name.
QHash< int, QByteArray > roleNames() const override
Re-implemented from QAbstractListModel.
Q_INVOKABLE void clear()
Removes all VACs.
Q_INVOKABLE GeoMaps::VAC get(const QString &name)
Obtain VACs from the library.
Q_INVOKABLE void remove(const QString &name)
Remove one VACs.
bool isEmpty() const
Getter function for property of the same name.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Re-implemented from QAbstractListModel.
Q_INVOKABLE QString importVAC(GeoMaps::VAC vac)
Import VAC.
~VACLibrary() override
Destructor.
VACLibrary(QObject *parent=nullptr)
Constructor.
QList< GeoMaps::VAC > vacs
List of all VACs installed.
@ NameRole
Name of the chart, a QString.
@ CenterRole
Center of the chart, a QGeoCoordinate.
@ VacRole
The chart, of type GeoMaps::VAC.
@ SectionRole
Section of the chart, a QString; see GeoMaps::VAC::section().
QBindable< bool > bindableHasManuallyImported() const
Getter function for property of the same name.
void hasManuallyImportedChanged()
Notifier signal.
bool isEmpty
True if library is empty.
QList< GeoMaps::VAC > vacs() const
Getter function for property of the same name.
void isEmptyChanged()
Notifier signal.
Q_INVOKABLE QVector< GeoMaps::VAC > vacs4Point(const QGeoCoordinate &position)
List of all VACs that contain a given point.
Q_INVOKABLE GeoMaps::VAC materialize(const GeoMaps::VAC &vac)
Obtain a VAC whose fileName points to a raster image file.
Q_INVOKABLE QString rename(const QString &oldName, const QString &newName)
Rename a VACs.
Q_INVOKABLE QString importTripKit(const QString &fileName)
Import trip kit.
void importTripKitStatus(double percent)
Progress report when importing a trip kit.
void vacsChanged()
Notifier signal.
bool hasManuallyImported
True if the library contains manually imported charts.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Re-implemented from QAbstractListModel.