libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
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
23
#include <
osmscoutclientqt/ClientQtImportExport.h
>
24
25
#include <osmscoutclient/DBThread.h>
26
27
#include <
osmscoutclientqt/MapDownloader.h
>
28
29
#include <QObject>
30
#include <QStringList>
31
#include <QList>
32
#include <QDir>
33
#include <QTimer>
34
35
namespace
osmscout
{
36
42
class
OSMSCOUT_CLIENT_QT_API
MapDownloadsModel
:
public
QAbstractListModel
43
{
44
Q_OBJECT
45
signals:
46
void
mapDownloadFails
(QString message);
47
48
public
slots:
49
void
onDownloadJobsChanged
();
50
void
onDownloadProgress
();
51
52
private
:
53
MapDownloaderRef
mapDownloader;
54
55
public
:
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 */
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
MapDownloader.h
osmscout::MapDownloadsModel::data
Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override
osmscout::MapDownloadsModel::getLookupDirectories
Q_INVOKABLE QStringList getLookupDirectories()
osmscout::MapDownloadsModel::roleNames
QHash< int, QByteArray > roleNames() const override
osmscout::MapDownloadsModel::rowCount
Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const override
osmscout::MapDownloadsModel::suggestedDirectory
Q_INVOKABLE QString suggestedDirectory(QObject *map, QString rootDirectory="")
osmscout::MapDownloadsModel::cancel
Q_INVOKABLE void cancel(int row)
osmscout::MapDownloadsModel::getFreeSpace
Q_INVOKABLE double getFreeSpace(QString dir)
osmscout::MapDownloadsModel::Roles
Roles
Definition
MapDownloadsModel.h:60
osmscout::MapDownloadsModel::ProgressRole
@ ProgressRole
Definition
MapDownloadsModel.h:63
osmscout::MapDownloadsModel::ErrorStringRole
@ ErrorStringRole
Definition
MapDownloadsModel.h:65
osmscout::MapDownloadsModel::TargetDirectoryRole
@ TargetDirectoryRole
Definition
MapDownloadsModel.h:62
osmscout::MapDownloadsModel::ProgressDescriptionRole
@ ProgressDescriptionRole
Definition
MapDownloadsModel.h:64
osmscout::MapDownloadsModel::MapNameRole
@ MapNameRole
Definition
MapDownloadsModel.h:61
osmscout::MapDownloadsModel::MapDownloadsModel
MapDownloadsModel(QObject *parent=Q_NULLPTR)
osmscout::MapDownloadsModel::mapDownloadFails
void mapDownloadFails(QString message)
osmscout::MapDownloadsModel::onDownloadJobsChanged
void onDownloadJobsChanged()
osmscout::MapDownloadsModel::downloadMap
Q_INVOKABLE void downloadMap(QObject *map, QString dir)
osmscout::MapDownloadsModel::flags
Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const override
osmscout::MapDownloadsModel::onDownloadProgress
void onDownloadProgress()
osmscout::MapDownloadsModel::~MapDownloadsModel
~MapDownloadsModel() override=default
osmscout::MapDownloaderRef
std::shared_ptr< MapDownloader > MapDownloaderRef
Definition
MapDownloader.h:128
osmscout
Definition
Area.h:39
Generated by
1.17.0