mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-07 16:02:51 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
30e78591c5 | |||
a26b1257b2 | |||
97a9dadd39 | |||
6acbf0d89f | |||
9941faa218 | |||
e7edd5c3c3 | |||
16cce5abd0 | |||
c2391929d3 | |||
5bd4999205 | |||
d8068ad994 | |||
6659e2ffa7 | |||
141226b509 | |||
4a2c7b19fb | |||
3bba3d6cd7 | |||
0374e59bce | |||
69c62ffdc3 | |||
b195993164 | |||
b2672a982a | |||
4d10a8d5d5 | |||
22b84cc6cd | |||
ba9319d7f6 | |||
7ac94588c8 | |||
1b358bde3c |
@ -63,7 +63,7 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
; Write the uninstall keys for Windows
|
; Write the uninstall keys for Windows
|
||||||
WriteRegStr HKCU "${REGENTRY}" "DisplayName" "GPXSee"
|
WriteRegStr HKCU "${REGENTRY}" "DisplayName" "GPXSee"
|
||||||
WriteRegStr HKCU "${REGENTRY}" "Publisher" "Martin Tuma"
|
WriteRegStr HKCU "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||||
WriteRegStr HKCU "${REGENTRY}" "DisplayVersion" "2.2"
|
WriteRegStr HKCU "${REGENTRY}" "DisplayVersion" "2.6"
|
||||||
WriteRegStr HKCU "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
WriteRegStr HKCU "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
WriteRegDWORD HKCU "${REGENTRY}" "NoModify" 1
|
WriteRegDWORD HKCU "${REGENTRY}" "NoModify" 1
|
||||||
WriteRegDWORD HKCU "${REGENTRY}" "NoRepair" 1
|
WriteRegDWORD HKCU "${REGENTRY}" "NoRepair" 1
|
||||||
|
@ -27,7 +27,10 @@ HEADERS += src/config.h \
|
|||||||
src/filebrowser.h \
|
src/filebrowser.h \
|
||||||
src/map.h \
|
src/map.h \
|
||||||
src/maplist.h \
|
src/maplist.h \
|
||||||
src/downloader.h
|
src/downloader.h \
|
||||||
|
src/units.h \
|
||||||
|
src/scaleitem.h \
|
||||||
|
src/nicenum.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/gpx.cpp \
|
src/gpx.cpp \
|
||||||
@ -48,7 +51,9 @@ SOURCES += src/main.cpp \
|
|||||||
src/filebrowser.cpp \
|
src/filebrowser.cpp \
|
||||||
src/map.cpp \
|
src/map.cpp \
|
||||||
src/maplist.cpp \
|
src/maplist.cpp \
|
||||||
src/downloader.cpp
|
src/downloader.cpp \
|
||||||
|
src/scaleitem.cpp \
|
||||||
|
src/nicenum.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||||
macx:ICON = icons/gpxsee.icns
|
macx:ICON = icons/gpxsee.icns
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
<file>icons/application-exit.png</file>
|
<file>icons/application-exit.png</file>
|
||||||
<file>icons/applications-internet.png</file>
|
<file>icons/applications-internet.png</file>
|
||||||
<file>icons/view-refresh.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>
|
<file>lang/gpxsee_cs.qm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</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 |
@ -15,31 +15,43 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="15"/>
|
<location filename="../src/elevationgraph.cpp" line="15"/>
|
||||||
|
<location filename="../src/elevationgraph.cpp" line="81"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation>km</translation>
|
<translation>km</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="16"/>
|
<location filename="../src/elevationgraph.cpp" line="16"/>
|
||||||
|
<location filename="../src/elevationgraph.cpp" line="82"/>
|
||||||
<source>m</source>
|
<source>m</source>
|
||||||
<translation>m</translation>
|
<translation>m</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="52"/>
|
<location filename="../src/elevationgraph.cpp" line="22"/>
|
||||||
<source>Ascent</source>
|
<source>Ascent</source>
|
||||||
<translation>Stoupání</translation>
|
<translation>Stoupání</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="54"/>
|
<location filename="../src/elevationgraph.cpp" line="24"/>
|
||||||
<source>Descent</source>
|
<source>Descent</source>
|
||||||
<translation>Klesání</translation>
|
<translation>Klesání</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="58"/>
|
<location filename="../src/elevationgraph.cpp" line="28"/>
|
||||||
<source>Minimum</source>
|
<source>Minimum</source>
|
||||||
<translation>Minimum</translation>
|
<translation>Minimum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/elevationgraph.cpp" line="56"/>
|
<location filename="../src/elevationgraph.cpp" line="86"/>
|
||||||
|
<source>mi</source>
|
||||||
|
<translation>mi</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/elevationgraph.cpp" line="87"/>
|
||||||
|
<source>ft</source>
|
||||||
|
<translation>ft</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/elevationgraph.cpp" line="26"/>
|
||||||
<source>Maximum</source>
|
<source>Maximum</source>
|
||||||
<translation>Maximum</translation>
|
<translation>Maximum</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -47,256 +59,326 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GUI</name>
|
<name>GUI</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="135"/>
|
<location filename="../src/gui.cpp" line="137"/>
|
||||||
<source>About Qt</source>
|
<source>About Qt</source>
|
||||||
<translation>O Qt</translation>
|
<translation>O Qt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="295"/>
|
<location filename="../src/gui.cpp" line="339"/>
|
||||||
<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>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="354"/>
|
<location filename="../src/gui.cpp" line="400"/>
|
||||||
<source>Open file</source>
|
<source>Open file</source>
|
||||||
<translation>Otevřít soubor</translation>
|
<translation>Otevřít soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="149"/>
|
<location filename="../src/gui.cpp" line="151"/>
|
||||||
<source>Save as</source>
|
<source>Save as</source>
|
||||||
<translation>Uložit jako</translation>
|
<translation>Uložit jako</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="405"/>
|
<location filename="../src/gui.cpp" line="455"/>
|
||||||
<source>Open POI file</source>
|
<source>Open POI file</source>
|
||||||
<translation>Otevřít POI soubor</translation>
|
<translation>Otevřít POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="140"/>
|
<location filename="../src/gui.cpp" line="142"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>Otevřít</translation>
|
<translation>Otevřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="123"/>
|
<location filename="../src/gui.cpp" line="125"/>
|
||||||
<source>Quit</source>
|
<source>Quit</source>
|
||||||
<translation>Ukončit</translation>
|
<translation>Ukončit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="130"/>
|
<location filename="../src/gui.cpp" line="132"/>
|
||||||
<location filename="../src/gui.cpp" line="311"/>
|
<location filename="../src/gui.cpp" line="355"/>
|
||||||
<location filename="../src/gui.cpp" line="312"/>
|
<location filename="../src/gui.cpp" line="356"/>
|
||||||
<source>Keyboard controls</source>
|
<source>Keyboard controls</source>
|
||||||
<translation>Ovládací klávesy</translation>
|
<translation>Ovládací klávesy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="144"/>
|
<location filename="../src/gui.cpp" line="146"/>
|
||||||
<source>Save</source>
|
<source>Save</source>
|
||||||
<translation>Uložit</translation>
|
<translation>Uložit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="154"/>
|
<location filename="../src/gui.cpp" line="156"/>
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<translation>Zavřít</translation>
|
<translation>Zavřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="159"/>
|
<location filename="../src/gui.cpp" line="161"/>
|
||||||
<source>Reload</source>
|
<source>Reload</source>
|
||||||
<translation>Znovu načíst</translation>
|
<translation>Znovu načíst</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="244"/>
|
<location filename="../src/gui.cpp" line="279"/>
|
||||||
<source>Show</source>
|
<source>Show</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="198"/>
|
<location filename="../src/gui.cpp" line="229"/>
|
||||||
<location filename="../src/gui.cpp" line="235"/>
|
<location filename="../src/gui.cpp" line="270"/>
|
||||||
<source>File</source>
|
<source>File</source>
|
||||||
<translation>Soubor</translation>
|
<translation>Soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="128"/>
|
<location filename="../src/gui.cpp" line="130"/>
|
||||||
<location filename="../src/gui.cpp" line="327"/>
|
<location filename="../src/gui.cpp" line="373"/>
|
||||||
<location filename="../src/gui.cpp" line="328"/>
|
<location filename="../src/gui.cpp" line="374"/>
|
||||||
<source>Data sources</source>
|
<source>Data sources</source>
|
||||||
<translation>Zdroje dat</translation>
|
<translation>Zdroje dat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="166"/>
|
<location filename="../src/gui.cpp" line="168"/>
|
||||||
<source>Load POI file</source>
|
<source>Load POI file</source>
|
||||||
<translation>Nahrát POI soubor</translation>
|
<translation>Nahrát POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="169"/>
|
<location filename="../src/gui.cpp" line="171"/>
|
||||||
<source>Show POIs</source>
|
<source>Show POIs</source>
|
||||||
<translation>Zobrazit POI</translation>
|
<translation>Zobrazit POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="174"/>
|
<location filename="../src/gui.cpp" line="176"/>
|
||||||
<source>Show map</source>
|
<source>Show map</source>
|
||||||
<translation>Zobrazit mapu</translation>
|
<translation>Zobrazit mapu</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="184"/>
|
<location filename="../src/gui.cpp" line="186"/>
|
||||||
<source>Show graphs</source>
|
<source>Show graphs</source>
|
||||||
<translation>Zobrazovat grafy</translation>
|
<translation>Zobrazovat grafy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="189"/>
|
<location filename="../src/gui.cpp" line="191"/>
|
||||||
<source>Show toolbars</source>
|
<source>Show toolbars</source>
|
||||||
<translation>Zobrazovat nástrojové lišty</translation>
|
<translation>Zobrazovat nástrojové lišty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="212"/>
|
<location filename="../src/gui.cpp" line="198"/>
|
||||||
|
<source>Metric</source>
|
||||||
|
<translation>Metrické</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="204"/>
|
||||||
|
<source>Imperial</source>
|
||||||
|
<translation>Imperiální</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="211"/>
|
||||||
|
<source>Next</source>
|
||||||
|
<translation>Následující</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="214"/>
|
||||||
|
<source>Previous</source>
|
||||||
|
<translation>Předchozí</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="218"/>
|
||||||
|
<source>Last</source>
|
||||||
|
<translation>Poslední</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="221"/>
|
||||||
|
<source>First</source>
|
||||||
|
<translation>První</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="243"/>
|
||||||
<source>Map</source>
|
<source>Map</source>
|
||||||
<translation>Mapa</translation>
|
<translation>Mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="217"/>
|
<location filename="../src/gui.cpp" line="248"/>
|
||||||
<source>POI</source>
|
<source>POI</source>
|
||||||
<translation>POI</translation>
|
<translation>POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="221"/>
|
<location filename="../src/gui.cpp" line="252"/>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Nastavení</translation>
|
<translation>Nastavení</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="225"/>
|
<location filename="../src/gui.cpp" line="253"/>
|
||||||
|
<source>Units</source>
|
||||||
|
<translation>Jednotky</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="260"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation>Nápověda</translation>
|
<translation>Nápověda</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="263"/>
|
<location filename="../src/gui.cpp" line="307"/>
|
||||||
<source>Elevation</source>
|
<source>Elevation</source>
|
||||||
<translation>Výška</translation>
|
<translation>Výška</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="264"/>
|
<location filename="../src/gui.cpp" line="308"/>
|
||||||
<source>Speed</source>
|
<source>Speed</source>
|
||||||
<translation>Rychlost</translation>
|
<translation>Rychlost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="314"/>
|
<location filename="../src/gui.cpp" line="358"/>
|
||||||
<source>Next file</source>
|
<source>Next file</source>
|
||||||
<translation>Následující soubor</translation>
|
<translation>Následující soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="315"/>
|
<location filename="../src/gui.cpp" line="359"/>
|
||||||
<source>Previous file</source>
|
<source>Previous file</source>
|
||||||
<translation>Předchozí soubor</translation>
|
<translation>Předchozí soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="317"/>
|
<location filename="../src/gui.cpp" line="361"/>
|
||||||
|
<source>First file</source>
|
||||||
|
<translation>První soubor</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="362"/>
|
||||||
|
<source>Last file</source>
|
||||||
|
<translation>Poslední soubor</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="363"/>
|
||||||
<source>Append modifier</source>
|
<source>Append modifier</source>
|
||||||
<translation>Modifikátor nahradit/přidat</translation>
|
<translation>Modifikátor nahradit/přidat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="331"/>
|
<location filename="../src/gui.cpp" line="377"/>
|
||||||
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
|
<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>
|
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="335"/>
|
<location filename="../src/gui.cpp" line="381"/>
|
||||||
<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>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="343"/>
|
<location filename="../src/gui.cpp" line="389"/>
|
||||||
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="396"/>
|
<location filename="../src/gui.cpp" line="446"/>
|
||||||
<location filename="../src/gui.cpp" line="412"/>
|
<location filename="../src/gui.cpp" line="462"/>
|
||||||
<source>Line: %1</source>
|
<source>Line: %1</source>
|
||||||
<translation>Řádka: %1</translation>
|
<translation>Řádka: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="464"/>
|
<location filename="../src/gui.cpp" line="509"/>
|
||||||
|
<location filename="../src/gui.cpp" line="629"/>
|
||||||
|
<source>mi</source>
|
||||||
|
<translation>mi</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="512"/>
|
||||||
|
<location filename="../src/gui.cpp" line="514"/>
|
||||||
|
<location filename="../src/gui.cpp" line="516"/>
|
||||||
|
<location filename="../src/gui.cpp" line="518"/>
|
||||||
|
<source>ft</source>
|
||||||
|
<translation>ft</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="515"/>
|
||||||
|
<location filename="../src/gui.cpp" line="527"/>
|
||||||
<source>Maximum</source>
|
<source>Maximum</source>
|
||||||
<translation>Maximum</translation>
|
<translation>Maximum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="466"/>
|
<location filename="../src/gui.cpp" line="517"/>
|
||||||
|
<location filename="../src/gui.cpp" line="529"/>
|
||||||
<source>Minimum</source>
|
<source>Minimum</source>
|
||||||
<translation>Minimum</translation>
|
<translation>Minimum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="133"/>
|
<location filename="../src/gui.cpp" line="135"/>
|
||||||
<location filename="../src/gui.cpp" line="291"/>
|
<location filename="../src/gui.cpp" line="335"/>
|
||||||
<source>About GPXSee</source>
|
<source>About GPXSee</source>
|
||||||
<translation>O aplikaci GPXSee</translation>
|
<translation>O aplikaci GPXSee</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="293"/>
|
<location filename="../src/gui.cpp" line="286"/>
|
||||||
|
<source>Navigation</source>
|
||||||
|
<translation>Navigace</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="337"/>
|
||||||
<source>GPX viewer and analyzer</source>
|
<source>GPX viewer and analyzer</source>
|
||||||
<translation>Prohlížeč a analyzátor GPX</translation>
|
<translation>Prohlížeč a analyzátor GPX</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="330"/>
|
<location filename="../src/gui.cpp" line="376"/>
|
||||||
<source>Map sources</source>
|
<source>Map sources</source>
|
||||||
<translation>Mapové zdroje</translation>
|
<translation>Mapové zdroje</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="342"/>
|
<location filename="../src/gui.cpp" line="388"/>
|
||||||
<source>POIs</source>
|
<source>POIs</source>
|
||||||
<translation>POI body</translation>
|
<translation>POI body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="457"/>
|
<location filename="../src/gui.cpp" line="508"/>
|
||||||
|
<location filename="../src/gui.cpp" line="520"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="459"/>
|
<location filename="../src/gui.cpp" line="510"/>
|
||||||
|
<location filename="../src/gui.cpp" line="522"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="460"/>
|
<location filename="../src/gui.cpp" line="511"/>
|
||||||
|
<location filename="../src/gui.cpp" line="523"/>
|
||||||
<source>Ascent</source>
|
<source>Ascent</source>
|
||||||
<translation>Stoupání</translation>
|
<translation>Stoupání</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="461"/>
|
<location filename="../src/gui.cpp" line="524"/>
|
||||||
<location filename="../src/gui.cpp" line="463"/>
|
<location filename="../src/gui.cpp" line="526"/>
|
||||||
<location filename="../src/gui.cpp" line="465"/>
|
<location filename="../src/gui.cpp" line="528"/>
|
||||||
<location filename="../src/gui.cpp" line="467"/>
|
<location filename="../src/gui.cpp" line="530"/>
|
||||||
<source>m</source>
|
<source>m</source>
|
||||||
<translation>m</translation>
|
<translation>m</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="462"/>
|
<location filename="../src/gui.cpp" line="513"/>
|
||||||
|
<location filename="../src/gui.cpp" line="525"/>
|
||||||
<source>Descent</source>
|
<source>Descent</source>
|
||||||
<translation>Klesání</translation>
|
<translation>Klesání</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="558"/>
|
<location filename="../src/gui.cpp" line="625"/>
|
||||||
<source>%1 tracks</source>
|
<source>%1 tracks</source>
|
||||||
<translation>Počet tras: %1</translation>
|
<translation>Počet tras: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="458"/>
|
<location filename="../src/gui.cpp" line="521"/>
|
||||||
<location filename="../src/gui.cpp" line="561"/>
|
<location filename="../src/gui.cpp" line="632"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation>km</translation>
|
<translation>km</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="398"/>
|
<location filename="../src/gui.cpp" line="448"/>
|
||||||
<location filename="../src/gui.cpp" line="413"/>
|
<location filename="../src/gui.cpp" line="463"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>Chyba</translation>
|
<translation>Chyba</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="393"/>
|
<location filename="../src/gui.cpp" line="443"/>
|
||||||
<source>Error loading GPX file:
|
<source>Error loading GPX file:
|
||||||
%1</source>
|
%1</source>
|
||||||
<translation>Soubor GPX nelze otevřít:
|
<translation>Soubor GPX nelze otevřít:
|
||||||
%1</translation>
|
%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="409"/>
|
<location filename="../src/gui.cpp" line="459"/>
|
||||||
<source>Error loading POI file:
|
<source>Error loading POI file:
|
||||||
%1</source>
|
%1</source>
|
||||||
<translation>Soubor POI nelze otevřít:
|
<translation>Soubor POI nelze otevřít:
|
||||||
@ -317,23 +399,35 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/speedgraph.cpp" line="11"/>
|
<location filename="../src/speedgraph.cpp" line="11"/>
|
||||||
|
<location filename="../src/speedgraph.cpp" line="70"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/speedgraph.cpp" line="12"/>
|
<location filename="../src/speedgraph.cpp" line="12"/>
|
||||||
|
<location filename="../src/speedgraph.cpp" line="71"/>
|
||||||
<source>km/h</source>
|
<source>km/h</source>
|
||||||
<translation>km/h</translation>
|
<translation>km/h</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/speedgraph.cpp" line="35"/>
|
<location filename="../src/speedgraph.cpp" line="20"/>
|
||||||
<source>Average</source>
|
<source>Average</source>
|
||||||
<translation>Průměr</translation>
|
<translation>Průměr</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/speedgraph.cpp" line="37"/>
|
<location filename="../src/speedgraph.cpp" line="22"/>
|
||||||
<source>Maximum</source>
|
<source>Maximum</source>
|
||||||
<translation>Maximum</translation>
|
<translation>Maximum</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/speedgraph.cpp" line="75"/>
|
||||||
|
<source>mi</source>
|
||||||
|
<translation>mi</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/speedgraph.cpp" line="76"/>
|
||||||
|
<source>mi/h</source>
|
||||||
|
<translation>mi/h</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "nicenum.h"
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
|
|
||||||
|
|
||||||
@ -15,38 +16,6 @@ struct Label {
|
|||||||
double d;
|
double d;
|
||||||
};
|
};
|
||||||
|
|
||||||
static double niceNum(double x, int round)
|
|
||||||
{
|
|
||||||
int expv;
|
|
||||||
double f;
|
|
||||||
double nf;
|
|
||||||
|
|
||||||
expv = 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.;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct Label label(double min, double max, int ticks)
|
static struct Label label(double min, double max, int ticks)
|
||||||
{
|
{
|
||||||
double range;
|
double range;
|
||||||
@ -123,7 +92,6 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FONT_SIZE);
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
painter->setFont(font);
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
QRect ts, ls;
|
QRect ts, ls;
|
||||||
struct Label l;
|
struct Label l;
|
||||||
@ -131,6 +99,8 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
qreal val;
|
qreal val;
|
||||||
|
|
||||||
|
|
||||||
|
painter->setFont(font);
|
||||||
|
|
||||||
ls = fm.tightBoundingRect(_label);
|
ls = fm.tightBoundingRect(_label);
|
||||||
|
|
||||||
if (_type == X) {
|
if (_type == X) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define APP_NAME "GPXSee"
|
#define APP_NAME "GPXSee"
|
||||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||||
#define APP_VERSION "2.2"
|
#define APP_VERSION "2.6"
|
||||||
|
|
||||||
#define FONT_FAMILY "Arial"
|
#define FONT_FAMILY "Arial"
|
||||||
#define FONT_SIZE 12
|
#define FONT_SIZE 12
|
||||||
|
@ -14,7 +14,19 @@ ElevationGraph::ElevationGraph(QWidget *parent) : Graph(parent)
|
|||||||
Graph::setYLabel(tr("Elevation"));
|
Graph::setYLabel(tr("Elevation"));
|
||||||
Graph::setXUnits(tr("km"));
|
Graph::setXUnits(tr("km"));
|
||||||
Graph::setYUnits(tr("m"));
|
Graph::setYUnits(tr("m"));
|
||||||
Graph::setXScale(0.001);
|
Graph::setXScale(M2KM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::addInfo()
|
||||||
|
{
|
||||||
|
Graph::addInfo(tr("Ascent"), QString::number(_ascent * _yScale, 'f', 0)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
|
Graph::addInfo(tr("Descent"), QString::number(_descent * _yScale, 'f', 0)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
|
Graph::addInfo(tr("Maximum"), QString::number(_max * _yScale, 'f', 0)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
|
Graph::addInfo(tr("Minimum"), QString::number(_min * _yScale, 'f', 0)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadGPX(const GPX &gpx)
|
void ElevationGraph::loadGPX(const GPX &gpx)
|
||||||
@ -49,16 +61,8 @@ void ElevationGraph::loadGPX(const GPX &gpx)
|
|||||||
_max = qMax(_max, max);
|
_max = qMax(_max, max);
|
||||||
_min = qMin(_min, min);
|
_min = qMin(_min, min);
|
||||||
|
|
||||||
addInfo(tr("Ascent"), QString::number(_ascent, 'f', 0)
|
addInfo();
|
||||||
+ THIN_SPACE + _yUnits);
|
loadData(data);
|
||||||
addInfo(tr("Descent"), QString::number(_descent, 'f', 0)
|
|
||||||
+ THIN_SPACE + _yUnits);
|
|
||||||
addInfo(tr("Maximum"), QString::number(_max, 'f', 0)
|
|
||||||
+ THIN_SPACE + _yUnits);
|
|
||||||
addInfo(tr("Minimum"), QString::number(_min, 'f', 0)
|
|
||||||
+ THIN_SPACE + _yUnits);
|
|
||||||
|
|
||||||
Graph::loadData(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::clear()
|
void ElevationGraph::clear()
|
||||||
@ -70,3 +74,23 @@ void ElevationGraph::clear()
|
|||||||
|
|
||||||
Graph::clear();
|
Graph::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::setUnits(enum Units units)
|
||||||
|
{
|
||||||
|
if (units == Metric) {
|
||||||
|
Graph::setXUnits(tr("km"));
|
||||||
|
Graph::setYUnits(tr("m"));
|
||||||
|
Graph::setXScale(M2KM);
|
||||||
|
Graph::setYScale(1);
|
||||||
|
} else {
|
||||||
|
Graph::setXUnits(tr("mi"));
|
||||||
|
Graph::setYUnits(tr("ft"));
|
||||||
|
Graph::setXScale(M2MI);
|
||||||
|
Graph::setYScale(M2FT);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearInfo();
|
||||||
|
addInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "gpx.h"
|
#include "gpx.h"
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
class ElevationGraph : public Graph
|
class ElevationGraph : public Graph
|
||||||
{
|
{
|
||||||
@ -13,6 +14,7 @@ public:
|
|||||||
|
|
||||||
void loadGPX(const GPX &gpx);
|
void loadGPX(const GPX &gpx);
|
||||||
void clear();
|
void clear();
|
||||||
|
void setUnits(enum Units units);
|
||||||
|
|
||||||
qreal ascent() const {return _ascent;}
|
qreal ascent() const {return _ascent;}
|
||||||
qreal descent() const {return _descent;}
|
qreal descent() const {return _descent;}
|
||||||
@ -20,6 +22,8 @@ public:
|
|||||||
qreal min() const {return _min;}
|
qreal min() const {return _min;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addInfo();
|
||||||
|
|
||||||
qreal _ascent, _descent;
|
qreal _ascent, _descent;
|
||||||
qreal _max, _min;
|
qreal _max, _min;
|
||||||
};
|
};
|
||||||
|
@ -41,6 +41,16 @@ void FileBrowser::setFilter(const QStringList &filter)
|
|||||||
reloadDirectory(_files.last().canonicalPath());
|
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()
|
QString FileBrowser::next()
|
||||||
{
|
{
|
||||||
if (_index < 0 || _index == _files.size() - 1)
|
if (_index < 0 || _index == _files.size() - 1)
|
||||||
@ -57,6 +67,24 @@ QString FileBrowser::prev()
|
|||||||
return _files.at(--_index).absoluteFilePath();
|
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)
|
void FileBrowser::reloadDirectory(const QString &path)
|
||||||
{
|
{
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
|
@ -20,6 +20,11 @@ public:
|
|||||||
|
|
||||||
QString next();
|
QString next();
|
||||||
QString prev();
|
QString prev();
|
||||||
|
QString last();
|
||||||
|
QString first();
|
||||||
|
|
||||||
|
bool isLast();
|
||||||
|
bool isFirst();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void reloadDirectory(const QString &path);
|
void reloadDirectory(const QString &path);
|
||||||
|
@ -116,6 +116,16 @@ void Graph::setYUnits(const QString &units)
|
|||||||
createYLabel();
|
createYLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Graph::setXScale(qreal scale)
|
||||||
|
{
|
||||||
|
_xScale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graph::setYScale(qreal scale)
|
||||||
|
{
|
||||||
|
_yScale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
void Graph::loadData(const QVector<QPointF> &data)
|
void Graph::loadData(const QVector<QPointF> &data)
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
@ -143,7 +153,13 @@ void Graph::loadData(const QVector<QPointF> &data)
|
|||||||
if (_graphs.size() > 1)
|
if (_graphs.size() > 1)
|
||||||
_sliderInfo->hide();
|
_sliderInfo->hide();
|
||||||
|
|
||||||
resize(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graph::redraw()
|
||||||
|
{
|
||||||
|
if (!_graphs.isEmpty())
|
||||||
|
resize(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph::resize(const QSizeF &size)
|
void Graph::resize(const QSizeF &size)
|
||||||
@ -187,10 +203,17 @@ void Graph::resize(const QSizeF &size)
|
|||||||
_scene->addItem(_xAxis);
|
_scene->addItem(_xAxis);
|
||||||
_scene->addItem(_yAxis);
|
_scene->addItem(_yAxis);
|
||||||
|
|
||||||
|
qreal sp = (_slider->pos().x() == _slider->area().left())
|
||||||
|
? 0 : (_slider->pos().x() - _slider->area().left())
|
||||||
|
/ _slider->area().width();
|
||||||
_slider->setArea(r);
|
_slider->setArea(r);
|
||||||
_slider->setPos(r.bottomLeft());
|
_slider->setPos(QPointF(sp * r.width(), r.bottom()));
|
||||||
_scene->addItem(_slider);
|
_scene->addItem(_slider);
|
||||||
|
|
||||||
|
const QPainterPath &path = _graphs.at(0)->path();
|
||||||
|
QPointF p = path.pointAtPercent(sp);
|
||||||
|
_sliderInfo->setText(QString::number(-p.y() * _yScale, 'f', _precision));
|
||||||
|
|
||||||
r = _scene->itemsBoundingRect();
|
r = _scene->itemsBoundingRect();
|
||||||
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
||||||
- _info->boundingRect().width()/2, -_info->boundingRect().height()));
|
- _info->boundingRect().width()/2, -_info->boundingRect().height()));
|
||||||
@ -202,7 +225,7 @@ void Graph::resize(const QSizeF &size)
|
|||||||
void Graph::resizeEvent(QResizeEvent *)
|
void Graph::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
if (!_graphs.empty())
|
if (!_graphs.empty())
|
||||||
resize(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graph::plot(QPainter *painter, const QRectF &target)
|
void Graph::plot(QPainter *painter, const QRectF &target)
|
||||||
@ -214,7 +237,7 @@ void Graph::plot(QPainter *painter, const QRectF &target)
|
|||||||
resize(canvas);
|
resize(canvas);
|
||||||
_slider->hide();
|
_slider->hide();
|
||||||
_info->hide();
|
_info->hide();
|
||||||
_scene->render(painter, target, QRectF(), Qt::KeepAspectRatioByExpanding);
|
_scene->render(painter, target, QRectF());
|
||||||
_slider->show();
|
_slider->show();
|
||||||
_info->show();
|
_info->show();
|
||||||
resize(orig);
|
resize(orig);
|
||||||
@ -234,6 +257,7 @@ void Graph::clear()
|
|||||||
_scene->removeItem(_info);
|
_scene->removeItem(_info);
|
||||||
_sliderInfo->show();
|
_sliderInfo->show();
|
||||||
|
|
||||||
|
_slider->clear();
|
||||||
_info->clear();
|
_info->clear();
|
||||||
_scene->clear();
|
_scene->clear();
|
||||||
_graphs.clear();
|
_graphs.clear();
|
||||||
@ -285,3 +309,8 @@ void Graph::addInfo(const QString &key, const QString &value)
|
|||||||
{
|
{
|
||||||
_info->insert(key, value);
|
_info->insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Graph::clearInfo()
|
||||||
|
{
|
||||||
|
_info->clear();
|
||||||
|
}
|
||||||
|
@ -41,10 +41,12 @@ public:
|
|||||||
void setYLabel(const QString &label);
|
void setYLabel(const QString &label);
|
||||||
void setXUnits(const QString &units);
|
void setXUnits(const QString &units);
|
||||||
void setYUnits(const QString &units);
|
void setYUnits(const QString &units);
|
||||||
void setXScale(qreal scale) {_xScale = scale;}
|
void setXScale(qreal scale);
|
||||||
void setYScale(qreal scale) {_yScale = scale;}
|
void setYScale(qreal scale);
|
||||||
void setPrecision(int p) {_precision = p;}
|
void setPrecision(int p) {_precision = p;}
|
||||||
|
|
||||||
|
void redraw();
|
||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -52,6 +54,7 @@ public:
|
|||||||
void setSliderPosition(qreal pos);
|
void setSliderPosition(qreal pos);
|
||||||
|
|
||||||
void addInfo(const QString &key, const QString &value);
|
void addInfo(const QString &key, const QString &value);
|
||||||
|
void clearInfo();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sliderPositionChanged(qreal);
|
void sliderPositionChanged(qreal);
|
||||||
|
201
src/gui.cpp
201
src/gui.cpp
@ -31,7 +31,7 @@ static QString timeSpan(qreal time)
|
|||||||
s = time - (h * 3600) - (m * 60);
|
s = time - (h * 3600) - (m * 60);
|
||||||
|
|
||||||
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
||||||
.arg(s,2, 10, QChar('0'));
|
.arg(s, 2, 10, QChar('0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +118,8 @@ void GUI::createActions()
|
|||||||
_fileActionGroup->setExclusive(false);
|
_fileActionGroup->setExclusive(false);
|
||||||
_fileActionGroup->setEnabled(false);
|
_fileActionGroup->setEnabled(false);
|
||||||
|
|
||||||
|
_navigationActionGroup = new QActionGroup(this);
|
||||||
|
_navigationActionGroup->setEnabled(false);
|
||||||
|
|
||||||
// General actions
|
// General actions
|
||||||
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
||||||
@ -168,12 +170,14 @@ void GUI::createActions()
|
|||||||
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
||||||
tr("Show POIs"), this);
|
tr("Show POIs"), this);
|
||||||
_showPOIAction->setCheckable(true);
|
_showPOIAction->setCheckable(true);
|
||||||
|
_showPOIAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
||||||
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
|
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
|
||||||
|
|
||||||
// Map actions
|
// Map actions
|
||||||
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
||||||
this);
|
this);
|
||||||
_showMapAction->setCheckable(true);
|
_showMapAction->setCheckable(true);
|
||||||
|
_showMapAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||||
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
|
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
|
||||||
if (_maps.empty())
|
if (_maps.empty())
|
||||||
_showMapAction->setEnabled(false);
|
_showMapAction->setEnabled(false);
|
||||||
@ -184,6 +188,7 @@ void GUI::createActions()
|
|||||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||||
_showGraphsAction->setCheckable(true);
|
_showGraphsAction->setCheckable(true);
|
||||||
_showGraphsAction->setChecked(true);
|
_showGraphsAction->setChecked(true);
|
||||||
|
_showGraphsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
|
||||||
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showGraphs(bool)));
|
SLOT(showGraphs(bool)));
|
||||||
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
||||||
@ -191,6 +196,35 @@ void GUI::createActions()
|
|||||||
_showToolbarsAction->setChecked(true);
|
_showToolbarsAction->setChecked(true);
|
||||||
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showToolbars(bool)));
|
SLOT(showToolbars(bool)));
|
||||||
|
QActionGroup *ag = new QActionGroup(this);
|
||||||
|
ag->setExclusive(true);
|
||||||
|
_metricUnitsAction = new QAction(tr("Metric"), this);
|
||||||
|
_metricUnitsAction->setCheckable(true);
|
||||||
|
_metricUnitsAction->setActionGroup(ag);
|
||||||
|
_metricUnitsAction->setChecked(true);
|
||||||
|
connect(_metricUnitsAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(setMetricUnits()));
|
||||||
|
_imperialUnitsAction = new QAction(tr("Imperial"), this);
|
||||||
|
_imperialUnitsAction->setCheckable(true);
|
||||||
|
_imperialUnitsAction->setActionGroup(ag);
|
||||||
|
connect(_imperialUnitsAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(setImperialUnits()));
|
||||||
|
|
||||||
|
// 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()
|
void GUI::createMenus()
|
||||||
@ -219,6 +253,10 @@ void GUI::createMenus()
|
|||||||
_poiMenu->addAction(_showPOIAction);
|
_poiMenu->addAction(_showPOIAction);
|
||||||
|
|
||||||
_settingsMenu = menuBar()->addMenu(tr("Settings"));
|
_settingsMenu = menuBar()->addMenu(tr("Settings"));
|
||||||
|
_unitsMenu = _settingsMenu->addMenu(tr("Units"));
|
||||||
|
_unitsMenu->addAction(_metricUnitsAction);
|
||||||
|
_unitsMenu->addAction(_imperialUnitsAction);
|
||||||
|
_settingsMenu->addSeparator();
|
||||||
_settingsMenu->addAction(_showToolbarsAction);
|
_settingsMenu->addAction(_showToolbarsAction);
|
||||||
_settingsMenu->addAction(_showGraphsAction);
|
_settingsMenu->addAction(_showGraphsAction);
|
||||||
|
|
||||||
@ -247,6 +285,15 @@ void GUI::createToolBars()
|
|||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
_showToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
_showToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
#endif // Q_OS_MAC
|
#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()
|
void GUI::createTrackView()
|
||||||
@ -314,8 +361,10 @@ void GUI::keys()
|
|||||||
QString("<div><table width=\"300\"><tr><td>") + tr("Next file")
|
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>SPACE</i></td></tr><tr><td>") + tr("Previous file")
|
||||||
+ QString("</td><td><i>BACKSPACE</i></td></tr><tr><td>")
|
+ QString("</td><td><i>BACKSPACE</i></td></tr><tr><td>")
|
||||||
+ tr("Append modifier") + QString("</td><td><i>SHIFT</i></td></tr>"
|
+ tr("First file") + QString("</td><td><i>HOME</i></td></tr><tr><td>")
|
||||||
"</table></div>"));
|
+ 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();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
@ -368,9 +417,13 @@ bool GUI::openFile(const QString &fileName)
|
|||||||
_browser->setCurrent(fileName);
|
_browser->setCurrent(fileName);
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
_fileActionGroup->setEnabled(true);
|
_fileActionGroup->setEnabled(true);
|
||||||
|
_navigationActionGroup->setEnabled(true);
|
||||||
|
updateNavigationActions();
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else {
|
||||||
|
updateNavigationActions();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GUI::loadFile(const QString &fileName)
|
bool GUI::loadFile(const QString &fileName)
|
||||||
@ -454,17 +507,31 @@ void GUI::saveFile(const QString &fileName)
|
|||||||
|
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
InfoItem info;
|
InfoItem info;
|
||||||
info.insert(tr("Distance"), QString::number(_distance / 1000, 'f', 1)
|
if (_imperialUnitsAction->isChecked()) {
|
||||||
+ THIN_SPACE + tr("km"));
|
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1)
|
||||||
info.insert(tr("Time"), timeSpan(_time));
|
+ THIN_SPACE + tr("mi"));
|
||||||
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent(), 'f', 0)
|
info.insert(tr("Time"), timeSpan(_time));
|
||||||
+ THIN_SPACE + tr("m"));
|
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent()
|
||||||
info.insert(tr("Descent"), QString::number(_elevationGraph->descent(), 'f',
|
* M2FT, 'f', 0) + THIN_SPACE + tr("ft"));
|
||||||
0) + THIN_SPACE + tr("m"));
|
info.insert(tr("Descent"), QString::number(_elevationGraph->descent()
|
||||||
info.insert(tr("Maximum"), QString::number(_elevationGraph->max(), 'f', 0)
|
* M2FT, 'f', 0) + THIN_SPACE + tr("ft"));
|
||||||
+ THIN_SPACE + tr("m"));
|
info.insert(tr("Maximum"), QString::number(_elevationGraph->max()
|
||||||
info.insert(tr("Minimum"), QString::number(_elevationGraph->min(), 'f', 0)
|
* M2FT, 'f', 0) + THIN_SPACE + tr("ft"));
|
||||||
+ THIN_SPACE + tr("m"));
|
info.insert(tr("Minimum"), QString::number(_elevationGraph->min()
|
||||||
|
* M2FT, 'f', 0) + THIN_SPACE + tr("ft"));
|
||||||
|
} else {
|
||||||
|
info.insert(tr("Distance"), QString::number(_distance * M2KM, 'f', 1)
|
||||||
|
+ THIN_SPACE + tr("km"));
|
||||||
|
info.insert(tr("Time"), timeSpan(_time));
|
||||||
|
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent(),
|
||||||
|
'f', 0) + THIN_SPACE + tr("m"));
|
||||||
|
info.insert(tr("Descent"), QString::number(_elevationGraph->descent(),
|
||||||
|
'f', 0) + THIN_SPACE + tr("m"));
|
||||||
|
info.insert(tr("Maximum"), QString::number(_elevationGraph->max(), 'f',
|
||||||
|
0) + THIN_SPACE + tr("m"));
|
||||||
|
info.insert(tr("Minimum"), QString::number(_elevationGraph->min(), 'f',
|
||||||
|
0) + THIN_SPACE + tr("m"));
|
||||||
|
}
|
||||||
scene.addItem(&info);
|
scene.addItem(&info);
|
||||||
scene.render(&p, QRectF(0, 0, printer.width(), 200));
|
scene.render(&p, QRectF(0, 0, printer.width(), 200));
|
||||||
|
|
||||||
@ -535,11 +602,14 @@ void GUI::showToolbars(bool checked)
|
|||||||
if (checked) {
|
if (checked) {
|
||||||
addToolBar(_fileToolBar);
|
addToolBar(_fileToolBar);
|
||||||
addToolBar(_showToolBar);
|
addToolBar(_showToolBar);
|
||||||
|
addToolBar(_navigationToolBar);
|
||||||
_fileToolBar->show();
|
_fileToolBar->show();
|
||||||
_showToolBar->show();
|
_showToolBar->show();
|
||||||
|
_navigationToolBar->show();
|
||||||
} else {
|
} else {
|
||||||
removeToolBar(_fileToolBar);
|
removeToolBar(_fileToolBar);
|
||||||
removeToolBar(_showToolBar);
|
removeToolBar(_showToolBar);
|
||||||
|
removeToolBar(_navigationToolBar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,8 +627,12 @@ void GUI::updateStatusBarInfo()
|
|||||||
else
|
else
|
||||||
_fileNameLabel->setText(tr("%1 tracks").arg(_files.size()));
|
_fileNameLabel->setText(tr("%1 tracks").arg(_files.size()));
|
||||||
|
|
||||||
_distanceLabel->setText(QString::number(_distance / 1000, 'f', 1)
|
if (_imperialUnitsAction->isChecked())
|
||||||
+ " " + tr("km"));
|
_distanceLabel->setText(QString::number(_distance * M2MI, 'f', 1)
|
||||||
|
+ " " + tr("mi"));
|
||||||
|
else
|
||||||
|
_distanceLabel->setText(QString::number(_distance * M2KM, 'f', 1)
|
||||||
|
+ " " + tr("km"));
|
||||||
_timeLabel->setText(timeSpan(_time));
|
_timeLabel->setText(timeSpan(_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,14 +652,99 @@ void GUI::graphChanged(int index)
|
|||||||
_speedGraph->setSliderPosition(_elevationGraph->sliderPosition());
|
_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::setMetricUnits()
|
||||||
|
{
|
||||||
|
_track->setUnits(Metric);
|
||||||
|
_elevationGraph->setUnits(Metric);
|
||||||
|
_speedGraph->setUnits(Metric);
|
||||||
|
updateStatusBarInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::setImperialUnits()
|
||||||
|
{
|
||||||
|
_track->setUnits(Imperial);
|
||||||
|
_elevationGraph->setUnits(Imperial);
|
||||||
|
_speedGraph->setUnits(Imperial);
|
||||||
|
updateStatusBarInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::next()
|
||||||
|
{
|
||||||
|
QString file = _browser->next();
|
||||||
|
if (file.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
closeFile();
|
||||||
|
openFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::prev()
|
||||||
|
{
|
||||||
|
QString file = _browser->prev();
|
||||||
|
if (file.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
closeFile();
|
||||||
|
openFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::last()
|
||||||
|
{
|
||||||
|
QString file = _browser->last();
|
||||||
|
if (file.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
closeFile();
|
||||||
|
openFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::first()
|
||||||
|
{
|
||||||
|
QString file = _browser->first();
|
||||||
|
if (file.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
closeFile();
|
||||||
|
openFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::keyPressEvent(QKeyEvent *event)
|
void GUI::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
QString file;
|
QString file;
|
||||||
|
|
||||||
if (event->key() == PREV_KEY)
|
switch (event->key()) {
|
||||||
file = _browser->prev();
|
case PREV_KEY:
|
||||||
if (event->key() == NEXT_KEY)
|
file = _browser->prev();
|
||||||
file = _browser->next();
|
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 (!file.isNull()) {
|
||||||
if (!(event->modifiers() & MODIFIER))
|
if (!(event->modifiers() & MODIFIER))
|
||||||
|
18
src/gui.h
18
src/gui.h
@ -45,6 +45,14 @@ private slots:
|
|||||||
void mapChanged(int);
|
void mapChanged(int);
|
||||||
void graphChanged(int);
|
void graphChanged(int);
|
||||||
|
|
||||||
|
void next();
|
||||||
|
void prev();
|
||||||
|
void last();
|
||||||
|
void first();
|
||||||
|
|
||||||
|
void setMetricUnits();
|
||||||
|
void setImperialUnits();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadFiles();
|
void loadFiles();
|
||||||
|
|
||||||
@ -59,6 +67,7 @@ private:
|
|||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
void saveFile(const QString &fileName);
|
void saveFile(const QString &fileName);
|
||||||
void updateStatusBarInfo();
|
void updateStatusBarInfo();
|
||||||
|
void updateNavigationActions();
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent * event);
|
void keyPressEvent(QKeyEvent * event);
|
||||||
|
|
||||||
@ -67,11 +76,14 @@ private:
|
|||||||
QMenu *_poiMenu;
|
QMenu *_poiMenu;
|
||||||
QMenu *_mapMenu;
|
QMenu *_mapMenu;
|
||||||
QMenu *_settingsMenu;
|
QMenu *_settingsMenu;
|
||||||
|
QMenu *_unitsMenu;
|
||||||
|
|
||||||
QToolBar *_fileToolBar;
|
QToolBar *_fileToolBar;
|
||||||
QToolBar *_showToolBar;
|
QToolBar *_showToolBar;
|
||||||
|
QToolBar *_navigationToolBar;
|
||||||
QTabWidget *_trackGraphs;
|
QTabWidget *_trackGraphs;
|
||||||
QActionGroup *_fileActionGroup;
|
QActionGroup *_fileActionGroup;
|
||||||
|
QActionGroup *_navigationActionGroup;
|
||||||
|
|
||||||
QAction *_exitAction;
|
QAction *_exitAction;
|
||||||
QAction *_keysAction;
|
QAction *_keysAction;
|
||||||
@ -88,6 +100,12 @@ private:
|
|||||||
QAction *_showMapAction;
|
QAction *_showMapAction;
|
||||||
QAction *_showGraphsAction;
|
QAction *_showGraphsAction;
|
||||||
QAction *_showToolbarsAction;
|
QAction *_showToolbarsAction;
|
||||||
|
QAction *_nextAction;
|
||||||
|
QAction *_prevAction;
|
||||||
|
QAction *_lastAction;
|
||||||
|
QAction *_firstAction;
|
||||||
|
QAction *_metricUnitsAction;
|
||||||
|
QAction *_imperialUnitsAction;
|
||||||
QList<QAction*> _mapActions;
|
QList<QAction*> _mapActions;
|
||||||
|
|
||||||
QLabel *_fileNameLabel;
|
QLabel *_fileNameLabel;
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||||
#define QUIT_ICON ":/icons/application-exit.png"
|
#define QUIT_ICON ":/icons/application-exit.png"
|
||||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.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)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
#define QT_ICON ":/trolltech/qmessagebox/images/qtlogo-64.png"
|
#define QT_ICON ":/trolltech/qmessagebox/images/qtlogo-64.png"
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "infoitem.h"
|
#include "infoitem.h"
|
||||||
|
|
||||||
|
|
||||||
#define PADDING 10
|
#define PADDING 10
|
||||||
|
|
||||||
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
@ -11,24 +10,21 @@ InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF InfoItem::boundingRect() const
|
void InfoItem::updateBoundingRect()
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FONT_SIZE);
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
QList<KV>::const_iterator i;
|
QList<KV>::const_iterator i;
|
||||||
int width = 0;
|
qreal width = 0;
|
||||||
|
|
||||||
if (_list.isEmpty())
|
|
||||||
return QRectF();
|
|
||||||
|
|
||||||
for (i = _list.constBegin(); i != _list.constEnd(); i++) {
|
for (i = _list.constBegin(); i != _list.constEnd(); i++) {
|
||||||
width += fm.width(i->key + ": ");
|
width += fm.width(i->key + ": ");
|
||||||
width += fm.width(i->value) + ((i == _list.end() - 1) ? 0 : PADDING);
|
width += fm.width(i->value) + ((i == _list.end() - 1) ? 0 : PADDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QRectF(0, 0, width, fm.height());
|
_boundingRect = QRectF(0, 0, width, _list.isEmpty() ? 0 : fm.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -74,5 +70,13 @@ void InfoItem::insert(const QString &key, const QString &value)
|
|||||||
else
|
else
|
||||||
_list[i] = kv;
|
_list[i] = kv;
|
||||||
|
|
||||||
|
updateBoundingRect();
|
||||||
|
prepareGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoItem::clear()
|
||||||
|
{
|
||||||
|
_list.clear();
|
||||||
|
updateBoundingRect();
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,16 @@ class InfoItem : public QGraphicsItem
|
|||||||
public:
|
public:
|
||||||
InfoItem(QGraphicsItem *parent = 0);
|
InfoItem(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const {return _boundingRect;}
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
|
|
||||||
void insert(const QString &key, const QString &value);
|
void insert(const QString &key, const QString &value);
|
||||||
void clear() {_list.clear();}
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateBoundingRect();
|
||||||
|
|
||||||
class KV {
|
class KV {
|
||||||
public:
|
public:
|
||||||
QString key;
|
QString key;
|
||||||
@ -29,6 +31,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
QList<KV> _list;
|
QList<KV> _list;
|
||||||
|
QRectF _boundingRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INFOITEM_H
|
#endif // INFOITEM_H
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#define NEXT_KEY Qt::Key_Space
|
#define NEXT_KEY Qt::Key_Space
|
||||||
#define PREV_KEY Qt::Key_Backspace
|
#define PREV_KEY Qt::Key_Backspace
|
||||||
|
#define FIRST_KEY Qt::Key_Home
|
||||||
|
#define LAST_KEY Qt::Key_End
|
||||||
#define MODIFIER Qt::ShiftModifier
|
#define MODIFIER Qt::ShiftModifier
|
||||||
|
|
||||||
#endif // KEYS_H
|
#endif // KEYS_H
|
||||||
|
@ -68,3 +68,9 @@ int scale2zoom(qreal scale)
|
|||||||
return ZOOM_MAX;
|
return ZOOM_MAX;
|
||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal zoom2resolution(int zoom, qreal y)
|
||||||
|
{
|
||||||
|
return (WGS84_RADIUS * 2 * M_PI / 256 * cos(2 * atan(exp(deg2rad(y)))
|
||||||
|
- M_PI/2)) / pow(2.0, zoom);
|
||||||
|
}
|
||||||
|
1
src/ll.h
1
src/ll.h
@ -12,5 +12,6 @@ qreal llDistance(const QPointF &p1, const QPointF &p2);
|
|||||||
QPoint mercator2tile(const QPointF &m, int zoom);
|
QPoint mercator2tile(const QPointF &m, int zoom);
|
||||||
QPointF tile2mercator(const QPoint &tile, int zoom);
|
QPointF tile2mercator(const QPoint &tile, int zoom);
|
||||||
int scale2zoom(qreal scale);
|
int scale2zoom(qreal scale);
|
||||||
|
qreal zoom2resolution(int zoom, qreal y);
|
||||||
|
|
||||||
#endif // LL_H
|
#endif // LL_H
|
||||||
|
@ -14,10 +14,9 @@ Map::Map(const QString &name, const QString &url)
|
|||||||
connect(&Downloader::instance(), SIGNAL(finished()), this,
|
connect(&Downloader::instance(), SIGNAL(finished()), this,
|
||||||
SLOT(emitLoaded()));
|
SLOT(emitLoaded()));
|
||||||
|
|
||||||
if (!QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name)))
|
QString path = QString(TILES_DIR"/") + _name;
|
||||||
fprintf(stderr, "Error creating tiles dir: %s\n",
|
if (!QDir::home().mkpath(path))
|
||||||
qPrintable(QDir::home().absolutePath() + QString("/"TILES_DIR"/%1")
|
fprintf(stderr, "Error creating tiles dir: %s\n", qPrintable(path));
|
||||||
.arg(_name)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::emitLoaded()
|
void Map::emitLoaded()
|
||||||
|
34
src/nicenum.cpp
Normal file
34
src/nicenum.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include <cmath>
|
||||||
|
#include "nicenum.h"
|
||||||
|
|
||||||
|
double niceNum(double x, int round)
|
||||||
|
{
|
||||||
|
int expv;
|
||||||
|
double f;
|
||||||
|
double nf;
|
||||||
|
|
||||||
|
expv = 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);
|
||||||
|
}
|
6
src/nicenum.h
Normal file
6
src/nicenum.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef NICENUM_H
|
||||||
|
#define NICENUM_H
|
||||||
|
|
||||||
|
double niceNum(double x, int round);
|
||||||
|
|
||||||
|
#endif // NICENUM_H
|
591
src/rtree.h
591
src/rtree.h
File diff suppressed because it is too large
Load Diff
129
src/scaleitem.cpp
Normal file
129
src/scaleitem.cpp
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#include <QPainter>
|
||||||
|
#include "config.h"
|
||||||
|
#include "ll.h"
|
||||||
|
#include "nicenum.h"
|
||||||
|
#include "scaleitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SCALE_WIDTH 132
|
||||||
|
#define SCALE_HEIGHT 5
|
||||||
|
#define SEGMENTS 3
|
||||||
|
|
||||||
|
#define PADDING 4
|
||||||
|
|
||||||
|
|
||||||
|
ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
|
{
|
||||||
|
_units = Metric;
|
||||||
|
_zoom = ZOOM_MIN;
|
||||||
|
_lat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::updateBoundingRect()
|
||||||
|
{
|
||||||
|
QFont font;
|
||||||
|
font.setPixelSize(FONT_SIZE);
|
||||||
|
font.setFamily(FONT_FAMILY);
|
||||||
|
QFontMetrics fm(font);
|
||||||
|
QRect ss, es, us;
|
||||||
|
|
||||||
|
ss = fm.tightBoundingRect(QString::number(0));
|
||||||
|
es = fm.tightBoundingRect(QString::number(_length * SEGMENTS));
|
||||||
|
us = fm.tightBoundingRect(units());
|
||||||
|
|
||||||
|
_boundingRect = QRectF(-ss.width()/2, 0,
|
||||||
|
_width * SEGMENTS + ss.width()/2 + qMax(us.width() + PADDING, es.width()/2),
|
||||||
|
SCALE_HEIGHT + PADDING + ss.height() + 2*fm.descent());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
QFont font;
|
||||||
|
font.setPixelSize(FONT_SIZE);
|
||||||
|
font.setFamily(FONT_FAMILY);
|
||||||
|
QFontMetrics fm(font);
|
||||||
|
QRect br;
|
||||||
|
|
||||||
|
painter->setFont(font);
|
||||||
|
|
||||||
|
for (int i = 0; i <= SEGMENTS; i++) {
|
||||||
|
QString label = QString::number(_length * i);
|
||||||
|
br = fm.tightBoundingRect(label);
|
||||||
|
painter->drawText(_width * i - br.width()/2, br.height(), label);
|
||||||
|
}
|
||||||
|
painter->drawText(_width * SEGMENTS + PADDING, SCALE_HEIGHT + PADDING
|
||||||
|
+ br.height() + fm.descent(), units());
|
||||||
|
|
||||||
|
painter->drawRect(QRectF(0, br.height() + PADDING, SEGMENTS * _width,
|
||||||
|
SCALE_HEIGHT));
|
||||||
|
for (int i = 0; i < SEGMENTS; i += 2)
|
||||||
|
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
|
||||||
|
SCALE_HEIGHT), Qt::black);
|
||||||
|
|
||||||
|
/*
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
painter->drawRect(boundingRect());
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ScaleItem::units() const
|
||||||
|
{
|
||||||
|
if (_units == Imperial)
|
||||||
|
return _scale ? QObject::tr("mi") : QObject::tr("ft");
|
||||||
|
else
|
||||||
|
return _scale ? QObject::tr("km") : QObject::tr("m");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::computeScale()
|
||||||
|
{
|
||||||
|
qreal res = zoom2resolution(_zoom, _lat);
|
||||||
|
|
||||||
|
if (_units == Imperial) {
|
||||||
|
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
|
if (_length >= MIINFT) {
|
||||||
|
_length = niceNum((res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
|
_width = (_length / (res * M2FT * FT2MI));
|
||||||
|
_scale = true;
|
||||||
|
} else {
|
||||||
|
_width = (_length / (res * M2FT));
|
||||||
|
_scale = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_length = niceNum((res * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
|
if (_length >= KMINM) {
|
||||||
|
_length *= M2KM;
|
||||||
|
_width = (_length / (res * M2KM));
|
||||||
|
_scale = true;
|
||||||
|
} else {
|
||||||
|
_width = (_length / res);
|
||||||
|
_scale = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::setLatitude(qreal lat)
|
||||||
|
{
|
||||||
|
_lat = lat;
|
||||||
|
computeScale();
|
||||||
|
updateBoundingRect();
|
||||||
|
prepareGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::setZoom(int z)
|
||||||
|
{
|
||||||
|
_zoom = z;
|
||||||
|
computeScale();
|
||||||
|
updateBoundingRect();
|
||||||
|
prepareGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScaleItem::setUnits(enum Units units)
|
||||||
|
{
|
||||||
|
_units = units;
|
||||||
|
computeScale();
|
||||||
|
updateBoundingRect();
|
||||||
|
prepareGeometryChange();
|
||||||
|
}
|
35
src/scaleitem.h
Normal file
35
src/scaleitem.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef SCALEITEM_H
|
||||||
|
#define SCALEITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
|
class ScaleItem : public QGraphicsItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScaleItem(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
QRectF boundingRect() const {return _boundingRect;}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
void setLatitude(qreal lat);
|
||||||
|
void setZoom(int z);
|
||||||
|
void setUnits(enum Units units);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateBoundingRect();
|
||||||
|
void computeScale();
|
||||||
|
QString units() const;
|
||||||
|
|
||||||
|
int _zoom;
|
||||||
|
qreal _lat;
|
||||||
|
qreal _width;
|
||||||
|
qreal _length;
|
||||||
|
Units _units;
|
||||||
|
bool _scale;
|
||||||
|
|
||||||
|
QRectF _boundingRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SCALEITEM_H
|
@ -46,3 +46,9 @@ QVariant SliderItem::itemChange(GraphicsItemChange change, const QVariant &value
|
|||||||
|
|
||||||
return QGraphicsItem::itemChange(change, value);
|
return QGraphicsItem::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SliderItem::clear()
|
||||||
|
{
|
||||||
|
_area = QRectF();
|
||||||
|
setPos(QPointF());
|
||||||
|
}
|
||||||
|
@ -17,6 +17,8 @@ public:
|
|||||||
QRectF area() {return _area;}
|
QRectF area() {return _area;}
|
||||||
void setArea(const QRectF &area) {_area = area;}
|
void setArea(const QRectF &area) {_area = area;}
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void positionChanged(const QPointF&);
|
void positionChanged(const QPointF&);
|
||||||
|
|
||||||
|
@ -10,11 +10,19 @@ SpeedGraph::SpeedGraph(QWidget *parent) : Graph(parent)
|
|||||||
Graph::setYLabel(tr("Speed"));
|
Graph::setYLabel(tr("Speed"));
|
||||||
Graph::setXUnits(tr("km"));
|
Graph::setXUnits(tr("km"));
|
||||||
Graph::setYUnits(tr("km/h"));
|
Graph::setYUnits(tr("km/h"));
|
||||||
Graph::setXScale(0.001);
|
Graph::setXScale(M2KM);
|
||||||
Graph::setYScale(3.6);
|
Graph::setYScale(MS2KMH);
|
||||||
Graph::setPrecision(1);
|
Graph::setPrecision(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpeedGraph::addInfo()
|
||||||
|
{
|
||||||
|
Graph::addInfo(tr("Average"), QString::number(avg() * _yScale, 'f', 1)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
|
Graph::addInfo(tr("Maximum"), QString::number(_max * _yScale, 'f', 1)
|
||||||
|
+ THIN_SPACE + _yUnits);
|
||||||
|
}
|
||||||
|
|
||||||
void SpeedGraph::loadGPX(const GPX &gpx)
|
void SpeedGraph::loadGPX(const GPX &gpx)
|
||||||
{
|
{
|
||||||
QVector<QPointF> data;
|
QVector<QPointF> data;
|
||||||
@ -31,13 +39,8 @@ void SpeedGraph::loadGPX(const GPX &gpx)
|
|||||||
max = qMax(max, data.at(i).y());
|
max = qMax(max, data.at(i).y());
|
||||||
_max = qMax(_max, max);
|
_max = qMax(_max, max);
|
||||||
|
|
||||||
|
addInfo();
|
||||||
addInfo(tr("Average"), QString::number(avg() * _yScale, 'f', 1)
|
loadData(data);
|
||||||
+ THIN_SPACE + _yUnits);
|
|
||||||
addInfo(tr("Maximum"), QString::number(_max * _yScale, 'f', 1)
|
|
||||||
+ THIN_SPACE + _yUnits);
|
|
||||||
|
|
||||||
Graph::loadData(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal SpeedGraph::avg() const
|
qreal SpeedGraph::avg() const
|
||||||
@ -60,3 +63,23 @@ void SpeedGraph::clear()
|
|||||||
|
|
||||||
Graph::clear();
|
Graph::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpeedGraph::setUnits(enum Units units)
|
||||||
|
{
|
||||||
|
if (units == Metric) {
|
||||||
|
Graph::setXUnits(tr("km"));
|
||||||
|
Graph::setYUnits(tr("km/h"));
|
||||||
|
Graph::setXScale(M2KM);
|
||||||
|
Graph::setYScale(MS2KMH);
|
||||||
|
} else {
|
||||||
|
Graph::setXUnits(tr("mi"));
|
||||||
|
Graph::setYUnits(tr("mi/h"));
|
||||||
|
Graph::setXScale(M2MI);
|
||||||
|
Graph::setYScale(MS2MIH);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearInfo();
|
||||||
|
addInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "gpx.h"
|
#include "gpx.h"
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
class SpeedGraph : public Graph
|
class SpeedGraph : public Graph
|
||||||
{
|
{
|
||||||
@ -14,11 +15,14 @@ public:
|
|||||||
|
|
||||||
void loadGPX(const GPX &gpx);
|
void loadGPX(const GPX &gpx);
|
||||||
void clear();
|
void clear();
|
||||||
|
void setUnits(enum Units units);
|
||||||
|
|
||||||
qreal avg() const;
|
qreal avg() const;
|
||||||
qreal max() const {return _max;}
|
qreal max() const {return _max;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addInfo();
|
||||||
|
|
||||||
qreal _max;
|
qreal _max;
|
||||||
QList<QPointF> _avg;
|
QList<QPointF> _avg;
|
||||||
};
|
};
|
||||||
|
@ -5,12 +5,14 @@
|
|||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include "poiitem.h"
|
#include "poiitem.h"
|
||||||
#include "markeritem.h"
|
#include "markeritem.h"
|
||||||
|
#include "scaleitem.h"
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
|
||||||
|
|
||||||
#define MARGIN 10.0
|
#define MARGIN 10.0
|
||||||
#define TRACK_WIDTH 3
|
#define TRACK_WIDTH 3
|
||||||
|
#define SCALE_OFFSET 7
|
||||||
|
|
||||||
Track::Track(QWidget *parent)
|
Track::Track(QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
@ -19,9 +21,13 @@ Track::Track(QWidget *parent)
|
|||||||
setScene(_scene);
|
setScene(_scene);
|
||||||
setCacheMode(QGraphicsView::CacheBackground);
|
setCacheMode(QGraphicsView::CacheBackground);
|
||||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||||
|
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
_mapScale = new ScaleItem();
|
||||||
|
_mapScale->setZValue(2.0);
|
||||||
|
|
||||||
_zoom = -1;
|
_zoom = -1;
|
||||||
_scale = 1.0;
|
_scale = 1.0;
|
||||||
_map = 0;
|
_map = 0;
|
||||||
@ -79,6 +85,12 @@ void Track::loadGPX(const GPX &gpx)
|
|||||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||||
_scene->setSceneRect(ba);
|
_scene->setSceneRect(ba);
|
||||||
centerOn(ba.center());
|
centerOn(ba.center());
|
||||||
|
|
||||||
|
if (_mapScale->scene() != _scene)
|
||||||
|
_scene->addItem(_mapScale);
|
||||||
|
|
||||||
|
_mapScale->setLatitude(track.at(track.size() / 2).y());
|
||||||
|
_mapScale->setZoom(_zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF Track::trackBoundingRect() const
|
QRectF Track::trackBoundingRect() const
|
||||||
@ -198,6 +210,11 @@ void Track::setMap(Map *map)
|
|||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Track::setUnits(enum Units units)
|
||||||
|
{
|
||||||
|
_mapScale->setUnits(units);
|
||||||
|
}
|
||||||
|
|
||||||
void Track::redraw()
|
void Track::redraw()
|
||||||
{
|
{
|
||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
@ -205,6 +222,9 @@ void Track::redraw()
|
|||||||
|
|
||||||
void Track::wheelEvent(QWheelEvent *event)
|
void Track::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
|
if (_tracks.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QPointF pos = mapToScene(event->pos());
|
QPointF pos = mapToScene(event->pos());
|
||||||
qreal scale = _scale;
|
qreal scale = _scale;
|
||||||
|
|
||||||
@ -222,13 +242,9 @@ void Track::wheelEvent(QWheelEvent *event)
|
|||||||
else
|
else
|
||||||
centerOn(pos * scale/_scale);
|
centerOn(pos * scale/_scale);
|
||||||
|
|
||||||
resetCachedContent();
|
_mapScale->setZoom(_zoom);
|
||||||
}
|
|
||||||
|
|
||||||
void Track::showMarkers(bool show)
|
resetCachedContent();
|
||||||
{
|
|
||||||
for (int i = 0; i < _markers.size(); i++)
|
|
||||||
_markers.at(i)->setVisible(show);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Track::setTrackLineWidth(qreal width)
|
void Track::setTrackLineWidth(qreal width)
|
||||||
@ -242,10 +258,14 @@ void Track::setTrackLineWidth(qreal width)
|
|||||||
|
|
||||||
void Track::plot(QPainter *painter, const QRectF &target)
|
void Track::plot(QPainter *painter, const QRectF &target)
|
||||||
{
|
{
|
||||||
QRectF orig = _scene->itemsBoundingRect();
|
QRectF orig, adj;
|
||||||
QRectF adj;
|
|
||||||
qreal ratio, diff;
|
qreal ratio, diff;
|
||||||
|
|
||||||
|
_scene->removeItem(_mapScale);
|
||||||
|
orig = _scene->itemsBoundingRect().adjusted(0, 0, 0,
|
||||||
|
_mapScale->boundingRect().height());
|
||||||
|
_scene->addItem(_mapScale);
|
||||||
|
|
||||||
if (target.width()/target.height() > orig.width()/orig.height()) {
|
if (target.width()/target.height() > orig.width()/orig.height()) {
|
||||||
ratio = target.width()/target.height();
|
ratio = target.width()/target.height();
|
||||||
diff = qAbs((orig.height() * ratio) - orig.width());
|
diff = qAbs((orig.height() * ratio) - orig.width());
|
||||||
@ -256,11 +276,13 @@ void Track::plot(QPainter *painter, const QRectF &target)
|
|||||||
adj = orig.adjusted(0, -diff/2, 0, diff/2);
|
adj = orig.adjusted(0, -diff/2, 0, diff/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
showMarkers(false);
|
_mapScale->setPos(adj.bottomRight()
|
||||||
|
+ QPoint(-_mapScale->boundingRect().width(),
|
||||||
|
-_mapScale->boundingRect().height()));
|
||||||
|
|
||||||
setTrackLineWidth(0);
|
setTrackLineWidth(0);
|
||||||
_scene->render(painter, target, adj, Qt::KeepAspectRatioByExpanding);
|
_scene->render(painter, target, adj);
|
||||||
setTrackLineWidth(TRACK_WIDTH * _scale);
|
setTrackLineWidth(TRACK_WIDTH * _scale);
|
||||||
showMarkers(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum QPrinter::Orientation Track::orientation() const
|
enum QPrinter::Orientation Track::orientation() const
|
||||||
@ -283,6 +305,9 @@ void Track::clearPOI()
|
|||||||
|
|
||||||
void Track::clear()
|
void Track::clear()
|
||||||
{
|
{
|
||||||
|
if (_mapScale->scene() == _scene)
|
||||||
|
_scene->removeItem(_mapScale);
|
||||||
|
|
||||||
_pois.clear();
|
_pois.clear();
|
||||||
_tracks.clear();
|
_tracks.clear();
|
||||||
_trackPaths.clear();
|
_trackPaths.clear();
|
||||||
@ -336,3 +361,36 @@ void Track::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
painter->drawPixmap(tp, t.pixmap());
|
painter->drawPixmap(tp, t.pixmap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Track::resizeEvent(QResizeEvent *e)
|
||||||
|
{
|
||||||
|
if (_tracks.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QRectF br = trackBoundingRect();
|
||||||
|
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||||
|
|
||||||
|
if (ba.width() < e->size().width()) {
|
||||||
|
qreal diff = e->size().width() - ba.width();
|
||||||
|
ba.adjust(-diff/2, 0, diff/2, 0);
|
||||||
|
}
|
||||||
|
if (ba.height() < e->size().height()) {
|
||||||
|
qreal diff = e->size().height() - ba.height();
|
||||||
|
ba.adjust(0, -diff/2, 0, diff/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
_scene->setSceneRect(ba);
|
||||||
|
|
||||||
|
centerOn(br.center());
|
||||||
|
resetCachedContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Track::paintEvent(QPaintEvent *e)
|
||||||
|
{
|
||||||
|
QPointF scenePos = mapToScene(rect().bottomLeft() + QPoint(SCALE_OFFSET,
|
||||||
|
-(SCALE_OFFSET + _mapScale->boundingRect().height())));
|
||||||
|
if (_mapScale->pos() != scenePos)
|
||||||
|
_mapScale->setPos(scenePos);
|
||||||
|
|
||||||
|
QGraphicsView::paintEvent(e);
|
||||||
|
}
|
||||||
|
@ -9,11 +9,13 @@
|
|||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
#include "gpx.h"
|
#include "gpx.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
#include "units.h"
|
||||||
#include "colorshop.h"
|
#include "colorshop.h"
|
||||||
|
|
||||||
|
|
||||||
class POIItem;
|
class POIItem;
|
||||||
class MarkerItem;
|
class MarkerItem;
|
||||||
|
class ScaleItem;
|
||||||
|
|
||||||
class Track : public QGraphicsView
|
class Track : public QGraphicsView
|
||||||
{
|
{
|
||||||
@ -30,6 +32,7 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
|
void setUnits(enum Units units);
|
||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target);
|
||||||
enum QPrinter::Orientation orientation() const;
|
enum QPrinter::Orientation orientation() const;
|
||||||
@ -51,6 +54,8 @@ private:
|
|||||||
|
|
||||||
void wheelEvent(QWheelEvent *event);
|
void wheelEvent(QWheelEvent *event);
|
||||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
QGraphicsScene *_scene;
|
QGraphicsScene *_scene;
|
||||||
QList<QVector<QPointF> > _tracks;
|
QList<QVector<QPointF> > _tracks;
|
||||||
@ -58,6 +63,7 @@ private:
|
|||||||
QList<MarkerItem*> _markers;
|
QList<MarkerItem*> _markers;
|
||||||
QHash<Entry, POIItem*> _pois;
|
QHash<Entry, POIItem*> _pois;
|
||||||
Map *_map;
|
Map *_map;
|
||||||
|
ScaleItem *_mapScale;
|
||||||
|
|
||||||
ColorShop _colorShop;
|
ColorShop _colorShop;
|
||||||
qreal _maxLen;
|
qreal _maxLen;
|
||||||
|
19
src/units.h
Normal file
19
src/units.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef UNITS_H
|
||||||
|
#define UNITS_H
|
||||||
|
|
||||||
|
enum Units {
|
||||||
|
Metric,
|
||||||
|
Imperial
|
||||||
|
};
|
||||||
|
|
||||||
|
#define M2KM 0.001000000000 // m -> km
|
||||||
|
#define M2MI 0.000621371192 // m -> mi
|
||||||
|
#define M2FT 3.280839900000 // m -> ft
|
||||||
|
#define MS2KMH 3.600000000000 // m/s -> km/h
|
||||||
|
#define MS2MIH 2.236936290000 // m/s -> mi/h
|
||||||
|
#define FT2MI 0.000189393939 // ft -> mi
|
||||||
|
|
||||||
|
#define MIINFT 5280 // 1 mi in ft
|
||||||
|
#define KMINM 1000 // 1 km in m
|
||||||
|
|
||||||
|
#endif // UNITS_H
|
Reference in New Issue
Block a user