1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Changed application data paths to more platform-standard locations

This commit is contained in:
Martin Tůma 2018-11-02 20:01:19 +01:00
parent f6b1344ee2
commit f762013e1e
35 changed files with 309 additions and 178 deletions

View File

@ -1,4 +1,4 @@
version: 6.3.{build}
version: 7.0.{build}
configuration: Release
platform: Any CPU
environment:

View File

@ -1,5 +1,5 @@
TARGET = GPXSee
VERSION = 6.3
VERSION = 7.0
QT += core \
gui \
@ -13,7 +13,7 @@ lessThan(QT_MAJOR_VERSION, 5) {QT += opengl}
equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4) {QT += opengl}
INCLUDEPATH += ./src
HEADERS += src/config.h \
HEADERS += src/common/config.h \
src/common/staticassert.h \
src/common/coordinates.h \
src/common/range.h \
@ -22,6 +22,8 @@ HEADERS += src/config.h \
src/common/util.h \
src/common/rtree.h \
src/common/kv.h \
src/common/greatcircle.h \
src/common/programpaths.h \
src/GUI/app.h \
src/GUI/icons.h \
src/GUI/gui.h \
@ -74,6 +76,7 @@ HEADERS += src/config.h \
src/GUI/cpuarch.h \
src/GUI/searchpointer.h \
src/GUI/mapview.h \
src/GUI/font.h \
src/map/projection.h \
src/map/ellipsoid.h \
src/map/datum.h \
@ -114,6 +117,15 @@ HEADERS += src/config.h \
src/map/crs.h \
src/map/coordinatesystem.h \
src/map/pointd.h \
src/map/rectd.h \
src/map/geocentric.h \
src/map/mercator.h \
src/map/jnxmap.h \
src/map/krovak.h \
src/map/geotiffmap.h \
src/map/image.h \
src/map/mbtilesmap.h \
src/map/osm.h \
src/data/graph.h \
src/data/poi.h \
src/data/waypoint.h \
@ -133,23 +145,15 @@ HEADERS += src/config.h \
src/data/igcparser.h \
src/data/nmeaparser.h \
src/data/oziparsers.h \
src/map/rectd.h \
src/map/geocentric.h \
src/map/mercator.h \
src/map/jnxmap.h \
src/map/krovak.h \
src/data/locparser.h \
src/data/slfparser.h \
src/map/geotiffmap.h \
src/map/image.h \
src/common/greatcircle.h \
src/map/mbtilesmap.h \
src/map/osm.h
src/data/slfparser.h
SOURCES += src/main.cpp \
src/common/coordinates.cpp \
src/common/rectc.cpp \
src/common/range.cpp \
src/common/util.cpp \
src/common/greatcircle.cpp \
src/common/programpaths.cpp \
src/GUI/app.cpp \
src/GUI/gui.cpp \
src/GUI/axisitem.cpp \
@ -227,6 +231,15 @@ SOURCES += src/main.cpp \
src/map/wms.cpp \
src/map/crs.cpp \
src/map/coordinatesystem.cpp \
src/map/geocentric.cpp \
src/map/mercator.cpp \
src/map/jnxmap.cpp \
src/map/krovak.cpp \
src/map/map.cpp \
src/map/geotiffmap.cpp \
src/map/image.cpp \
src/map/mbtilesmap.cpp \
src/map/osm.cpp \
src/data/data.cpp \
src/data/poi.cpp \
src/data/track.cpp \
@ -240,19 +253,8 @@ SOURCES += src/main.cpp \
src/data/igcparser.cpp \
src/data/nmeaparser.cpp \
src/data/oziparsers.cpp \
src/map/geocentric.cpp \
src/map/mercator.cpp \
src/map/jnxmap.cpp \
src/map/krovak.cpp \
src/map/map.cpp \
src/data/locparser.cpp \
src/data/slfparser.cpp \
src/map/geotiffmap.cpp \
src/map/image.cpp \
src/common/greatcircle.cpp \
src/map/mbtilesmap.cpp \
src/map/osm.cpp
src/data/slfparser.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_en.ts \
lang/gpxsee_cs.ts \

View File

@ -7,7 +7,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "6.3"
!define VERSION "7.0"
; The file to write
OutFile "GPXSee-${VERSION}.exe"

View File

