1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-05 21:52:10 +01:00

OP309/OP179/GCS - Fixes maps cache location not being selectable, now defaults to "C:\Users\name_of_user\AppData\Roaming\OpenPilot\mapscache" on windows, no idea where this goes on nix.

Also tried to fix crashes seen on Mac, but I'll need a Mac or a stack trace to do a better job.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3106 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2011-03-30 15:57:53 +00:00 committed by zedamota
parent b125e51251
commit 282661734e
8 changed files with 621 additions and 610 deletions

View File

@ -1,196 +1,200 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file cache.cpp * @file cache.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief * @brief
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget * @defgroup OPMapWidget
* @{ * @{
* *
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "cache.h" #include "cache.h"
#include <QSettings>
namespace core { namespace core {
Cache* Cache::m_pInstance=0; Cache* Cache::m_pInstance=0;
Cache* Cache::Instance() Cache* Cache::Instance()
{ {
if(!m_pInstance) if(!m_pInstance)
m_pInstance=new Cache; m_pInstance=new Cache;
return m_pInstance; return m_pInstance;
} }
void Cache::setCacheLocation(const QString& value) void Cache::setCacheLocation(const QString& value)
{ {
cache=value; cache=value;
routeCache = cache + "RouteCache" + QDir::separator(); routeCache = cache + "RouteCache" + QDir::separator();
geoCache = cache + "GeocoderCache"+ QDir::separator(); geoCache = cache + "GeocoderCache"+ QDir::separator();
placemarkCache = cache + "PlacemarkCache" + QDir::separator(); placemarkCache = cache + "PlacemarkCache" + QDir::separator();
ImageCache.setGtileCache(value); ImageCache.setGtileCache(value);
} }
QString Cache::CacheLocation() QString Cache::CacheLocation()
{ {
return cache; return cache;
} }
Cache::Cache() Cache::Cache()
{ {
if(cache.isNull()|cache.isEmpty()) if(cache.isNull()|cache.isEmpty())
{ {
cache=QDir::currentPath()+QDir::separator()+"mapscache"+QDir::separator(); QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
setCacheLocation(cache); QDir dir(set.fileName());
} QFileInfo f(dir.absolutePath());
} f.dir().absolutePath();
QString Cache::GetGeocoderFromCache(const QString &urlEnd) cache=f.dir().absolutePath()+QDir::separator()+"mapscache"+QDir::separator();
{ setCacheLocation(cache);
#ifdef DEBUG_GetGeocoderFromCache }
qDebug()<<"Entered GetGeocoderFromCache"; }
#endif QString Cache::GetGeocoderFromCache(const QString &urlEnd)
QString ret=QString::null; {
QString filename=geoCache+QString(urlEnd)+".geo"; #ifdef DEBUG_GetGeocoderFromCache
#ifdef DEBUG_GetGeocoderFromCache qDebug()<<"Entered GetGeocoderFromCache";
qDebug()<<"GetGeocoderFromCache: Does file exist?:"<<filename; #endif
#endif QString ret=QString::null;
QFileInfo File(filename); QString filename=geoCache+QString(urlEnd)+".geo";
if (File .exists()) #ifdef DEBUG_GetGeocoderFromCache
{ qDebug()<<"GetGeocoderFromCache: Does file exist?:"<<filename;
#ifdef DEBUG_GetGeocoderFromCache #endif
qDebug()<<"GetGeocoderFromCache:File exists!!"; QFileInfo File(filename);
#endif if (File .exists())
QFile file(filename); {
if (file.open(QIODevice::ReadOnly)) #ifdef DEBUG_GetGeocoderFromCache
{ qDebug()<<"GetGeocoderFromCache:File exists!!";
QTextStream stream(&file); #endif
stream.setCodec("UTF-8"); QFile file(filename);
stream>>ret; if (file.open(QIODevice::ReadOnly))
} {
} QTextStream stream(&file);
#ifdef DEBUG_GetGeocoderFromCache stream.setCodec("UTF-8");
qDebug()<<"GetGeocoderFromCache:Returning:"<<ret; stream>>ret;
#endif }
return ret; }
} #ifdef DEBUG_GetGeocoderFromCache
void Cache::CacheGeocoder(const QString &urlEnd, const QString &content) qDebug()<<"GetGeocoderFromCache:Returning:"<<ret;
{ #endif
QString ret=QString::null; return ret;
QString filename=geoCache+QString(urlEnd)+".geo"; }
#ifdef DEBUG_CACHE void Cache::CacheGeocoder(const QString &urlEnd, const QString &content)
qDebug()<<"CacheGeocoder: Filename:"<<filename; {
#endif //DEBUG_CACHE QString ret=QString::null;
QFileInfo File(filename);; QString filename=geoCache+QString(urlEnd)+".geo";
QDir dir=File.absoluteDir(); #ifdef DEBUG_CACHE
QString path=dir.absolutePath(); qDebug()<<"CacheGeocoder: Filename:"<<filename;
#ifdef DEBUG_CACHE #endif //DEBUG_CACHE
qDebug()<<"CacheGeocoder: Path:"<<path; QFileInfo File(filename);;
#endif //DEBUG_CACHE QDir dir=File.absoluteDir();
if(!dir.exists()) QString path=dir.absolutePath();
{ #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"CacheGeocoder: Path:"<<path;
qDebug()<<"CacheGeocoder: Cache path doesn't exist, try to create"; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE if(!dir.exists())
if(!dir.mkpath(path)) {
{ #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"CacheGeocoder: Cache path doesn't exist, try to create";
qDebug()<<"GetGeocoderFromCache: Could not create path"; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE if(!dir.mkpath(path))
} {
} #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"GetGeocoderFromCache: Could not create path";
qDebug()<<"CacheGeocoder: OpenFile:"<<filename; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE }
QFile file(filename); }
if (file.open(QIODevice::WriteOnly)) #ifdef DEBUG_CACHE
{ qDebug()<<"CacheGeocoder: OpenFile:"<<filename;
#ifdef DEBUG_CACHE #endif //DEBUG_CACHE
qDebug()<<"CacheGeocoder: File Opened!!!:"<<filename; QFile file(filename);
#endif //DEBUG_CACHE if (file.open(QIODevice::WriteOnly))
QTextStream stream(&file); {
stream.setCodec("UTF-8"); #ifdef DEBUG_CACHE
stream<<content; qDebug()<<"CacheGeocoder: File Opened!!!:"<<filename;
} #endif //DEBUG_CACHE
} QTextStream stream(&file);
QString Cache::GetPlacemarkFromCache(const QString &urlEnd) stream.setCodec("UTF-8");
{ stream<<content;
#ifdef DEBUG_CACHE }
qDebug()<<"Entered GetPlacemarkFromCache"; }
#endif //DEBUG_CACHE QString Cache::GetPlacemarkFromCache(const QString &urlEnd)
QString ret=QString::null; {
QString filename=placemarkCache+QString(urlEnd)+".plc"; #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"Entered GetPlacemarkFromCache";
qDebug()<<"GetPlacemarkFromCache: Does file exist?:"<<filename; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE QString ret=QString::null;
QFileInfo File(filename); QString filename=placemarkCache+QString(urlEnd)+".plc";
if (File .exists()) #ifdef DEBUG_CACHE
{ qDebug()<<"GetPlacemarkFromCache: Does file exist?:"<<filename;
#ifdef DEBUG_CACHE #endif //DEBUG_CACHE
qDebug()<<"GetPlacemarkFromCache:File exists!!"; QFileInfo File(filename);
#endif //DEBUG_CACHE if (File .exists())
QFile file(filename); {
if (file.open(QIODevice::ReadOnly)) #ifdef DEBUG_CACHE
{ qDebug()<<"GetPlacemarkFromCache:File exists!!";
QTextStream stream(&file); #endif //DEBUG_CACHE
stream.setCodec("UTF-8"); QFile file(filename);
stream>>ret; if (file.open(QIODevice::ReadOnly))
} {
} QTextStream stream(&file);
#ifdef DEBUG_CACHE stream.setCodec("UTF-8");
qDebug()<<"GetPlacemarkFromCache:Returning:"<<ret; stream>>ret;
#endif //DEBUG_CACHE }
return ret; }
} #ifdef DEBUG_CACHE
void Cache::CachePlacemark(const QString &urlEnd, const QString &content) qDebug()<<"GetPlacemarkFromCache:Returning:"<<ret;
{ #endif //DEBUG_CACHE
QString ret=QString::null; return ret;
QString filename=placemarkCache+QString(urlEnd)+".plc"; }
#ifdef DEBUG_CACHE void Cache::CachePlacemark(const QString &urlEnd, const QString &content)
qDebug()<<"CachePlacemark: Filename:"<<filename; {
#endif //DEBUG_CACHE QString ret=QString::null;
QFileInfo File(filename);; QString filename=placemarkCache+QString(urlEnd)+".plc";
QDir dir=File.absoluteDir(); #ifdef DEBUG_CACHE
QString path=dir.absolutePath(); qDebug()<<"CachePlacemark: Filename:"<<filename;
#ifdef DEBUG_CACHE #endif //DEBUG_CACHE
qDebug()<<"CachePlacemark: Path:"<<path; QFileInfo File(filename);;
#endif //DEBUG_CACHE QDir dir=File.absoluteDir();
if(!dir.exists()) QString path=dir.absolutePath();
{ #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"CachePlacemark: Path:"<<path;
qDebug()<<"CachePlacemark: Cache path doesn't exist, try to create"; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE if(!dir.exists())
if(!dir.mkpath(path)) {
{ #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"CachePlacemark: Cache path doesn't exist, try to create";
qDebug()<<"CachePlacemark: Could not create path"; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE if(!dir.mkpath(path))
} {
} #ifdef DEBUG_CACHE
#ifdef DEBUG_CACHE qDebug()<<"CachePlacemark: Could not create path";
qDebug()<<"CachePlacemark: OpenFile:"<<filename; #endif //DEBUG_CACHE
#endif //DEBUG_CACHE }
QFile file(filename); }
if (file.open(QIODevice::WriteOnly)) #ifdef DEBUG_CACHE
{ qDebug()<<"CachePlacemark: OpenFile:"<<filename;
#ifdef DEBUG_CACHE #endif //DEBUG_CACHE
qDebug()<<"CachePlacemark: File Opened!!!:"<<filename; QFile file(filename);
#endif //DEBUG_CACHE if (file.open(QIODevice::WriteOnly))
QTextStream stream(&file); {
stream.setCodec("UTF-8"); #ifdef DEBUG_CACHE
stream<<content; qDebug()<<"CachePlacemark: File Opened!!!:"<<filename;
} #endif //DEBUG_CACHE
} QTextStream stream(&file);
} stream.setCodec("UTF-8");
stream<<content;
}
}
}

View File

@ -26,36 +26,19 @@
*/ */
#include "pureimagecache.h" #include "pureimagecache.h"
#include <QDateTime> #include <QDateTime>
#include <QSettings>
//#define DEBUG_PUREIMAGECACHE //#define DEBUG_PUREIMAGECACHE
namespace core { namespace core {
qlonglong PureImageCache::ConnCounter=0; qlonglong PureImageCache::ConnCounter=0;
PureImageCache::PureImageCache() PureImageCache::PureImageCache()
{ {
gtilecache=QDir::currentPath()+QDir::separator()+"mapscache"+QDir::separator();
QDir d;
if(!d.exists(gtilecache))
{
d.mkdir(gtilecache);
#ifdef DEBUG_PUREIMAGECACHE
qDebug()<<"Create Cache directory";
#endif //DEBUG_PUREIMAGECACHE
}
{
QString db=gtilecache+"Data.qmdb";
if(!QFileInfo(db).exists())
{
#ifdef DEBUG_PUREIMAGECACHE
qDebug()<<"Try to create EmptyDB";
#endif //DEBUG_PUREIMAGECACHE
CreateEmptyDB(db);
}
}
} }
void PureImageCache::setGtileCache(const QString &value) void PureImageCache::setGtileCache(const QString &value)
{ {
lock.lockForWrite();
gtilecache=value; gtilecache=value;
QDir d; QDir d;
if(!d.exists(gtilecache)) if(!d.exists(gtilecache))
@ -75,6 +58,7 @@ namespace core {
CreateEmptyDB(db); CreateEmptyDB(db);
} }
} }
lock.unlock();
} }
QString PureImageCache::GtileCache() QString PureImageCache::GtileCache()
{ {
@ -187,6 +171,9 @@ namespace core {
} }
bool PureImageCache::PutImageToCache(const QByteArray &tile, const MapType::Types &type,const Point &pos,const int &zoom) bool PureImageCache::PutImageToCache(const QByteArray &tile, const MapType::Types &type,const Point &pos,const int &zoom)
{ {
if(gtilecache.isEmpty()|gtilecache.isNull())
return false;
lock.lockForRead();
#ifdef DEBUG_PUREIMAGECACHE #ifdef DEBUG_PUREIMAGECACHE
qDebug()<<"PutImageToCache Start:";//<<pos; qDebug()<<"PutImageToCache Start:";//<<pos;
#endif //DEBUG_PUREIMAGECACHE #endif //DEBUG_PUREIMAGECACHE
@ -222,11 +209,15 @@ namespace core {
} }
} }
QSqlDatabase::removeDatabase(QString::number(id)); QSqlDatabase::removeDatabase(QString::number(id));
lock.unlock();
return true; return true;
} }
QByteArray PureImageCache::GetImageFromCache(MapType::Types type, Point pos, int zoom) QByteArray PureImageCache::GetImageFromCache(MapType::Types type, Point pos, int zoom)
{ {
lock.lockForRead();
QByteArray ar; QByteArray ar;
if(gtilecache.isEmpty()|gtilecache.isNull())
return ar;
QString dir=gtilecache; QString dir=gtilecache;
Mcounter.lock(); Mcounter.lock();
qlonglong id=++ConnCounter; qlonglong id=++ConnCounter;
@ -260,10 +251,13 @@ namespace core {
} }
} }
QSqlDatabase::removeDatabase(QString::number(id)); QSqlDatabase::removeDatabase(QString::number(id));
lock.unlock();
return ar; return ar;
} }
void PureImageCache::deleteOlderTiles(int const& days) void PureImageCache::deleteOlderTiles(int const& days)
{ {
if(gtilecache.isEmpty()|gtilecache.isNull())
return;
QList<long> add; QList<long> add;
bool ret=true; bool ret=true;
QString dir=gtilecache; QString dir=gtilecache;

View File

@ -41,7 +41,7 @@
#include "pureimage.h" #include "pureimage.h"
#include <QList> #include <QList>
#include <QMutex> #include <QMutex>
#include <QReadWriteLock>
namespace core { namespace core {
class PureImageCache class PureImageCache
{ {
@ -58,6 +58,7 @@ namespace core {
private: private:
QString gtilecache; QString gtilecache;
QMutex Mcounter; QMutex Mcounter;
QReadWriteLock lock;
static qlonglong ConnCounter; static qlonglong ConnCounter;
}; };

View File

@ -80,7 +80,6 @@ namespace core {
void UrlFactory::setIsCorrectGoogleVersions(bool value) void UrlFactory::setIsCorrectGoogleVersions(bool value)
{ {
isCorrectedGoogleVersions=value; isCorrectedGoogleVersions=value;
} }
bool UrlFactory::IsCorrectGoogleVersions() bool UrlFactory::IsCorrectGoogleVersions()
@ -90,6 +89,7 @@ namespace core {
void UrlFactory::TryCorrectGoogleVersions() void UrlFactory::TryCorrectGoogleVersions()
{ {
QMutexLocker locker(&mutex);
if(CorrectGoogleVersions && !IsCorrectGoogleVersions()) if(CorrectGoogleVersions && !IsCorrectGoogleVersions())
{ {
QNetworkReply *reply; QNetworkReply *reply;

View File

@ -1,87 +1,88 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file urlfactory.h * @file urlfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief * @brief
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget * @defgroup OPMapWidget
* @{ * @{
* *
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef URLFACTORY_H #ifndef URLFACTORY_H
#define URLFACTORY_H #define URLFACTORY_H
#include <QtNetwork/QNetworkProxy> #include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkAccessManager>
#include <QUrl> #include <QUrl>
#include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkReply>
#include <QTimer> #include <QTimer>
#include <QCoreApplication> #include <QCoreApplication>
#include "providerstrings.h" #include "providerstrings.h"
#include "pureimagecache.h" #include "pureimagecache.h"
#include "../internals/pointlatlng.h" #include "../internals/pointlatlng.h"
#include "geodecoderstatus.h" #include "geodecoderstatus.h"
#include <QTime> #include <QTime>
#include "cache.h" #include "cache.h"
#include "placemark.h" #include "placemark.h"
#include <QTextCodec> #include <QTextCodec>
#include "cmath" #include "cmath"
namespace core { namespace core {
class UrlFactory: public QObject,public ProviderStrings class UrlFactory: public QObject,public ProviderStrings
{ {
Q_OBJECT Q_OBJECT
public: public:
/// <summary> /// <summary>
/// Gets or sets the value of the User-agent HTTP header. /// Gets or sets the value of the User-agent HTTP header.
/// </summary> /// </summary>
QByteArray UserAgent; QByteArray UserAgent;
QNetworkProxy Proxy; QNetworkProxy Proxy;
UrlFactory(); UrlFactory();
~UrlFactory(); ~UrlFactory();
QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language); QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language);
internals::PointLatLng GetLatLngFromGeodecoder(const QString &keywords,GeoCoderStatusCode::Types &status); internals::PointLatLng GetLatLngFromGeodecoder(const QString &keywords,GeoCoderStatusCode::Types &status);
Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location); Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location);
int Timeout; int Timeout;
private: private:
void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2); void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
int GetServerNum(const core::Point &pos,const int &max) const; int GetServerNum(const core::Point &pos,const int &max) const;
void TryCorrectGoogleVersions(); void TryCorrectGoogleVersions();
bool isCorrectedGoogleVersions; bool isCorrectedGoogleVersions;
QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const; QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const;
bool CorrectGoogleVersions; bool CorrectGoogleVersions;
bool UseGeocoderCache; //TODO GetSet bool UseGeocoderCache; //TODO GetSet
bool UsePlacemarkCache;//TODO GetSet bool UsePlacemarkCache;//TODO GetSet
static const double EarthRadiusKm; static const double EarthRadiusKm;
double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2); double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2);
QMutex mutex;
protected:
static short timelapse; protected:
QString LanguageStr; static short timelapse;
bool IsCorrectGoogleVersions(); QString LanguageStr;
void setIsCorrectGoogleVersions(bool value); bool IsCorrectGoogleVersions();
QString MakeGeocoderUrl(QString keywords); void setIsCorrectGoogleVersions(bool value);
QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language); QString MakeGeocoderUrl(QString keywords);
internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status); QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language);
Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache); internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status);
}; Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache);
};
}
#endif // URLFACTORY_H }
#endif // URLFACTORY_H

View File

@ -1,97 +1,105 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file opmapgadgetconfiguration.cpp * @file opmapgadgetconfiguration.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin * @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{ * @{
* @brief The OpenPilot Map plugin * @brief The OpenPilot Map plugin
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "opmapgadgetconfiguration.h" #include "opmapgadgetconfiguration.h"
#include "utils/pathutils.h" #include "utils/pathutils.h"
#include <QDir> #include <QDir>
OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) : OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent), IUAVGadgetConfiguration(classId, parent),
m_mapProvider("GoogleHybrid"), m_mapProvider("GoogleHybrid"),
m_defaultZoom(2), m_defaultZoom(2),
m_defaultLatitude(0), m_defaultLatitude(0),
m_defaultLongitude(0), m_defaultLongitude(0),
m_useOpenGL(false), m_useOpenGL(false),
m_showTileGridLines(false), m_showTileGridLines(false),
m_accessMode("ServerAndCache"), m_accessMode("ServerAndCache"),
m_useMemoryCache(true), m_useMemoryCache(true),
m_cacheLocation(Utils::PathUtils().GetStoragePath() + "mapscache" + QDir::separator()) m_cacheLocation(Utils::PathUtils().GetStoragePath() + "mapscache" + QDir::separator())
{ {
QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
//if a saved configuration exists load it QDir dir(set.fileName());
if(qSettings != 0) { QFileInfo f(dir.absolutePath());
QString mapProvider = qSettings->value("mapProvider").toString(); f.dir().absolutePath();
int zoom = qSettings->value("defaultZoom").toInt(); m_cacheLocation=f.dir().absolutePath()+QDir::separator() + "mapscache" + QDir::separator();
double latitude= qSettings->value("defaultLatitude").toDouble();
double longitude= qSettings->value("defaultLongitude").toDouble(); //if a saved configuration exists load it
bool useOpenGL= qSettings->value("useOpenGL").toBool(); if(qSettings != 0) {
bool showTileGridLines= qSettings->value("showTileGridLines").toBool(); QString mapProvider = qSettings->value("mapProvider").toString();
QString accessMode= qSettings->value("accessMode").toString(); int zoom = qSettings->value("defaultZoom").toInt();
bool useMemoryCache= qSettings->value("useMemoryCache").toBool(); double latitude= qSettings->value("defaultLatitude").toDouble();
QString cacheLocation= qSettings->value("cacheLocation").toString(); double longitude= qSettings->value("defaultLongitude").toDouble();
bool useOpenGL= qSettings->value("useOpenGL").toBool();
if (!mapProvider.isEmpty()) m_mapProvider = mapProvider; bool showTileGridLines= qSettings->value("showTileGridLines").toBool();
m_defaultZoom = zoom; QString accessMode= qSettings->value("accessMode").toString();
m_defaultLatitude = latitude; bool useMemoryCache= qSettings->value("useMemoryCache").toBool();
m_defaultLongitude = longitude; QString cacheLocation= qSettings->value("cacheLocation").toString();
m_useOpenGL = useOpenGL;
m_showTileGridLines = showTileGridLines; if (!mapProvider.isEmpty()) m_mapProvider = mapProvider;
m_defaultZoom = zoom;
if (!accessMode.isEmpty()) m_accessMode = accessMode; m_defaultLatitude = latitude;
m_useMemoryCache = useMemoryCache; m_defaultLongitude = longitude;
if (!cacheLocation.isEmpty()) m_cacheLocation = Utils::PathUtils().InsertStoragePath(cacheLocation); m_useOpenGL = useOpenGL;
} m_showTileGridLines = showTileGridLines;
}
if (!accessMode.isEmpty()) m_accessMode = accessMode;
IUAVGadgetConfiguration * OPMapGadgetConfiguration::clone() m_useMemoryCache = useMemoryCache;
{ if (!cacheLocation.isEmpty()) m_cacheLocation = Utils::PathUtils().InsertStoragePath(cacheLocation);
OPMapGadgetConfiguration *m = new OPMapGadgetConfiguration(this->classId()); }
}
m->m_mapProvider = m_mapProvider;
m->m_defaultZoom = m_defaultZoom; IUAVGadgetConfiguration * OPMapGadgetConfiguration::clone()
m->m_defaultLatitude = m_defaultLatitude; {
m->m_defaultLongitude = m_defaultLongitude; OPMapGadgetConfiguration *m = new OPMapGadgetConfiguration(this->classId());
m->m_useOpenGL = m_useOpenGL;
m->m_showTileGridLines = m_showTileGridLines; m->m_mapProvider = m_mapProvider;
m->m_accessMode = m_accessMode; m->m_defaultZoom = m_defaultZoom;
m->m_useMemoryCache = m_useMemoryCache; m->m_defaultLatitude = m_defaultLatitude;
m->m_cacheLocation = m_cacheLocation; m->m_defaultLongitude = m_defaultLongitude;
m->m_useOpenGL = m_useOpenGL;
return m; m->m_showTileGridLines = m_showTileGridLines;
} m->m_accessMode = m_accessMode;
m->m_useMemoryCache = m_useMemoryCache;
void OPMapGadgetConfiguration::saveConfig(QSettings* qSettings) const { m->m_cacheLocation = m_cacheLocation;
qSettings->setValue("mapProvider", m_mapProvider);
qSettings->setValue("defaultZoom", m_defaultZoom); return m;
qSettings->setValue("defaultLatitude", m_defaultLatitude); }
qSettings->setValue("defaultLongitude", m_defaultLongitude);
qSettings->setValue("useOpenGL", m_useOpenGL); void OPMapGadgetConfiguration::saveConfig(QSettings* qSettings) const {
qSettings->setValue("showTileGridLines", m_showTileGridLines); qSettings->setValue("mapProvider", m_mapProvider);
qSettings->setValue("accessMode", m_accessMode); qSettings->setValue("defaultZoom", m_defaultZoom);
qSettings->setValue("useMemoryCache", m_useMemoryCache); qSettings->setValue("defaultLatitude", m_defaultLatitude);
qSettings->setValue("cacheLocation", Utils::PathUtils().RemoveStoragePath(m_cacheLocation)); qSettings->setValue("defaultLongitude", m_defaultLongitude);
} qSettings->setValue("useOpenGL", m_useOpenGL);
qSettings->setValue("showTileGridLines", m_showTileGridLines);
qSettings->setValue("accessMode", m_accessMode);
qSettings->setValue("useMemoryCache", m_useMemoryCache);
qSettings->setValue("cacheLocation", Utils::PathUtils().RemoveStoragePath(m_cacheLocation));
}
void OPMapGadgetConfiguration::setCacheLocation(QString cacheLocation){
m_cacheLocation = cacheLocation;
}

View File

@ -1,90 +1,90 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file opmapgadgetconfiguration.h * @file opmapgadgetconfiguration.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin * @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{ * @{
* @brief The OpenPilot Map plugin * @brief The OpenPilot Map plugin
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef OPMAP_GADGETCONFIGURATION_H #ifndef OPMAP_GADGETCONFIGURATION_H
#define OPMAP_GADGETCONFIGURATION_H #define OPMAP_GADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h> #include <coreplugin/iuavgadgetconfiguration.h>
#include <QtCore/QString> #include <QtCore/QString>
using namespace Core; using namespace Core;
class OPMapGadgetConfiguration : public IUAVGadgetConfiguration class OPMapGadgetConfiguration : public IUAVGadgetConfiguration
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider) Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider)
Q_PROPERTY(int zoommo READ zoom WRITE setZoom) Q_PROPERTY(int zoommo READ zoom WRITE setZoom)
Q_PROPERTY(double latitude READ latitude WRITE setLatitude) Q_PROPERTY(double latitude READ latitude WRITE setLatitude)
Q_PROPERTY(double longitude READ longitude WRITE setLongitude) Q_PROPERTY(double longitude READ longitude WRITE setLongitude)
Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL) Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL)
Q_PROPERTY(bool showTileGridLines READ showTileGridLines WRITE setShowTileGridLines) Q_PROPERTY(bool showTileGridLines READ showTileGridLines WRITE setShowTileGridLines)
Q_PROPERTY(QString accessMode READ accessMode WRITE setAccessMode) Q_PROPERTY(QString accessMode READ accessMode WRITE setAccessMode)
Q_PROPERTY(bool useMemoryCache READ useMemoryCache WRITE setUseMemoryCache) Q_PROPERTY(bool useMemoryCache READ useMemoryCache WRITE setUseMemoryCache)
Q_PROPERTY(QString cacheLocation READ cacheLocation WRITE setCacheLocation) Q_PROPERTY(QString cacheLocation READ cacheLocation WRITE setCacheLocation)
public: public:
explicit OPMapGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0); explicit OPMapGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings* settings) const; void saveConfig(QSettings* settings) const;
IUAVGadgetConfiguration *clone(); IUAVGadgetConfiguration *clone();
QString mapProvider() const { return m_mapProvider; } QString mapProvider() const { return m_mapProvider; }
int zoom() const { return m_defaultZoom; } int zoom() const { return m_defaultZoom; }
double latitude() const { return m_defaultLatitude; } double latitude() const { return m_defaultLatitude; }
double longitude() const { return m_defaultLongitude; } double longitude() const { return m_defaultLongitude; }
bool useOpenGL() const { return m_useOpenGL; } bool useOpenGL() const { return m_useOpenGL; }
bool showTileGridLines() const { return m_showTileGridLines; } bool showTileGridLines() const { return m_showTileGridLines; }
QString accessMode() const { return m_accessMode; } QString accessMode() const { return m_accessMode; }
bool useMemoryCache() const { return m_useMemoryCache; } bool useMemoryCache() const { return m_useMemoryCache; }
QString cacheLocation() const { return m_cacheLocation; } QString cacheLocation() const { return m_cacheLocation; }
public slots: public slots:
void setMapProvider(QString provider) { m_mapProvider = provider; } void setMapProvider(QString provider) { m_mapProvider = provider; }
void setZoom(int zoom) { m_defaultZoom = zoom; } void setZoom(int zoom) { m_defaultZoom = zoom; }
void setLatitude(double latitude) { m_defaultLatitude = latitude; } void setLatitude(double latitude) { m_defaultLatitude = latitude; }
void setLongitude(double longitude) { m_defaultLongitude = longitude; } void setLongitude(double longitude) { m_defaultLongitude = longitude; }
void setUseOpenGL(bool useOpenGL) { m_useOpenGL = useOpenGL; } void setUseOpenGL(bool useOpenGL) { m_useOpenGL = useOpenGL; }
void setShowTileGridLines(bool showTileGridLines) { m_showTileGridLines = showTileGridLines; } void setShowTileGridLines(bool showTileGridLines) { m_showTileGridLines = showTileGridLines; }
void setAccessMode(QString accessMode) { m_accessMode = accessMode; } void setAccessMode(QString accessMode) { m_accessMode = accessMode; }
void setUseMemoryCache(bool useMemoryCache) { m_useMemoryCache = useMemoryCache; } void setUseMemoryCache(bool useMemoryCache) { m_useMemoryCache = useMemoryCache; }
void setCacheLocation(QString cacheLocation) { m_cacheLocation = cacheLocation; } void setCacheLocation(QString cacheLocation);
private: private:
QString m_mapProvider; QString m_mapProvider;
int m_defaultZoom; int m_defaultZoom;
double m_defaultLatitude; double m_defaultLatitude;
double m_defaultLongitude; double m_defaultLongitude;
bool m_useOpenGL; bool m_useOpenGL;
bool m_showTileGridLines; bool m_showTileGridLines;
QString m_accessMode; QString m_accessMode;
bool m_useMemoryCache; bool m_useMemoryCache;
QString m_cacheLocation; QString m_cacheLocation;
}; };
#endif // OPMAP_GADGETCONFIGURATION_H #endif // OPMAP_GADGETCONFIGURATION_H

View File

@ -1,118 +1,121 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file opmapgadgetoptionspage.cpp * @file opmapgadgetoptionspage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins * @addtogroup GCSPlugins GCS Plugins
* @{ * @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin * @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{ * @{
* @brief The OpenPilot Map plugin * @brief The OpenPilot Map plugin
*****************************************************************************/ *****************************************************************************/
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "opmapgadgetoptionspage.h" #include "opmapgadgetoptionspage.h"
#include "opmapgadgetconfiguration.h" #include "opmapgadgetconfiguration.h"
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QSpinBox> #include <QtGui/QSpinBox>
#include <QtGui/QDoubleSpinBox> #include <QtGui/QDoubleSpinBox>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include "opmapcontrol/opmapcontrol.h" #include "opmapcontrol/opmapcontrol.h"
#include "utils/pathutils.h" #include "utils/pathutils.h"
#include "ui_opmapgadgetoptionspage.h" #include "ui_opmapgadgetoptionspage.h"
// ********************************************* // *********************************************
OPMapGadgetOptionsPage::OPMapGadgetOptionsPage(OPMapGadgetConfiguration *config, QObject *parent) : OPMapGadgetOptionsPage::OPMapGadgetOptionsPage(OPMapGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent), IOptionsPage(parent),
m_config(config) m_config(config)
{ {
} }
QWidget *OPMapGadgetOptionsPage::createPage(QWidget *parent) QWidget *OPMapGadgetOptionsPage::createPage(QWidget *parent)
{ {
m_page = new Ui::OPMapGadgetOptionsPage(); m_page = new Ui::OPMapGadgetOptionsPage();
QWidget *w = new QWidget(parent); QWidget *w = new QWidget(parent);
m_page->setupUi(w); m_page->setupUi(w);
// populate the map provider combobox // populate the map provider combobox
m_page->providerComboBox->clear(); m_page->providerComboBox->clear();
m_page->providerComboBox->addItems(mapcontrol::Helper::MapTypes()); m_page->providerComboBox->addItems(mapcontrol::Helper::MapTypes());
// populate the access mode combobox // populate the access mode combobox
m_page->accessModeComboBox->clear(); m_page->accessModeComboBox->clear();
m_page->accessModeComboBox->addItems(mapcontrol::Helper::AccessModeTypes()); m_page->accessModeComboBox->addItems(mapcontrol::Helper::AccessModeTypes());
int index = m_page->providerComboBox->findText(m_config->mapProvider()); int index = m_page->providerComboBox->findText(m_config->mapProvider());
index = (index >= 0) ? index : 0; index = (index >= 0) ? index : 0;
m_page->providerComboBox->setCurrentIndex(index); m_page->providerComboBox->setCurrentIndex(index);
m_page->zoomSpinBox->setValue(m_config->zoom()); m_page->zoomSpinBox->setValue(m_config->zoom());
m_page->latitudeSpinBox->setValue(m_config->latitude()); m_page->latitudeSpinBox->setValue(m_config->latitude());
m_page->longitudeSpinBox->setValue(m_config->longitude()); m_page->longitudeSpinBox->setValue(m_config->longitude());
m_page->checkBoxUseOpenGL->setChecked(m_config->useOpenGL()); m_page->checkBoxUseOpenGL->setChecked(m_config->useOpenGL());
m_page->checkBoxShowTileGridLines->setChecked(m_config->showTileGridLines()); m_page->checkBoxShowTileGridLines->setChecked(m_config->showTileGridLines());
index = m_page->accessModeComboBox->findText(m_config->accessMode()); index = m_page->accessModeComboBox->findText(m_config->accessMode());
index = (index >= 0) ? index : 0; index = (index >= 0) ? index : 0;
m_page->accessModeComboBox->setCurrentIndex(index); m_page->accessModeComboBox->setCurrentIndex(index);
m_page->checkBoxUseMemoryCache->setChecked(m_config->useMemoryCache()); m_page->checkBoxUseMemoryCache->setChecked(m_config->useMemoryCache());
m_page->lineEditCacheLocation->setExpectedKind(Utils::PathChooser::Directory); m_page->lineEditCacheLocation->setExpectedKind(Utils::PathChooser::Directory);
m_page->lineEditCacheLocation->setPromptDialogTitle(tr("Choose Cache Directory")); m_page->lineEditCacheLocation->setPromptDialogTitle(tr("Choose Cache Directory"));
m_page->lineEditCacheLocation->setPath(m_config->cacheLocation()); m_page->lineEditCacheLocation->setPath(m_config->cacheLocation());
connect(m_page->pushButtonCacheDefaults, SIGNAL(clicked()), this, SLOT(on_pushButtonCacheDefaults_clicked())); connect(m_page->pushButtonCacheDefaults, SIGNAL(clicked()), this, SLOT(on_pushButtonCacheDefaults_clicked()));
return w; return w;
} }
void OPMapGadgetOptionsPage::on_pushButtonCacheDefaults_clicked() void OPMapGadgetOptionsPage::on_pushButtonCacheDefaults_clicked()
{ {
int index = m_page->accessModeComboBox->findText("ServerAndCache"); int index = m_page->accessModeComboBox->findText("ServerAndCache");
index = (index >= 0) ? index : 0; index = (index >= 0) ? index : 0;
m_page->accessModeComboBox->setCurrentIndex(index); m_page->accessModeComboBox->setCurrentIndex(index);
m_page->checkBoxUseMemoryCache->setChecked(true); m_page->checkBoxUseMemoryCache->setChecked(true);
QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
m_page->lineEditCacheLocation->setPath(Utils::PathUtils().GetStoragePath() + "mapscache" + QDir::separator()); QDir dir(set.fileName());
QFileInfo f(dir.absolutePath());
} f.dir().absolutePath();
m_page->lineEditCacheLocation->setPath(f.dir().absolutePath()+QDir::separator() + "mapscache" + QDir::separator());
void OPMapGadgetOptionsPage::apply()
{ }
m_config->setMapProvider(m_page->providerComboBox->currentText());
m_config->setZoom(m_page->zoomSpinBox->value()); void OPMapGadgetOptionsPage::apply()
m_config->setLatitude(m_page->latitudeSpinBox->value()); {
m_config->setLongitude(m_page->longitudeSpinBox->value()); m_config->setMapProvider(m_page->providerComboBox->currentText());
m_config->setUseOpenGL(m_page->checkBoxUseOpenGL->isChecked()); m_config->setZoom(m_page->zoomSpinBox->value());
m_config->setShowTileGridLines(m_page->checkBoxShowTileGridLines->isChecked()); m_config->setLatitude(m_page->latitudeSpinBox->value());
m_config->setAccessMode(m_page->accessModeComboBox->currentText()); m_config->setLongitude(m_page->longitudeSpinBox->value());
m_config->setUseMemoryCache(m_page->checkBoxUseMemoryCache->isChecked()); m_config->setUseOpenGL(m_page->checkBoxUseOpenGL->isChecked());
m_config->setCacheLocation(m_page->lineEditCacheLocation->path()); m_config->setShowTileGridLines(m_page->checkBoxShowTileGridLines->isChecked());
} m_config->setAccessMode(m_page->accessModeComboBox->currentText());
m_config->setUseMemoryCache(m_page->checkBoxUseMemoryCache->isChecked());
void OPMapGadgetOptionsPage::finish() m_config->setCacheLocation(m_page->lineEditCacheLocation->path());
{ }
delete m_page;
} void OPMapGadgetOptionsPage::finish()
{
delete m_page;
}