Skip to content

Commit 88aa368

Browse files
committed
QtLocationPlugin: Split CacheWorker & CacheDatabase
1 parent 73d8707 commit 88aa368

File tree

9 files changed

+2731
-770
lines changed

9 files changed

+2731
-770
lines changed

src/QGCApplication.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ class QGCApplication : public QApplication
101101
/// Although public, these methods are internal and should only be called by UnitTest code
102102
QQmlApplicationEngine *qmlAppEngine() const { return _qmlAppEngine; }
103103

104+
/// Get current language
105+
QLocale getCurrentLanguage() const { return _locale; }
106+
104107
signals:
105108
void languageChanged(const QLocale &locale);
106109

@@ -109,9 +112,6 @@ public slots:
109112

110113
void qmlAttemptWindowClose();
111114

112-
/// Get current language
113-
QLocale getCurrentLanguage() const { return _locale; }
114-
115115
/// Show non-modal vehicle message to the user
116116
void showCriticalVehicleMessage(const QString &message);
117117

src/QtLocationPlugin/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ qt_add_plugin(QGCLocation
2727
QGCMapUrlEngine.cpp
2828
QGCMapUrlEngine.h
2929
QGCTile.h
30+
QGCTileCacheDatabase.cpp
31+
QGCTileCacheDatabase.h
3032
QGCTileCacheWorker.cpp
3133
QGCTileCacheWorker.h
3234
QGCTileSet.h
@@ -44,10 +46,6 @@ qt_add_plugin(QGCLocation
4446
QGeoTileFetcherQGC.h
4547
)
4648

47-
if(IOS)
48-
target_compile_definitions(QGCLocation PRIVATE QGC_NO_GOOGLE_MAPS)
49-
endif()
50-
5149
target_link_libraries(QGCLocation
5250
PRIVATE
5351
Qt6::Positioning

src/QtLocationPlugin/QGCMapEngineManager.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,22 +397,21 @@ bool QGCMapEngineManager::exportSets(const QString &path)
397397
return false;
398398
}
399399

400-
QList<QGCCachedTileSet*> sets;
401-
400+
QList<quint64> setIDs;
402401
for (qsizetype i = 0; i < _tileSets->count(); i++) {
403-
QGCCachedTileSet* const set = qobject_cast<QGCCachedTileSet*>(_tileSets->get(i));
402+
const QGCCachedTileSet *set = qobject_cast<const QGCCachedTileSet*>(_tileSets->get(i));
404403
if (set->selected()) {
405-
sets.append(set);
404+
setIDs.append(set->id());
406405
}
407406
}
408407

409-
if (sets.isEmpty()) {
408+
if (setIDs.isEmpty()) {
410409
return false;
411410
}
412411

413412
setImportAction(ImportAction::ActionExporting);
414413

415-
QGCExportTileTask *task = new QGCExportTileTask(sets, path);
414+
QGCExportTileTask *task = new QGCExportTileTask(setIDs, path);
416415
(void) connect(task, &QGCExportTileTask::actionCompleted, this, &QGCMapEngineManager::_actionCompleted);
417416
(void) connect(task, &QGCExportTileTask::actionProgress, this, &QGCMapEngineManager::_actionProgressHandler);
418417
(void) connect(task, &QGCMapTask::error, this, &QGCMapEngineManager::taskError);

src/QtLocationPlugin/QGCMapTasks.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,14 @@ class QGCExportTileTask : public QGCMapTask
324324
Q_OBJECT
325325

326326
public:
327-
explicit QGCExportTileTask(const QList<QGCCachedTileSet*> &sets, const QString &path, QObject *parent = nullptr)
327+
explicit QGCExportTileTask(const QList<quint64> &setIDs, const QString &path, QObject *parent = nullptr)
328328
: QGCMapTask(TaskType::taskExport, parent)
329-
, m_sets(sets)
329+
, m_setIDs(setIDs)
330330
, m_path(path)
331331
{}
332332
~QGCExportTileTask() = default;
333333

334-
QList<QGCCachedTileSet*> sets() const { return m_sets; }
334+
const QList<quint64>& setIDs() const { return m_setIDs; }
335335
QString path() const { return m_path; }
336336

337337
void setExportCompleted()
@@ -349,7 +349,7 @@ class QGCExportTileTask : public QGCMapTask
349349
void actionProgress(int percentage);
350350

351351
private:
352-
const QList<QGCCachedTileSet*> m_sets;
352+
const QList<quint64> m_setIDs;
353353
const QString m_path;
354354
};
355355

src/QtLocationPlugin/QGCMapUrlEngine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
QGC_LOGGING_CATEGORY(QGCMapUrlEngineLog, "qgc.qtlocationplugin.qgcmapurlengine")
2323

2424
const QList<SharedMapProvider> UrlFactory::_providers = {
25-
#ifndef QGC_NO_GOOGLE_MAPS
2625
std::make_shared<GoogleStreetMapProvider>(),
2726
std::make_shared<GoogleSatelliteMapProvider>(),
2827
std::make_shared<GoogleTerrainMapProvider>(),
2928
std::make_shared<GoogleHybridMapProvider>(),
3029
std::make_shared<GoogleLabelsMapProvider>(),
31-
#endif
30+
3231
std::make_shared<BingRoadMapProvider>(),
3332
std::make_shared<BingSatelliteMapProvider>(),
3433
std::make_shared<BingHybridMapProvider>(),

0 commit comments

Comments
 (0)