libosmscout 1.1.1
Loading...
Searching...
No Matches
MapDownloadsModel.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_MAPDOWNLOADSMODEL_H
2#define OSMSCOUT_CLIENT_QT_MAPDOWNLOADSMODEL_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2016 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
24
25#include <osmscoutclient/DBThread.h>
26
28
29#include <QObject>
30#include <QStringList>
31#include <QList>
32#include <QDir>
33#include <QTimer>
34
35namespace osmscout {
36
42class OSMSCOUT_CLIENT_QT_API MapDownloadsModel: public QAbstractListModel
43{
44 Q_OBJECT
45signals:
46 void mapDownloadFails(QString message);
47
48public slots:
51
52private:
53 MapDownloaderRef mapDownloader;
54
55public:
56 MapDownloadsModel(QObject *parent=Q_NULLPTR);
57
58 ~MapDownloadsModel() override = default;
59
60 enum Roles {
61 MapNameRole = Qt::UserRole,
62 TargetDirectoryRole = Qt::UserRole+1,
63 ProgressRole = Qt::UserRole+2,
64 ProgressDescriptionRole = Qt::UserRole+3,
65 ErrorStringRole = Qt::UserRole+4,
66 };
67 Q_ENUM(Roles)
68
69 Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const override;
70 Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override;
71 QHash<int, QByteArray> roleNames() const override;
72 Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const override;
73
74 Q_INVOKABLE void cancel(int row);
75
76 Q_INVOKABLE QString suggestedDirectory(QObject *map, QString rootDirectory = "");
77 Q_INVOKABLE void downloadMap(QObject *map, QString dir);
78 Q_INVOKABLE QStringList getLookupDirectories();
79 Q_INVOKABLE double getFreeSpace(QString dir);
80};
81
82}
83
84#endif /* OSMSCOUT_CLIENT_QT_MAPDOWNLOADSMODEL_H */
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override
Q_INVOKABLE QStringList getLookupDirectories()
QHash< int, QByteArray > roleNames() const override
Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const override
Q_INVOKABLE QString suggestedDirectory(QObject *map, QString rootDirectory="")
Q_INVOKABLE void cancel(int row)
Q_INVOKABLE double getFreeSpace(QString dir)
Roles
Definition MapDownloadsModel.h:60
@ ProgressRole
Definition MapDownloadsModel.h:63
@ ErrorStringRole
Definition MapDownloadsModel.h:65
@ TargetDirectoryRole
Definition MapDownloadsModel.h:62
@ ProgressDescriptionRole
Definition MapDownloadsModel.h:64
@ MapNameRole
Definition MapDownloadsModel.h:61
MapDownloadsModel(QObject *parent=Q_NULLPTR)
void mapDownloadFails(QString message)
Q_INVOKABLE void downloadMap(QObject *map, QString dir)
Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const override
~MapDownloadsModel() override=default
std::shared_ptr< MapDownloader > MapDownloaderRef
Definition MapDownloader.h:128
Definition Area.h:39