mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-01 21:39:15 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
69c62ffdc3 | |||
b195993164 | |||
b2672a982a | |||
4d10a8d5d5 | |||
22b84cc6cd | |||
ba9319d7f6 | |||
7ac94588c8 | |||
1b358bde3c | |||
9b2ca4ccb7 | |||
2d9677096d | |||
f3eb136187 |
@ -63,7 +63,7 @@ Section "GPXSee (required)" SEC_APP
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKCU "${REGENTRY}" "DisplayName" "GPXSee"
|
||||
WriteRegStr HKCU "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||
WriteRegStr HKCU "${REGENTRY}" "DisplayVersion" "2.1"
|
||||
WriteRegStr HKCU "${REGENTRY}" "DisplayVersion" "2.3"
|
||||
WriteRegStr HKCU "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKCU "${REGENTRY}" "NoModify" 1
|
||||
WriteRegDWORD HKCU "${REGENTRY}" "NoRepair" 1
|
||||
|
@ -9,6 +9,10 @@
|
||||
<file>icons/application-exit.png</file>
|
||||
<file>icons/applications-internet.png</file>
|
||||
<file>icons/view-refresh.png</file>
|
||||
<file>icons/arrow-left.png</file>
|
||||
<file>icons/arrow-right.png</file>
|
||||
<file>icons/arrow-left-double.png</file>
|
||||
<file>icons/arrow-right-double.png</file>
|
||||
<file>lang/gpxsee_cs.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
icons/arrow-left-double.png
Normal file
BIN
icons/arrow-left-double.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 926 B |
BIN
icons/arrow-left.png
Normal file
BIN
icons/arrow-left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 707 B |
BIN
icons/arrow-right-double.png
Normal file
BIN
icons/arrow-right-double.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 924 B |
BIN
icons/arrow-right.png
Normal file
BIN
icons/arrow-right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 682 B |
@ -47,256 +47,291 @@
|
||||
<context>
|
||||
<name>GUI</name>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="135"/>
|
||||
<location filename="../src/gui.cpp" line="137"/>
|
||||
<source>About Qt</source>
|
||||
<translation>O Qt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="295"/>
|
||||
<location filename="../src/gui.cpp" line="319"/>
|
||||
<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="354"/>
|
||||
<location filename="../src/gui.cpp" line="381"/>
|
||||
<source>Open file</source>
|
||||
<translation>Otevřít soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="149"/>
|
||||
<location filename="../src/gui.cpp" line="151"/>
|
||||
<source>Save as</source>
|
||||
<translation>Uložit jako</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="405"/>
|
||||
<location filename="../src/gui.cpp" line="434"/>
|
||||
<source>Open POI file</source>
|
||||
<translation>Otevřít POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="140"/>
|
||||
<location filename="../src/gui.cpp" line="142"/>
|
||||
<source>Open</source>
|
||||
<translation>Otevřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="123"/>
|
||||
<location filename="../src/gui.cpp" line="125"/>
|
||||
<source>Quit</source>
|
||||
<translation>Ukončit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="130"/>
|
||||
<location filename="../src/gui.cpp" line="311"/>
|
||||
<location filename="../src/gui.cpp" line="312"/>
|
||||
<location filename="../src/gui.cpp" line="132"/>
|
||||
<location filename="../src/gui.cpp" line="335"/>
|
||||
<location filename="../src/gui.cpp" line="336"/>
|
||||
<source>Keyboard controls</source>
|
||||
<translation>Ovládací klávesy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="144"/>
|
||||
<location filename="../src/gui.cpp" line="146"/>
|
||||
<source>Save</source>
|
||||
<translation>Uložit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="154"/>
|
||||
<location filename="../src/gui.cpp" line="156"/>
|
||||
<source>Close</source>
|
||||
<translation>Zavřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="159"/>
|
||||
<location filename="../src/gui.cpp" line="161"/>
|
||||
<source>Reload</source>
|
||||
<translation>Znovu načíst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="244"/>
|
||||
<location filename="../src/gui.cpp" line="262"/>
|
||||
<source>Show</source>
|
||||
<translation>Zobrazit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="198"/>
|
||||
<location filename="../src/gui.cpp" line="235"/>
|
||||
<location filename="../src/gui.cpp" line="216"/>
|
||||
<location filename="../src/gui.cpp" line="253"/>
|
||||
<source>File</source>
|
||||
<translation>Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="128"/>
|
||||
<location filename="../src/gui.cpp" line="327"/>
|
||||
<location filename="../src/gui.cpp" line="328"/>
|
||||
<location filename="../src/gui.cpp" line="130"/>
|
||||
<location filename="../src/gui.cpp" line="354"/>
|
||||
<location filename="../src/gui.cpp" line="355"/>
|
||||
<source>Data sources</source>
|
||||
<translation>Zdroje dat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="166"/>
|
||||
<location filename="../src/gui.cpp" line="168"/>
|
||||
<source>Load POI file</source>
|
||||
<translation>Nahrát POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="169"/>
|
||||
<location filename="../src/gui.cpp" line="171"/>
|
||||
<source>Show POIs</source>
|
||||
<translation>Zobrazit POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="174"/>
|
||||
<location filename="../src/gui.cpp" line="176"/>
|
||||
<source>Show map</source>
|
||||
<translation>Zobrazit mapu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="184"/>
|
||||
<location filename="../src/gui.cpp" line="186"/>
|
||||
<source>Show graphs</source>
|
||||
<translation>Zobrazovat grafy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="189"/>
|
||||
<location filename="../src/gui.cpp" line="191"/>
|
||||
<source>Show toolbars</source>
|
||||
<translation>Zobrazovat nástrojové lišty</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="212"/>
|
||||
<location filename="../src/gui.cpp" line="198"/>
|
||||
<source>Next</source>
|
||||
<translation>Následující</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="201"/>
|
||||
<source>Previous</source>
|
||||
<translation>Předchozí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="205"/>
|
||||
<source>Last</source>
|
||||
<translation>Poslední</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="208"/>
|
||||
<source>First</source>
|
||||
<translation>První</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="230"/>
|
||||
<source>Map</source>
|
||||
<translation>Mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="217"/>
|
||||
<location filename="../src/gui.cpp" line="235"/>
|
||||
<source>POI</source>
|
||||
<translation>POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="221"/>
|
||||
<location filename="../src/gui.cpp" line="239"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="225"/>
|
||||
<location filename="../src/gui.cpp" line="243"/>
|
||||
<source>Help</source>
|
||||
<translation>Nápověda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="263"/>
|
||||
<location filename="../src/gui.cpp" line="287"/>
|
||||
<source>Elevation</source>
|
||||
<translation>Výška</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="264"/>
|
||||
<location filename="../src/gui.cpp" line="288"/>
|
||||
<source>Speed</source>
|
||||
<translation>Rychlost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="314"/>
|
||||
<location filename="../src/gui.cpp" line="338"/>
|
||||
<source>Next file</source>
|
||||
<translation>Následující soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="315"/>
|
||||
<location filename="../src/gui.cpp" line="339"/>
|
||||
<source>Previous file</source>
|
||||
<translation>Předchozí soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="317"/>
|
||||
<location filename="../src/gui.cpp" line="341"/>
|
||||
<source>First file</source>
|
||||
<translation>První soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="342"/>
|
||||
<source>Last file</source>
|
||||
<translation>Poslední soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="344"/>
|
||||
<source>Append modifier</source>
|
||||
<translation>Modifikátor nahradit/přidat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="331"/>
|
||||
<location filename="../src/gui.cpp" line="358"/>
|
||||
<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="335"/>
|
||||
<location filename="../src/gui.cpp" line="362"/>
|
||||
<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="343"/>
|
||||
<location filename="../src/gui.cpp" line="370"/>
|
||||
<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="396"/>
|
||||
<location filename="../src/gui.cpp" line="412"/>
|
||||
<location filename="../src/gui.cpp" line="425"/>
|
||||
<location filename="../src/gui.cpp" line="441"/>
|
||||
<source>Line: %1</source>
|
||||
<translation>Řádka: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="464"/>
|
||||
<location filename="../src/gui.cpp" line="493"/>
|
||||
<source>Maximum</source>
|
||||
<translation>Maximum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="466"/>
|
||||
<location filename="../src/gui.cpp" line="495"/>
|
||||
<source>Minimum</source>
|
||||
<translation>Minimum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="133"/>
|
||||
<location filename="../src/gui.cpp" line="291"/>
|
||||
<location filename="../src/gui.cpp" line="135"/>
|
||||
<location filename="../src/gui.cpp" line="315"/>
|
||||
<source>About GPXSee</source>
|
||||
<translation>O aplikaci GPXSee</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="293"/>
|
||||
<location filename="../src/gui.cpp" line="269"/>
|
||||
<source>Navigation</source>
|
||||
<translation>Navigace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="317"/>
|
||||
<source>GPX viewer and analyzer</source>
|
||||
<translation>Prohlížeč a analyzátor GPX</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="330"/>
|
||||
<location filename="../src/gui.cpp" line="357"/>
|
||||
<source>Map sources</source>
|
||||
<translation>Mapové zdroje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="342"/>
|
||||
<location filename="../src/gui.cpp" line="369"/>
|
||||
<source>POIs</source>
|
||||
<translation>POI body</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="457"/>
|
||||
<location filename="../src/gui.cpp" line="486"/>
|
||||
<source>Distance</source>
|
||||
<translation>Vzdálenost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="459"/>
|
||||
<location filename="../src/gui.cpp" line="488"/>
|
||||
<source>Time</source>
|
||||
<translation>Čas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="460"/>
|
||||
<location filename="../src/gui.cpp" line="489"/>
|
||||
<source>Ascent</source>
|
||||
<translation>Stoupání</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="461"/>
|
||||
<location filename="../src/gui.cpp" line="463"/>
|
||||
<location filename="../src/gui.cpp" line="465"/>
|
||||
<location filename="../src/gui.cpp" line="467"/>
|
||||
<location filename="../src/gui.cpp" line="490"/>
|
||||
<location filename="../src/gui.cpp" line="492"/>
|
||||
<location filename="../src/gui.cpp" line="494"/>
|
||||
<location filename="../src/gui.cpp" line="496"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="462"/>
|
||||
<location filename="../src/gui.cpp" line="491"/>
|
||||
<source>Descent</source>
|
||||
<translation>Klesání</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="558"/>
|
||||
<location filename="../src/gui.cpp" line="588"/>
|
||||
<source>%1 tracks</source>
|
||||
<translation>Počet tras: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="458"/>
|
||||
<location filename="../src/gui.cpp" line="561"/>
|
||||
<location filename="../src/gui.cpp" line="487"/>
|
||||
<location filename="../src/gui.cpp" line="591"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="398"/>
|
||||
<location filename="../src/gui.cpp" line="413"/>
|
||||
<location filename="../src/gui.cpp" line="427"/>
|
||||
<location filename="../src/gui.cpp" line="442"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="393"/>
|
||||
<location filename="../src/gui.cpp" line="422"/>
|
||||
<source>Error loading GPX file:
|
||||
%1</source>
|
||||
<translation>Soubor GPX nelze otevřít:
|
||||
%1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="409"/>
|
||||
<location filename="../src/gui.cpp" line="438"/>
|
||||
<source>Error loading POI file:
|
||||
%1</source>
|
||||
<translation>Soubor POI nelze otevřít:
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#define APP_NAME "GPXSee"
|
||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||
#define APP_VERSION "2.1"
|
||||
#define APP_VERSION "2.3"
|
||||
|
||||
#define FONT_FAMILY "Arial"
|
||||
#define FONT_SIZE 12
|
||||
|
@ -18,19 +18,23 @@
|
||||
|
||||
Downloader::Downloader()
|
||||
{
|
||||
connect(&manager, SIGNAL(finished(QNetworkReply*)),
|
||||
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
|
||||
SLOT(downloadFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
void Downloader::doDownload(const Download &dl)
|
||||
{
|
||||
QUrl url(dl.url());
|
||||
|
||||
if (_errorDownloads.contains(url))
|
||||
return;
|
||||
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::User, QVariant(dl.file()));
|
||||
request.setRawHeader("User-Agent", USER_AGENT);
|
||||
QNetworkReply *reply = manager.get(request);
|
||||
QNetworkReply *reply = _manager.get(request);
|
||||
|
||||
currentDownloads.append(reply);
|
||||
_currentDownloads.append(reply);
|
||||
}
|
||||
|
||||
bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
|
||||
@ -53,6 +57,7 @@ void Downloader::downloadFinished(QNetworkReply *reply)
|
||||
{
|
||||
QUrl url = reply->url();
|
||||
if (reply->error()) {
|
||||
_errorDownloads.insert(url);
|
||||
fprintf(stderr, "Error downloading map tile: %s: %s\n",
|
||||
url.toEncoded().constData(), qPrintable(reply->errorString()));
|
||||
} else {
|
||||
@ -61,10 +66,10 @@ void Downloader::downloadFinished(QNetworkReply *reply)
|
||||
saveToDisk(filename, reply);
|
||||
}
|
||||
|
||||
currentDownloads.removeAll(reply);
|
||||
_currentDownloads.removeAll(reply);
|
||||
reply->deleteLater();
|
||||
|
||||
if (currentDownloads.isEmpty())
|
||||
if (_currentDownloads.isEmpty())
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
|
||||
|
||||
class Download
|
||||
@ -45,8 +46,9 @@ private:
|
||||
void doDownload(const Download &dl);
|
||||
bool saveToDisk(const QString &filename, QIODevice *data);
|
||||
|
||||
QNetworkAccessManager manager;
|
||||
QList<QNetworkReply *> currentDownloads;
|
||||
QNetworkAccessManager _manager;
|
||||
QList<QNetworkReply *> _currentDownloads;
|
||||
QSet<QUrl> _errorDownloads;
|
||||
};
|
||||
|
||||
#endif // DOWNLOADER_H
|
||||
|
@ -41,6 +41,16 @@ void FileBrowser::setFilter(const QStringList &filter)
|
||||
reloadDirectory(_files.last().canonicalPath());
|
||||
}
|
||||
|
||||
bool FileBrowser::isLast()
|
||||
{
|
||||
return (_files.size() > 0 && _index == _files.size() - 1);
|
||||
}
|
||||
|
||||
bool FileBrowser::isFirst()
|
||||
{
|
||||
return (_files.size() > 0 && _index == 0);
|
||||
}
|
||||
|
||||
QString FileBrowser::next()
|
||||
{
|
||||
if (_index < 0 || _index == _files.size() - 1)
|
||||
@ -57,6 +67,24 @@ QString FileBrowser::prev()
|
||||
return _files.at(--_index).absoluteFilePath();
|
||||
}
|
||||
|
||||
QString FileBrowser::last()
|
||||
{
|
||||
if (_files.empty())
|
||||
return QString();
|
||||
|
||||
_index = _files.size() - 1;
|
||||
return _files.last().absoluteFilePath();
|
||||
}
|
||||
|
||||
QString FileBrowser::first()
|
||||
{
|
||||
if (_files.empty())
|
||||
return QString();
|
||||
|
||||
_index = 0;
|
||||
return _files.first().absoluteFilePath();
|
||||
}
|
||||
|
||||
void FileBrowser::reloadDirectory(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
|
@ -20,6 +20,11 @@ public:
|
||||
|
||||
QString next();
|
||||
QString prev();
|
||||
QString last();
|
||||
QString first();
|
||||
|
||||
bool isLast();
|
||||
bool isFirst();
|
||||
|
||||
private slots:
|
||||
void reloadDirectory(const QString &path);
|
||||
|
126
src/gui.cpp
126
src/gui.cpp
@ -118,6 +118,8 @@ void GUI::createActions()
|
||||
_fileActionGroup->setExclusive(false);
|
||||
_fileActionGroup->setEnabled(false);
|
||||
|
||||
_navigationActionGroup = new QActionGroup(this);
|
||||
_navigationActionGroup->setEnabled(false);
|
||||
|
||||
// General actions
|
||||
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
||||
@ -191,6 +193,22 @@ void GUI::createActions()
|
||||
_showToolbarsAction->setChecked(true);
|
||||
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showToolbars(bool)));
|
||||
|
||||
// Navigation actions
|
||||
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
|
||||
_nextAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_nextAction, SIGNAL(triggered()), this, SLOT(next()));
|
||||
_prevAction = new QAction(QIcon(QPixmap(PREV_FILE_ICON)), tr("Previous"),
|
||||
this);
|
||||
_prevAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_prevAction, SIGNAL(triggered()), this, SLOT(prev()));
|
||||
_lastAction = new QAction(QIcon(QPixmap(LAST_FILE_ICON)), tr("Last"), this);
|
||||
_lastAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_lastAction, SIGNAL(triggered()), this, SLOT(last()));
|
||||
_firstAction = new QAction(QIcon(QPixmap(FIRST_FILE_ICON)), tr("First"),
|
||||
this);
|
||||
_firstAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_firstAction, SIGNAL(triggered()), this, SLOT(first()));
|
||||
}
|
||||
|
||||
void GUI::createMenus()
|
||||
@ -247,6 +265,15 @@ void GUI::createToolBars()
|
||||
#ifdef Q_OS_MAC
|
||||
_showToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_navigationToolBar = addToolBar(tr("Navigation"));
|
||||
_navigationToolBar->addAction(_firstAction);
|
||||
_navigationToolBar->addAction(_prevAction);
|
||||
_navigationToolBar->addAction(_nextAction);
|
||||
_navigationToolBar->addAction(_lastAction);
|
||||
#ifdef Q_OS_MAC
|
||||
_navigationToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void GUI::createTrackView()
|
||||
@ -314,8 +341,10 @@ void GUI::keys()
|
||||
QString("<div><table width=\"300\"><tr><td>") + tr("Next file")
|
||||
+ QString("</td><td><i>SPACE</i></td></tr><tr><td>") + tr("Previous file")
|
||||
+ QString("</td><td><i>BACKSPACE</i></td></tr><tr><td>")
|
||||
+ tr("Append modifier") + QString("</td><td><i>SHIFT</i></td></tr>"
|
||||
"</table></div>"));
|
||||
+ tr("First file") + QString("</td><td><i>HOME</i></td></tr><tr><td>")
|
||||
+ tr("Last file") + QString("</td><td><i>END</i></td></tr><tr><td></td>"
|
||||
"<td></td></tr><tr><td>") + tr("Append modifier")
|
||||
+ QString("</td><td><i>SHIFT</i></td></tr></table></div>"));
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
@ -368,6 +397,8 @@ bool GUI::openFile(const QString &fileName)
|
||||
_browser->setCurrent(fileName);
|
||||
updateStatusBarInfo();
|
||||
_fileActionGroup->setEnabled(true);
|
||||
_navigationActionGroup->setEnabled(true);
|
||||
updateNavigationActions();
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
@ -506,6 +537,7 @@ void GUI::closeFile()
|
||||
_files.clear();
|
||||
|
||||
_fileActionGroup->setEnabled(false);
|
||||
_navigationActionGroup->setEnabled(false);
|
||||
updateStatusBarInfo();
|
||||
}
|
||||
|
||||
@ -535,11 +567,14 @@ void GUI::showToolbars(bool checked)
|
||||
if (checked) {
|
||||
addToolBar(_fileToolBar);
|
||||
addToolBar(_showToolBar);
|
||||
addToolBar(_navigationToolBar);
|
||||
_fileToolBar->show();
|
||||
_showToolBar->show();
|
||||
_navigationToolBar->show();
|
||||
} else {
|
||||
removeToolBar(_fileToolBar);
|
||||
removeToolBar(_showToolBar);
|
||||
removeToolBar(_navigationToolBar);
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,18 +613,97 @@ void GUI::graphChanged(int index)
|
||||
_speedGraph->setSliderPosition(_elevationGraph->sliderPosition());
|
||||
}
|
||||
|
||||
void GUI::updateNavigationActions()
|
||||
{
|
||||
if (_browser->isLast()) {
|
||||
_nextAction->setEnabled(false);
|
||||
_lastAction->setEnabled(false);
|
||||
} else {
|
||||
_nextAction->setEnabled(true);
|
||||
_lastAction->setEnabled(true);
|
||||
}
|
||||
|
||||
if (_browser->isFirst()) {
|
||||
_prevAction->setEnabled(false);
|
||||
_firstAction->setEnabled(false);
|
||||
} else {
|
||||
_prevAction->setEnabled(true);
|
||||
_firstAction->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::next()
|
||||
{
|
||||
QString file = _browser->next();
|
||||
if (file.isNull())
|
||||
return;
|
||||
|
||||
closeFile();
|
||||
openFile(file);
|
||||
|
||||
updateNavigationActions();
|
||||
}
|
||||
|
||||
void GUI::prev()
|
||||
{
|
||||
QString file = _browser->prev();
|
||||
if (file.isNull())
|
||||
return;
|
||||
|
||||
closeFile();
|
||||
openFile(file);
|
||||
|
||||
updateNavigationActions();
|
||||
}
|
||||
|
||||
void GUI::last()
|
||||
{
|
||||
QString file = _browser->last();
|
||||
if (file.isNull())
|
||||
return;
|
||||
|
||||
closeFile();
|
||||
openFile(file);
|
||||
|
||||
updateNavigationActions();
|
||||
}
|
||||
|
||||
void GUI::first()
|
||||
{
|
||||
QString file = _browser->first();
|
||||
if (file.isNull())
|
||||
return;
|
||||
|
||||
closeFile();
|
||||
openFile(file);
|
||||
|
||||
updateNavigationActions();
|
||||
}
|
||||
|
||||
void GUI::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QString file;
|
||||
|
||||
if (event->key() == PREV_KEY)
|
||||
file = _browser->prev();
|
||||
if (event->key() == NEXT_KEY)
|
||||
file = _browser->next();
|
||||
switch (event->key()) {
|
||||
case PREV_KEY:
|
||||
file = _browser->prev();
|
||||
break;
|
||||
case NEXT_KEY:
|
||||
file = _browser->next();
|
||||
break;
|
||||
case FIRST_KEY:
|
||||
file = _browser->first();
|
||||
break;
|
||||
case LAST_KEY:
|
||||
file = _browser->last();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!file.isNull()) {
|
||||
if (!(event->modifiers() & MODIFIER))
|
||||
closeFile();
|
||||
openFile(file);
|
||||
}
|
||||
|
||||
updateNavigationActions();
|
||||
}
|
||||
|
12
src/gui.h
12
src/gui.h
@ -45,6 +45,11 @@ private slots:
|
||||
void mapChanged(int);
|
||||
void graphChanged(int);
|
||||
|
||||
void next();
|
||||
void prev();
|
||||
void last();
|
||||
void first();
|
||||
|
||||
private:
|
||||
void loadFiles();
|
||||
|
||||
@ -59,6 +64,7 @@ private:
|
||||
bool loadFile(const QString &fileName);
|
||||
void saveFile(const QString &fileName);
|
||||
void updateStatusBarInfo();
|
||||
void updateNavigationActions();
|
||||
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
|
||||
@ -70,8 +76,10 @@ private:
|
||||
|
||||
QToolBar *_fileToolBar;
|
||||
QToolBar *_showToolBar;
|
||||
QToolBar *_navigationToolBar;
|
||||
QTabWidget *_trackGraphs;
|
||||
QActionGroup *_fileActionGroup;
|
||||
QActionGroup *_navigationActionGroup;
|
||||
|
||||
QAction *_exitAction;
|
||||
QAction *_keysAction;
|
||||
@ -88,6 +96,10 @@ private:
|
||||
QAction *_showMapAction;
|
||||
QAction *_showGraphsAction;
|
||||
QAction *_showToolbarsAction;
|
||||
QAction *_nextAction;
|
||||
QAction *_prevAction;
|
||||
QAction *_lastAction;
|
||||
QAction *_firstAction;
|
||||
QList<QAction*> _mapActions;
|
||||
|
||||
QLabel *_fileNameLabel;
|
||||
|
@ -12,6 +12,10 @@
|
||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||
#define QUIT_ICON ":/icons/application-exit.png"
|
||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
||||
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
||||
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
||||
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
||||
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#define QT_ICON ":/trolltech/qmessagebox/images/qtlogo-64.png"
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#define NEXT_KEY Qt::Key_Space
|
||||
#define PREV_KEY Qt::Key_Backspace
|
||||
#define FIRST_KEY Qt::Key_Home
|
||||
#define LAST_KEY Qt::Key_End
|
||||
#define MODIFIER Qt::ShiftModifier
|
||||
|
||||
#endif // KEYS_H
|
||||
|
@ -14,10 +14,9 @@ Map::Map(const QString &name, const QString &url)
|
||||
connect(&Downloader::instance(), SIGNAL(finished()), this,
|
||||
SLOT(emitLoaded()));
|
||||
|
||||
if (!QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name)))
|
||||
fprintf(stderr, "Error creating tiles dir: %s\n",
|
||||
qPrintable(QDir::home().absolutePath() + QString("/"TILES_DIR"/%1")
|
||||
.arg(_name)));
|
||||
QString path = QString(TILES_DIR"/") + _name;
|
||||
if (!QDir::home().mkpath(path))
|
||||
fprintf(stderr, "Error creating tiles dir: %s\n", qPrintable(path));
|
||||
}
|
||||
|
||||
void Map::emitLoaded()
|
||||
|
813
src/rtree.h
813
src/rtree.h
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,30 @@ void Track::loadGPX(const GPX &gpx)
|
||||
|
||||
if (_trackPaths.size() > 1 && prevScale != _scale)
|
||||
rescale(_scale);
|
||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||
|
||||
QRectF br = trackBoundingRect();
|
||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||
_scene->setSceneRect(ba);
|
||||
centerOn(ba.center());
|
||||
}
|
||||
|
||||
QRectF Track::trackBoundingRect() const
|
||||
{
|
||||
qreal bottom, top, left, right;
|
||||
|
||||
bottom = _trackPaths.at(0)->sceneBoundingRect().bottom();
|
||||
top = _trackPaths.at(0)->sceneBoundingRect().top();
|
||||
left = _trackPaths.at(0)->sceneBoundingRect().left();
|
||||
right = _trackPaths.at(0)->sceneBoundingRect().right();
|
||||
|
||||
for (int i = 1; i < _trackPaths.size(); i++) {
|
||||
bottom = qMax(bottom, _trackPaths.at(i)->sceneBoundingRect().bottom());
|
||||
top = qMin(top, _trackPaths.at(i)->sceneBoundingRect().top());
|
||||
right = qMax(right, _trackPaths.at(i)->sceneBoundingRect().right());
|
||||
left = qMin(left, _trackPaths.at(i)->sceneBoundingRect().left());
|
||||
}
|
||||
|
||||
return QRectF(QPointF(left, top), QPointF(right, bottom));
|
||||
}
|
||||
|
||||
qreal Track::trackScale() const
|
||||
@ -138,6 +161,9 @@ void Track::loadPOI(const POI &poi)
|
||||
{
|
||||
QHash<Entry, POIItem*>::const_iterator it,jt;
|
||||
|
||||
if (!_tracks.size())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++) {
|
||||
QVector<Entry> p = poi.points(_tracks.at(i));
|
||||
|
||||
@ -162,8 +188,6 @@ void Track::loadPOI(const POI &poi)
|
||||
jt.value()->hide();
|
||||
}
|
||||
}
|
||||
|
||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||
}
|
||||
|
||||
void Track::setMap(Map *map)
|
||||
@ -188,8 +212,16 @@ void Track::wheelEvent(QWheelEvent *event)
|
||||
qMin(_zoom + 1, ZOOM_MAX) : qMax(_zoom - 1, ZOOM_MIN);
|
||||
|
||||
rescale(mapScale());
|
||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||
centerOn(pos * scale/_scale);
|
||||
QRectF br = trackBoundingRect();
|
||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||
_scene->setSceneRect(ba);
|
||||
|
||||
if (br.width() < viewport()->size().width()
|
||||
&& br.height() < viewport()->size().height())
|
||||
centerOn(br.center());
|
||||
else
|
||||
centerOn(pos * scale/_scale);
|
||||
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
@ -210,7 +242,7 @@ void Track::setTrackLineWidth(qreal width)
|
||||
|
||||
void Track::plot(QPainter *painter, const QRectF &target)
|
||||
{
|
||||
QRectF orig = sceneRect();
|
||||
QRectF orig = _scene->itemsBoundingRect();
|
||||
QRectF adj;
|
||||
qreal ratio, diff;
|
||||
|
||||
|
@ -41,6 +41,7 @@ private slots:
|
||||
void redraw();
|
||||
|
||||
private:
|
||||
QRectF trackBoundingRect() const;
|
||||
qreal trackScale() const;
|
||||
qreal mapScale() const;
|
||||
void rescale(qreal scale);
|
||||
|
Reference in New Issue
Block a user