libosmscout
0.1
|
Tree model with maps available by configured providers (see Settings::GetMapProviders). More...
#include <AvailableMapsModel.h>
Public Types | |
enum | Roles { NameRole = Qt::UserRole, PathRole = Qt::UserRole+1, DirRole = Qt::UserRole+2, ServerDirectoryRole = Qt::UserRole+3, TimeRole = Qt::UserRole+4, VersionRole = Qt::UserRole+5, ByteSizeRole = Qt::UserRole+6, ProviderUriRole = Qt::UserRole+7, DescriptionRole = Qt::UserRole+8, SizeRole = Qt::UserRole+9, MapRole = Qt::UserRole+10 } |
Public Slots | |
void | listDownloaded (const MapProvider &provider, QNetworkReply *) |
void | reload () |
Signals | |
void | loadingChanged () |
Public Member Functions | |
AvailableMapsModel () | |
Q_INVOKABLE int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
Q_INVOKABLE QVariant | data (const QModelIndex &index, int role) const override |
Q_INVOKABLE Qt::ItemFlags | flags (const QModelIndex &index) const override |
QString | getFetchError () const |
Q_INVOKABLE QModelIndex | index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override |
bool | isLoading () const |
Q_INVOKABLE QVariant | map (const QModelIndex &index) const |
Q_INVOKABLE QObject * | mapByPath (QStringList path) |
Q_INVOKABLE QModelIndex | parent (const QModelIndex &index) const override |
QHash< int, QByteArray > | roleNames () const override |
Q_INVOKABLE int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
Q_INVOKABLE QVariant | timeOfMap (QStringList path) |
Generation time of map with given path. More... | |
~AvailableMapsModel () override | |
Properties | |
QString | fetchError |
bool | loading |
Tree model with maps available by configured providers (see Settings::GetMapProviders).
Every map provider have to expose list of maps by json. Json format example:
[ { "version" : 10, "timestamp" : 1480801927, "name" : "Czech Republic", "directory" : "europe/czech-republic-10-20161203", "size" : 622036876, "map" : "europe/czech-republic" }, { "dir" : "europe", "name" : "Europe" } ]
osmscout::AvailableMapsModel::AvailableMapsModel | ( | ) |
References osmscout::OSMScoutQt::GetInstance(), osmscout::OSMScoutQt::GetSettings(), and reload().
|
override |
|
override |
References parent().
|
override |
References ByteSizeRole, DescriptionRole, DirRole, osmscout::AvailableMapsModelItem::getDescription(), osmscout::AvailableMapsModelItem::getName(), osmscout::AvailableMapsModelItem::getPath(), index(), osmscout::AvailableMapsModelItem::isDirectory(), map(), MapRole, NameRole, PathRole, ProviderUriRole, ServerDirectoryRole, SizeRole, TimeRole, and VersionRole.
Referenced by map().
|
override |
References index().
|
inline |
|
override |
|
inline |
|
slot |
References osmscout::availableMapsModelItemLessThan(), fetchError, loadingChanged(), and map().
Referenced by reload().
|
signal |
Referenced by listDownloaded(), and reload().
QVariant osmscout::AvailableMapsModel::map | ( | const QModelIndex & | index | ) | const |
References data(), index(), and MapRole.
Referenced by data(), listDownloaded(), mapByPath(), and timeOfMap().
QObject * osmscout::AvailableMapsModel::mapByPath | ( | QStringList | path | ) |
|
override |
References osmscout::AvailableMapsModelItem::getPath(), and index().
Referenced by columnCount(), index(), and rowCount().
|
slot |
|
override |
References ByteSizeRole, DescriptionRole, DirRole, MapRole, NameRole, PathRole, ProviderUriRole, ServerDirectoryRole, SizeRole, TimeRole, and VersionRole.
|
override |
References parent().
QVariant osmscout::AvailableMapsModel::timeOfMap | ( | QStringList | path | ) |
Generation time of map with given path.
Null if don't exists in available maps. It may be used for detection if there is some update available.
path |
References osmscout::AvailableMapsModelItem::getPath(), osmscout::AvailableMapsModelItem::isDirectory(), osmscout::AvailableMapsModelItem::isValid(), and map().
|
read |
Referenced by listDownloaded(), and reload().
|
read |