@ -7,7 +7,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "6.3"
!define VERSION "7.0"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -6,13 +6,14 @@
#include <QNetworkAccessManager>
#include <QLibraryInfo>
#include <QSettings>
#include "common/programpaths.h"
#include "common/config.h"
#include "map/downloader.h"
#include "map/ellipsoid.h"
#include "map/gcs.h"
#include "map/pcs.h"
#include "opengl.h"
#include "gui.h"
#include "config.h"
#include "settings.h"
#include "app.h"
@ -20,13 +21,21 @@
App::App(int &argc, char **argv) : QApplication(argc, argv),
_argc(argc), _argv(argv)
{
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
setApplicationName(APP_NAME);
#else
setApplicationName(QString(APP_NAME).toLower());
#endif
setApplicationVersion(APP_VERSION);
QTranslator *gpxsee = new QTranslator(this);
gpxsee->load(QLocale::system(), "gpxsee", "_", TRANSLATIONS_DIR);
gpxsee->load(QLocale::system(), "gpxsee", "_",
ProgramPaths::translationsDir());
installTranslator(gpxsee);
QTranslator *qt = new QTranslator(this);
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
qt->load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR);
qt->load(QLocale::system(), "qt", "_", ProgramPaths::translationsDir());
#else // Q_OS_WIN32 || Q_OS_MAC
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
QLibraryInfo::TranslationsPath));
@ -65,14 +74,15 @@ App::~App()
delete _gui;
}
void App::run()
int App::run()
{
_gui->show();
for (int i = 1; i < _argc; i++)
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
QStringList args(arguments());
for (int i = 1; i < args.count(); i++)
_gui->openFile(args.at(i));
exec();
return exec();
}
bool App::event(QEvent *event)
@ -87,41 +97,27 @@ bool App::event(QEvent *event)
void App::loadDatums()
{
QString ef, df;
QString ellipsoidsFile(ProgramPaths::ellipsoidsFile());
QString gcsFile(ProgramPaths::gcsFile());
if (QFile::exists(USER_ELLIPSOID_FILE))
ef = USER_ELLIPSOID_FILE;
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
ef = GLOBAL_ELLIPSOID_FILE;
else
if (ellipsoidsFile.isNull())
qWarning("No ellipsoids file found.");
if (gcsFile.isNull())
qWarning("No GCS file found.");
if (QFile::exists(USER_GCS_FILE))
df = USER_GCS_FILE;
else if (QFile::exists(GLOBAL_GCS_FILE))
df = GLOBAL_GCS_FILE;
else
qWarning("No datums file found.");
if (!ef.isNull() && !df.isNull()) {
Ellipsoid::loadList(ef);
GCS::loadList(df);
if (!ellipsoidsFile.isNull() && !gcsFile.isNull()) {
Ellipsoid::loadList(ellipsoidsFile);
GCS::loadList(gcsFile);
} else
qWarning("Maps based on a datum different from WGS84 won't work.");
}
void App::loadPCSs()
{
QString file;
QString pcsFile(ProgramPaths::pcsFile());
if (QFile::exists(USER_PCS_FILE))
file = USER_PCS_FILE;
else if (QFile::exists(GLOBAL_PCS_FILE))
file = GLOBAL_PCS_FILE;
else {
if (pcsFile.isNull())
qWarning("No PCS file found.");
return;
}
PCS::loadList(file);
else
PCS::loadList(pcsFile);
}

View File

@ -12,7 +12,7 @@ class App : QApplication
public:
App(int &argc, char **argv);
~App();
void run();
int run();
protected:
bool event(QEvent *event);

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <QPainter>
#include "common/util.h"
#include "config.h"
#include "font.h"
#include "axisitem.h"

View File

@ -1,7 +1,6 @@
#include <cmath>
#include <QLocale>
#include "data/data.h"
#include "config.h"
#include "tooltip.h"
#include "elevationgraphitem.h"
#include "elevationgraph.h"

7
src/GUI/font.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef FONT_H
#define FONT_H
#define FONT_FAMILY "Arial"
#define FONT_SIZE 12 // px
#endif // FONT_H

View File

@ -8,7 +8,6 @@
#include <QLocale>
#include "data/graph.h"
#include "opengl.h"
#include "config.h"
#include "axisitem.h"
#include "slideritem.h"
#include "sliderinfoitem.h"

View File

@ -1,4 +1,4 @@
#include "config.h"
#include "common/config.h"
#include <QApplication>
#include <QSplitter>
#include <QVBoxLayout>
@ -28,6 +28,7 @@
#include <QScreen>
#endif // ENABLE_HIDPI
#include <QStyle>
#include "common/programpaths.h"
#include "data/data.h"
#include "data/poi.h"
#include "map/maplist.h"
@ -108,14 +109,9 @@ GUI::GUI()
void GUI::loadMaps()
{
_ml = new MapList(this);
QString dir;
QString mapDir(ProgramPaths::mapDir());
if (QFile::exists(USER_MAP_DIR))
dir = USER_MAP_DIR;
else if (QFile::exists(GLOBAL_MAP_DIR))
dir = GLOBAL_MAP_DIR;
if (!dir.isNull() && !_ml->loadDir(dir))
if (!mapDir.isNull() && !_ml->loadDir(mapDir))
qWarning("%s", qPrintable(_ml->errorString()));
_map = new EmptyMap(this);
@ -124,14 +120,9 @@ void GUI::loadMaps()
void GUI::loadPOIs()
{
_poi = new POI(this);
QString dir;
QString poiDir(ProgramPaths::poiDir());
if (QFile::exists(USER_POI_DIR))
dir = USER_POI_DIR;
else if (QFile::exists(GLOBAL_POI_DIR))
dir = GLOBAL_POI_DIR;
if (!dir.isNull() && !_poi->loadDir(dir))
if (!poiDir.isNull() && !_poi->loadDir(poiDir))
qWarning("%s", qPrintable(_poi->errorString()));
}
@ -702,19 +693,13 @@ void GUI::paths()
msgBox.setWindowTitle(tr("Paths"));
msgBox.setText("<h3>" + tr("Paths") + "</h3>");
msgBox.setInformativeText(
"<style>td {white-space: pre; padding-right: 1em;}</style><h4>"
+ tr("Global") + "</h4><table><tr><td>" + tr("Map directory:")
+ "</td><td><code>" + QDir::cleanPath(GLOBAL_MAP_DIR)
+ "</code></td></tr><tr><td>" + tr("POI directory:") + "</td><td><code>"
+ QDir::cleanPath(GLOBAL_POI_DIR) + "</code></td></tr><tr><td>"
"<style>td {white-space: pre; padding-right: 1em;}</style><table><tr><td>"
+ tr("Map directory:") + "</td><td><code>"
+ QDir::cleanPath(ProgramPaths::mapDir(true)) + "</code></td></tr><tr><td>"
+ tr("POI directory:") + "</td><td><code>"
+ QDir::cleanPath(ProgramPaths::poiDir(true)) + "</code></td></tr><tr><td>"
+ tr("GCS/PCS directory:") + "</td><td><code>"
+ QDir::cleanPath(GLOBAL_CSV_DIR) + "</code></td></tr></table>"
+ "<h4>" + tr("User-specific") + "</h4><table><tr><td>"
+ tr("Map directory:") + "</td><td><code>" + QDir::cleanPath(USER_MAP_DIR)
+ "</code></td></tr><tr><td>" + tr("POI directory:") + "</td><td><code>"
+ QDir::cleanPath(USER_POI_DIR) + "</code></td></tr><tr><td>"
+ tr("GCS/PCS directory:") + "</td><td><code>"
+ QDir::cleanPath(USER_CSV_DIR) + "</code></td></tr></table>"
+ QDir::cleanPath(ProgramPaths::csvDir(true)) + "</code></td></tr></table>"
);
msgBox.exec();
@ -1615,7 +1600,7 @@ void GUI::dropEvent(QDropEvent *event)
void GUI::writeSettings()
{
QSettings settings(APP_NAME, APP_NAME);
QSettings settings(qApp->applicationName(), qApp->applicationName());
settings.clear();
settings.beginGroup(WINDOW_SETTINGS_GROUP);
@ -1810,7 +1795,7 @@ void GUI::writeSettings()
void GUI::readSettings()
{
int value;
QSettings settings(APP_NAME, APP_NAME);
QSettings settings(qApp->applicationName(), qApp->applicationName());
settings.beginGroup(WINDOW_SETTINGS_GROUP);
resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize());

View File

@ -1,6 +1,6 @@
#include <QFont>
#include <QPainter>
#include "config.h"
#include "font.h"
#include "infoitem.h"
#define PADDING 10

View File

@ -6,12 +6,12 @@
#include <QHash>
#include <QList>
#include "common/rectc.h"
#include "common/config.h"
#include "data/waypoint.h"
#include "searchpointer.h"
#include "units.h"
#include "format.h"
#include "palette.h"
#include "config.h"
class Data;
class POI;

View File

@ -2,10 +2,9 @@
#define OPTIONSDIALOG_H
#include <QDialog>
#include "common/config.h"
#include "palette.h"
#include "units.h"
#include "config.h"
class ColorBox;
class StyleComboBox;

View File

@ -1,7 +1,8 @@
#include <cmath>
#include <QApplication>
#include <QPainter>
#include "common/util.h"
#include "config.h"
#include "font.h"
#include "scaleitem.h"

View File

@ -1,5 +1,5 @@
#include <QPainter>
#include "config.h"
#include "font.h"
#include "sliderinfoitem.h"

View File

@ -1,6 +1,5 @@
#include <QLocale>
#include "data/data.h"
#include "config.h"
#include "tooltip.h"
#include "format.h"
#include "speedgraphitem.h"

View File

@ -1,6 +1,5 @@
#include <QPaintEngine>
#include <QPaintDevice>
#include "config.h"
#include "infoitem.h"
#include "trackinfo.h"

View File

@ -1,6 +1,6 @@
#include <QApplication>
#include <QPainter>
#include "config.h"
#include "font.h"
#include "tooltip.h"
#include "waypointitem.h"

17
src/common/config.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <QtGlobal>
#define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://www.gpxsee.org"
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1)
#define ENABLE_HTTP2
#endif // QT >= 5.10.1
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#define ENABLE_HIDPI
#endif // QT >= 5.6
#endif /* CONFIG_H */

165
src/common/programpaths.cpp Normal file
View File

@ -0,0 +1,165 @@
#include <QtGlobal>
#include <QDir>
#include "programpaths.h"
#define MAP_DIR "maps"
#define POI_DIR "POI"
#define CSV_DIR "csv"
#define TILES_DIR "tiles"
#define TRANSLATIONS_DIR "translations"
#define ELLIPSOID_FILE "ellipsoids.csv"
#define GCS_FILE "gcs.csv"
#define PCS_FILE "pcs.csv"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QApplication>
#if defined(Q_OS_WIN32)
#define USER_DIR QDir::homePath() + QString("/AppData/Roaming/") \
+ qApp->applicationName()
#define GLOBAL_DIR QApplication::applicationDirPath()
#elif defined(Q_OS_MAC)
#define USER_DIR QDir::homePath() \
+ QString("/Library/Application Support/") \
+ qApp->applicationName()
#define GLOBAL_DIR QApplication::applicationDirPath() \
+ QString("/../Resources")
#else
#define USER_DIR QDir::homePath() + QString("/.local/share/") \
+ qApp->applicationName()
#define GLOBAL_DIR QString("/usr/share/") + qApp->applicationName()
#endif
static QString dir(const QString &dirName, bool writable = false)
{
QDir userDir(QDir(USER_DIR).filePath(dirName));
if (writable || userDir.exists())
return userDir.absolutePath();
else {
QDir globalDir(QDir(GLOBAL_DIR).filePath(dirName));
if (globalDir.exists())
return globalDir.absolutePath();
else
return QString();
}
}
static QString file(const QString &path, const QString &fileName)
{
if (path.isNull())
return QString();
QFileInfo fi(QDir(path).filePath(fileName));
return fi.exists() ? fi.absoluteFilePath() : QString();
}
QString ProgramPaths::mapDir(bool writable)
{
return dir(MAP_DIR, writable);
}
QString ProgramPaths::poiDir(bool writable)
{
return dir(POI_DIR, writable);
}
QString ProgramPaths::csvDir(bool writable)
{
return dir(CSV_DIR, writable);
}
QString ProgramPaths::tilesDir()
{
return dir(TILES_DIR);
}
QString ProgramPaths::translationsDir()
{
return dir(TRANSLATIONS_DIR);
}
QString ProgramPaths::ellipsoidsFile()
{
return file(dir(CSV_DIR), ELLIPSOID_FILE);
}
QString ProgramPaths::gcsFile()
{
return file(dir(CSV_DIR), GCS_FILE);
}
QString ProgramPaths::pcsFile()
{
return file(dir(CSV_DIR), PCS_FILE);
}
#else // QT_VERSION < 5
#include <QStandardPaths>
QString ProgramPaths::mapDir(bool writable)
{
if (writable)
return QDir(QStandardPaths::writableLocation(
QStandardPaths::AppDataLocation)).filePath(MAP_DIR);
else
return QString(QStandardPaths::locate(QStandardPaths::AppDataLocation,
MAP_DIR, QStandardPaths::LocateDirectory));
}
QString ProgramPaths::poiDir(bool writable)
{
if (writable)
return QDir(QStandardPaths::writableLocation(
QStandardPaths::AppDataLocation)).filePath(POI_DIR);
else
return QString(QStandardPaths::locate(QStandardPaths::AppDataLocation,
POI_DIR, QStandardPaths::LocateDirectory));
}
QString ProgramPaths::csvDir(bool writable)
{
if (writable)
return QDir(QStandardPaths::writableLocation(
QStandardPaths::AppDataLocation)).filePath(CSV_DIR);
else
return QString(QStandardPaths::locate(QStandardPaths::AppDataLocation,
CSV_DIR, QStandardPaths::LocateDirectory));
}
QString ProgramPaths::tilesDir()
{
return QString(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation,
TILES_DIR, QStandardPaths::LocateDirectory));
}
QString ProgramPaths::translationsDir()
{
return QString(QStandardPaths::locate(QStandardPaths::AppDataLocation,
TRANSLATIONS_DIR, QStandardPaths::LocateDirectory));
}
QString ProgramPaths::ellipsoidsFile()
{
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
CSV_DIR "/" ELLIPSOID_FILE, QStandardPaths::LocateFile);
}
QString ProgramPaths::gcsFile()
{
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
CSV_DIR "/" GCS_FILE, QStandardPaths::LocateFile);
}
QString ProgramPaths::pcsFile()
{
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
CSV_DIR "/" PCS_FILE, QStandardPaths::LocateFile);
}
#endif // QT_VERSION < 5

18
src/common/programpaths.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef PROGRAMPATHS_H
#define PROGRAMPATHS_H
#include <QString>
namespace ProgramPaths
{
QString mapDir(bool writable = false);
QString poiDir(bool writable = false);
QString csvDir(bool writable = false);
QString tilesDir();
QString translationsDir();
QString ellipsoidsFile();
QString gcsFile();
QString pcsFile();
}
#endif // PROGRAMPATHS_H

View File

@ -1,58 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <QtGlobal>
#include <QDir>
#include <QApplication>
#include <QString>
#define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://www.gpxsee.org"
#define FONT_FAMILY "Arial"
#define FONT_SIZE 12 // px
#define MAP_DIR QString("maps")
#define POI_DIR QString("POI")
#define CSV_DIR QString("csv")
#define ELLIPSOID_FILE QString("ellipsoids.csv")
#define GCS_FILE QString("gcs.csv")
#define PCS_FILE QString("pcs.csv")
#if defined(Q_OS_WIN32)
#define USER_DIR QDir::homePath() + QString("/GPXSee")
#define GLOBAL_DIR QApplication::applicationDirPath()
#elif defined(Q_OS_MAC)
#define USER_DIR QDir::homePath() + QString("/.gpxsee")
#define GLOBAL_DIR QApplication::applicationDirPath() \
+ QString("/../Resources")
#else
#define USER_DIR QDir::homePath() + QString("/.gpxsee")
#define GLOBAL_DIR QString("/usr/share/gpxsee")
#endif
#define USER_CSV_DIR USER_DIR + QString("/") + CSV_DIR
#define USER_ELLIPSOID_FILE USER_CSV_DIR + QString("/") + ELLIPSOID_FILE
#define USER_GCS_FILE USER_CSV_DIR + QString("/") + GCS_FILE
#define USER_PCS_FILE USER_CSV_DIR + QString("/") + PCS_FILE
#define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR
#define USER_POI_DIR USER_DIR + QString("/") + POI_DIR
#define GLOBAL_CSV_DIR GLOBAL_DIR + QString("/") + CSV_DIR
#define GLOBAL_ELLIPSOID_FILE GLOBAL_CSV_DIR + QString("/") + ELLIPSOID_FILE
#define GLOBAL_GCS_FILE GLOBAL_CSV_DIR + QString("/") + GCS_FILE
#define GLOBAL_PCS_FILE GLOBAL_CSV_DIR + QString("/") + PCS_FILE
#define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR
#define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR
#define TILES_DIR USER_DIR + QString("/tiles")
#define TRANSLATIONS_DIR GLOBAL_DIR + QString("/translations")
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1)
#define ENABLE_HTTP2
#endif // QT >= 5.10.1
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#define ENABLE_HIDPI
#endif // QT >= 5.6
#endif /* CONFIG_H */

View File

@ -1,5 +1,5 @@
#include "common/config.h"
#include "GUI/app.h"
#include "config.h"
int main(int argc, char *argv[])
{
@ -9,7 +9,5 @@ int main(int argc, char *argv[])
#endif // ENABLE_HIDPI
App app(argc, argv);
app.run();
return 0;
return app.run();
}

View File

@ -2,6 +2,8 @@
#include <QFileInfo>
#include <QNetworkRequest>
#include <QBasicTimer>
#include <QDir>
#include <QTimerEvent>
#include "downloader.h"

View File

@ -7,7 +7,7 @@
#include <QList>
#include <QSet>
#include <QHash>
#include "config.h"
#include "common/config.h"
class Download

View File

@ -1,7 +1,7 @@
#include <QFileInfo>
#include <QPainter>
#include <QImageReader>
#include "config.h"
#include "common/config.h"
#include "geotiff.h"
#include "image.h"
#include "geotiffmap.h"

View File

@ -1,6 +1,6 @@
#include <QPainter>
#include <QPixmapCache>
#include "config.h"
#include "common/config.h"
#include "image.h"

View File

@ -2,10 +2,10 @@
#include <QPainter>
#include <QFileInfo>
#include <QPixmapCache>
#include "common/config.h"
#include "rectd.h"
#include "gcs.h"
#include "pcs.h"
#include "config.h"
#include "jnxmap.h"

