1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Added support for tiles cache clearing

This commit is contained in:
Martin Tůma 2016-04-01 19:25:34 +02:00
parent 9fa031ca4d
commit f247c2fa22
6 changed files with 174 additions and 125 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="cs_CZ">
<TS version="2.0" language="cs_CZ">
<context>
<name>ElevationGraph</name>
<message>
@ -14,44 +14,44 @@
<translation>Výška</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="16"/>
<location filename="../src/elevationgraph.cpp" line="86"/>
<location filename="../src/elevationgraph.cpp" line="81"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="17"/>
<location filename="../src/elevationgraph.cpp" line="87"/>
<location filename="../src/elevationgraph.cpp" line="78"/>
<location filename="../src/elevationgraph.cpp" line="98"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="24"/>
<location filename="../src/elevationgraph.cpp" line="22"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="26"/>
<location filename="../src/elevationgraph.cpp" line="24"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="30"/>
<location filename="../src/elevationgraph.cpp" line="28"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="91"/>
<location filename="../src/elevationgraph.cpp" line="89"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="92"/>
<location filename="../src/elevationgraph.cpp" line="86"/>
<location filename="../src/elevationgraph.cpp" line="101"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="28"/>
<location filename="../src/elevationgraph.cpp" line="26"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
@ -59,356 +59,363 @@
<context>
<name>GUI</name>
<message>
<location filename="../src/gui.cpp" line="186"/>
<location filename="../src/gui.cpp" line="192"/>
<source>About Qt</source>
<translation>O Qt</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="406"/>
<location filename="../src/gui.cpp" line="418"/>
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
</message>
<message>
<location filename="../src/gui.cpp" line="465"/>
<location filename="../src/gui.cpp" line="477"/>
<source>Open file</source>
<translation>Otevřít soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="200"/>
<location filename="../src/gui.cpp" line="206"/>
<source>Save as</source>
<translation>Uložit jako</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="532"/>
<location filename="../src/gui.cpp" line="548"/>
<source>Open POI file</source>
<translation>Otevřít POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="191"/>
<location filename="../src/gui.cpp" line="197"/>
<source>Open</source>
<translation>Otevřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="174"/>
<location filename="../src/gui.cpp" line="180"/>
<source>Quit</source>
<translation>Ukončit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="181"/>
<location filename="../src/gui.cpp" line="422"/>
<location filename="../src/gui.cpp" line="423"/>
<location filename="../src/gui.cpp" line="187"/>
<location filename="../src/gui.cpp" line="434"/>
<location filename="../src/gui.cpp" line="435"/>
<source>Keyboard controls</source>
<translation>Ovládací klávesy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="195"/>
<location filename="../src/gui.cpp" line="201"/>
<source>Save</source>
<translation>Uložit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="205"/>
<location filename="../src/gui.cpp" line="211"/>
<source>Close</source>
<translation>Zavřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="210"/>
<location filename="../src/gui.cpp" line="216"/>
<source>Reload</source>
<translation>Znovu načíst</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="342"/>
<location filename="../src/gui.cpp" line="354"/>
<source>Show</source>
<translation>Zobrazit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="287"/>
<location filename="../src/gui.cpp" line="333"/>
<location filename="../src/gui.cpp" line="297"/>
<location filename="../src/gui.cpp" line="345"/>
<source>File</source>
<translation>Soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="179"/>
<location filename="../src/gui.cpp" line="440"/>
<location filename="../src/gui.cpp" line="441"/>
<location filename="../src/gui.cpp" line="185"/>
<location filename="../src/gui.cpp" line="452"/>
<location filename="../src/gui.cpp" line="453"/>
<source>Data sources</source>
<translation>Zdroje dat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="217"/>
<location filename="../src/gui.cpp" line="223"/>
<source>Load POI file</source>
<translation>Nahrát POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="220"/>
<location filename="../src/gui.cpp" line="226"/>
<source>Close POI files</source>
<translation>Zavřit soubory POI</translation>
<translation>Zavřit POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="223"/>
<location filename="../src/gui.cpp" line="229"/>
<source>Show POIs</source>
<translation>Zobrazit POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="230"/>
<location filename="../src/gui.cpp" line="236"/>
<source>Show map</source>
<translation>Zobrazit mapu</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="243"/>
<location filename="../src/gui.cpp" line="241"/>
<source>Clear tile cache</source>
<translation>Vymazat mezipaměť dlaždic</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="253"/>
<source>Show graphs</source>
<translation>Zobrazovat grafy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="249"/>
<location filename="../src/gui.cpp" line="259"/>
<source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="256"/>
<location filename="../src/gui.cpp" line="266"/>
<source>Metric</source>
<translation>Metrické</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="262"/>
<location filename="../src/gui.cpp" line="272"/>
<source>Imperial</source>
<translation>Imperiální</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="269"/>
<location filename="../src/gui.cpp" line="279"/>
<source>Next</source>
<translation>Následující</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="272"/>
<location filename="../src/gui.cpp" line="282"/>
<source>Previous</source>
<translation>Předchozí</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="276"/>
<location filename="../src/gui.cpp" line="286"/>
<source>Last</source>
<translation>Poslední</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="279"/>
<location filename="../src/gui.cpp" line="289"/>
<source>First</source>
<translation>První</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="301"/>
<location filename="../src/gui.cpp" line="311"/>
<source>Map</source>
<translation>Mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="306"/>
<location filename="../src/gui.cpp" line="318"/>
<source>POI</source>
<translation>POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="307"/>
<location filename="../src/gui.cpp" line="319"/>
<source>POI files</source>
<translation>POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="315"/>
<location filename="../src/gui.cpp" line="327"/>
<source>Settings</source>
<translation>Nastavení</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="316"/>
<location filename="../src/gui.cpp" line="328"/>
<source>Units</source>
<translation>Jednotky</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="323"/>
<location filename="../src/gui.cpp" line="335"/>
<source>Help</source>
<translation>Nápověda</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="732"/>
<location filename="../src/gui.cpp" line="756"/>
<source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="804"/>
<location filename="../src/gui.cpp" line="838"/>
<source>Elevation</source>
<translation>Výška</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="805"/>
<location filename="../src/gui.cpp" line="839"/>
<source>Speed</source>
<translation>Rychlost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="806"/>
<location filename="../src/gui.cpp" line="840"/>
<source>Heart rate</source>
<translation>Tep</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="425"/>
<location filename="../src/gui.cpp" line="437"/>
<source>Next file</source>
<translation>Následující soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="426"/>
<location filename="../src/gui.cpp" line="438"/>
<source>Previous file</source>
<translation>Předchozí soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="428"/>
<location filename="../src/gui.cpp" line="440"/>
<source>First file</source>
<translation>První soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="429"/>
<location filename="../src/gui.cpp" line="441"/>
<source>Last file</source>
<translation>Poslední soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="430"/>
<location filename="../src/gui.cpp" line="442"/>
<source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="444"/>
<location filename="../src/gui.cpp" line="456"/>
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="447"/>
<location filename="../src/gui.cpp" line="459"/>
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="455"/>
<location filename="../src/gui.cpp" line="467"/>
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="466"/>
<location filename="../src/gui.cpp" line="478"/>
<source>GPX files (*.gpx);;All files (*)</source>
<translation>soubory GPX (*.gpx);;všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="523"/>
<location filename="../src/gui.cpp" line="549"/>
<location filename="../src/gui.cpp" line="539"/>
<location filename="../src/gui.cpp" line="565"/>
<source>Line: %1</source>
<translation>Řádka: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="533"/>
<location filename="../src/gui.cpp" line="549"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="614"/>
<location filename="../src/gui.cpp" line="743"/>
<location filename="../src/gui.cpp" line="630"/>
<location filename="../src/gui.cpp" line="771"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="617"/>
<location filename="../src/gui.cpp" line="619"/>
<location filename="../src/gui.cpp" line="621"/>
<location filename="../src/gui.cpp" line="623"/>
<location filename="../src/gui.cpp" line="633"/>
<location filename="../src/gui.cpp" line="635"/>
<location filename="../src/gui.cpp" line="637"/>
<location filename="../src/gui.cpp" line="639"/>
<location filename="../src/gui.cpp" line="768"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="620"/>
<location filename="../src/gui.cpp" line="632"/>
<location filename="../src/gui.cpp" line="636"/>
<location filename="../src/gui.cpp" line="648"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="622"/>
<location filename="../src/gui.cpp" line="634"/>
<location filename="../src/gui.cpp" line="638"/>
<location filename="../src/gui.cpp" line="650"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="184"/>
<location filename="../src/gui.cpp" line="402"/>
<location filename="../src/gui.cpp" line="190"/>
<location filename="../src/gui.cpp" line="414"/>
<source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="349"/>
<location filename="../src/gui.cpp" line="361"/>
<source>Navigation</source>
<translation>Navigace</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="404"/>
<location filename="../src/gui.cpp" line="416"/>
<source>GPX viewer and analyzer</source>
<translation>Prohlížeč a analyzátor GPX</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="443"/>
<location filename="../src/gui.cpp" line="455"/>
<source>Map sources</source>
<translation>Mapové zdroje</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="454"/>
<location filename="../src/gui.cpp" line="466"/>
<source>POIs</source>
<translation>POI body</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="613"/>
<location filename="../src/gui.cpp" line="625"/>
<location filename="../src/gui.cpp" line="629"/>
<location filename="../src/gui.cpp" line="641"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="615"/>
<location filename="../src/gui.cpp" line="627"/>
<location filename="../src/gui.cpp" line="631"/>
<location filename="../src/gui.cpp" line="643"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="616"/>
<location filename="../src/gui.cpp" line="628"/>
<location filename="../src/gui.cpp" line="632"/>
<location filename="../src/gui.cpp" line="644"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="629"/>
<location filename="../src/gui.cpp" line="631"/>
<location filename="../src/gui.cpp" line="633"/>
<location filename="../src/gui.cpp" line="635"/>
<location filename="../src/gui.cpp" line="645"/>
<location filename="../src/gui.cpp" line="647"/>
<location filename="../src/gui.cpp" line="649"/>
<location filename="../src/gui.cpp" line="651"/>
<location filename="../src/gui.cpp" line="775"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="618"/>
<location filename="../src/gui.cpp" line="630"/>
<location filename="../src/gui.cpp" line="634"/>
<location filename="../src/gui.cpp" line="646"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="739"/>
<location filename="../src/gui.cpp" line="763"/>
<source>%1 tracks</source>
<translation>Počet tras: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="626"/>
<location filename="../src/gui.cpp" line="746"/>
<location filename="../src/gui.cpp" line="642"/>
<location filename="../src/gui.cpp" line="778"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="525"/>
<location filename="../src/gui.cpp" line="550"/>
<location filename="../src/gui.cpp" line="541"/>
<location filename="../src/gui.cpp" line="566"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="520"/>
<location filename="../src/gui.cpp" line="536"/>
<source>Error loading GPX file:
%1</source>
<translation>Soubor GPX nelze otevřít:
%1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="546"/>
<location filename="../src/gui.cpp" line="562"/>
<source>Error loading POI file:
%1</source>
<translation>Soubor POI nelze otevřít:
@ -418,38 +425,47 @@
<context>
<name>HeartRateGraph</name>
<message>
<location filename="../src/heartrategraph.cpp" line="9"/>
<location filename="../src/heartrategraph.cpp" line="10"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="10"/>
<location filename="../src/heartrategraph.cpp" line="11"/>
<source>Heart rate</source>
<translation>Tep</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="11"/>
<location filename="../src/heartrategraph.cpp" line="76"/>
<location filename="../src/heartrategraph.cpp" line="78"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="12"/>
<location filename="../src/heartrategraph.cpp" line="9"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="19"/>
<location filename="../src/heartrategraph.cpp" line="18"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="21"/>
<location filename="../src/heartrategraph.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="79"/>
<location filename="../src/heartrategraph.cpp" line="75"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="83"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="86"/>
<source>mi</source>
<translation>mi</translation>
</message>
@ -480,44 +496,52 @@
<context>
<name>SpeedGraph</name>
<message>
<location filename="../src/speedgraph.cpp" line="10"/>
<location filename="../src/speedgraph.cpp" line="11"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="11"/>
<location filename="../src/speedgraph.cpp" line="12"/>
<source>Speed</source>
<translation>Rychlost</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="12"/>
<location filename="../src/speedgraph.cpp" line="72"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="75"/>
<source>km</source>
<translation></translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="13"/>
<location filename="../src/speedgraph.cpp" line="76"/>
<location filename="../src/speedgraph.cpp" line="80"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="92"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="21"/>
<location filename="../src/speedgraph.cpp" line="19"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="23"/>
<location filename="../src/speedgraph.cpp" line="21"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="80"/>
<location filename="../src/speedgraph.cpp" line="83"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="81"/>
<location filename="../src/speedgraph.cpp" line="95"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>

View File

@ -238,9 +238,13 @@ void GUI::createActions()
_showMapAction->setCheckable(true);
_showMapAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
if (_maps.empty())
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
connect(_clearMapCacheAction, SIGNAL(triggered()), this,
SLOT(clearMapCache()));
if (_maps.empty()) {
_showMapAction->setEnabled(false);
else {
_clearMapCacheAction->setEnabled(false);
} else {
createMapActions();
_showMapAction->setChecked(true);
}
@ -307,6 +311,8 @@ void GUI::createMenus()
_mapMenu = menuBar()->addMenu(tr("Map"));
_mapMenu->addActions(_mapActions);
_mapMenu->addSeparator();
_mapMenu->addAction(_clearMapCacheAction);
_mapMenu->addSeparator();
_mapMenu->addAction(_showMapAction);
_poiMenu = menuBar()->addMenu(tr("POI"));
@ -738,6 +744,12 @@ void GUI::showToolbars(bool checked)
}
}
void GUI::clearMapCache()
{
_currentMap->clearCache();
_track->redraw();
}
void GUI::updateStatusBarInfo()
{
if (_files.count() == 0) {

View File

@ -45,6 +45,7 @@ private slots:
void showMap(bool checked);
void showGraphs(bool checked);
void showToolbars(bool checked);
void clearMapCache();
void mapChanged(int);
void graphChanged(int);
@ -114,6 +115,7 @@ private:
QAction *_closePOIAction;
QAction *_showPOIAction;
QAction *_showMapAction;
QAction *_clearMapCacheAction;
QAction *_showGraphsAction;
QAction *_showToolbarsAction;
QAction *_nextAction;

View File

@ -5,6 +5,8 @@
#include "config.h"
#include "map.h"
#include <QDebug>
Map::Map(QObject *parent, const QString &name, const QString &url)
: QObject(parent)
@ -16,7 +18,7 @@ Map::Map(QObject *parent, const QString &name, const QString &url)
SLOT(emitLoaded()));
QString path = TILES_DIR + QString("/") + _name;
if (!QDir::home().mkpath(path))
if (!QDir().mkpath(path))
fprintf(stderr, "Error creating tiles dir: %s\n", qPrintable(path));
}
@ -54,3 +56,13 @@ void Map::loadTiles(QList<Tile> &list)
if (!dl.empty())
Downloader::instance().get(dl);
}
void Map::clearCache()
{
QString path = TILES_DIR + QString("/") + _name;
QDir dir = QDir(path);
QStringList list = dir.entryList();
for (int i = 0; i < list.count(); i++)
dir.remove(list.at(i));
}

View File

@ -24,15 +24,16 @@ class Map : public QObject
{
Q_OBJECT
signals:
void loaded();
public:
Map(QObject *parent = 0, const QString &name = QString(),
const QString &url = QString());
const QString &name() const {return _name;}
void loadTiles(QList<Tile> &list);
void clearCache();
signals:
void loaded();
private slots:
void emitLoaded();

View File

@ -42,8 +42,6 @@ public:
public slots:
void movePositionMarker(qreal val);
private slots:
void redraw();
private: