mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Added tooltip info to tracks/waypoints
This commit is contained in:
parent
33b6e8954c
commit
dac06b9537
@ -27,7 +27,6 @@ HEADERS += src/config.h \
|
||||
src/downloader.h \
|
||||
src/units.h \
|
||||
src/scaleitem.h \
|
||||
src/nicenum.h \
|
||||
src/waypoint.h \
|
||||
src/trackview.h \
|
||||
src/track.h \
|
||||
@ -45,7 +44,8 @@ HEADERS += src/config.h \
|
||||
src/fileselectwidget.h \
|
||||
src/margins.h \
|
||||
src/temperaturegraph.h \
|
||||
src/graphtab.h
|
||||
src/graphtab.h \
|
||||
src/misc.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/gui.cpp \
|
||||
src/gpx.cpp \
|
||||
@ -64,7 +64,6 @@ SOURCES += src/main.cpp \
|
||||
src/maplist.cpp \
|
||||
src/downloader.cpp \
|
||||
src/scaleitem.cpp \
|
||||
src/nicenum.cpp \
|
||||
src/trackview.cpp \
|
||||
src/track.cpp \
|
||||
src/graphview.cpp \
|
||||
@ -77,7 +76,8 @@ SOURCES += src/main.cpp \
|
||||
src/exportdialog.cpp \
|
||||
src/fileselectwidget.cpp \
|
||||
src/temperaturegraph.cpp \
|
||||
src/trackpoint.cpp
|
||||
src/trackpoint.cpp \
|
||||
src/misc.cpp
|
||||
RESOURCES += gpxsee.qrc
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||
macx {
|
||||
|
@ -163,338 +163,326 @@
|
||||
<context>
|
||||
<name>GUI</name>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="451"/>
|
||||
<location filename="../src/gui.cpp" line="440"/>
|
||||
<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="515"/>
|
||||
<location filename="../src/gui.cpp" line="504"/>
|
||||
<source>Open file</source>
|
||||
<translation>Otevřít soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="591"/>
|
||||
<location filename="../src/gui.cpp" line="580"/>
|
||||
<source>Open POI file</source>
|
||||
<translation>Otevřít POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="205"/>
|
||||
<location filename="../src/gui.cpp" line="194"/>
|
||||
<source>Open</source>
|
||||
<translation>Otevřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="189"/>
|
||||
<location filename="../src/gui.cpp" line="178"/>
|
||||
<source>Quit</source>
|
||||
<translation>Ukončit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="197"/>
|
||||
<location filename="../src/gui.cpp" line="467"/>
|
||||
<location filename="../src/gui.cpp" line="468"/>
|
||||
<location filename="../src/gui.cpp" line="186"/>
|
||||
<location filename="../src/gui.cpp" line="456"/>
|
||||
<location filename="../src/gui.cpp" line="457"/>
|
||||
<source>Keyboard controls</source>
|
||||
<translation>Ovládací klávesy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="221"/>
|
||||
<location filename="../src/gui.cpp" line="210"/>
|
||||
<source>Close</source>
|
||||
<translation>Zavřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="227"/>
|
||||
<location filename="../src/gui.cpp" line="216"/>
|
||||
<source>Reload</source>
|
||||
<translation>Znovu načíst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="383"/>
|
||||
<location filename="../src/gui.cpp" line="372"/>
|
||||
<source>Show</source>
|
||||
<translation>Zobrazit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="324"/>
|
||||
<location filename="../src/gui.cpp" line="377"/>
|
||||
<location filename="../src/gui.cpp" line="313"/>
|
||||
<location filename="../src/gui.cpp" line="366"/>
|
||||
<source>File</source>
|
||||
<translation>Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="195"/>
|
||||
<location filename="../src/gui.cpp" line="490"/>
|
||||
<location filename="../src/gui.cpp" line="491"/>
|
||||
<location filename="../src/gui.cpp" line="184"/>
|
||||
<location filename="../src/gui.cpp" line="479"/>
|
||||
<location filename="../src/gui.cpp" line="480"/>
|
||||
<source>Data sources</source>
|
||||
<translation>Zdroje dat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="235"/>
|
||||
<location filename="../src/gui.cpp" line="224"/>
|
||||
<source>Load POI file</source>
|
||||
<translation>Nahrát POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="238"/>
|
||||
<location filename="../src/gui.cpp" line="227"/>
|
||||
<source>Close POI files</source>
|
||||
<translation>Zavřit POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="241"/>
|
||||
<location filename="../src/gui.cpp" line="230"/>
|
||||
<source>Show POIs</source>
|
||||
<translation>Zobrazit POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="249"/>
|
||||
<location filename="../src/gui.cpp" line="238"/>
|
||||
<source>Show map</source>
|
||||
<translation>Zobrazit mapu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="255"/>
|
||||
<location filename="../src/gui.cpp" line="244"/>
|
||||
<source>Clear tile cache</source>
|
||||
<translation>Vymazat mezipaměť dlaždic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="264"/>
|
||||
<location filename="../src/gui.cpp" line="268"/>
|
||||
<location filename="../src/gui.cpp" line="477"/>
|
||||
<location filename="../src/gui.cpp" line="253"/>
|
||||
<location filename="../src/gui.cpp" line="257"/>
|
||||
<location filename="../src/gui.cpp" line="466"/>
|
||||
<source>Next map</source>
|
||||
<translation>Následující mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="275"/>
|
||||
<location filename="../src/gui.cpp" line="264"/>
|
||||
<source>Show graphs</source>
|
||||
<translation>Zobrazovat grafy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="281"/>
|
||||
<location filename="../src/gui.cpp" line="270"/>
|
||||
<source>Show toolbars</source>
|
||||
<translation>Zobrazovat nástrojové lišty</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="287"/>
|
||||
<location filename="../src/gui.cpp" line="276"/>
|
||||
<source>Metric</source>
|
||||
<translation>Metrické</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="292"/>
|
||||
<location filename="../src/gui.cpp" line="281"/>
|
||||
<source>Imperial</source>
|
||||
<translation>Imperiální</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="298"/>
|
||||
<location filename="../src/gui.cpp" line="287"/>
|
||||
<source>Fullscreen mode</source>
|
||||
<translation>Celoobrazovkový režim</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="306"/>
|
||||
<location filename="../src/gui.cpp" line="295"/>
|
||||
<source>Next</source>
|
||||
<translation>Následující</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="309"/>
|
||||
<location filename="../src/gui.cpp" line="298"/>
|
||||
<source>Previous</source>
|
||||
<translation>Předchozí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="313"/>
|
||||
<location filename="../src/gui.cpp" line="302"/>
|
||||
<source>Last</source>
|
||||
<translation>Poslední</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="316"/>
|
||||
<location filename="../src/gui.cpp" line="305"/>
|
||||
<source>First</source>
|
||||
<translation>První</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="338"/>
|
||||
<location filename="../src/gui.cpp" line="327"/>
|
||||
<source>Map</source>
|
||||
<translation>Mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="345"/>
|
||||
<location filename="../src/gui.cpp" line="334"/>
|
||||
<source>POI</source>
|
||||
<translation>POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="346"/>
|
||||
<location filename="../src/gui.cpp" line="335"/>
|
||||
<source>POI files</source>
|
||||
<translation>POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="354"/>
|
||||
<location filename="../src/gui.cpp" line="343"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="355"/>
|
||||
<location filename="../src/gui.cpp" line="344"/>
|
||||
<source>Units</source>
|
||||
<translation>Jednotky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="364"/>
|
||||
<location filename="../src/gui.cpp" line="353"/>
|
||||
<source>Help</source>
|
||||
<translation>Nápověda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="479"/>
|
||||
<location filename="../src/gui.cpp" line="468"/>
|
||||
<source>Previous map</source>
|
||||
<translation>Předchozí mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="676"/>
|
||||
<location filename="../src/gui.cpp" line="679"/>
|
||||
<location filename="../src/gui.cpp" line="665"/>
|
||||
<location filename="../src/gui.cpp" line="668"/>
|
||||
<source>Date</source>
|
||||
<translation>Datum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="852"/>
|
||||
<location filename="../src/gui.cpp" line="841"/>
|
||||
<source>No GPX files loaded</source>
|
||||
<translation>Nejsou načteny žádné GPX soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="470"/>
|
||||
<location filename="../src/gui.cpp" line="459"/>
|
||||
<source>Next file</source>
|
||||
<translation>Následující soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="447"/>
|
||||
<location filename="../src/gui.cpp" line="436"/>
|
||||
<source>Version </source>
|
||||
<translation>Verze </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="210"/>
|
||||
<location filename="../src/gui.cpp" line="199"/>
|
||||
<source>Print...</source>
|
||||
<translation>Tisknout...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="215"/>
|
||||
<location filename="../src/gui.cpp" line="204"/>
|
||||
<source>Export to PDF...</source>
|
||||
<translation>Exportovat do PDF...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="471"/>
|
||||
<location filename="../src/gui.cpp" line="460"/>
|
||||
<source>Previous file</source>
|
||||
<translation>Předchozí soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="473"/>
|
||||
<location filename="../src/gui.cpp" line="462"/>
|
||||
<source>First file</source>
|
||||
<translation>První soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="474"/>
|
||||
<location filename="../src/gui.cpp" line="463"/>
|
||||
<source>Last file</source>
|
||||
<translation>Poslední soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="475"/>
|
||||
<location filename="../src/gui.cpp" line="464"/>
|
||||
<source>Append modifier</source>
|
||||
<translation>Modifikátor nahradit/přidat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="494"/>
|
||||
<location filename="../src/gui.cpp" line="483"/>
|
||||
<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="497"/>
|
||||
<location filename="../src/gui.cpp" line="486"/>
|
||||
<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="505"/>
|
||||
<location filename="../src/gui.cpp" line="494"/>
|
||||
<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="516"/>
|
||||
<location filename="../src/gui.cpp" line="505"/>
|
||||
<source>GPX files (*.gpx);;All files (*)</source>
|
||||
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="582"/>
|
||||
<location filename="../src/gui.cpp" line="608"/>
|
||||
<location filename="../src/gui.cpp" line="571"/>
|
||||
<location filename="../src/gui.cpp" line="597"/>
|
||||
<source>Line: %1</source>
|
||||
<translation>Řádka: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="592"/>
|
||||
<location filename="../src/gui.cpp" line="581"/>
|
||||
<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="682"/>
|
||||
<location filename="../src/gui.cpp" line="671"/>
|
||||
<source>Tracks</source>
|
||||
<translation>Počet tras</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="688"/>
|
||||
<location filename="../src/gui.cpp" line="867"/>
|
||||
<location filename="../src/gui.cpp" line="677"/>
|
||||
<source>mi</source>
|
||||
<translation>mi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="864"/>
|
||||
<source>ft</source>
|
||||
<translation>ft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="200"/>
|
||||
<location filename="../src/gui.cpp" line="445"/>
|
||||
<location filename="../src/gui.cpp" line="189"/>
|
||||
<location filename="../src/gui.cpp" line="434"/>
|
||||
<source>About GPXSee</source>
|
||||
<translation>O aplikaci GPXSee</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="387"/>
|
||||
<location filename="../src/gui.cpp" line="376"/>
|
||||
<source>Navigation</source>
|
||||
<translation>Navigace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="493"/>
|
||||
<location filename="../src/gui.cpp" line="482"/>
|
||||
<source>Map sources</source>
|
||||
<translation>Mapové zdroje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="504"/>
|
||||
<location filename="../src/gui.cpp" line="493"/>
|
||||
<source>POIs</source>
|
||||
<translation>POI body</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="687"/>
|
||||
<location filename="../src/gui.cpp" line="690"/>
|
||||
<location filename="../src/gui.cpp" line="676"/>
|
||||
<location filename="../src/gui.cpp" line="679"/>
|
||||
<source>Distance</source>
|
||||
<translation>Vzdálenost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="695"/>
|
||||
<location filename="../src/gui.cpp" line="684"/>
|
||||
<source>Time</source>
|
||||
<translation>Čas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="871"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="859"/>
|
||||
<location filename="../src/gui.cpp" line="848"/>
|
||||
<source>%1 tracks</source>
|
||||
<translation>Počet tras: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="691"/>
|
||||
<location filename="../src/gui.cpp" line="874"/>
|
||||
<location filename="../src/gui.cpp" line="680"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="584"/>
|
||||
<location filename="../src/gui.cpp" line="609"/>
|
||||
<location filename="../src/gui.cpp" line="573"/>
|
||||
<location filename="../src/gui.cpp" line="598"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="579"/>
|
||||
<location filename="../src/gui.cpp" line="568"/>
|
||||
<source>Error loading GPX file:
|
||||
%1</source>
|
||||
<translation>Soubor GPX nelze otevřít:
|
||||
%1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="605"/>
|
||||
<location filename="../src/gui.cpp" line="594"/>
|
||||
<source>Error loading POI file:
|
||||
%1</source>
|
||||
<translation>Soubor POI nelze otevřít:
|
||||
@ -553,21 +541,25 @@
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/misc.cpp" line="57"/>
|
||||
<location filename="../src/scaleitem.cpp" line="81"/>
|
||||
<source>mi</source>
|
||||
<translation>mi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/misc.cpp" line="54"/>
|
||||
<location filename="../src/scaleitem.cpp" line="81"/>
|
||||
<source>ft</source>
|
||||
<translation>ft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/misc.cpp" line="64"/>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/misc.cpp" line="61"/>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
@ -686,4 +678,22 @@
|
||||
<translation>F</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TrackView</name>
|
||||
<message>
|
||||
<location filename="../src/trackview.cpp" line="55"/>
|
||||
<source>Date:</source>
|
||||
<translation>Datum:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/trackview.cpp" line="55"/>
|
||||
<source>Distance:</source>
|
||||
<translation>Vzdálenost:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/trackview.cpp" line="56"/>
|
||||
<source>Time:</source>
|
||||
<translation>Cas:</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <cmath>
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "nicenum.h"
|
||||
#include "misc.h"
|
||||
#include "axisitem.h"
|
||||
|
||||
|
||||
|
30
src/gui.cpp
30
src/gui.cpp
@ -35,21 +35,10 @@
|
||||
#include "cpuarch.h"
|
||||
#include "exportdialog.h"
|
||||
#include "graphtab.h"
|
||||
#include "misc.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
static QString timeSpan(qreal time)
|
||||
{
|
||||
unsigned h, m, s;
|
||||
|
||||
h = time / 3600;
|
||||
m = (time - (h * 3600)) / 60;
|
||||
s = time - (h * 3600) - (m * 60);
|
||||
|
||||
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
||||
.arg(s, 2, 10, QChar('0'));
|
||||
}
|
||||
|
||||
GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
loadMaps();
|
||||
@ -858,21 +847,8 @@ void GUI::updateStatusBarInfo()
|
||||
else
|
||||
_fileNameLabel->setText(tr("%1 tracks").arg(_trackCount));
|
||||
|
||||
if (_imperialUnitsAction->isChecked()) {
|
||||
if (_distance < MIINM)
|
||||
_distanceLabel->setText(QString::number(_distance * M2FT, 'f', 0)
|
||||
+ UNIT_SPACE + tr("ft"));
|
||||
else
|
||||
_distanceLabel->setText(QString::number(_distance * M2MI, 'f', 1)
|
||||
+ UNIT_SPACE + tr("mi"));
|
||||
} else {
|
||||
if (_distance < KMINM)
|
||||
_distanceLabel->setText(QString::number(_distance, 'f', 0)
|
||||
+ UNIT_SPACE + tr("m"));
|
||||
else
|
||||
_distanceLabel->setText(QString::number(_distance * M2KM, 'f', 1)
|
||||
+ UNIT_SPACE + tr("km"));
|
||||
}
|
||||
Units units = _imperialUnitsAction->isChecked() ? Imperial : Metric;
|
||||
_distanceLabel->setText(distance(_distance, units));
|
||||
_timeLabel->setText(timeSpan(_time));
|
||||
}
|
||||
|
||||
|
66
src/misc.cpp
Normal file
66
src/misc.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include <cmath>
|
||||
#include <QObject>
|
||||
#include "misc.h"
|
||||
|
||||
double niceNum(double x, int round)
|
||||
{
|
||||
int expv;
|
||||
double f;
|
||||
double nf;
|
||||
|
||||
expv = (int)floor(log10(x));
|
||||
f = x / pow(10.0, expv);
|
||||
|
||||
if (round) {
|
||||
if (f < 1.5)
|
||||
nf = 1.0;
|
||||
else if (f < 3.0)
|
||||
nf = 2.0;
|
||||
else if (f < 7.0)
|
||||
nf = 5.0;
|
||||
else
|
||||
nf = 10.0;
|
||||
} else {
|
||||
if (f <= 1.0)
|
||||
nf = 1.0;
|
||||
else if (f <= 2.0)
|
||||
nf = 2.0;
|
||||
else if (f <= 5.0)
|
||||
nf = 5.0;
|
||||
else
|
||||
nf = 10.0;
|
||||
}
|
||||
|
||||
return nf * pow(10.0, expv);
|
||||
}
|
||||
|
||||
QString timeSpan(qreal time)
|
||||
{
|
||||
unsigned h, m, s;
|
||||
|
||||
h = time / 3600;
|
||||
m = (time - (h * 3600)) / 60;
|
||||
s = time - (h * 3600) - (m * 60);
|
||||
|
||||
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
||||
.arg(s, 2, 10, QChar('0'));
|
||||
}
|
||||
|
||||
QString distance(qreal value, Units units)
|
||||
{
|
||||
if (units == Imperial) {
|
||||
if (value < MIINM)
|
||||
return QString::number(value * M2FT, 'f', 0)
|
||||
+ UNIT_SPACE + QObject::tr("ft");
|
||||
else
|
||||
return QString::number(value * M2MI, 'f', 1)
|
||||
+ UNIT_SPACE + QObject::tr("mi");
|
||||
} else {
|
||||
if (value < KMINM)
|
||||
return QString::number(value, 'f', 0) + UNIT_SPACE
|
||||
+ QObject::tr("m");
|
||||
else
|
||||
return QString::number(value * M2KM, 'f', 1)
|
||||
+ UNIT_SPACE + QObject::tr("km");
|
||||
}
|
||||
}
|
11
src/misc.h
Normal file
11
src/misc.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#include <QString>
|
||||
#include "units.h"
|
||||
|
||||
double niceNum(double x, int round);
|
||||
QString timeSpan(qreal time);
|
||||
QString distance(qreal value, Units units);
|
||||
|
||||
#endif // MISC_H
|
@ -1,34 +0,0 @@
|
||||
#include <cmath>
|
||||
#include "nicenum.h"
|
||||
|
||||
double niceNum(double x, int round)
|
||||
{
|
||||
int expv;
|
||||
double f;
|
||||
double nf;
|
||||
|
||||
expv = (int)floor(log10(x));
|
||||
f = x / pow(10.0, expv);
|
||||
|
||||
if (round) {
|
||||
if (f < 1.5)
|
||||
nf = 1.0;
|
||||
else if (f < 3.0)
|
||||
nf = 2.0;
|
||||
else if (f < 7.0)
|
||||
nf = 5.0;
|
||||
else
|
||||
nf = 10.0;
|
||||
} else {
|
||||
if (f <= 1.0)
|
||||
nf = 1.0;
|
||||
else if (f <= 2.0)
|
||||
nf = 2.0;
|
||||
else if (f <= 5.0)
|
||||
nf = 5.0;
|
||||
else
|
||||
nf = 10.0;
|
||||
}
|
||||
|
||||
return nf * pow(10.0, expv);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#ifndef NICENUM_H
|
||||
#define NICENUM_H
|
||||
|
||||
double niceNum(double x, int round);
|
||||
|
||||
#endif // NICENUM_H
|
@ -29,8 +29,14 @@ void Parser::handleTrackpointData(TrackpointElement element,
|
||||
|
||||
void Parser::handleWaypointData(WaypointElement element, const QString &value)
|
||||
{
|
||||
if (element == Name)
|
||||
_waypoints.last().setDescription(value);
|
||||
switch (element) {
|
||||
case Name:
|
||||
_waypoints.last().setName(value);
|
||||
break;
|
||||
case Description:
|
||||
_waypoints.last().setDescription(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Parser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
||||
@ -117,6 +123,8 @@ void Parser::waypointData()
|
||||
while (_reader.readNextStartElement()) {
|
||||
if (_reader.name() == "name")
|
||||
handleWaypointData(Name, _reader.readElementText());
|
||||
else if (_reader.name() == "desc")
|
||||
handleWaypointData(Description, _reader.readElementText());
|
||||
else
|
||||
_reader.skipCurrentElement();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ private:
|
||||
Elevation, Time, Geoidheight, Speed, HeartRate, Temperature
|
||||
};
|
||||
enum WaypointElement {
|
||||
Name
|
||||
Name, Description
|
||||
};
|
||||
|
||||
bool parse();
|
||||
|
@ -106,9 +106,14 @@ bool POI::loadCSVFile(const QString &fileName)
|
||||
return false;
|
||||
}
|
||||
QByteArray ba = list[2].trimmed();
|
||||
QString name = QString::fromUtf8(ba.data(), ba.size());
|
||||
QString description;
|
||||
if (list.size() > 3) {
|
||||
ba = list[3].trimmed();
|
||||
description = QString::fromUtf8(ba.data(), ba.size());
|
||||
}
|
||||
|
||||
_data.append(Waypoint(QPointF(lon, lat),
|
||||
QString::fromUtf8(ba.data(), ba.size())));
|
||||
_data.append(Waypoint(QPointF(lon, lat), name, description));
|
||||
ln++;
|
||||
}
|
||||
index.end = _data.size() - 1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "ll.h"
|
||||
#include "nicenum.h"
|
||||
#include "misc.h"
|
||||
#include "scaleitem.h"
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "markeritem.h"
|
||||
#include "scaleitem.h"
|
||||
#include "ll.h"
|
||||
#include "misc.h"
|
||||
#include "trackview.h"
|
||||
|
||||
|
||||
@ -38,6 +39,7 @@ TrackView::TrackView(QWidget *parent)
|
||||
_maxDistance = 0;
|
||||
|
||||
_plot = false;
|
||||
_units = Metric;
|
||||
}
|
||||
|
||||
TrackView::~TrackView()
|
||||
@ -46,7 +48,16 @@ TrackView::~TrackView()
|
||||
delete _mapScale;
|
||||
}
|
||||
|
||||
void TrackView::addTrack(const QVector<QPointF> &track)
|
||||
QString TrackView::toolTip(const TrackInfo &info)
|
||||
{
|
||||
QString date = info.date.date().toString(Qt::SystemLocaleShortDate);
|
||||
|
||||
return "<b>" + tr("Date:") + "</b> " + date + "<br><b>" + tr("Distance:")
|
||||
+ "</b> " + distance(info.distance, _units) + "<br><b>" + tr("Time:")
|
||||
+ "</b> " + timeSpan(info.time);
|
||||
}
|
||||
|
||||
void TrackView::addTrack(const QVector<QPointF> &track, const TrackInfo &info)
|
||||
{
|
||||
QPainterPath path;
|
||||
QGraphicsPathItem *pi;
|
||||
@ -71,12 +82,15 @@ void TrackView::addTrack(const QVector<QPointF> &track)
|
||||
|
||||
pi = new QGraphicsPathItem(path);
|
||||
_paths.append(pi);
|
||||
_info.append(info);
|
||||
_zoom = qMin(_zoom, scale2zoom(trackScale()));
|
||||
_scale = mapScale(_zoom);
|
||||
QBrush brush(_palette.color(), Qt::SolidPattern);
|
||||
QPen pen(brush, TRACK_WIDTH * _scale);
|
||||
pi->setPen(pen);
|
||||
pi->setScale(1.0/_scale);
|
||||
pi->setToolTip(toolTip(info));
|
||||
pi->setCursor(Qt::ArrowCursor);
|
||||
_scene->addItem(pi);
|
||||
|
||||
mi = new MarkerItem(pi);
|
||||
@ -91,7 +105,7 @@ void TrackView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||
const Waypoint &w = waypoints.at(i);
|
||||
WaypointItem *wi = new WaypointItem(
|
||||
Waypoint(ll2mercator(QPointF(w.coordinates().x(),
|
||||
-w.coordinates().y())), w.description()));
|
||||
-w.coordinates().y())), w.name(), w.description()));
|
||||
|
||||
wi->setPos(wi->entry().coordinates() * 1.0/_scale);
|
||||
wi->setZValue(1);
|
||||
@ -111,8 +125,10 @@ void TrackView::loadGPX(const GPX &gpx)
|
||||
|
||||
for (int i = 0; i < gpx.trackCount(); i++) {
|
||||
QVector<QPointF> track;
|
||||
TrackInfo info = {gpx.track(i).date(), gpx.track(i).distance(),
|
||||
gpx.track(i).time()};
|
||||
gpx.track(i).track(track);
|
||||
addTrack(track);
|
||||
addTrack(track, info);
|
||||
_maxDistance = qMax(gpx.track(i).distance(), _maxDistance);
|
||||
}
|
||||
|
||||
@ -263,7 +279,7 @@ void TrackView::addPOI(const QVector<Waypoint> &waypoints)
|
||||
|
||||
WaypointItem *pi = new WaypointItem(
|
||||
Waypoint(ll2mercator(QPointF(w.coordinates().x(),
|
||||
-w.coordinates().y())), w.description()));
|
||||
-w.coordinates().y())), w.name(), w.description()));
|
||||
|
||||
pi->setPos(pi->entry().coordinates() * 1.0/_scale);
|
||||
pi->setZValue(1);
|
||||
@ -304,7 +320,12 @@ void TrackView::setMap(Map *map)
|
||||
|
||||
void TrackView::setUnits(enum Units units)
|
||||
{
|
||||
_units = units;
|
||||
|
||||
_mapScale->setUnits(units);
|
||||
|
||||
for (int i = 0; i < _info.count(); i++)
|
||||
_paths[i]->setToolTip(toolTip(_info.at(i)));
|
||||
}
|
||||
|
||||
void TrackView::redraw()
|
||||
@ -423,6 +444,7 @@ void TrackView::clear()
|
||||
|
||||
_pois.clear();
|
||||
_paths.clear();
|
||||
_info.clear();
|
||||
_locations.clear();
|
||||
_markers.clear();
|
||||
_scene->clear();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QVector>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
#include "units.h"
|
||||
#include "palette.h"
|
||||
#include "waypoint.h"
|
||||
@ -43,10 +44,18 @@ public slots:
|
||||
void redraw();
|
||||
|
||||
private:
|
||||
void addTrack(const QVector<QPointF> &track);
|
||||
struct TrackInfo {
|
||||
QDateTime date;
|
||||
qreal distance;
|
||||
qreal time;
|
||||
};
|
||||
|
||||
void addTrack(const QVector<QPointF> &track, const TrackInfo &info);
|
||||
void addWaypoints(const QList<Waypoint> &waypoints);
|
||||
void addPOI(const QVector<Waypoint> &waypoints);
|
||||
|
||||
QString toolTip(const TrackInfo &info);
|
||||
|
||||
QRectF trackBoundingRect() const;
|
||||
QRectF waypointBoundingRect() const;
|
||||
qreal trackScale() const;
|
||||
@ -64,6 +73,7 @@ private:
|
||||
|
||||
QGraphicsScene *_scene;
|
||||
QList<QGraphicsPathItem*> _paths;
|
||||
QList<TrackInfo> _info;
|
||||
QList<MarkerItem*> _markers;
|
||||
QList<WaypointItem*> _locations;
|
||||
QHash<Waypoint, WaypointItem*> _pois;
|
||||
@ -79,6 +89,7 @@ private:
|
||||
qreal _scale;
|
||||
int _zoom;
|
||||
|
||||
Units _units;
|
||||
bool _plot;
|
||||
};
|
||||
|
||||
|
@ -9,28 +9,33 @@ class Waypoint
|
||||
{
|
||||
public:
|
||||
Waypoint() {}
|
||||
Waypoint(const QPointF &coordinates, const QString &description)
|
||||
: _coordinates(coordinates), _description(description) {}
|
||||
Waypoint(const QPointF &coordinates, const QString &name,
|
||||
const QString &description)
|
||||
: _coordinates(coordinates), _name(name), _description(description) {}
|
||||
|
||||
const QPointF &coordinates() const {return _coordinates;}
|
||||
const QString &name() const {return _name;}
|
||||
const QString &description() const {return _description;}
|
||||
void setCoordinates(const QPointF &coordinates)
|
||||
{_coordinates = coordinates;}
|
||||
void setName(const QString &name)
|
||||
{_name = name;}
|
||||
void setDescription(const QString &description)
|
||||
{_description = description;}
|
||||
|
||||
bool operator==(const Waypoint &other) const
|
||||
{return this->_description == other._description
|
||||
{return this->_name == other._name
|
||||
&& this->_coordinates == other._coordinates;}
|
||||
|
||||
private:
|
||||
QPointF _coordinates;
|
||||
QString _name;
|
||||
QString _description;
|
||||
};
|
||||
|
||||
inline uint qHash(const Waypoint &key)
|
||||
{
|
||||
return ::qHash(key.description());
|
||||
return ::qHash(key.name());
|
||||
}
|
||||
|
||||
#endif // WAYPOINT_H
|
||||
|
@ -10,6 +10,11 @@ WaypointItem::WaypointItem(const Waypoint &entry, QGraphicsItem *parent)
|
||||
{
|
||||
_entry = entry;
|
||||
updateBoundingRect();
|
||||
|
||||
if (!entry.description().isEmpty()) {
|
||||
setToolTip(entry.description());
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointItem::updateBoundingRect()
|
||||
@ -18,14 +23,14 @@ void WaypointItem::updateBoundingRect()
|
||||
font.setPixelSize(FONT_SIZE);
|
||||
font.setFamily(FONT_FAMILY);
|
||||
QFontMetrics fm(font);
|
||||
QRect ts = fm.tightBoundingRect(_entry.description());
|
||||
QRect ts = fm.tightBoundingRect(_entry.name());
|
||||
|
||||
_boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, ts.width()
|
||||
+ POINT_SIZE, ts.height() + fm.descent() + POINT_SIZE);
|
||||
}
|
||||
|
||||
void WaypointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
void WaypointItem::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
@ -33,11 +38,11 @@ void WaypointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
font.setPixelSize(FONT_SIZE);
|
||||
font.setFamily(FONT_FAMILY);
|
||||
QFontMetrics fm(font);
|
||||
QRect ts = fm.tightBoundingRect(_entry.description());
|
||||
QRect ts = fm.tightBoundingRect(_entry.name());
|
||||
|
||||
painter->setFont(font);
|
||||
painter->drawText(POINT_SIZE/2 - qMax(ts.x(), 0), POINT_SIZE/2 + ts.height(),
|
||||
_entry.description());
|
||||
_entry.name());
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->drawEllipse(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE, POINT_SIZE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user