View File

@ -1,6 +1,6 @@
#include <QFile>
#include <QXmlStreamReader>
#include "config.h"
#include "common/config.h"
#include "onlinemap.h"
#include "wmtsmap.h"
#include "wmsmap.h"

View File

@ -5,8 +5,8 @@
#include <QPainter>
#include <QPixmapCache>
#include "common/rectc.h"
#include "common/config.h"
#include "osm.h"
#include "config.h"
#include "mbtilesmap.h"

View File

@ -1,9 +1,10 @@
#include <QtCore>
#include <QPainter>
#include <QDir>
#include "common/rectc.h"
#include "common/programpaths.h"
#include "downloader.h"
#include "osm.h"
#include "config.h"
#include "onlinemap.h"
@ -16,7 +17,8 @@ OnlineMap::OnlineMap(const QString &name, const QString &url,
_zoom(_zooms.max()), _deviceRatio(1.0), _tileRatio(tileRatio),
_invertY(invertY)
{
_tileLoader = new TileLoader(TILES_DIR + "/" + _name, this);
_tileLoader = new TileLoader(QDir(ProgramPaths::tilesDir()).filePath(_name),
this);
_tileLoader->setUrl(url);
_tileLoader->setAuthorization(authorization);
connect(_tileLoader, SIGNAL(finished()), this, SIGNAL(loaded()));

View File

@ -7,11 +7,11 @@
#include <QPixmapCache>
#include "common/coordinates.h"
#include "common/rectc.h"
#include "common/config.h"
#include "tar.h"
#include "ozf.h"
#include "image.h"
#include "mapfile.h"
#include "config.h"
#include "ozimap.h"

View File

@ -3,7 +3,7 @@
#include <QPainter>
#include "common/wgs84.h"
#include "common/rectc.h"
#include "config.h"
#include "common/programpaths.h"
#include "downloader.h"
#include "tileloader.h"
#include "wmsmap.h"
@ -42,7 +42,7 @@ QString WMSMap::tileUrl(const QString &version) const
QString WMSMap::tilesDir() const
{
return QString(TILES_DIR + "/" + _name);
return QString(QDir(ProgramPaths::tilesDir()).filePath(_name));
}
void WMSMap::computeZooms(const RangeF &scaleDenominator)

View File

@ -1,8 +1,9 @@
#include <QtCore>
#include <QPainter>
#include <QDir>
#include "common/rectc.h"
#include "common/wgs84.h"
#include "config.h"
#include "common/programpaths.h"
#include "transform.h"
#include "tileloader.h"
#include "wmts.h"
@ -58,7 +59,7 @@ void WMTSMap::clearCache()
QString WMTSMap::tilesDir() const
{
return QString(TILES_DIR + "/" + _name);
return QString(QDir(ProgramPaths::tilesDir()).filePath(_name));
}
double WMTSMap::sd2res(double scaleDenominator) const