libosmscout  1.1.1
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
osmscout::AvailableMapsModel Class Reference

#include <libosmscout-client-qt/include/osmscout/AvailableMapsModel.h>

Inheritance diagram for osmscout::AvailableMapsModel:
Inheritance graph
[legend]
Collaboration diagram for osmscout::AvailableMapsModel:
Collaboration graph
[legend]

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 ()
 
 ~AvailableMapsModel () override
 
Q_INVOKABLE int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE QModelIndex index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE QModelIndex parent (const QModelIndex &index) const override
 
Q_INVOKABLE QVariant data (const QModelIndex &index, int role) const override
 
QHash< int, QByteArray > roleNames () const override
 
Q_INVOKABLE Qt::ItemFlags flags (const QModelIndex &index) const override
 
Q_INVOKABLE QVariant map (const QModelIndex &index) const
 
Q_INVOKABLE QVariant timeOfMap (QStringList path)
 
Q_INVOKABLE QObject * mapByPath (QStringList path)
 
bool isLoading () const
 
QString getFetchError () const
 

Properties

bool loading
 
QString fetchError
 

Detailed Description

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"
 }
]

Member Enumeration Documentation

◆ Roles

Enumerator
NameRole 
PathRole 
DirRole 
ServerDirectoryRole 
TimeRole 
VersionRole 
ByteSizeRole 
ProviderUriRole 
DescriptionRole 
SizeRole 
MapRole 

Constructor & Destructor Documentation

◆ AvailableMapsModel()

osmscout::AvailableMapsModel::AvailableMapsModel ( )

◆ ~AvailableMapsModel()

osmscout::AvailableMapsModel::~AvailableMapsModel ( )
override

Member Function Documentation

◆ columnCount()

Q_INVOKABLE int osmscout::AvailableMapsModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ data()

Q_INVOKABLE QVariant osmscout::AvailableMapsModel::data ( const QModelIndex &  index,
int  role 
) const
override

◆ flags()

Q_INVOKABLE Qt::ItemFlags osmscout::AvailableMapsModel::flags ( const QModelIndex &  index) const
override

◆ getFetchError()

QString osmscout::AvailableMapsModel::getFetchError ( ) const
inline

◆ index()

Q_INVOKABLE QModelIndex osmscout::AvailableMapsModel::index ( int  row,
int  column = 0,
const QModelIndex &  parent = QModelIndex() 
) const
override

◆ isLoading()

bool osmscout::AvailableMapsModel::isLoading ( ) const
inline

◆ listDownloaded

void osmscout::AvailableMapsModel::listDownloaded ( const MapProvider provider,
QNetworkReply *   
)
slot

◆ loadingChanged

void osmscout::AvailableMapsModel::loadingChanged ( )
signal

◆ map()

Q_INVOKABLE QVariant osmscout::AvailableMapsModel::map ( const QModelIndex &  index) const

◆ mapByPath()

Q_INVOKABLE QObject* osmscout::AvailableMapsModel::mapByPath ( QStringList  path)

◆ parent()

Q_INVOKABLE QModelIndex osmscout::AvailableMapsModel::parent ( const QModelIndex &  index) const
override

◆ reload

void osmscout::AvailableMapsModel::reload ( )
slot

◆ roleNames()

QHash<int, QByteArray> osmscout::AvailableMapsModel::roleNames ( ) const
override

◆ rowCount()

Q_INVOKABLE int osmscout::AvailableMapsModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ timeOfMap()

Q_INVOKABLE 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.

Parameters
path
Returns

Property Documentation

◆ fetchError

QString osmscout::AvailableMapsModel::fetchError
read

◆ loading

bool osmscout::AvailableMapsModel::loading
read

The documentation for this class was generated from the following file: