1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-10 09:14:28 +02:00

Compare commits

...

62 Commits
5.16 ... 5.18

Author SHA1 Message Date
7432459c93 Improved dateline crossing handling 2018-09-15 13:40:21 +02:00
eda5046518 Show the path marker on the great circle segment line 2018-09-15 10:41:00 +02:00
b867ce9a7f Code cleanup 2018-09-15 08:40:37 +02:00
c89137204e Use the GreatCircle for all segments longer than 1 arc minute 2018-09-15 00:22:27 +02:00
e707cc30ad Weblate import 2018-09-14 00:09:50 +02:00
df104b16c6 Yet another optimization 2018-09-13 01:45:17 +02:00
8f9049a8d4 Code cleanup/optimization 2018-09-13 01:15:43 +02:00
9957e1834e Now drawing path segments > 1 arc minute as great circle curves instead of rhumb lines 2018-09-13 00:43:28 +02:00
8d1be76043 Fixed Garmin CSV reader coordinates order (correct is lon, lat) 2018-09-12 20:13:09 +02:00
09a5f57109 Fixed POI selection when the POI radius is not >> trackpoint distance
Fixes #153
2018-09-12 19:55:32 +02:00
3291ea86ef Localization update 2018-09-11 01:01:09 +02:00
672df4255e Version++ 2018-09-11 00:36:11 +02:00
89f384feed Made the HiDPI display mode (of non-HiDPI maps) configurable 2018-09-11 00:33:20 +02:00
d58322b412 Map API cleanup 2018-09-10 21:22:57 +02:00
70222f4ae2 Fixed overlapping scale numbers 2018-09-10 21:22:01 +02:00
fe1aaa73a0 Fixed compile warning 2018-09-10 21:21:40 +02:00
2501f834c8 Display numbers according to the locale settings
Closes #150
2018-09-09 18:46:43 +02:00
3f4b70ee48 Localization update 2018-09-09 15:34:34 +02:00
384d20b1a5 Changed 1/min to more convenient bpm/rpm
Closes #135
2018-09-09 15:27:44 +02:00
b4a06057f8 Fixed copy&paste error 2018-09-09 15:26:45 +02:00
9f14eb7e70 Added weblate info 2018-09-09 14:51:27 +02:00
dcf1c686e5 Added support for new IGC date header format
Fixes #152
2018-09-09 14:38:37 +02:00
a8d183639e Fixed broken zoom 0 handling
Fixes #151
2018-09-09 09:41:04 +02:00
d9e025a18c String handling optimization 2018-08-27 22:25:55 +02:00
0a9077545b Make huge images work under OpenGL (at least memory-ineficient) 2018-08-24 12:26:32 +02:00
bbc1d43290 Fixed QT4 build 2018-08-24 00:46:06 +02:00
524d72ce3c Merge branch 'master' of https://github.com/tumic0/GPXSee 2018-08-24 00:15:12 +02:00
9f74bbb27a Some more code cleanup 2018-08-24 00:14:40 +02:00
ce34d449c2 Translations update (#149) 2018-08-23 23:58:06 +02:00
21dbd3958d Removed obsolete method 2018-08-23 23:56:23 +02:00
92ac7c0c10 Removed obsolete define 2018-08-23 20:33:14 +02:00
1f71b3a3b2 Code/API cleanup 2018-08-23 20:26:10 +02:00
27886ea96a Update gpxsee_sv.ts (#148)
new string translated
2018-08-23 09:10:55 +02:00
3176271955 Only create/copy the sub-images when OpenGL is used 2018-08-23 09:08:59 +02:00
d4b46a4bb6 Broken OpenGL image part drawing workaround 2018-08-22 00:14:07 +02:00
3b2d4dcd31 Update README.md 2018-08-21 22:40:38 +02:00
de196e8281 Splited the OfflineMap class to separate OziMap and GeoTIFF map classes 2018-08-21 20:01:47 +02:00
f376f7139b Report an error on HiDPI maps when HiDPI support is not enabled 2018-08-20 18:46:44 +02:00
9fe10f10b8 Fixed compiler warning 2018-08-19 10:44:12 +02:00
cdc9e51696 Added HiDPI displays/maps support 2018-08-18 21:06:36 +02:00
975d9816f4 Added maps repo link 2018-08-16 07:17:30 +02:00
187a909b4f Now using macros for the translations sections 2018-08-16 06:57:26 +02:00
1e6a49673e Added SLF info 2018-08-12 17:56:46 +02:00
3b7905fe8c Version++ 2018-08-12 14:23:02 +02:00
f70a4536b2 Translations update 2018-08-12 14:21:02 +02:00
b989d0e086 Added EPSG:102067 PCS (EPSG:5514 alias) 2018-08-12 14:10:26 +02:00
c3deab5369 Added SLF files association 2018-08-12 13:30:20 +02:00
f49e0223b2 Added SLF icns icon 2018-08-10 23:06:39 +02:00
96940c28d4 Added SLF ico file 2018-08-10 22:57:50 +02:00
e9ebc999fd Added SLF icon definition 2018-08-10 22:55:31 +02:00
c724bf134c Added support for Sigma SLF files 2018-08-10 22:46:04 +02:00
203f44b75a Update gpxsee_sv.ts (#145)
new strings translated
2018-08-10 19:10:26 +02:00
d0edd825cf Translations update 2018-08-10 00:25:11 +02:00
e3013bf815 Translations update (#144) 2018-08-10 00:19:56 +02:00
d4fd60b1d8 Fixed file association icons indexes 2018-08-10 00:14:31 +02:00
ba2347f363 Added LOC file association stuff 2018-08-09 22:48:44 +02:00
93a912a34a Updated ico icons 2018-08-09 22:47:17 +02:00
fb779840ce Broken SVG rendering workaround 2018-08-09 22:46:27 +02:00
dd183edd8d Updated icns icons 2018-08-09 22:32:52 +02:00
679bae0d67 Merge branch 'master' of https://github.com/tumic0/GPXSee 2018-08-09 22:31:44 +02:00
8fb4acc4c2 Added LOC icons generation
Broken SVG rendering workaround + code cleanup
2018-08-09 22:29:16 +02:00
6194519b18 Added support for geocaching.com LOC files 2018-08-08 20:18:08 +02:00
146 changed files with 4451 additions and 3170 deletions

View File

@ -1,4 +1,4 @@
version: 5.16.{build} version: 5.18.{build}
configuration: Release configuration: Release
platform: Any CPU platform: Any CPU
environment: environment:

View File

@ -1,17 +1,18 @@
# GPXSee # GPXSee
GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX, GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX,
KML, FIT, IGC, NMEA and OziExplorer files. KML, FIT, IGC, NMEA, SLF, LOC and OziExplorer files.
## Features ## Features
* User-definable online maps (OSM/Google tiles, WMTS, WMS). * [User-definable online maps](https://github.com/tumic0/GPXSee-maps) (OSM/Google tiles, WMTS, WMS).
* Offline maps (OziExplorer maps, TrekBuddy maps/atlases, Garmin JNX maps, GeoTIFF images). * Offline maps (OziExplorer maps, TrekBuddy maps/atlases, Garmin JNX maps, GeoTIFF images).
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs. * Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs.
* Support for multiple tracks in one view. * Support for multiple tracks in one view.
* Support for POI files. * Support for POI files.
* Print/export to PDF. * Print/export to PDF.
* Full-screen mode. * Full-screen mode.
* HiDPI/Retina displays & maps support.
* Native GUI for Windows, Mac OS X and Linux. * Native GUI for Windows, Mac OS X and Linux.
* Opens GPX, TCX, FIT, KML, IGC, NMEA, OziExplorer (PLT, RTE, WPT) and Garmin CSV files. * Opens GPX, TCX, FIT, KML, IGC, NMEA, SLF, LOC, OziExplorer (PLT, RTE, WPT) and Garmin CSV files.
![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux2.png) ![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux2.png)
@ -31,3 +32,6 @@ make
## Homepage ## Homepage
http://www.gpxsee.org http://www.gpxsee.org
## Translations
GPXSee uses [Weblate](https://hosted.weblate.org/projects/gpxsee) for translations.

View File

@ -1,5 +1,5 @@
TARGET = GPXSee TARGET = GPXSee
VERSION = 5.16 VERSION = 5.18
QT += core \ QT += core \
gui \ gui \
@ -89,7 +89,7 @@ HEADERS += src/config.h \
src/map/downloader.h \ src/map/downloader.h \
src/map/tile.h \ src/map/tile.h \
src/map/emptymap.h \ src/map/emptymap.h \
src/map/offlinemap.h \ src/map/ozimap.h \
src/map/tar.h \ src/map/tar.h \
src/map/ozf.h \ src/map/ozf.h \
src/map/atlas.h \ src/map/atlas.h \
@ -137,7 +137,12 @@ HEADERS += src/config.h \
src/map/mercator.h \ src/map/mercator.h \
src/map/jnxmap.h \ src/map/jnxmap.h \
src/map/krovak.h \ src/map/krovak.h \
src/GUI/kv.h src/GUI/kv.h \
src/data/locparser.h \
src/data/slfparser.h \
src/map/geotiffmap.h \
src/map/image.h \
src/common/greatcircle.h
SOURCES += src/main.cpp \ SOURCES += src/main.cpp \
src/common/coordinates.cpp \ src/common/coordinates.cpp \
src/common/rectc.cpp \ src/common/rectc.cpp \
@ -190,7 +195,7 @@ SOURCES += src/main.cpp \
src/map/onlinemap.cpp \ src/map/onlinemap.cpp \
src/map/downloader.cpp \ src/map/downloader.cpp \
src/map/emptymap.cpp \ src/map/emptymap.cpp \
src/map/offlinemap.cpp \ src/map/ozimap.cpp \
src/map/tar.cpp \ src/map/tar.cpp \
src/map/atlas.cpp \ src/map/atlas.cpp \
src/map/ozf.cpp \ src/map/ozf.cpp \
@ -238,7 +243,12 @@ SOURCES += src/main.cpp \
src/map/mercator.cpp \ src/map/mercator.cpp \
src/map/jnxmap.cpp \ src/map/jnxmap.cpp \
src/map/krovak.cpp \ src/map/krovak.cpp \
src/map/map.cpp src/map/map.cpp \
src/data/locparser.cpp \
src/data/slfparser.cpp \
src/map/geotiffmap.cpp \
src/map/image.cpp \
src/common/greatcircle.cpp
RESOURCES += gpxsee.qrc RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \ TRANSLATIONS = lang/gpxsee_cs.ts \
@ -273,7 +283,9 @@ macx {
icons/nmea.icns \ icons/nmea.icns \
icons/plt.icns \ icons/plt.icns \
icons/rte.icns \ icons/rte.icns \
icons/wpt.icns icons/wpt.icns \
icons/loc.icns \
icons/slf.icns
QMAKE_BUNDLE_DATA += LOCALE MAPS ICONS CSV QMAKE_BUNDLE_DATA += LOCALE MAPS ICONS CSV
} }
win32 { win32 {
@ -286,8 +298,11 @@ win32 {
icons/nmea.ico \ icons/nmea.ico \
icons/plt.ico \ icons/plt.ico \
icons/rte.ico \ icons/rte.ico \
icons/wpt.ico icons/wpt.ico \
icons/loc.ico \
icons/slf.ico
DEFINES += _USE_MATH_DEFINES DEFINES += _USE_MATH_DEFINES
} }
DEFINES += APP_VERSION=\\\"$$VERSION\\\" DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES *= QT_USE_QSTRINGBUILDER

View File

@ -1,24 +1,46 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>icons/dialog-close.png</file> <file>icons/dialog-close.png</file>
<file>icons/dialog-close@2x.png</file>
<file>icons/document-open.png</file> <file>icons/document-open.png</file>
<file>icons/document-open@2x.png</file>
<file>icons/document-print.png</file> <file>icons/document-print.png</file>
<file>icons/document-print@2x.png</file>
<file>icons/document-export.png</file> <file>icons/document-export.png</file>
<file>icons/document-export@2x.png</file>
<file>icons/flag.png</file> <file>icons/flag.png</file>
<file>icons/flag@2x.png</file>
<file>icons/gpxsee.png</file> <file>icons/gpxsee.png</file>
<file>icons/gpxsee@2x.png</file>
<file>icons/application-exit.png</file> <file>icons/application-exit.png</file>
<file>icons/application-exit@2x.png</file>
<file>icons/applications-internet.png</file> <file>icons/applications-internet.png</file>
<file>icons/applications-internet@2x.png</file>
<file>icons/view-refresh.png</file> <file>icons/view-refresh.png</file>
<file>icons/view-refresh@2x.png</file>
<file>icons/arrow-left.png</file> <file>icons/arrow-left.png</file>
<file>icons/arrow-left@2x.png</file>
<file>icons/arrow-right.png</file> <file>icons/arrow-right.png</file>
<file>icons/arrow-right@2x.png</file>
<file>icons/arrow-left-double.png</file> <file>icons/arrow-left-double.png</file>
<file>icons/arrow-left-double@2x.png</file>
<file>icons/arrow-right-double.png</file> <file>icons/arrow-right-double.png</file>
<file>icons/arrow-right-double@2x.png</file>
<file>icons/view-fullscreen.png</file> <file>icons/view-fullscreen.png</file>
<file>icons/view-fullscreen@2x.png</file>
<file>icons/office-chart-line.png</file> <file>icons/office-chart-line.png</file>
<file>icons/preferences-desktop-display.png</file> <file>icons/office-chart-line@2x.png</file>
<file>icons/flag_48.png</file> <file>icons/format-stroke-color.png</file>
<file>icons/system-run.png</file> <file>icons/format-stroke-color@2x.png</file>
<file>icons/document-print-preview.png</file> <file>icons/flag_32.png</file>
<file>icons/flag_32@2x.png</file>
<file>icons/preferences-system.png</file>
<file>icons/preferences-system@2x.png</file>
<file>icons/document-print_32.png</file>
<file>icons/document-print_32@2x.png</file>
<file>icons/view-filter.png</file> <file>icons/view-filter.png</file>
<file>icons/view-filter@2x.png</file>
<file>icons/applications-internet_32.png</file>
<file>icons/applications-internet_32@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icons/arrow-left@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
icons/arrow-right@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
icons/dialog-close@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
icons/document-open@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icons/document-print@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icons/document-print_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 302 KiB

BIN
icons/flag@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
icons/flag_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
icons/flag_32@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 305 KiB

BIN
icons/gpxsee@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

BIN
icons/loc.icns Normal file

Binary file not shown.

BIN
icons/loc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 302 KiB

11
icons/scripts/extensions Normal file
View File

@ -0,0 +1,11 @@
fit:#006600
gpx:#003399
igc:#ff3300
kml:#990000
nmea:#0083d7
plt:#66ff00
rte:#66ff00
tcx:#ffcc00
wpt:#66ff00
loc:#556677
slf:#881199

View File

@ -1,9 +1,6 @@
#!/bin/bash #!/bin/bash
EXTENSIONS="fit:#006600 gpx:#003399 igc:#ff3300 kml:#990000 nmea:#0083d7 \ while read e; do
plt:#66ff00 rte:#66ff00 tcx:#ffcc00 wpt:#66ff00"
for e in $EXTENSIONS; do
IFS=":"; set $e IFS=":"; set $e
EXT=`echo $1 | tr /a-z/ /A-Z/` EXT=`echo $1 | tr /a-z/ /A-Z/`
@ -25,4 +22,4 @@ for e in $EXTENSIONS; do
iconutil -c icns -o $1.icns "$ICONSET" iconutil -c icns -o $1.icns "$ICONSET"
rm -R "$ICONSET" $1.svg rm -R "$ICONSET" $1.svg
done done < extensions

View File

@ -1,13 +1,10 @@
#!/bin/bash #!/bin/bash
EXTENSIONS="fit:#006600 gpx:#003399 igc:#ff3300 kml:#990000 nmea:#0083d7 \ while read e; do
plt:#66ff00 rte:#66ff00 tcx:#ffcc00 wpt:#66ff00"
for e in $EXTENSIONS; do
IFS=":"; set $e IFS=":"; set $e
EXT=`echo $1 | tr /a-z/ /A-Z/` EXT=`echo $1 | tr /a-z/ /A-Z/`
sed -e "s/\$EXTENSION/$EXT/" -e "s/\$COLOR/$2/" icon-template.svg > $1.svg sed -e "s/\$EXTENSION/$EXT/" -e "s/\$COLOR/$2/" icon-template.svg > $1.svg
convert -density 400 $1.svg -define icon:auto-resize $1.ico convert -density 400 $1.svg -define icon:auto-resize $1.ico
rm $1.svg rm $1.svg
done done < extensions

View File

@ -12,6 +12,9 @@
</g> </g>
<g transform="translate(16.573463,124.9782)"> <g transform="translate(16.573463,124.9782)">
<rect y="0" x="0" id="textrect" height="50" width="120" style="fill:$COLOR;fill-opacity:1;stroke:none;"/> <rect y="0" x="0" id="textrect" height="50" width="120" style="fill:$COLOR;fill-opacity:1;stroke:none;"/>
<text y="28" x="60" dominant-baseline="central" text-anchor="middle" style="fill:#FFFFFF;font-size:39px;font-family:sans-serif;font-weight:bold;">$EXTENSION</text> <!--
<text y="28" x="60" dominant-baseline="central" text-anchor="middle" style="fill:#FFFFFF;font-size:39px;font-family:Helvetica;font-weight:bold;">$EXTENSION</text>
-->
<text y="25" x="60" dy="0.36em" text-anchor="middle" style="fill:#FFFFFF;font-size:39px;font-family:Helvetica;font-weight:bold;">$EXTENSION</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
icons/slf.icns Normal file

Binary file not shown.

BIN
icons/slf.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 885 B

BIN
icons/view-filter@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
icons/view-refresh@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,38 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Viewer</string> <string>Viewer</string>
</dict> </dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>loc</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/loc+xml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>icons/loc.icns</string>
<key>CFBundleTypeName</key>
<string>Geocaching.com Waypoint File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>slf</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/slf+xml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>icons/slf.icns</string>
<key>CFBundleTypeName</key>
<string>Sigma Log Format</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
@ -230,6 +262,48 @@
<string>application/vnd.google-earth.kml+xml</string> <string>application/vnd.google-earth.kml+xml</string>
</dict> </dict>
</dict> </dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.geocaching.loc</string>
<key>UTTypeReferenceURL</key>
<string>https://www.geocaching.com</string>
<key>UTTypeDescription</key>
<string>Geocaching.com Waypoint File</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>loc</string>
</array>
<key>public.mime-type</key>
<string>application/loc+xml</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.sigmasport.slf</string>
<key>UTTypeReferenceURL</key>
<string>https://www.sigmasport.com</string>
<key>UTTypeDescription</key>
<string>Sigma Log Format</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>slf</string>
</array>
<key>public.mime-type</key>
<string>application/slf+xml</string>
</dict>
</dict>
<dict> <dict>
<key>UTTypeIdentifier</key> <key>UTTypeIdentifier</key>
<string>com.thisisant.fit</string> <string>com.thisisant.fit</string>

View File

@ -1847,6 +1847,7 @@ RSRGD2000 / PCLC2000,5481,4764,5477,9001,9802,4500,8821,-71.3,9110,8822,166,9110
RGAF09 / UTM zone 20N,5490,5489,16020,9001,9807,4400,8801,0,9102,8802,-63,9102,8805,0.9996,9201,8806,500000,9001,8807,0,9001,,,,,, RGAF09 / UTM zone 20N,5490,5489,16020,9001,9807,4400,8801,0,9102,8802,-63,9102,8805,0.9996,9201,8806,500000,9001,8807,0,9001,,,,,,
S-JTSK / Krovak,5513,4156,5509,9001,9819,6501,1036,30.1717303,9110,8806,0,9001,8807,0,9001,8811,49.3,9110,8818,78.3,9110,8819,0.9999,9201,8833,24.5,9110 S-JTSK / Krovak,5513,4156,5509,9001,9819,6501,1036,30.1717303,9110,8806,0,9001,8807,0,9001,8811,49.3,9110,8818,78.3,9110,8819,0.9999,9201,8833,24.5,9110
S-JTSK / Krovak East North,5514,4156,5510,9001,1041,4499,1036,30.1717303,9110,8806,0,9001,8807,0,9001,8811,49.3,9110,8818,78.3,9110,8819,0.9999,9201,8833,24.5,9110 S-JTSK / Krovak East North,5514,4156,5510,9001,1041,4499,1036,30.1717303,9110,8806,0,9001,8807,0,9001,8811,49.3,9110,8818,78.3,9110,8819,0.9999,9201,8833,24.5,9110
S-JTSK / Krovak East North,102067,4156,5510,9001,1041,4499,1036,30.1717303,9110,8806,0,9001,8807,0,9001,8811,49.3,9110,8818,78.3,9110,8819,0.9999,9201,8833,24.5,9110
CI1971 / Chatham Islands Map Grid,5518,4672,5517,9001,9807,4500,8801,-44,9110,8802,-176.3,9110,8805,1,9201,8806,350000,9001,8807,650000,9001,,,,,, CI1971 / Chatham Islands Map Grid,5518,4672,5517,9001,9807,4500,8801,-44,9110,8802,-176.3,9110,8805,1,9201,8806,350000,9001,8807,650000,9001,,,,,,
CI1979 / Chatham Islands Map Grid,5519,4673,5517,9001,9807,4500,8801,-44,9110,8802,-176.3,9110,8805,1,9201,8806,350000,9001,8807,650000,9001,,,,,, CI1979 / Chatham Islands Map Grid,5519,4673,5517,9001,9807,4500,8801,-44,9110,8802,-176.3,9110,8805,1,9201,8806,350000,9001,8807,650000,9001,,,,,,
DHDN / 3-degree Gauss-Kruger zone 1,5520,4314,16261,9001,9807,4530,8801,0,9102,8802,3,9102,8805,1,9201,8806,1500000,9001,8807,0,9001,,,,,, DHDN / 3-degree Gauss-Kruger zone 1,5520,4314,16261,9001,9807,4530,8801,0,9102,8802,3,9102,8805,1,9201,8806,1500000,9001,8807,0,9001,,,,,,

Can't render this file because it is too large.

View File

@ -11,4 +11,4 @@ Icon=gpxsee
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Graphics;Viewer;Maps;Qt; Categories=Graphics;Viewer;Maps;Qt;
MimeType=application/gpx+xml;application/tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt; MimeType=application/gpx+xml;application/tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/loc+xml;application/slf+xml;

View File

@ -2,10 +2,35 @@
!include "x64.nsh" !include "x64.nsh"
!include "WinVer.nsh" !include "WinVer.nsh"
; Macros
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
!macroend
!macro FILE_ASSOCIATION_REMOVE EXT
DeleteRegKey HKCR "GPXSee.${EXT}"
DeleteRegKey HKCR ".${EXT}"
!macroend
!macro LOCALIZATION LANG CODE
Section "${LANG}"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
!if /FileExists translations\qt_${CODE}.qm
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
!endif
SectionEnd
!macroend
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "5.16" !define VERSION "5.18"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}.exe" OutFile "GPXSee-${VERSION}.exe"
@ -32,16 +57,6 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller ; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee" !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; File types registry entries
!define REGGPX "GPXSee.gpx"
!define REGTCX "GPXSee.tcx"
!define REGKML "GPXSee.kml"
!define REGFIT "GPXSee.fit"
!define REGIGC "GPXSee.igc"
!define REGNMEA "GPXSee.nmea"
!define REGPLT "GPXSee.plt"
!define REGRTE "GPXSee.rte"
!define REGWPT "GPXSee.wpt"
; Start menu page configuration ; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -114,43 +129,17 @@ Section "GPXSee" SEC_APP
; Associate file formats ; Associate file formats
DetailPrint "Associating file types..." DetailPrint "Associating file types..."
WriteRegStr HKCR ".gpx" "" "${REGGPX}" !insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 4
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format" !insertmacro FILE_ASSOCIATION_ADD "tcx" "Training Center XML" 5
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,2" !insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 6
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\"" !insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 7
WriteRegStr HKCR ".tcx" "" "${REGTCX}" !insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 8
WriteRegStr HKCR "${REGTCX}" "" "Training Center XML" !insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 data" 9
WriteRegStr HKCR "${REGTCX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,3" !insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track Point File" 10
WriteRegStr HKCR "${REGTCX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\"" !insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 11
WriteRegStr HKCR ".kml" "" "${REGKML}" !insertmacro FILE_ASSOCIATION_ADD "wpt" "OziExplorer Waypoint File" 1
WriteRegStr HKCR "${REGKML}" "" "Keyhole Markup Language" !insertmacro FILE_ASSOCIATION_ADD "loc" "Geocaching.com Waypoint File" 2
WriteRegStr HKCR "${REGKML}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4" !insertmacro FILE_ASSOCIATION_ADD "slf" "Sigma Log File" 3
WriteRegStr HKCR "${REGKML}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".fit" "" "${REGFIT}"
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,5"
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".igc" "" "${REGIGC}"
WriteRegStr HKCR "${REGIGC}" "" "Flight Recorder Data Format"
WriteRegStr HKCR "${REGIGC}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,6"
WriteRegStr HKCR "${REGIGC}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".nmea" "" "${REGNMEA}"
WriteRegStr HKCR "${REGNMEA}" "" "NMEA 0183 data"
WriteRegStr HKCR "${REGNMEA}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,7"
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".plt" "" "${REGPLT}"
WriteRegStr HKCR "${REGPLT}" "" "OziExplorer Track Point File"
WriteRegStr HKCR "${REGPLT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,8"
WriteRegStr HKCR "${REGPLT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".rte" "" "${REGRTE}"
WriteRegStr HKCR "${REGRTE}" "" "OziExplorer Route File"
WriteRegStr HKCR "${REGRTE}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,9"
WriteRegStr HKCR "${REGRTE}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".wpt" "" "${REGWPT}"
WriteRegStr HKCR "${REGWPT}" "" "OziExplorer Waypoint File"
WriteRegStr HKCR "${REGWPT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGWPT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd
@ -211,40 +200,13 @@ Section "ANGLE" SEC_ANGLE
SectionEnd SectionEnd
SectionGroup "Localization" SEC_LOCALIZATION SectionGroup "Localization" SEC_LOCALIZATION
Section "Czech" !insertmacro LOCALIZATION "Czech" "cs"
CreateDirectory "$INSTDIR\translations" !insertmacro LOCALIZATION "Finnish" "fi"
File /oname=translations\gpxsee_cs.qm translations\gpxsee_cs.qm !insertmacro LOCALIZATION "French" "fr"
File /oname=translations\qt_cs.qm translations\qt_cs.qm !insertmacro LOCALIZATION "German" "de"
SectionEnd !insertmacro LOCALIZATION "Polish" "pl"
Section "Finnish" !insertmacro LOCALIZATION "Russian" "ru"
CreateDirectory "$INSTDIR\translations" !insertmacro LOCALIZATION "Swedish" "sv"
File /oname=translations\gpxsee_fi.qm translations\gpxsee_fi.qm
File /oname=translations\qt_fi.qm translations\qt_fi.qm
SectionEnd
Section "French"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_fr.qm translations\gpxsee_fr.qm
File /oname=translations\qt_fr.qm translations\qt_fr.qm
SectionEnd
Section "German"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_de.qm translations\gpxsee_de.qm
File /oname=translations\qt_de.qm translations\qt_de.qm
SectionEnd
Section "Polish"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_pl.qm translations\gpxsee_pl.qm
File /oname=translations\qt_pl.qm translations\qt_pl.qm
SectionEnd
Section "Russian"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_ru.qm translations\gpxsee_ru.qm
File /oname=translations\qt_ru.qm translations\qt_ru.qm
SectionEnd
Section "Swedish"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_sv.qm translations\gpxsee_sv.qm
SectionEnd
SectionGroupEnd SectionGroupEnd
;-------------------------------- ;--------------------------------
@ -267,24 +229,17 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove GPX file association ; Remove GPX file association
DeleteRegKey HKCR "${REGGPX}" !insertmacro FILE_ASSOCIATION_REMOVE "gpx"
DeleteRegKey HKCR ".gpx" !insertmacro FILE_ASSOCIATION_REMOVE "tcx"
DeleteRegKey HKCR "${REGTCX}" !insertmacro FILE_ASSOCIATION_REMOVE "kml"
DeleteRegKey HKCR ".tcx" !insertmacro FILE_ASSOCIATION_REMOVE "fit"
DeleteRegKey HKCR "${REGKML}" !insertmacro FILE_ASSOCIATION_REMOVE "igc"
DeleteRegKey HKCR ".kml" !insertmacro FILE_ASSOCIATION_REMOVE "nmea"
DeleteRegKey HKCR "${REGFIT}" !insertmacro FILE_ASSOCIATION_REMOVE "plt"
DeleteRegKey HKCR ".fit" !insertmacro FILE_ASSOCIATION_REMOVE "rte"
DeleteRegKey HKCR "${REGIGC}" !insertmacro FILE_ASSOCIATION_REMOVE "wpt"
DeleteRegKey HKCR ".igc" !insertmacro FILE_ASSOCIATION_REMOVE "loc"
DeleteRegKey HKCR "${REGNMEA}" !insertmacro FILE_ASSOCIATION_REMOVE "slf"
DeleteRegKey HKCR ".nmea"
DeleteRegKey HKCR "${REGPLT}"
DeleteRegKey HKCR ".plt"
DeleteRegKey HKCR "${REGRTE}"
DeleteRegKey HKCR ".rte"
DeleteRegKey HKCR "${REGWPT}"
DeleteRegKey HKCR ".wpt"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd

View File

@ -22,6 +22,20 @@
<glob pattern="*.kml"/> <glob pattern="*.kml"/>
</mime-type> </mime-type>
<mime-type type="application/loc+xml">
<comment>Geocaching.com Waypoint File</comment>
<sub-class-of type="application/xml"/>
<generic-icon name="application-xml"/>
<glob pattern="*.loc"/>
</mime-type>
<mime-type type="application/slf+xml">
<comment>Sigma Log Format</comment>
<sub-class-of type="application/xml"/>
<generic-icon name="application-xml"/>
<glob pattern="*.slf"/>
</mime-type>
<mime-type type="application/vnd.ant.fit"> <mime-type type="application/vnd.ant.fit">
<comment>Flexible and Interoperable Data Transfer</comment> <comment>Flexible and Interoperable Data Transfer</comment>
<sub-class-of type="application/octet-stream"/> <sub-class-of type="application/octet-stream"/>

View File

@ -2,10 +2,35 @@
!include "x64.nsh" !include "x64.nsh"
!include "WinVer.nsh" !include "WinVer.nsh"
; Macros
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
!macroend
!macro FILE_ASSOCIATION_REMOVE EXT
DeleteRegKey HKCR "GPXSee.${EXT}"
DeleteRegKey HKCR ".${EXT}"
!macroend
!macro LOCALIZATION LANG CODE
Section "${LANG}"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
!if /FileExists translations\qt_${CODE}.qm
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
!endif
SectionEnd
!macroend
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "5.16" !define VERSION "5.18"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}_x64.exe" OutFile "GPXSee-${VERSION}_x64.exe"
@ -32,16 +57,6 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller ; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee" !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; File types registry entries
!define REGGPX "GPXSee.gpx"
!define REGTCX "GPXSee.tcx"
!define REGKML "GPXSee.kml"
!define REGFIT "GPXSee.fit"
!define REGIGC "GPXSee.igc"
!define REGNMEA "GPXSee.nmea"
!define REGPLT "GPXSee.plt"
!define REGRTE "GPXSee.rte"
!define REGWPT "GPXSee.wpt"
; Start menu page configuration ; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -121,43 +136,17 @@ Section "GPXSee" SEC_APP
; Associate file formats ; Associate file formats
DetailPrint "Associating file types..." DetailPrint "Associating file types..."
WriteRegStr HKCR ".gpx" "" "${REGGPX}" !insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 4
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format" !insertmacro FILE_ASSOCIATION_ADD "tcx" "Training Center XML" 5
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,2" !insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 6
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\"" !insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 7
WriteRegStr HKCR ".tcx" "" "${REGTCX}" !insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 8
WriteRegStr HKCR "${REGTCX}" "" "Training Center XML" !insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 data" 9
WriteRegStr HKCR "${REGTCX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,3" !insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track Point File" 10
WriteRegStr HKCR "${REGTCX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\"" !insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 11
WriteRegStr HKCR ".kml" "" "${REGKML}" !insertmacro FILE_ASSOCIATION_ADD "wpt" "OziExplorer Waypoint File" 1
WriteRegStr HKCR "${REGKML}" "" "Keyhole Markup Language" !insertmacro FILE_ASSOCIATION_ADD "loc" "Geocaching.com Waypoint File" 2
WriteRegStr HKCR "${REGKML}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4" !insertmacro FILE_ASSOCIATION_ADD "slf" "Sigma Log File" 3
WriteRegStr HKCR "${REGKML}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".fit" "" "${REGFIT}"
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,5"
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".igc" "" "${REGIGC}"
WriteRegStr HKCR "${REGIGC}" "" "Flight Recorder Data Format"
WriteRegStr HKCR "${REGIGC}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,6"
WriteRegStr HKCR "${REGIGC}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".nmea" "" "${REGNMEA}"
WriteRegStr HKCR "${REGNMEA}" "" "NMEA 0183 data"
WriteRegStr HKCR "${REGNMEA}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,7"
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".plt" "" "${REGPLT}"
WriteRegStr HKCR "${REGPLT}" "" "OziExplorer Track Point File"
WriteRegStr HKCR "${REGPLT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,8"
WriteRegStr HKCR "${REGPLT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".rte" "" "${REGRTE}"
WriteRegStr HKCR "${REGRTE}" "" "OziExplorer Route File"
WriteRegStr HKCR "${REGRTE}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,9"
WriteRegStr HKCR "${REGRTE}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
WriteRegStr HKCR ".wpt" "" "${REGWPT}"
WriteRegStr HKCR "${REGWPT}" "" "OziExplorer Waypoint File"
WriteRegStr HKCR "${REGWPT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGWPT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd
@ -213,40 +202,13 @@ Section "ANGLE" SEC_ANGLE
SectionEnd SectionEnd
SectionGroup "Localization" SEC_LOCALIZATION SectionGroup "Localization" SEC_LOCALIZATION
Section "Czech" !insertmacro LOCALIZATION "Czech" "cs"
CreateDirectory "$INSTDIR\translations" !insertmacro LOCALIZATION "Finnish" "fi"
File /oname=translations\gpxsee_cs.qm translations\gpxsee_cs.qm !insertmacro LOCALIZATION "French" "fr"
File /oname=translations\qt_cs.qm translations\qt_cs.qm !insertmacro LOCALIZATION "German" "de"
SectionEnd !insertmacro LOCALIZATION "Polish" "pl"
Section "Finnish" !insertmacro LOCALIZATION "Russian" "ru"
CreateDirectory "$INSTDIR\translations" !insertmacro LOCALIZATION "Swedish" "sv"
File /oname=translations\gpxsee_fi.qm translations\gpxsee_fi.qm
File /oname=translations\qt_fi.qm translations\qt_fi.qm
SectionEnd
Section "French"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_fr.qm translations\gpxsee_fr.qm
File /oname=translations\qt_fr.qm translations\qt_fr.qm
SectionEnd
Section "German"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_de.qm translations\gpxsee_de.qm
File /oname=translations\qt_de.qm translations\qt_de.qm
SectionEnd
Section "Polish"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_pl.qm translations\gpxsee_pl.qm
File /oname=translations\qt_pl.qm translations\qt_pl.qm
SectionEnd
Section "Russian"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_ru.qm translations\gpxsee_ru.qm
File /oname=translations\qt_ru.qm translations\qt_ru.qm
SectionEnd
Section "Swedish"
CreateDirectory "$INSTDIR\translations"
File /oname=translations\gpxsee_sv.qm translations\gpxsee_sv.qm
SectionEnd
SectionGroupEnd SectionGroupEnd
;-------------------------------- ;--------------------------------
@ -270,24 +232,17 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove File associations ; Remove File associations
DeleteRegKey HKCR "${REGGPX}" !insertmacro FILE_ASSOCIATION_REMOVE "gpx"
DeleteRegKey HKCR ".gpx" !insertmacro FILE_ASSOCIATION_REMOVE "tcx"
DeleteRegKey HKCR "${REGTCX}" !insertmacro FILE_ASSOCIATION_REMOVE "kml"
DeleteRegKey HKCR ".tcx" !insertmacro FILE_ASSOCIATION_REMOVE "fit"
DeleteRegKey HKCR "${REGKML}" !insertmacro FILE_ASSOCIATION_REMOVE "igc"
DeleteRegKey HKCR ".kml" !insertmacro FILE_ASSOCIATION_REMOVE "nmea"
DeleteRegKey HKCR "${REGFIT}" !insertmacro FILE_ASSOCIATION_REMOVE "plt"
DeleteRegKey HKCR ".fit" !insertmacro FILE_ASSOCIATION_REMOVE "rte"
DeleteRegKey HKCR "${REGIGC}" !insertmacro FILE_ASSOCIATION_REMOVE "wpt"
DeleteRegKey HKCR ".igc" !insertmacro FILE_ASSOCIATION_REMOVE "loc"
DeleteRegKey HKCR "${REGNMEA}" !insertmacro FILE_ASSOCIATION_REMOVE "slf"
DeleteRegKey HKCR ".nmea"
DeleteRegKey HKCR "${REGPLT}"
DeleteRegKey HKCR ".plt"
DeleteRegKey HKCR "${REGRTE}"
DeleteRegKey HKCR ".rte"
DeleteRegKey HKCR "${REGWPT}"
DeleteRegKey HKCR ".wpt"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd

View File

@ -36,17 +36,14 @@ Ticks::Ticks(double minValue, double maxValue, int maxCount)
} }
AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent) AxisItem::AxisItem(Type type, QGraphicsItem *parent)
: QGraphicsItem(parent), _locale(QLocale::system())
{ {
_type = type; _type = type;
_size = 0; _size = 0;
_font.setPixelSize(FONT_SIZE); _font.setPixelSize(FONT_SIZE);
_font.setFamily(FONT_FAMILY); _font.setFamily(FONT_FAMILY);
#ifndef Q_OS_MAC
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
#endif // Q_OS_MAC
} }
void AxisItem::setRange(const RangeF &range) void AxisItem::setRange(const RangeF &range)
@ -60,7 +57,7 @@ void AxisItem::setRange(const RangeF &range)
for (int i = 0; i < ticks.count(); i++) { for (int i = 0; i < ticks.count(); i++) {
Tick &t = _ticks[i]; Tick &t = _ticks[i];
t.value = ticks.val(i); t.value = ticks.val(i);
t.boundingBox = fm.tightBoundingRect(QString::number(t.value)); t.boundingBox = fm.tightBoundingRect(_locale.toString(t.value));
} }
updateBoundingRect(); updateBoundingRect();
@ -130,7 +127,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
TICK/2, (_size/_range.size()) * (val - _range.min()), -TICK/2); TICK/2, (_size/_range.size()) * (val - _range.min()), -TICK/2);
painter->drawText(((_size/_range.size()) * (val - _range.min())) painter->drawText(((_size/_range.size()) * (val - _range.min()))
- (ts.width()/2), ts.height() + TICK/2 + PADDING, - (ts.width()/2), ts.height() + TICK/2 + PADDING,
QString::number(val)); _locale.toString(val));
} }
painter->drawText(_size/2 - _labelBB.width()/2, _labelBB.height() painter->drawText(_size/2 - _labelBB.width()/2, _labelBB.height()
@ -149,7 +146,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
* (val - _range.min()))); * (val - _range.min())));
painter->drawText(-(ts.width() + PADDING + TICK/2), painter->drawText(-(ts.width() + PADDING + TICK/2),
-((_size/_range.size()) * (val - _range.min())) + (ts.height()/2), -((_size/_range.size()) * (val - _range.min())) + (ts.height()/2),
QString::number(val)); _locale.toString(val));
} }
painter->rotate(-90); painter->rotate(-90);

View File

@ -3,6 +3,7 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QVector> #include <QVector>
#include <QLocale>
#include "common/range.h" #include "common/range.h"
class AxisItem : public QGraphicsItem class AxisItem : public QGraphicsItem
@ -39,6 +40,7 @@ private:
QVector<Tick> _ticks; QVector<Tick> _ticks;
QRectF _boundingRect; QRectF _boundingRect;
QFont _font; QFont _font;
QLocale _locale;
}; };
#endif // AXISITEM_H #endif // AXISITEM_H

View File

@ -1,3 +1,4 @@
#include <QLocale>
#include "data/data.h" #include "data/data.h"
#include "cadencegraphitem.h" #include "cadencegraphitem.h"
#include "cadencegraph.h" #include "cadencegraph.h"
@ -7,7 +8,7 @@ CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
{ {
_showTracks = true; _showTracks = true;
GraphView::setYUnits(tr("1/min")); GraphView::setYUnits(tr("rpm"));
setYLabel(tr("Cadence")); setYLabel(tr("Cadence"));
setSliderPrecision(1); setSliderPrecision(1);
@ -16,9 +17,11 @@ CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
void CadenceGraph::setInfo() void CadenceGraph::setInfo()
{ {
if (_showTracks) { if (_showTracks) {
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale() QLocale l(QLocale::system());
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); + yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale() GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); + yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
} else } else
clearInfo(); clearInfo();

View File

@ -1,6 +1,8 @@
#include <QLocale>
#include "tooltip.h" #include "tooltip.h"
#include "cadencegraphitem.h" #include "cadencegraphitem.h"
CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type, CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent) QGraphicsItem *parent) : GraphItem(graph, type, parent)
{ {
@ -16,11 +18,12 @@ CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
QString CadenceGraphItem::toolTip() const QString CadenceGraphItem::toolTip() const
{ {
ToolTip tt; ToolTip tt;
QLocale l(QLocale::system());
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1) tt.insert(tr("Maximum"), l.toString(max(), 'f', 1)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("rpm"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 1) tt.insert(tr("Average"), l.toString(avg(), 'f', 1)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("rpm"));
return tt.toString(); return tt.toString();
} }

View File

@ -1,4 +1,5 @@
#include <cmath> #include <cmath>
#include <QLocale>
#include "data/data.h" #include "data/data.h"
#include "config.h" #include "config.h"
#include "tooltip.h" #include "tooltip.h"
@ -54,13 +55,15 @@ void ElevationGraph::setInfo()
if (std::isnan(max()) || std::isnan(min())) if (std::isnan(max()) || std::isnan(min()))
clearInfo(); clearInfo();
else { else {
GraphView::addInfo(tr("Ascent"), QString::number(ascent() * yScale(), QLocale l(QLocale::system());
GraphView::addInfo(tr("Ascent"), l.toString(ascent() * yScale(),
'f', 0) + UNIT_SPACE + yUnits()); 'f', 0) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Descent"), QString::number(descent() * yScale(), GraphView::addInfo(tr("Descent"), l.toString(descent() * yScale(),
'f', 0) + UNIT_SPACE + yUnits()); 'f', 0) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
0) + UNIT_SPACE + yUnits()); 0) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
0) + UNIT_SPACE + yUnits()); 0) + UNIT_SPACE + yUnits());
} }
} }

View File

@ -1,6 +1,8 @@
#include <QLocale>
#include "tooltip.h" #include "tooltip.h"
#include "elevationgraphitem.h" #include "elevationgraphitem.h"
ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type, ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent) QGraphicsItem *parent) : GraphItem(graph, type, parent)
{ {
@ -24,14 +26,15 @@ QString ElevationGraphItem::toolTip(Units units) const
ToolTip tt; ToolTip tt;
qreal scale = (units == Metric) ? 1.0 : M2FT; qreal scale = (units == Metric) ? 1.0 : M2FT;
QString su = (units == Metric) ? tr("m") : tr("ft"); QString su = (units == Metric) ? tr("m") : tr("ft");
QLocale l(QLocale::system());
tt.insert(tr("Ascent"), QString::number(ascent() * scale, 'f', 0) tt.insert(tr("Ascent"), l.toString(ascent() * scale, 'f', 0)
+ UNIT_SPACE + su); + UNIT_SPACE + su);
tt.insert(tr("Descent"), QString::number(descent() * scale, 'f', 0) tt.insert(tr("Descent"), l.toString(descent() * scale, 'f', 0)
+ UNIT_SPACE + su); + UNIT_SPACE + su);
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 0) tt.insert(tr("Maximum"), l.toString(max() * scale, 'f', 0)
+ UNIT_SPACE + su); + UNIT_SPACE + su);
tt.insert(tr("Minimum"), QString::number(min() * scale, 'f', 0) tt.insert(tr("Minimum"), l.toString(min() * scale, 'f', 0)
+ UNIT_SPACE + su); + UNIT_SPACE + su);
return tt.toString(); return tt.toString();

View File

@ -46,37 +46,41 @@ QString Format::timeSpan(qreal time, bool full)
QString Format::distance(qreal value, Units units) QString Format::distance(qreal value, Units units)
{ {
QLocale l(QLocale::system());
if (units == Imperial) { if (units == Imperial) {
if (value < MIINM) if (value < MIINM)
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "ft"); + qApp->translate("Format", "ft");
else else
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "mi"); + qApp->translate("Format", "mi");
} else if (units == Nautical) { } else if (units == Nautical) {
if (value < NMIINM) if (value < NMIINM)
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "ft"); + qApp->translate("Format", "ft");
else else
return QString::number(value * M2NMI, 'f', 1) + UNIT_SPACE return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "nmi"); + qApp->translate("Format", "nmi");
} else { } else {
if (value < KMINM) if (value < KMINM)
return QString::number(value, 'f', 0) + UNIT_SPACE return l.toString(value, 'f', 0) + UNIT_SPACE
+ qApp->translate("Format", "m"); + qApp->translate("Format", "m");
else else
return QString::number(value * M2KM, 'f', 1) + UNIT_SPACE return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE
+ qApp->translate("Format", "km"); + qApp->translate("Format", "km");
} }
} }
QString Format::elevation(qreal value, Units units) QString Format::elevation(qreal value, Units units)
{ {
QLocale l(QLocale::system());
if (units == Metric) if (units == Metric)
return QString::number(qRound(value)) + UNIT_SPACE return l.toString(qRound(value)) + UNIT_SPACE
+ qApp->translate("Format", "m"); + qApp->translate("Format", "m");
else else
return QString::number(qRound(value * M2FT)) + UNIT_SPACE return l.toString(qRound(value * M2FT)) + UNIT_SPACE
+ qApp->translate("Format", "ft"); + qApp->translate("Format", "ft");
} }
@ -95,7 +99,8 @@ QString Format::coordinates(const Coordinates &value, CoordinatesFormat type)
+ deg2DMS(qAbs(value.lon())) + xH; + deg2DMS(qAbs(value.lon())) + xH;
break; break;
default: default:
return QString::number(qAbs(value.lat()), 'f', 5) + yH + "," QLocale l(QLocale::system());
+ QChar(0x00A0) + QString::number(qAbs(value.lon()), 'f', 5) + xH; return l.toString(qAbs(value.lat()), 'f', 5) + yH + ","
+ QChar(0x00A0) + l.toString(qAbs(value.lon()), 'f', 5) + xH;
} }
} }

View File

@ -1,3 +1,4 @@
#include <QLocale>
#include "data/data.h" #include "data/data.h"
#include "gearratiographitem.h" #include "gearratiographitem.h"
#include "gearratiograph.h" #include "gearratiograph.h"
@ -16,11 +17,13 @@ GearRatioGraph::GearRatioGraph(QWidget *parent) : GraphTab(parent)
void GearRatioGraph::setInfo() void GearRatioGraph::setInfo()
{ {
if (_showTracks) { if (_showTracks) {
GraphView::addInfo(tr("Most used"), QString::number(top() * yScale(), QLocale l(QLocale::system());
GraphView::addInfo(tr("Most used"), l.toString(top() * yScale(),
'f', 2) + UNIT_SPACE + yUnits()); 'f', 2) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
2) + UNIT_SPACE + yUnits()); 2) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
2) + UNIT_SPACE + yUnits()); 2) + UNIT_SPACE + yUnits());
} else } else
clearInfo(); clearInfo();

View File

@ -1,7 +1,9 @@
#include <QMap> #include <QMap>
#include <QLocale>
#include "tooltip.h" #include "tooltip.h"
#include "gearratiographitem.h" #include "gearratiographitem.h"
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type, GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN) QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
{ {
@ -30,10 +32,11 @@ GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
QString GearRatioGraphItem::toolTip() const QString GearRatioGraphItem::toolTip() const
{ {
ToolTip tt; ToolTip tt;
QLocale l(QLocale::system());
tt.insert(tr("Minimum"), QString::number(min(), 'f', 2)); tt.insert(tr("Minimum"), l.toString(min(), 'f', 2));
tt.insert(tr("Maximum"), QString::number(max(), 'f', 2)); tt.insert(tr("Maximum"), l.toString(max(), 'f', 2));
tt.insert(tr("Most used"), QString::number(top(), 'f', 2)); tt.insert(tr("Most used"), l.toString(top(), 'f', 2));
return tt.toString(); return tt.toString();
} }

View File

@ -5,6 +5,7 @@
#include <QPaintDevice> #include <QPaintDevice>
#include <QGraphicsSimpleTextItem> #include <QGraphicsSimpleTextItem>
#include <QPalette> #include <QPalette>
#include <QLocale>
#include "data/graph.h" #include "data/graph.h"
#include "opengl.h" #include "opengl.h"
#include "config.h" #include "config.h"
@ -413,8 +414,10 @@ void GraphView::updateSliderPosition()
void GraphView::updateSliderInfo() void GraphView::updateSliderInfo()
{ {
QLocale l(QLocale::system());
qreal r, y; qreal r, y;
if (_visible.count() > 1) { if (_visible.count() > 1) {
r = 0; r = 0;
y = 0; y = 0;
@ -435,9 +438,9 @@ void GraphView::updateSliderInfo()
_sliderInfo->setSide(s); _sliderInfo->setSide(s);
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r)); _sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
_sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos, _sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos,
bounds().width() > 3600) : QString::number(_sliderPos * _xScale, 'f', 1) bounds().width() > 3600) : l.toString(_sliderPos * _xScale, 'f', 1)
+ UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString() + UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString()
: QString::number(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE : l.toString(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE
+ _yUnits); + _yUnits);
} }

View File

@ -1,3 +1,4 @@
#include "config.h"
#include <QApplication> #include <QApplication>
#include <QSplitter> #include <QSplitter>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -22,12 +23,16 @@
#include <QMimeData> #include <QMimeData>
#include <QUrl> #include <QUrl>
#include <QPixmapCache> #include <QPixmapCache>
#ifdef ENABLE_HIDPI
#include <QWindow>
#include <QScreen>
#endif // ENABLE_HIDPI
#include <QStyle>
#include "data/data.h" #include "data/data.h"
#include "data/poi.h" #include "data/poi.h"
#include "map/maplist.h" #include "map/maplist.h"
#include "map/emptymap.h" #include "map/emptymap.h"
#include "map/downloader.h" #include "map/downloader.h"
#include "config.h"
#include "icons.h" #include "icons.h"
#include "keys.h" #include "keys.h"
#include "settings.h" #include "settings.h"
@ -48,6 +53,8 @@
#include "gui.h" #include "gui.h"
#define TOOLBAR_ICON_SIZE 22
GUI::GUI() GUI::GUI()
{ {
loadMaps(); loadMaps();
@ -72,7 +79,7 @@ GUI::GUI()
_splitter->setStretchFactor(1, 1); _splitter->setStretchFactor(1, 1);
setCentralWidget(_splitter); setCentralWidget(_splitter);
setWindowIcon(QIcon(QPixmap(APP_ICON))); setWindowIcon(QIcon(APP_ICON));
setWindowTitle(APP_NAME); setWindowTitle(APP_NAME);
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
setAcceptDrops(true); setAcceptDrops(true);
@ -195,7 +202,7 @@ void GUI::createActions()
_navigationActionGroup->setEnabled(false); _navigationActionGroup->setEnabled(false);
// General actions // General actions
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this); _exitAction = new QAction(QIcon(QUIT_ICON), tr("Quit"), this);
_exitAction->setShortcut(QUIT_SHORTCUT); _exitAction->setShortcut(QUIT_SHORTCUT);
_exitAction->setMenuRole(QAction::QuitRole); _exitAction->setMenuRole(QAction::QuitRole);
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
@ -208,40 +215,37 @@ void GUI::createActions()
_keysAction = new QAction(tr("Keyboard controls"), this); _keysAction = new QAction(tr("Keyboard controls"), this);
_keysAction->setMenuRole(QAction::NoRole); _keysAction->setMenuRole(QAction::NoRole);
connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys())); connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys()));
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)), _aboutAction = new QAction(QIcon(APP_ICON), tr("About GPXSee"), this);
tr("About GPXSee"), this);
_aboutAction->setMenuRole(QAction::AboutRole); _aboutAction->setMenuRole(QAction::AboutRole);
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about())); connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
// File actions // File actions
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)), _openFileAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Open..."), this);
tr("Open..."), this);
_openFileAction->setMenuRole(QAction::NoRole); _openFileAction->setMenuRole(QAction::NoRole);
_openFileAction->setShortcut(OPEN_SHORTCUT); _openFileAction->setShortcut(OPEN_SHORTCUT);
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
addAction(_openFileAction); addAction(_openFileAction);
_printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)), _printFileAction = new QAction(QIcon(PRINT_FILE_ICON), tr("Print..."),
tr("Print..."), this); this);
_printFileAction->setMenuRole(QAction::NoRole); _printFileAction->setMenuRole(QAction::NoRole);
_printFileAction->setActionGroup(_fileActionGroup); _printFileAction->setActionGroup(_fileActionGroup);
connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile())); connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
addAction(_printFileAction); addAction(_printFileAction);
_exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)), _exportFileAction = new QAction(QIcon(EXPORT_FILE_ICON),
tr("Export to PDF..."), this); tr("Export to PDF..."), this);
_exportFileAction->setMenuRole(QAction::NoRole); _exportFileAction->setMenuRole(QAction::NoRole);
_exportFileAction->setShortcut(EXPORT_SHORTCUT); _exportFileAction->setShortcut(EXPORT_SHORTCUT);
_exportFileAction->setActionGroup(_fileActionGroup); _exportFileAction->setActionGroup(_fileActionGroup);
connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile())); connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
addAction(_exportFileAction); addAction(_exportFileAction);
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closeFileAction = new QAction(QIcon(CLOSE_FILE_ICON), tr("Close"), this);
tr("Close"), this);
_closeFileAction->setMenuRole(QAction::NoRole); _closeFileAction->setMenuRole(QAction::NoRole);
_closeFileAction->setShortcut(CLOSE_SHORTCUT); _closeFileAction->setShortcut(CLOSE_SHORTCUT);
_closeFileAction->setActionGroup(_fileActionGroup); _closeFileAction->setActionGroup(_fileActionGroup);
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll())); connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll()));
addAction(_closeFileAction); addAction(_closeFileAction);
_reloadFileAction = new QAction(QIcon(QPixmap(RELOAD_FILE_ICON)), _reloadFileAction = new QAction(QIcon(RELOAD_FILE_ICON), tr("Reload"),
tr("Reload"), this); this);
_reloadFileAction->setMenuRole(QAction::NoRole); _reloadFileAction->setMenuRole(QAction::NoRole);
_reloadFileAction->setShortcut(RELOAD_SHORTCUT); _reloadFileAction->setShortcut(RELOAD_SHORTCUT);
_reloadFileAction->setActionGroup(_fileActionGroup); _reloadFileAction->setActionGroup(_fileActionGroup);
@ -255,12 +259,12 @@ void GUI::createActions()
addAction(_statisticsAction); addAction(_statisticsAction);
// POI actions // POI actions
_openPOIAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)), _openPOIAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load POI file..."),
tr("Load POI file..."), this); this);
_openPOIAction->setMenuRole(QAction::NoRole); _openPOIAction->setMenuRole(QAction::NoRole);
connect(_openPOIAction, SIGNAL(triggered()), this, SLOT(openPOIFile())); connect(_openPOIAction, SIGNAL(triggered()), this, SLOT(openPOIFile()));
_closePOIAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closePOIAction = new QAction(QIcon(CLOSE_FILE_ICON), tr("Close POI files"),
tr("Close POI files"), this); this);
_closePOIAction->setMenuRole(QAction::NoRole); _closePOIAction->setMenuRole(QAction::NoRole);
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles())); connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
_overlapPOIAction = new QAction(tr("Overlap POIs"), this); _overlapPOIAction = new QAction(tr("Overlap POIs"), this);
@ -273,8 +277,7 @@ void GUI::createActions()
_showPOILabelsAction->setCheckable(true); _showPOILabelsAction->setCheckable(true);
connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _mapView, connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showPOILabels(bool))); SLOT(showPOILabels(bool)));
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)), _showPOIAction = new QAction(QIcon(SHOW_POI_ICON), tr("Show POIs"), this);
tr("Show POIs"), this);
_showPOIAction->setMenuRole(QAction::NoRole); _showPOIAction->setMenuRole(QAction::NoRole);
_showPOIAction->setCheckable(true); _showPOIAction->setCheckable(true);
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT); _showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
@ -284,7 +287,7 @@ void GUI::createActions()
createPOIFilesActions(); createPOIFilesActions();
// Map actions // Map actions
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"), _showMapAction = new QAction(QIcon(SHOW_MAP_ICON), tr("Show map"),
this); this);
_showMapAction->setMenuRole(QAction::NoRole); _showMapAction->setMenuRole(QAction::NoRole);
_showMapAction->setCheckable(true); _showMapAction->setCheckable(true);
@ -292,8 +295,8 @@ void GUI::createActions()
connect(_showMapAction, SIGNAL(triggered(bool)), _mapView, connect(_showMapAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showMap(bool))); SLOT(showMap(bool)));
addAction(_showMapAction); addAction(_showMapAction);
_loadMapAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)), _loadMapAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load map..."),
tr("Load map..."), this); this);
_loadMapAction->setMenuRole(QAction::NoRole); _loadMapAction->setMenuRole(QAction::NoRole);
connect(_loadMapAction, SIGNAL(triggered()), this, SLOT(loadMap())); connect(_loadMapAction, SIGNAL(triggered()), this, SLOT(loadMap()));
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this); _clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
@ -344,8 +347,8 @@ void GUI::createActions()
SLOT(showRouteWaypoints(bool))); SLOT(showRouteWaypoints(bool)));
// Graph actions // Graph actions
_showGraphsAction = new QAction(QIcon(QPixmap(SHOW_GRAPHS_ICON)), _showGraphsAction = new QAction(QIcon(SHOW_GRAPHS_ICON), tr("Show graphs"),
tr("Show graphs"), this); this);
_showGraphsAction->setMenuRole(QAction::NoRole); _showGraphsAction->setMenuRole(QAction::NoRole);
_showGraphsAction->setCheckable(true); _showGraphsAction->setCheckable(true);
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT); _showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
@ -439,7 +442,7 @@ void GUI::createActions()
_DMSAction->setCheckable(true); _DMSAction->setCheckable(true);
_DMSAction->setActionGroup(ag); _DMSAction->setActionGroup(ag);
connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS())); connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS()));
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)), _fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
tr("Fullscreen mode"), this); tr("Fullscreen mode"), this);
_fullscreenAction->setMenuRole(QAction::NoRole); _fullscreenAction->setMenuRole(QAction::NoRole);
_fullscreenAction->setCheckable(true); _fullscreenAction->setCheckable(true);
@ -453,21 +456,19 @@ void GUI::createActions()
SLOT(openOptions())); SLOT(openOptions()));
// Navigation actions // Navigation actions
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this); _nextAction = new QAction(QIcon(NEXT_FILE_ICON), tr("Next"), this);
_nextAction->setActionGroup(_navigationActionGroup); _nextAction->setActionGroup(_navigationActionGroup);
_nextAction->setMenuRole(QAction::NoRole); _nextAction->setMenuRole(QAction::NoRole);
connect(_nextAction, SIGNAL(triggered()), this, SLOT(next())); connect(_nextAction, SIGNAL(triggered()), this, SLOT(next()));
_prevAction = new QAction(QIcon(QPixmap(PREV_FILE_ICON)), tr("Previous"), _prevAction = new QAction(QIcon(PREV_FILE_ICON), tr("Previous"), this);
this);
_prevAction->setMenuRole(QAction::NoRole); _prevAction->setMenuRole(QAction::NoRole);
_prevAction->setActionGroup(_navigationActionGroup); _prevAction->setActionGroup(_navigationActionGroup);
connect(_prevAction, SIGNAL(triggered()), this, SLOT(prev())); connect(_prevAction, SIGNAL(triggered()), this, SLOT(prev()));
_lastAction = new QAction(QIcon(QPixmap(LAST_FILE_ICON)), tr("Last"), this); _lastAction = new QAction(QIcon(LAST_FILE_ICON), tr("Last"), this);
_lastAction->setMenuRole(QAction::NoRole); _lastAction->setMenuRole(QAction::NoRole);
_lastAction->setActionGroup(_navigationActionGroup); _lastAction->setActionGroup(_navigationActionGroup);
connect(_lastAction, SIGNAL(triggered()), this, SLOT(last())); connect(_lastAction, SIGNAL(triggered()), this, SLOT(last()));
_firstAction = new QAction(QIcon(QPixmap(FIRST_FILE_ICON)), tr("First"), _firstAction = new QAction(QIcon(FIRST_FILE_ICON), tr("First"), this);
this);
_firstAction->setMenuRole(QAction::NoRole); _firstAction->setMenuRole(QAction::NoRole);
_firstAction->setActionGroup(_navigationActionGroup); _firstAction->setActionGroup(_navigationActionGroup);
connect(_firstAction, SIGNAL(triggered()), this, SLOT(first())); connect(_firstAction, SIGNAL(triggered()), this, SLOT(first()));
@ -555,22 +556,28 @@ void GUI::createMenus()
void GUI::createToolBars() void GUI::createToolBars()
{ {
int is = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
QSize iconSize(qMin(is, TOOLBAR_ICON_SIZE), qMin(is, TOOLBAR_ICON_SIZE));
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
setToolButtonStyle(Qt::ToolButtonTextUnderIcon); setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // Q_OS_MAC #endif // Q_OS_MAC
_fileToolBar = addToolBar(tr("File")); _fileToolBar = addToolBar(tr("File"));
_fileToolBar->setIconSize(iconSize);
_fileToolBar->addAction(_openFileAction); _fileToolBar->addAction(_openFileAction);
_fileToolBar->addAction(_reloadFileAction); _fileToolBar->addAction(_reloadFileAction);
_fileToolBar->addAction(_closeFileAction); _fileToolBar->addAction(_closeFileAction);
_fileToolBar->addAction(_printFileAction); _fileToolBar->addAction(_printFileAction);
_showToolBar = addToolBar(tr("Show")); _showToolBar = addToolBar(tr("Show"));
_showToolBar->setIconSize(iconSize);
_showToolBar->addAction(_showPOIAction); _showToolBar->addAction(_showPOIAction);
_showToolBar->addAction(_showMapAction); _showToolBar->addAction(_showMapAction);
_showToolBar->addAction(_showGraphsAction); _showToolBar->addAction(_showGraphsAction);
_navigationToolBar = addToolBar(tr("Navigation")); _navigationToolBar = addToolBar(tr("Navigation"));
_navigationToolBar->setIconSize(iconSize);
_navigationToolBar->addAction(_firstAction); _navigationToolBar->addAction(_firstAction);
_navigationToolBar->addAction(_prevAction); _navigationToolBar->addAction(_prevAction);
_navigationToolBar->addAction(_nextAction); _navigationToolBar->addAction(_nextAction);
@ -924,6 +931,11 @@ void GUI::openOptions()
if (options.enableHTTP2 != _options.enableHTTP2) if (options.enableHTTP2 != _options.enableHTTP2)
Downloader::enableHTTP2(options.enableHTTP2); Downloader::enableHTTP2(options.enableHTTP2);
#endif // ENABLE_HTTP2 #endif // ENABLE_HTTP2
#ifdef ENABLE_HIDPI
if (options.hidpiMap != _options.hidpiMap)
_mapView->setDevicePixelRatio(options.hidpiMap ? devicePixelRatioF()
: 1.0);
#endif // ENABLE_HIDPI
if (reload) if (reload)
reloadFile(); reloadFile();
@ -964,6 +976,8 @@ void GUI::exportFile()
void GUI::statistics() void GUI::statistics()
{ {
QLocale l(QLocale::system());
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
QString text = "<style>td {white-space: pre; padding-right: 4em;}" QString text = "<style>td {white-space: pre; padding-right: 4em;}"
"th {text-align: left; padding-top: 0.5em;}</style><table>"; "th {text-align: left; padding-top: 0.5em;}</style><table>";
@ -974,21 +988,21 @@ void GUI::statistics()
if (_showTracksAction->isChecked() && _trackCount > 1) if (_showTracksAction->isChecked() && _trackCount > 1)
text.append("<tr><td>" + tr("Tracks") + ":</td><td>" text.append("<tr><td>" + tr("Tracks") + ":</td><td>"
+ QString::number(_trackCount) + "</td></tr>"); + l.toString(_trackCount) + "</td></tr>");
if (_showRoutesAction->isChecked() && _routeCount > 1) if (_showRoutesAction->isChecked() && _routeCount > 1)
text.append("<tr><td>" + tr("Routes") + ":</td><td>" text.append("<tr><td>" + tr("Routes") + ":</td><td>"
+ QString::number(_routeCount) + "</td></tr>"); + l.toString(_routeCount) + "</td></tr>");
if (_showWaypointsAction->isChecked() && _waypointCount > 1) if (_showWaypointsAction->isChecked() && _waypointCount > 1)
text.append("<tr><td>" + tr("Waypoints") + ":</td><td>" text.append("<tr><td>" + tr("Waypoints") + ":</td><td>"
+ QString::number(_waypointCount) + "</td></tr>"); + l.toString(_waypointCount) + "</td></tr>");
if (_dateRange.first.isValid()) { if (_dateRange.first.isValid()) {
if (_dateRange.first == _dateRange.second) { if (_dateRange.first == _dateRange.second) {
QString format = QLocale::system().dateFormat(QLocale::LongFormat); QString format = l.dateFormat(QLocale::LongFormat);
text.append("<tr><td>" + tr("Date") + ":</td><td>" text.append("<tr><td>" + tr("Date") + ":</td><td>"
+ _dateRange.first.toString(format) + "</td></tr>"); + _dateRange.first.toString(format) + "</td></tr>");
} else { } else {
QString format = QLocale::system().dateFormat(QLocale::ShortFormat); QString format = l.dateFormat(QLocale::ShortFormat);
text.append("<tr><td>" + tr("Date") + ":</td><td>" text.append("<tr><td>" + tr("Date") + ":</td><td>"
+ QString("%1 - %2").arg(_dateRange.first.toString(format), + QString("%1 - %2").arg(_dateRange.first.toString(format),
_dateRange.second.toString(format)) + "</td></tr>"); _dateRange.second.toString(format)) + "</td></tr>");
@ -1030,6 +1044,7 @@ void GUI::statistics()
void GUI::plot(QPrinter *printer) void GUI::plot(QPrinter *printer)
{ {
QLocale l(QLocale::system());
QPainter p(printer); QPainter p(printer);
TrackInfo info; TrackInfo info;
qreal ih, gh, mh, ratio; qreal ih, gh, mh, ratio;
@ -1040,19 +1055,19 @@ void GUI::plot(QPrinter *printer)
if (_options.printItemCount) { if (_options.printItemCount) {
if (_showTracksAction->isChecked() && _trackCount > 1) if (_showTracksAction->isChecked() && _trackCount > 1)
info.insert(tr("Tracks"), QString::number(_trackCount)); info.insert(tr("Tracks"), l.toString(_trackCount));
if (_showRoutesAction->isChecked() && _routeCount > 1) if (_showRoutesAction->isChecked() && _routeCount > 1)
info.insert(tr("Routes"), QString::number(_routeCount)); info.insert(tr("Routes"), l.toString(_routeCount));
if (_showWaypointsAction->isChecked() && _waypointCount > 1) if (_showWaypointsAction->isChecked() && _waypointCount > 1)
info.insert(tr("Waypoints"), QString::number(_waypointCount)); info.insert(tr("Waypoints"), l.toString(_waypointCount));
} }
if (_dateRange.first.isValid() && _options.printDate) { if (_dateRange.first.isValid() && _options.printDate) {
if (_dateRange.first == _dateRange.second) { if (_dateRange.first == _dateRange.second) {
QString format = QLocale::system().dateFormat(QLocale::LongFormat); QString format = l.dateFormat(QLocale::LongFormat);
info.insert(tr("Date"), _dateRange.first.toString(format)); info.insert(tr("Date"), _dateRange.first.toString(format));
} else { } else {
QString format = QLocale::system().dateFormat(QLocale::ShortFormat); QString format = l.dateFormat(QLocale::ShortFormat);
info.insert(tr("Date"), QString("%1 - %2") info.insert(tr("Date"), QString("%1 - %2")
.arg(_dateRange.first.toString(format), .arg(_dateRange.first.toString(format),
_dateRange.second.toString(format))); _dateRange.second.toString(format)));
@ -1788,6 +1803,10 @@ void GUI::writeSettings()
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor); settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT) if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap); settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
#ifdef ENABLE_HIDPI
if (_options.hidpiMap != HIDPI_MAP_DEFAULT)
settings.setValue(HIDPI_MAP_SETTING, _options.hidpiMap);
#endif // ENABLE_HIDPI
settings.endGroup(); settings.endGroup();
} }
@ -2023,6 +2042,10 @@ void GUI::readSettings()
SLIDER_COLOR_DEFAULT).value<QColor>(); SLIDER_COLOR_DEFAULT).value<QColor>();
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
ALWAYS_SHOW_MAP_DEFAULT).toBool(); ALWAYS_SHOW_MAP_DEFAULT).toBool();
#ifdef ENABLE_HIDPI
_options.hidpiMap = settings.value(HIDPI_MAP_SETTING, HIDPI_MAP_SETTING)
.toBool();
#endif // ENABLE_HIDPI
_mapView->setPalette(_options.palette); _mapView->setPalette(_options.palette);
_mapView->setMapOpacity(_options.mapOpacity); _mapView->setMapOpacity(_options.mapOpacity);
@ -2039,6 +2062,9 @@ void GUI::readSettings()
_mapView->setMarkerColor(_options.sliderColor); _mapView->setMarkerColor(_options.sliderColor);
if (_options.useOpenGL) if (_options.useOpenGL)
_mapView->useOpenGL(true); _mapView->useOpenGL(true);
#ifdef ENABLE_HIDPI
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
#endif // ENABLE_HIDPI
for (int i = 0; i < _tabs.count(); i++) { for (int i = 0; i < _tabs.count(); i++) {
_tabs.at(i)->setPalette(_options.palette); _tabs.at(i)->setPalette(_options.palette);
@ -2107,3 +2133,39 @@ qreal GUI::movingTime() const
{ {
return (_showTracksAction->isChecked()) ? _movingTime : 0; return (_showTracksAction->isChecked()) ? _movingTime : 0;
} }
void GUI::show()
{
QMainWindow::show();
#ifdef ENABLE_HIDPI
QWindow *w = windowHandle();
connect(w->screen(), SIGNAL(logicalDotsPerInchChanged(qreal)), this,
SLOT(logicalDotsPerInchChanged(qreal)));
connect(w, SIGNAL(screenChanged(QScreen*)), this,
SLOT(screenChanged(QScreen*)));
#endif // ENABLE_HIDPI
}
void GUI::screenChanged(QScreen *screen)
{
#ifdef ENABLE_HIDPI
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
SLOT(logicalDotsPerInchChanged(qreal)));
connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)), this,
SLOT(logicalDotsPerInchChanged(qreal)));
#else // ENABLE_HIDPI
Q_UNUSED(screen);
#endif // ENABLE_HIDPI
}
void GUI::logicalDotsPerInchChanged(qreal dpi)
{
Q_UNUSED(dpi)
#ifdef ENABLE_HIDPI
_mapView->setDevicePixelRatio(_options.hidpiMap ? devicePixelRatioF() : 1.0);
#endif // ENBLE_HIDPI
}

View File

@ -28,6 +28,7 @@ class MapView;
class Map; class Map;
class MapList; class MapList;
class POI; class POI;
class QScreen;
class GUI : public QMainWindow class GUI : public QMainWindow
{ {
@ -37,6 +38,7 @@ public:
GUI(); GUI();
bool openFile(const QString &fileName); bool openFile(const QString &fileName);
void show();
private slots: private slots:
void about(); void about();
@ -83,6 +85,8 @@ private slots:
void setDMS() {setCoordinatesFormat(DMS);} void setDMS() {setCoordinatesFormat(DMS);}
void sliderPositionChanged(qreal pos); void sliderPositionChanged(qreal pos);
void screenChanged(QScreen *screen);
void logicalDotsPerInchChanged(qreal dpi);
private: private:
typedef QPair<QDate, QDate> DateRange; typedef QPair<QDate, QDate> DateRange;

View File

@ -1,3 +1,4 @@
#include <QLocale>
#include "data/data.h" #include "data/data.h"
#include "heartrategraphitem.h" #include "heartrategraphitem.h"
#include "heartrategraph.h" #include "heartrategraph.h"
@ -7,7 +8,7 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
{ {
_showTracks = true; _showTracks = true;
GraphView::setYUnits(tr("1/min")); GraphView::setYUnits(tr("bpm"));
setYLabel(tr("Heart rate")); setYLabel(tr("Heart rate"));
setSliderPrecision(0); setSliderPrecision(0);
@ -16,9 +17,11 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
void HeartRateGraph::setInfo() void HeartRateGraph::setInfo()
{ {
if (_showTracks) { if (_showTracks) {
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', QLocale l(QLocale::system());
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f',
0) + UNIT_SPACE + yUnits()); 0) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
0) + UNIT_SPACE + yUnits()); 0) + UNIT_SPACE + yUnits());
} else } else
clearInfo(); clearInfo();

View File

@ -1,6 +1,8 @@
#include <QLocale>
#include "tooltip.h" #include "tooltip.h"
#include "heartrategraphitem.h" #include "heartrategraphitem.h"
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type, HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent) QGraphicsItem *parent) : GraphItem(graph, type, parent)
{ {
@ -16,11 +18,12 @@ HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
QString HeartRateGraphItem::toolTip() const QString HeartRateGraphItem::toolTip() const
{ {
ToolTip tt; ToolTip tt;
QLocale l(QLocale::system());
tt.insert(tr("Maximum"), QString::number(max(), 'f', 0) tt.insert(tr("Maximum"), l.toString(max(), 'f', 0)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("bpm"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 0) tt.insert(tr("Average"), l.toString(avg(), 'f', 0)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("bpm"));
return tt.toString(); return tt.toString();
} }

View File

@ -20,10 +20,11 @@
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png" #define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
// Options dialog icons // Options dialog icons
#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png" #define APPEARANCE_ICON ":/icons/format-stroke-color.png"
#define POI_ICON ":/icons/flag_48.png" #define POI_ICON ":/icons/flag_32.png"
#define SYSTEM_ICON ":/icons/system-run.png" #define SYSTEM_ICON ":/icons/preferences-system.png"
#define PRINT_EXPORT_ICON ":/icons/document-print-preview.png" #define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
#define DATA_ICON ":/icons/view-filter.png" #define DATA_ICON ":/icons/view-filter.png"
#define MAPS_ICON ":/icons/applications-internet_32.png"
#endif /* ICONS_H */ #endif /* ICONS_H */

View File

@ -9,10 +9,6 @@ InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{ {
_font.setPixelSize(FONT_SIZE); _font.setPixelSize(FONT_SIZE);
_font.setFamily(FONT_FAMILY); _font.setFamily(FONT_FAMILY);
#ifndef Q_OS_MAC
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
#endif // Q_OS_MAC
} }
void InfoItem::updateBoundingRect() void InfoItem::updateBoundingRect()

View File

@ -29,7 +29,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
_scene = new QGraphicsScene(this); _scene = new QGraphicsScene(this);
setScene(_scene); setScene(_scene);
setCacheMode(QGraphicsView::CacheBackground);
setDragMode(QGraphicsView::ScrollHandDrag); setDragMode(QGraphicsView::ScrollHandDrag);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate); setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -72,6 +71,10 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
_poiSize = 8; _poiSize = 8;
_poiColor = Qt::black; _poiColor = Qt::black;
#ifdef ENABLE_HIDPI
_ratio = 1.0;
#endif // ENABLE_HIDPI
_opengl = false;
_plot = false; _plot = false;
_digitalZoom = 0; _digitalZoom = 0;
@ -228,7 +231,7 @@ void MapView::updatePOIVisibility()
void MapView::rescale() void MapView::rescale()
{ {
_scene->setSceneRect(_map->bounds()); _scene->setSceneRect(_map->bounds());
resetCachedContent(); reloadMap();
for (int i = 0; i < _tracks.size(); i++) for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setMap(_map); _tracks.at(i)->setMap(_map);
@ -266,6 +269,9 @@ void MapView::setMap(Map *map)
_map = map; _map = map;
_map->load(); _map->load();
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(_ratio);
#endif // ENABLE_HIDPI
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap())); connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
digitalZoom(0); digitalZoom(0);
@ -289,7 +295,7 @@ void MapView::setMap(Map *map)
_map->ll2xy(cr.bottomRight())).center(); _map->ll2xy(cr.bottomRight())).center();
centerOn(nc); centerOn(nc);
resetCachedContent(); reloadMap();
QPixmapCache::clear(); QPixmapCache::clear();
} }
@ -498,6 +504,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
// Enter plot mode // Enter plot mode
setUpdatesEnabled(false); setUpdatesEnabled(false);
_plot = true; _plot = true;
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(1.0);
#endif // ENABLE_HIDPI
// Compute sizes & ratios // Compute sizes & ratios
orig = viewport()->rect(); orig = viewport()->rect();
@ -556,6 +565,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
_mapScale->setPos(origPos); _mapScale->setPos(origPos);
// Exit plot mode // Exit plot mode
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(_ratio);
#endif // ENABLE_HIDPI
_plot = false; _plot = false;
setUpdatesEnabled(true); setUpdatesEnabled(true);
} }
@ -635,7 +647,7 @@ void MapView::showRouteWaypoints(bool show)
void MapView::showMap(bool show) void MapView::showMap(bool show)
{ {
_showMap = show; _showMap = show;
resetCachedContent(); reloadMap();
} }
void MapView::showPOI(bool show) void MapView::showPOI(bool show)
@ -738,13 +750,13 @@ void MapView::setPOIColor(const QColor &color)
void MapView::setMapOpacity(int opacity) void MapView::setMapOpacity(int opacity)
{ {
_opacity = opacity / 100.0; _opacity = opacity / 100.0;
resetCachedContent(); reloadMap();
} }
void MapView::setBackgroundColor(const QColor &color) void MapView::setBackgroundColor(const QColor &color)
{ {
_backgroundColor = color; _backgroundColor = color;
resetCachedContent(); reloadMap();
} }
void MapView::drawBackground(QPainter *painter, const QRectF &rect) void MapView::drawBackground(QPainter *painter, const QRectF &rect)
@ -753,9 +765,17 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect)
if (_showMap) { if (_showMap) {
QRectF ir = rect.intersected(_map->bounds()); QRectF ir = rect.intersected(_map->bounds());
Map::Flags flags = Map::NoFlags;
if (_opacity < 1.0) if (_opacity < 1.0)
painter->setOpacity(_opacity); painter->setOpacity(_opacity);
_map->draw(painter, ir, _plot);
if (_plot)
flags = Map::Block;
else if (_opengl)
flags = Map::OpenGL;
_map->draw(painter, ir, flags);
} }
} }
@ -796,6 +816,8 @@ void MapView::scrollContentsBy(int dx, int dy)
void MapView::useOpenGL(bool use) void MapView::useOpenGL(bool use)
{ {
_opengl = use;
if (use) if (use)
setViewport(new OPENGL_WIDGET); setViewport(new OPENGL_WIDGET);
else else
@ -819,5 +841,42 @@ void MapView::setMarkerColor(const QColor &color)
void MapView::reloadMap() void MapView::reloadMap()
{ {
resetCachedContent(); _scene->invalidate();
}
void MapView::setDevicePixelRatio(qreal ratio)
{
#ifdef ENABLE_HIDPI
if (_ratio == ratio)
return;
_ratio = ratio;
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
.intersected(_map->bounds()));
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
_map->setDevicePixelRatio(_ratio);
_scene->setSceneRect(_map->bounds());
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setMap(_map);
for (int i = 0; i < _routes.size(); i++)
_routes.at(i)->setMap(_map);
for (int i = 0; i < _waypoints.size(); i++)
_waypoints.at(i)->setMap(_map);
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
it.value()->setMap(_map);
updatePOIVisibility();
QPointF nc = QRectF(_map->ll2xy(cr.topLeft()),
_map->ll2xy(cr.bottomRight())).center();
centerOn(nc);
reloadMap();
#else // ENABLE_HIDPI
Q_UNUSED(ratio);
#endif // ENABLE_HIDPI
} }

View File

@ -11,6 +11,7 @@
#include "units.h" #include "units.h"
#include "format.h" #include "format.h"
#include "palette.h" #include "palette.h"
#include "config.h"
class Data; class Data;
class POI; class POI;
@ -68,6 +69,7 @@ public slots:
void showRouteWaypoints(bool show); void showRouteWaypoints(bool show);
void clearMapCache(); void clearMapCache();
void setCoordinatesFormat(CoordinatesFormat format); void setCoordinatesFormat(CoordinatesFormat format);
void setDevicePixelRatio(qreal ratio);
private slots: private slots:
void updatePOI(); void updatePOI();
@ -136,6 +138,11 @@ private:
int _digitalZoom; int _digitalZoom;
bool _plot; bool _plot;
#ifdef ENABLE_HIDPI
qreal _ratio;
#endif // ENABLE_HIDPI
bool _opengl;
}; };
#endif // MAPVIEW_H #endif // MAPVIEW_H

View File

@ -34,26 +34,61 @@ static QFrame *line()
} }
#endif #endif
QWidget *OptionsDialog::createGeneralPage() QWidget *OptionsDialog::createMapPage()
{ {
_alwaysShowMap = new QCheckBox(tr("Always show the map")); _alwaysShowMap = new QCheckBox(tr("Always show the map"));
_alwaysShowMap->setChecked(_options->alwaysShowMap); _alwaysShowMap->setChecked(_options->alwaysShowMap);
_alwaysShowMap->setToolTip("<p>" + _alwaysShowMap->setToolTip("<p>" +
tr("Show the map even when no files are loaded.") + "</p>"); tr("Show the map even when no files are loaded.") + "</p>");
#ifdef ENABLE_HIDPI
_hidpi = new QRadioButton(tr("High-resolution"));
_lodpi = new QRadioButton(tr("Standard"));
if (_options->hidpiMap)
_hidpi->setChecked(true);
else
_lodpi->setChecked(true);
QLabel *lhi = new QLabel(tr("Non-HiDPI maps are loaded as HiDPI maps. "
"The map is sharp but map objects are small/hard to read."));
QLabel *llo = new QLabel(tr("Non-HiDPI maps are loaded such as they are. "
"Map objects have the expected size but the map is blurry."));
QFont f = lhi->font();
f.setPointSize(f.pointSize() - 1);
lhi->setWordWrap(true);
llo->setWordWrap(true);
lhi->setFont(f);
llo->setFont(f);
#endif // ENABLE_HIDPI
QFormLayout *showMapLayout = new QFormLayout(); QFormLayout *showMapLayout = new QFormLayout();
showMapLayout->addWidget(_alwaysShowMap); showMapLayout->addWidget(_alwaysShowMap);
QWidget *generalTab = new QWidget(); QWidget *mapTab = new QWidget();
QVBoxLayout *generalTabLayout = new QVBoxLayout(); QVBoxLayout *mapTabLayout = new QVBoxLayout();
generalTabLayout->addLayout(showMapLayout); mapTabLayout->addLayout(showMapLayout);
generalTabLayout->addStretch(); mapTabLayout->addStretch();
generalTab->setLayout(generalTabLayout); mapTab->setLayout(mapTabLayout);
QTabWidget *generalPage = new QTabWidget(); #ifdef ENABLE_HIDPI
generalPage->addTab(generalTab, tr("General")); QVBoxLayout *hidpiTabLayout = new QVBoxLayout();
hidpiTabLayout->addWidget(_lodpi);
hidpiTabLayout->addWidget(llo);
hidpiTabLayout->addSpacing(10);
hidpiTabLayout->addWidget(_hidpi);
hidpiTabLayout->addWidget(lhi);
hidpiTabLayout->addStretch();
return generalPage; QWidget *hidpiTab = new QWidget();
hidpiTab->setLayout(hidpiTabLayout);
#endif // ENABLE_HIDPI
QTabWidget *mapPage = new QTabWidget();
mapPage->addTab(mapTab, tr("General"));
#ifdef ENABLE_HIDPI
mapPage->addTab(hidpiTab, tr("HiDPI display mode"));
#endif // ENABLE_HIDPI
return mapPage;
} }
QWidget *OptionsDialog::createAppearancePage() QWidget *OptionsDialog::createAppearancePage()
@ -483,8 +518,8 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
: QDialog(parent), _options(options) : QDialog(parent), _options(options)
{ {
QStackedWidget *pages = new QStackedWidget(); QStackedWidget *pages = new QStackedWidget();
pages->addWidget(createGeneralPage());
pages->addWidget(createAppearancePage()); pages->addWidget(createAppearancePage());
pages->addWidget(createMapPage());
pages->addWidget(createDataPage()); pages->addWidget(createDataPage());
pages->addWidget(createPOIPage()); pages->addWidget(createPOIPage());
pages->addWidget(createExportPage()); pages->addWidget(createExportPage());
@ -492,14 +527,14 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
QListWidget *menu = new QListWidget(); QListWidget *menu = new QListWidget();
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE)); menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
new QListWidgetItem(QIcon(QPixmap(APP_ICON)), tr("General"), menu); new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
menu); menu);
new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu); new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
new QListWidgetItem(QIcon(QPixmap(POI_ICON)), tr("POI"), menu); new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
new QListWidgetItem(QIcon(QPixmap(PRINT_EXPORT_ICON)), tr("Print & Export"), new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
menu); menu);
new QListWidgetItem(QIcon(QPixmap(SYSTEM_ICON)), tr("System"), menu); new QListWidgetItem(QIcon(SYSTEM_ICON), tr("System"), menu);
QHBoxLayout *contentLayout = new QHBoxLayout(); QHBoxLayout *contentLayout = new QHBoxLayout();
contentLayout->addWidget(menu); contentLayout->addWidget(menu);
@ -532,8 +567,6 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
void OptionsDialog::accept() void OptionsDialog::accept()
{ {
_options->alwaysShowMap = _alwaysShowMap->isChecked();
_options->palette.setColor(_baseColor->color()); _options->palette.setColor(_baseColor->color());
_options->palette.setShift(_colorOffset->value()); _options->palette.setShift(_colorOffset->value());
_options->mapOpacity = _mapOpacity->value(); _options->mapOpacity = _mapOpacity->value();
@ -553,6 +586,11 @@ void OptionsDialog::accept()
_options->sliderColor = _sliderColor->color(); _options->sliderColor = _sliderColor->color();
_options->graphAntiAliasing = _graphAA->isChecked(); _options->graphAntiAliasing = _graphAA->isChecked();
_options->alwaysShowMap = _alwaysShowMap->isChecked();
#ifdef ENABLE_HIDPI
_options->hidpiMap = _hidpi->isChecked();
#endif // ENABLE_HIDPI
_options->elevationFilter = _elevationFilter->value(); _options->elevationFilter = _elevationFilter->value();
_options->speedFilter = _speedFilter->value(); _options->speedFilter = _speedFilter->value();
_options->heartRateFilter = _heartRateFilter->value(); _options->heartRateFilter = _heartRateFilter->value();

View File

@ -18,8 +18,6 @@ class QRadioButton;
class PercentSlider; class PercentSlider;
struct Options { struct Options {
// General
bool alwaysShowMap;
// Appearance // Appearance
Palette palette; Palette palette;
int trackWidth; int trackWidth;
@ -36,6 +34,11 @@ struct Options {
bool graphAntiAliasing; bool graphAntiAliasing;
int mapOpacity; int mapOpacity;
QColor backgroundColor; QColor backgroundColor;
// Map
bool alwaysShowMap;
#ifdef ENABLE_HIDPI
bool hidpiMap;
#endif // ENABLE_HIDPI
// Data // Data
int elevationFilter; int elevationFilter;
int speedFilter; int speedFilter;
@ -79,7 +82,7 @@ public slots:
void accept(); void accept();
private: private:
QWidget *createGeneralPage(); QWidget *createMapPage();
QWidget *createAppearancePage(); QWidget *createAppearancePage();
QWidget *createDataPage(); QWidget *createDataPage();
QWidget *createPOIPage(); QWidget *createPOIPage();
@ -88,8 +91,6 @@ private:
Options *_options; Options *_options;
// General
QCheckBox *_alwaysShowMap;
// Appearance // Appearance
ColorBox *_baseColor; ColorBox *_baseColor;
QDoubleSpinBox *_colorOffset; QDoubleSpinBox *_colorOffset;
@ -107,6 +108,12 @@ private:
QSpinBox *_graphWidth; QSpinBox *_graphWidth;
ColorBox *_sliderColor; ColorBox *_sliderColor;
QCheckBox *_graphAA; QCheckBox *_graphAA;
// Map
QCheckBox *_alwaysShowMap;
#ifdef ENABLE_HIDPI
QRadioButton *_hidpi;
QRadioButton *_lodpi;
#endif // ENABLE_HIDPI
// Data // Data
OddSpinBox *_elevationFilter; OddSpinBox *_elevationFilter;
OddSpinBox *_speedFilter; OddSpinBox *_speedFilter;

View File

@ -2,12 +2,20 @@
#include <QApplication> #include <QApplication>
#include <QCursor> #include <QCursor>
#include <QPainter> #include <QPainter>
#include "common/greatcircle.h"
#include "map/map.h" #include "map/map.h"
#include "tooltip.h" #include "tooltip.h"
#include "nicenum.h" #include "nicenum.h"
#include "pathitem.h" #include "pathitem.h"
#define GEOGRAPHICAL_MILE 1855.3248
static unsigned segments(qreal distance)
{
return ceil(distance / GEOGRAPHICAL_MILE);
}
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent) PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
: QGraphicsObject(parent) : QGraphicsObject(parent)
{ {
@ -21,7 +29,7 @@ PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
QBrush brush(Qt::SolidPattern); QBrush brush(Qt::SolidPattern);
_pen = QPen(brush, _width); _pen = QPen(brush, _width);
updatePainterPath(map); updatePainterPath();
updateShape(); updateShape();
_marker = new MarkerItem(this); _marker = new MarkerItem(this);
@ -39,13 +47,36 @@ void PathItem::updateShape()
_shape = s.createStroke(_painterPath); _shape = s.createStroke(_painterPath);
} }
void PathItem::updatePainterPath(Map *map) void PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
{
if (fabs(c1.lon() - c2.lon()) > 180.0)
_painterPath.moveTo(_map->ll2xy(c2));
else
_painterPath.lineTo(_map->ll2xy(c2));
}
void PathItem::updatePainterPath()
{ {
_painterPath = QPainterPath(); _painterPath = QPainterPath();
_painterPath.moveTo(map->ll2xy(_path.first().coordinates())); _painterPath.moveTo(_map->ll2xy(_path.first().coordinates()));
for (int i = 1; i < _path.size(); i++) for (int i = 1; i < _path.size(); i++) {
_painterPath.lineTo(map->ll2xy(_path.at(i).coordinates())); const PathPoint &p1 = _path.at(i-1);
const PathPoint &p2 = _path.at(i);
unsigned n = segments(p2.distance() - p1.distance());
if (n > 1) {
GreatCircle gc(p1.coordinates(), p2.coordinates());
Coordinates last = p1.coordinates();
for (unsigned j = 1; j <= n; j++) {
Coordinates c(gc.pointAt(j/(double)n));
addSegment(last, c);
last = c;
}
} else
addSegment(p1.coordinates(), p2.coordinates());
}
} }
void PathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void PathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
@ -70,7 +101,7 @@ void PathItem::setMap(Map *map)
_map = map; _map = map;
updatePainterPath(map); updatePainterPath();
updateShape(); updateShape();
_marker->setPos(position(_markerDistance)); _marker->setPos(position(_markerDistance));
@ -141,19 +172,40 @@ QPointF PathItem::position(qreal x) const
return _map->ll2xy(_path.at(mid).coordinates()); return _map->ll2xy(_path.at(mid).coordinates());
} }
QLineF l; Coordinates c1, c2;
qreal p1, p2; qreal p1, p2;
if (_path.at(mid).distance() < x) { if (_path.at(mid).distance() < x) {
l = QLineF(_map->ll2xy(_path.at(mid).coordinates()), c1 = _path.at(mid).coordinates(); c2 = _path.at(mid+1).coordinates();
_map->ll2xy(_path.at(mid+1).coordinates()));
p1 = _path.at(mid).distance(); p2 = _path.at(mid+1).distance(); p1 = _path.at(mid).distance(); p2 = _path.at(mid+1).distance();
} else { } else {
l = QLineF(_map->ll2xy(_path.at(mid-1).coordinates()), c1 = _path.at(mid-1).coordinates(); c2 = _path.at(mid).coordinates();
_map->ll2xy(_path.at(mid).coordinates()));
p1 = _path.at(mid-1).distance(); p2 = _path.at(mid).distance(); p1 = _path.at(mid-1).distance(); p2 = _path.at(mid).distance();
} }
unsigned n = segments(p2 - p1);
if (n > 1) {
GreatCircle gc(c1, c2);
// Great circle point
double f = (x - p1) / (p2 - p1);
QPointF p(_map->ll2xy(gc.pointAt(f)));
// Segment line of the great circle path
double f1 = floor(n * f) / n;
double f2 = ceil(n * f) / n;
QLineF l(_map->ll2xy(gc.pointAt(f1)), _map->ll2xy(gc.pointAt(f2)));
// Project the great circle point to the segment line
QLineF u = l.unitVector();
double lambda = (u.dx() * (p.x() - l.p1().x())) + (u.dy() * (p.y()
- l.p1().y()));
return QPointF((u.dx() * lambda) + l.p1().x(), (u.dy() * lambda)
+ l.p1().y());
} else {
QLineF l(_map->ll2xy(c1), _map->ll2xy(c2));
return l.pointAt((x - p1) / (p2 - p1)); return l.pointAt((x - p1) / (p2 - p1));
}
} }
void PathItem::moveMarker(qreal distance) void PathItem::moveMarker(qreal distance)

View File

@ -43,8 +43,10 @@ protected:
private: private:
QPointF position(qreal distance) const; QPointF position(qreal distance) const;
void updatePainterPath(Map *map); void updatePainterPath();
void updateShape(); void updateShape();
void addSegment(const Coordinates &c1, const Coordinates &c2);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);

View File

@ -1,13 +1,14 @@
#include <QSlider> #include <QSlider>
#include <QLabel> #include <QLabel>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLocale>
#include "units.h" #include "units.h"
#include "percentslider.h" #include "percentslider.h"
static QString format(int value) static QString format(int value)
{ {
return QString::number(value) + UNIT_SPACE + QString("%"); return QLocale::system().toString(value) + UNIT_SPACE + QString("%");
} }
PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent) PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent)

View File

@ -1,3 +1,4 @@
#include <QLocale>
#include "data/data.h" #include "data/data.h"
#include "powergraphitem.h" #include "powergraphitem.h"
#include "powergraph.h" #include "powergraph.h"
@ -16,9 +17,11 @@ PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent)
void PowerGraph::setInfo() void PowerGraph::setInfo()
{ {
if (_showTracks) { if (_showTracks) {
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale() QLocale l(QLocale::system());
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); + yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale() GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits()); + yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
} else } else
clearInfo(); clearInfo();

View File

@ -1,6 +1,8 @@
#include <QLocale>
#include "tooltip.h" #include "tooltip.h"
#include "powergraphitem.h" #include "powergraphitem.h"
PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type, PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
QGraphicsItem *parent) : GraphItem(graph, type, parent) QGraphicsItem *parent) : GraphItem(graph, type, parent)
{ {
@ -16,11 +18,12 @@ PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
QString PowerGraphItem::toolTip() const QString PowerGraphItem::toolTip() const
{ {
ToolTip tt; ToolTip tt;
QLocale l(QLocale::system());
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1) tt.insert(tr("Maximum"), l.toString(max(), 'f', 1)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("W"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 1) tt.insert(tr("Average"), l.toString(avg(), 'f', 1)
+ UNIT_SPACE + tr("1/min")); + UNIT_SPACE + tr("W"));
return tt.toString(); return tt.toString();
} }

Some files were not shown because too many files have changed in this diff Show More