Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qabstractgeotilecache.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qgeotilespec_p.h"
6
8
9#include <QDir>
10#include <QStandardPaths>
11#include <QMetaType>
12#include <QPixmap>
13#include <QDebug>
14
16
19{
20 qRegisterMetaType<QGeoTileSpec>();
21 qRegisterMetaType<QList<QGeoTileSpec> >();
22 qRegisterMetaType<QSet<QGeoTileSpec> >();
23}
24
26{
27}
28
30{
31}
32
34{
35 qWarning() << "tile request error " << error;
36}
37
39{
41}
42
44{
45 return 0;
46}
47
49{
50 return 0;
51}
52
54{
56}
57
59{
60 return 0;
61}
62
64{
65 return 0;
66}
67
69{
71
72 // Try the shared cache first and use a specific directory. (e.g. ~/.cache/QtLocation)
73 // If this is not supported by the platform, use the application-specific cache
74 // location. (e.g. ~/.cache/<app_name>/QtLocation)
76
77 if (!dir.isEmpty()) {
78 // The shared cache may not be writable when application isolation is enforced.
79 static bool writable = false;
80 static bool writableChecked = false;
81 if (!writableChecked) {
82 writableChecked = true;
84 QFile writeTestFile(QDir(dir).filePath(QStringLiteral("qt_cache_check")));
85 writable = writeTestFile.open(QIODevice::WriteOnly);
86 if (writable)
87 writeTestFile.remove();
88 }
89 if (!writable)
90 dir = QString();
91 }
92
93 if (dir.isEmpty())
95
96 if (!dir.endsWith(QLatin1Char('/')))
97 dir += QLatin1Char('/');
98
99 return dir;
100}
101
103{
104 // This scheme allows to have the "tiles" prefix hardcoded here
105 // NOTE: changing the Qt version here requires changing it also in QGeoFileTileCache::init,
106 // in the code that remove old version tiles !
107 return baseCacheDirectory() + QLatin1String("QtLocation/5.8/tiles/");
108}
109
static QString baseCacheDirectory()
virtual void setMaxDiskUsage(int diskUsage)
virtual int diskUsage() const
static QString baseLocationCacheDirectory()
virtual int maxDiskUsage() const
virtual int memoryUsage() const
virtual void setMaxMemoryUsage(int memoryUsage)
virtual void handleError(const QGeoTileSpec &spec, const QString &errorString)
virtual int maxMemoryUsage() const
QAbstractGeoTileCache(QObject *parent=nullptr)
\inmodule QtCore
Definition qdir.h:19
static QDir root()
Returns the root directory.
Definition qdir.h:221
bool mkpath(const QString &dirPath) const
Creates the directory path dirPath.
Definition qdir.cpp:1579
\inmodule QtCore
Definition qfile.h:93
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:881
bool remove()
Removes the file specified by fileName().
Definition qfile.cpp:419
\inmodule QtCore
Definition qobject.h:90
static QString writableLocation(StandardLocation type)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition qstring.cpp:5350
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
#define qWarning
Definition qlogging.h:162
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define QStringLiteral(str)
#define Q_UNUSED(x)
QString dir
[11]
\inmodule QtCore \reentrant
Definition qchar.h:17
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent