Compare commits
375 Commits
Author | SHA1 | Date | |
---|---|---|---|
5e74642dc8 | |||
b1d1cae9dd | |||
de2278ba04 | |||
e90f152432 | |||
8deab1c9ca | |||
51e0f9a9c6 | |||
e330abe180 | |||
53a4b45b7b | |||
53229681d2 | |||
b2df7d207f | |||
1ff2162811 | |||
0f10c7596b | |||
4cc3bc28e2 | |||
3ce1918645 | |||
d70f0cf9e0 | |||
34c5ba4669 | |||
afbb8c3284 | |||
5bdc263cda | |||
179f2f1451 | |||
92e772a02b | |||
cbdfe4c105 | |||
a20a268975 | |||
48e972f920 | |||
c38f50538e | |||
53147b5e6e | |||
6c6e384862 | |||
90b780a444 | |||
56d1ac7ff2 | |||
00acd48009 | |||
e30078a63e | |||
51c0c31838 | |||
bc218c9f65 | |||
56e4c80999 | |||
443b916301 | |||
8675a0e945 | |||
0894fb0ddf | |||
73e15f8f11 | |||
0fe7843e52 | |||
e76439bb6e | |||
b54aeff369 | |||
72968efeef | |||
ec3f529b0f | |||
57a171ee8c | |||
d3193abd0b | |||
6809853a8a | |||
3155e8436b | |||
69f9d05ccb | |||
e24a3cd99a | |||
a94fa9f0ea | |||
c4f2a44410 | |||
da4a51e7fa | |||
bb47a34823 | |||
11196c0e35 | |||
00ef815738 | |||
64f685cf60 | |||
7ab13ec8e5 | |||
d3fbbecb2d | |||
7bc83603ca | |||
2cd35b139e | |||
a74afa54fd | |||
753c4e8db0 | |||
d0b3f48caf | |||
e47cd1be7e | |||
d1ba35f012 | |||
b9489afbfe | |||
a7506cfd82 | |||
c060abe6a7 | |||
b457fc430c | |||
89947851fd | |||
7d40dfddb2 | |||
151ae03b53 | |||
9fd8b84c3b | |||
47683e5447 | |||
84bcf07bd4 | |||
cc694971be | |||
ba856d7eb6 | |||
b14eeb58ab | |||
8e932b966c | |||
35818ce16e | |||
6ef7537dff | |||
abbb823890 | |||
0a4f8a46d4 | |||
fd2823c703 | |||
d16b61051f | |||
e69f17aad5 | |||
33b1e179d3 | |||
5efb9f8a4e | |||
ebf39f11bd | |||
8b7422b70a | |||
ef3da2e156 | |||
6e13c2b704 | |||
f3e4719439 | |||
7b6789e78d | |||
95442461fc | |||
729cbd641c | |||
2e2dad8d04 | |||
4e3b6c2eb2 | |||
6430933a96 | |||
3e14d4afda | |||
ebb30a3fca | |||
bd20d40ba7 | |||
77823fba14 | |||
dcc5cbe9bc | |||
cd3c99b065 | |||
83189a4e65 | |||
797fd7f02b | |||
a45125be9a | |||
a7154988ab | |||
afe9a14d5b | |||
b3f1596918 | |||
cd90407f56 | |||
73f06e61f0 | |||
c708fa35fd | |||
dcedfe1e9f | |||
daa9d296bd | |||
b8a9a4481c | |||
e792bf3b23 | |||
359a9f0a5a | |||
4b0b6513d1 | |||
c7762e26fb | |||
5b8d41afb7 | |||
81e1664a9b | |||
fad3f116f5 | |||
a6e522d758 | |||
ab65deadb6 | |||
7f80e8f7b7 | |||
9a5c5eaf61 | |||
9bc5016141 | |||
a4a46232e4 | |||
d85fbe5b48 | |||
141e0cb404 | |||
2b7d0cd631 | |||
d106f47771 | |||
e48729fc84 | |||
dca53bc622 | |||
65045dfee4 | |||
002b9c35e1 | |||
945528d6b1 | |||
4697ba4ef0 | |||
9bf1447a7e | |||
1a8114af8e | |||
ad154dfd7d | |||
c2004ded31 | |||
3ced367fab | |||
506d1998f8 | |||
afc5e9ca4b | |||
425d0e3013 | |||
3a8b1107fe | |||
ad7a413d50 | |||
8d5f72de64 | |||
9e798e626c | |||
cb70f0dded | |||
400003f684 | |||
69db510b10 | |||
cd9ea0f8a9 | |||
0f6c8eb896 | |||
6b3c0d05ca | |||
b0cc028c4c | |||
1513130435 | |||
ec798451e8 | |||
ffc61552d2 | |||
aff7b1c13f | |||
d54f22d3f0 | |||
dba6291f3e | |||
e96cee2ea8 | |||
1eaaea98a3 | |||
a90073c422 | |||
223a13583c | |||
4386e1f2e1 | |||
5bfe9c2527 | |||
efa2b1c366 | |||
e0ad64a902 | |||
f0a1acb96a | |||
5f3bdb87f8 | |||
90d062e097 | |||
58b4c87d46 | |||
02654ec862 | |||
ff015c8714 | |||
c339116cd1 | |||
d8d70bfd8b | |||
7d8149ace3 | |||
4460b454c4 | |||
211310f377 | |||
1e4bcd0ac1 | |||
1a66ed0a36 | |||
273a127069 | |||
1c0a0fd0b3 | |||
713e331b2a | |||
96f406aad7 | |||
0aedec66c4 | |||
b500031713 | |||
699e4f32d5 | |||
992c8aaaf9 | |||
68a72c5809 | |||
eace308774 | |||
e4e3f7d143 | |||
acc49d015e | |||
b48652cb78 | |||
0808f6679e | |||
610ac3d73f | |||
1d719fdcc8 | |||
1746e1cf08 | |||
5d5a5365cd | |||
7dfdeac1da | |||
1ff13ee9f8 | |||
34b1fb6b5d | |||
02bf85780a | |||
47199348d8 | |||
3b55bc0efc | |||
4de3ddf71b | |||
e26fa92ce6 | |||
dfb69b2755 | |||
c2a30738cb | |||
fd53e89ea5 | |||
ccf91bb29f | |||
75bd388be0 | |||
aef0357204 | |||
d073d606d0 | |||
8822bf7e5f | |||
051a3ed303 | |||
96437ae6ab | |||
89c25bbc3a | |||
322792ea04 | |||
ce1c76a315 | |||
804e9594ad | |||
651973c524 | |||
533af66080 | |||
bab5750cf7 | |||
0d6f3ea162 | |||
b915302e2f | |||
03ef7a9147 | |||
33cb944e36 | |||
8bc575aef2 | |||
f0b7abdb72 | |||
6ce14734cd | |||
925a0e2951 | |||
e46bba18f2 | |||
a56aa4e706 | |||
c4b3a81b0b | |||
957cc6f4f3 | |||
ebad0832ee | |||
186c135ad5 | |||
72b5b1ea97 | |||
106d4c6e0b | |||
8f815a6af0 | |||
60f107d7cd | |||
e87fff4bf8 | |||
e6547d92f0 | |||
bfcc577f64 | |||
a56ad8a933 | |||
b1748c848b | |||
3763d44662 | |||
b3e8081942 | |||
b3dc886afc | |||
431002fd62 | |||
63c3a50ca6 | |||
7fd30bbda3 | |||
c1844f9557 | |||
0c7601c831 | |||
19eb3fba7f | |||
bde3c8cc3d | |||
b0ce471ea8 | |||
bd23120c2c | |||
ac4ef0631e | |||
60d9a172b6 | |||
b8eede21c0 | |||
70ddbe192f | |||
d8477571cc | |||
92545acba0 | |||
2bf66ea912 | |||
b21c2267cf | |||
278aa904c1 | |||
b369985f0a | |||
6a5781771f | |||
1b616f3c81 | |||
99dfbc1d2f | |||
f83e3376b4 | |||
311aeecb27 | |||
338ace6dff | |||
51e9ef4416 | |||
ebefe54510 | |||
1ec732c78d | |||
ff733b2705 | |||
99e32b1a15 | |||
f4a992a66f | |||
f52fa9a9ef | |||
61f3a1c932 | |||
93313da01d | |||
a253ac1796 | |||
e6a0eeefcc | |||
214d7c40dc | |||
cd89706d74 | |||
961eac9324 | |||
ddacac8d2e | |||
bd9b5dbc6a | |||
8b813b5879 | |||
b79de29464 | |||
ae2765528d | |||
0356917790 | |||
7352b24473 | |||
3a9ec6247c | |||
e74ac78138 | |||
5fa91be4ac | |||
536b4fd121 | |||
0556ae0f58 | |||
e38fdb26d7 | |||
e420602c69 | |||
b2a49eaa23 | |||
211a4e4cef | |||
8ff8d4bf16 | |||
46598a85fc | |||
32cbd33c91 | |||
0e356d0222 | |||
1a29ab6304 | |||
5581cff55b | |||
a458b82e37 | |||
bd946fb477 | |||
7e6ed0933c | |||
1586a5e912 | |||
3e340ab941 | |||
ea178d1acb | |||
f61488fcfa | |||
b68ca92add | |||
0448ae5eea | |||
2bc112c7b4 | |||
ccd92edb8d | |||
0cbf79870b | |||
7e8530555d | |||
2fd16e5e31 | |||
a5033c8b19 | |||
b0c6176ddd | |||
6edd7a8c61 | |||
8a299be65b | |||
cde4c65c53 | |||
b24136a580 | |||
da1b2bb90a | |||
30e198cf46 | |||
0f2deca4fa | |||
1055c4fd98 | |||
18c501b610 | |||
71310116e3 | |||
34e48199b2 | |||
4cf027df58 | |||
a9668ca86e | |||
181f60ed40 | |||
307405d661 | |||
1242423ca8 | |||
2bdab0f449 | |||
4e23df3a66 | |||
23f5a317d0 | |||
80bc9f1f01 | |||
dec3f10df3 | |||
296d4c6c9d | |||
668558cf2e | |||
a6053a4d7b | |||
535361dada | |||
e9e7660beb | |||
eb5692a0ab | |||
367427b26a | |||
371fa13bc6 | |||
5a8250ed63 | |||
c8a39a607b | |||
215cf03b68 | |||
9cadb8d0a5 | |||
20c82deda7 | |||
7c9768e83a | |||
736566b12c | |||
540339bf22 | |||
81a9743064 | |||
818fa11fd3 | |||
dd80d34e58 | |||
17c791d753 | |||
9f06b042ca | |||
d201101587 | |||
da842bd21d |
52
.appveyor.yml
Normal file
@ -0,0 +1,52 @@
|
||||
version: 4.18.{build}
|
||||
configuration: Release
|
||||
platform: Any CPU
|
||||
environment:
|
||||
NSISDIR: C:\Program Files (x86)\NSIS
|
||||
matrix:
|
||||
- QTDIR: C:\Qt\5.9\msvc2015
|
||||
PLATFORM: x86
|
||||
NSI: gpxsee.nsi
|
||||
OPENSSLDIR: C:\OpenSSL-Win32\bin
|
||||
- QTDIR: C:\Qt\5.9\msvc2015_64
|
||||
PLATFORM: x86_amd64
|
||||
NSI: gpxsee64.nsi
|
||||
OPENSSLDIR: C:\OpenSSL-Win64\bin
|
||||
install:
|
||||
- cmd: >-
|
||||
set PATH=%QTDIR%\bin;%NSISDIR%;%PATH%
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
|
||||
build_script:
|
||||
- cmd: >-
|
||||
lrelease gpxsee.pro
|
||||
|
||||
qmake gpxsee.pro
|
||||
|
||||
nmake release
|
||||
|
||||
|
||||
md installer
|
||||
|
||||
copy release\GPXSee.exe installer
|
||||
|
||||
windeployqt --no-svg --release installer\GPXSee.exe
|
||||
|
||||
copy pkg\%NSI% installer
|
||||
|
||||
copy pkg\datums.csv installer
|
||||
|
||||
copy pkg\ellipsoids.csv installer
|
||||
|
||||
copy pkg\maps.txt installer
|
||||
|
||||
copy licence.txt installer
|
||||
|
||||
copy %OPENSSLDIR%\libeay32.dll installer
|
||||
|
||||
copy %OPENSSLDIR%\ssleay32.dll installer
|
||||
|
||||
|
||||
makensis.exe installer\%NSI%
|
||||
artifacts:
|
||||
- path: installer\GPXSee-*.exe
|
18
.travis.yml
Normal file
@ -0,0 +1,18 @@
|
||||
language: c++
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi
|
||||
|
||||
install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libqt4-dev; fi
|
||||
|
||||
script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH=/usr/local/opt/qt/bin/:${PATH}; fi
|
||||
- lrelease gpxsee.pro
|
||||
- qmake gpxsee.pro
|
||||
- make
|
80
Info.plist
@ -15,7 +15,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>@EXECUTABLE@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>cz.wz.tumic.GPXSee</string>
|
||||
<string>org.gpxsee.GPXSee</string>
|
||||
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
@ -74,7 +74,7 @@
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/octet-stream</string>
|
||||
<string>application/vnd.ant.fit</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>fit.icns</string>
|
||||
@ -83,6 +83,38 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>igc</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.fai.igc</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>igc.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Flight Recorder Data Format</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>nmea</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.nmea.nmea</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>nmea.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>NMEA 0183 data</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
@ -168,7 +200,49 @@
|
||||
<string>fit</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/octet-stream</string>
|
||||
<string>application/vnd.ant.fit</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>org.fai.igc</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.fai.org/gnss-recording-devices/igc-approved-flight-recorders</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Flight Recorder Data Format</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>igc</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.fai.igc</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>org.nmea.nmea</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.nmea.org/content/nmea_standards/nmea_0183_v_410.asp</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>NMEA 0183 data</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>nmea</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.nmea.nmea</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
|
34
README.md
@ -1,33 +1,33 @@
|
||||
# GPXSee
|
||||
GPX viewer and analyzer.
|
||||
GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX,
|
||||
KML, FIT, IGC and NMEA files.
|
||||
|
||||
* User-definable map sources.
|
||||
* Track and elevation/speed/heart rate graphs.
|
||||
## Features
|
||||
* User-definable online maps.
|
||||
* Offline maps (OziExplorer maps and TrekBuddy maps/atlases).
|
||||
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
||||
* Support for multiple tracks in one view.
|
||||
* Support for POI files.
|
||||
* Export to PDF.
|
||||
* Full-screen mode
|
||||
* Print/export to PDF.
|
||||
* Full-screen mode.
|
||||
* Native GUI for Windows, Mac OS X and Linux.
|
||||
* Opens GPX, TCX, FIT, KML, IGC, NMEA and Garmin CSV files.
|
||||
|
||||

|
||||

|
||||
|
||||
## Build
|
||||
### Linux/OS X
|
||||
```shell
|
||||
lrelease gpxsee.pro
|
||||
qmake gpxsee.pro
|
||||
make
|
||||
```
|
||||
### Windows
|
||||
```shell
|
||||
lrelease gpxsee.pro
|
||||
qmake gpxsee.pro
|
||||
nmake release
|
||||
```
|
||||
|
||||
## Binaries
|
||||
* Windows & OS X builds: http://sourceforge.net/projects/gpxsee
|
||||
* Linux packages: https://build.opensuse.org/project/repositories/home:tumic:GPXSee
|
||||
## Download
|
||||
* [Windows & OS X builds](http://sourceforge.net/projects/gpxsee)
|
||||
* [Linux packages](http://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee)
|
||||
|
||||
## Changelog
|
||||
[Changelog](https://build.opensuse.org/package/view_file/home:tumic:GPXSee/gpxsee/gpxsee.changes)
|
||||
|
||||
## Homepage
|
||||
GPXSee homepage: http://tumic.wz.cz/gpxsee
|
||||
http://www.gpxsee.org
|
||||
|
@ -1,6 +0,0 @@
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||
set PATH=C:\qt\qtbase\bin;%PATH%
|
||||
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
|
||||
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
|
||||
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;%LIB%
|
||||
set CL=/D_USING_V110_SDK71_
|
@ -1,6 +0,0 @@
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
set PATH=C:\qt64\qtbase\bin;%PATH%
|
||||
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
|
||||
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
|
||||
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;%LIB%
|
||||
set CL=/D_USING_V110_SDK71_
|
BIN
cert/mac/gpxsee.cer
Normal file
BIN
cert/win/gpxsee.cer
Normal file
302
gpxsee.pro
@ -1,124 +1,192 @@
|
||||
TARGET = GPXSee
|
||||
VERSION = 3.0
|
||||
VERSION = 4.18
|
||||
QT += core \
|
||||
gui \
|
||||
network
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
||||
lessThan(QT_VERSION, 5.4): QT += opengl
|
||||
macx: QT += opengl
|
||||
INCLUDEPATH += ./src
|
||||
HEADERS += src/config.h \
|
||||
src/icons.h \
|
||||
src/gui.h \
|
||||
src/poi.h \
|
||||
src/rtree.h \
|
||||
src/axisitem.h \
|
||||
src/keys.h \
|
||||
src/slideritem.h \
|
||||
src/markeritem.h \
|
||||
src/infoitem.h \
|
||||
src/elevationgraph.h \
|
||||
src/speedgraph.h \
|
||||
src/sliderinfoitem.h \
|
||||
src/filebrowser.h \
|
||||
src/map.h \
|
||||
src/maplist.h \
|
||||
src/downloader.h \
|
||||
src/units.h \
|
||||
src/scaleitem.h \
|
||||
src/waypoint.h \
|
||||
src/track.h \
|
||||
src/graphview.h \
|
||||
src/trackpoint.h \
|
||||
src/waypointitem.h \
|
||||
src/palette.h \
|
||||
src/heartrategraph.h \
|
||||
src/range.h \
|
||||
src/cpuarch.h \
|
||||
src/settings.h \
|
||||
src/app.h \
|
||||
src/trackinfo.h \
|
||||
src/exportdialog.h \
|
||||
src/fileselectwidget.h \
|
||||
src/margins.h \
|
||||
src/temperaturegraph.h \
|
||||
src/graphtab.h \
|
||||
src/misc.h \
|
||||
src/trackitem.h \
|
||||
src/tooltip.h \
|
||||
src/route.h \
|
||||
src/routeitem.h \
|
||||
src/graphitem.h \
|
||||
src/graph.h \
|
||||
src/pathitem.h \
|
||||
src/pathview.h \
|
||||
src/griditem.h \
|
||||
src/data.h \
|
||||
src/gpxparser.h \
|
||||
src/tcxparser.h \
|
||||
src/parser.h \
|
||||
src/csvparser.h \
|
||||
src/coordinates.h \
|
||||
src/tile.h \
|
||||
src/rd.h \
|
||||
src/wgs84.h \
|
||||
src/kmlparser.h \
|
||||
src/trackdata.h \
|
||||
src/routedata.h \
|
||||
src/fitparser.h \
|
||||
src/format.h \
|
||||
src/path.h \
|
||||
src/assert.h \
|
||||
src/cadencegraph.h \
|
||||
src/powergraph.h
|
||||
src/common/staticassert.h \
|
||||
src/common/coordinates.h \
|
||||
src/common/range.h \
|
||||
src/common/rectc.h \
|
||||
src/common/wgs84.h \
|
||||
src/GUI/app.h \
|
||||
src/GUI/icons.h \
|
||||
src/GUI/gui.h \
|
||||
src/GUI/axisitem.h \
|
||||
src/GUI/keys.h \
|
||||
src/GUI/slideritem.h \
|
||||
src/GUI/markeritem.h \
|
||||
src/GUI/infoitem.h \
|
||||
src/GUI/elevationgraph.h \
|
||||
src/GUI/speedgraph.h \
|
||||
src/GUI/sliderinfoitem.h \
|
||||
src/GUI/filebrowser.h \
|
||||
src/GUI/units.h \
|
||||
src/GUI/scaleitem.h \
|
||||
src/GUI/graphview.h \
|
||||
src/GUI/waypointitem.h \
|
||||
src/GUI/palette.h \
|
||||
src/GUI/heartrategraph.h \
|
||||
src/GUI/trackinfo.h \
|
||||
src/GUI/exportdialog.h \
|
||||
src/GUI/fileselectwidget.h \
|
||||
src/GUI/margins.h \
|
||||
src/GUI/temperaturegraph.h \
|
||||
src/GUI/graphtab.h \
|
||||
src/GUI/trackitem.h \
|
||||
src/GUI/tooltip.h \
|
||||
src/GUI/routeitem.h \
|
||||
src/GUI/graphitem.h \
|
||||
src/GUI/pathitem.h \
|
||||
src/GUI/griditem.h \
|
||||
src/GUI/format.h \
|
||||
src/GUI/cadencegraph.h \
|
||||
src/GUI/powergraph.h \
|
||||
src/GUI/optionsdialog.h \
|
||||
src/GUI/colorbox.h \
|
||||
src/GUI/stylecombobox.h \
|
||||
src/GUI/opengl.h \
|
||||
src/GUI/timetype.h \
|
||||
src/GUI/percentslider.h \
|
||||
src/GUI/elevationgraphitem.h \
|
||||
src/GUI/speedgraphitem.h \
|
||||
src/GUI/heartrategraphitem.h \
|
||||
src/GUI/temperaturegraphitem.h \
|
||||
src/GUI/cadencegraphitem.h \
|
||||
src/GUI/powergraphitem.h \
|
||||
src/GUI/oddspinbox.h \
|
||||
src/GUI/settings.h \
|
||||
src/GUI/nicenum.h \
|
||||
src/GUI/cpuarch.h \
|
||||
src/GUI/searchpointer.h \
|
||||
src/GUI/mapview.h \
|
||||
src/map/projection.h \
|
||||
src/map/ellipsoid.h \
|
||||
src/map/datum.h \
|
||||
src/map/mercator.h \
|
||||
src/map/transversemercator.h \
|
||||
src/map/latlon.h \
|
||||
src/map/utm.h \
|
||||
src/map/lambertconic.h \
|
||||
src/map/lambertazimuthal.h \
|
||||
src/map/albersequal.h \
|
||||
src/map/map.h \
|
||||
src/map/maplist.h \
|
||||
src/map/onlinemap.h \
|
||||
src/map/downloader.h \
|
||||
src/map/tile.h \
|
||||
src/map/emptymap.h \
|
||||
src/map/offlinemap.h \
|
||||
src/map/tar.h \
|
||||
src/map/ozf.h \
|
||||
src/map/atlas.h \
|
||||
src/map/matrix.h \
|
||||
src/map/misc.h \
|
||||
src/data/graph.h \
|
||||
src/data/poi.h \
|
||||
src/data/waypoint.h \
|
||||
src/data/track.h \
|
||||
src/data/route.h \
|
||||
src/data/trackpoint.h \
|
||||
src/data/data.h \
|
||||
src/data/parser.h \
|
||||
src/data/trackdata.h \
|
||||
src/data/routedata.h \
|
||||
src/data/path.h \
|
||||
src/data/rtree.h \
|
||||
src/data/gpxparser.h \
|
||||
src/data/tcxparser.h \
|
||||
src/data/csvparser.h \
|
||||
src/data/kmlparser.h \
|
||||
src/data/fitparser.h \
|
||||
src/data/igcparser.h \
|
||||
src/data/nmeaparser.h \
|
||||
src/data/str2int.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/gui.cpp \
|
||||
src/poi.cpp \
|
||||
src/axisitem.cpp \
|
||||
src/slideritem.cpp \
|
||||
src/markeritem.cpp \
|
||||
src/infoitem.cpp \
|
||||
src/elevationgraph.cpp \
|
||||
src/speedgraph.cpp \
|
||||
src/sliderinfoitem.cpp \
|
||||
src/filebrowser.cpp \
|
||||
src/map.cpp \
|
||||
src/maplist.cpp \
|
||||
src/downloader.cpp \
|
||||
src/scaleitem.cpp \
|
||||
src/track.cpp \
|
||||
src/graphview.cpp \
|
||||
src/waypointitem.cpp \
|
||||
src/palette.cpp \
|
||||
src/heartrategraph.cpp \
|
||||
src/range.cpp \
|
||||
src/app.cpp \
|
||||
src/trackinfo.cpp \
|
||||
src/exportdialog.cpp \
|
||||
src/fileselectwidget.cpp \
|
||||
src/temperaturegraph.cpp \
|
||||
src/trackpoint.cpp \
|
||||
src/misc.cpp \
|
||||
src/waypoint.cpp \
|
||||
src/trackitem.cpp \
|
||||
src/tooltip.cpp \
|
||||
src/route.cpp \
|
||||
src/routeitem.cpp \
|
||||
src/graphitem.cpp \
|
||||
src/pathitem.cpp \
|
||||
src/pathview.cpp \
|
||||
src/griditem.cpp \
|
||||
src/data.cpp \
|
||||
src/gpxparser.cpp \
|
||||
src/tcxparser.cpp \
|
||||
src/csvparser.cpp \
|
||||
src/coordinates.cpp \
|
||||
src/kmlparser.cpp \
|
||||
src/fitparser.cpp \
|
||||
src/format.cpp \
|
||||
src/graph.cpp \
|
||||
src/cadencegraph.cpp \
|
||||
src/powergraph.cpp
|
||||
src/common/coordinates.cpp \
|
||||
src/common/rectc.cpp \
|
||||
src/common/range.cpp \
|
||||
src/GUI/app.cpp \
|
||||
src/GUI/gui.cpp \
|
||||
src/GUI/axisitem.cpp \
|
||||
src/GUI/slideritem.cpp \
|
||||
src/GUI/markeritem.cpp \
|
||||
src/GUI/infoitem.cpp \
|
||||
src/GUI/elevationgraph.cpp \
|
||||
src/GUI/speedgraph.cpp \
|
||||
src/GUI/sliderinfoitem.cpp \
|
||||
src/GUI/filebrowser.cpp \
|
||||
src/GUI/scaleitem.cpp \
|
||||
src/GUI/graphview.cpp \
|
||||
src/GUI/waypointitem.cpp \
|
||||
src/GUI/palette.cpp \
|
||||
src/GUI/heartrategraph.cpp \
|
||||
src/GUI/trackinfo.cpp \
|
||||
src/GUI/exportdialog.cpp \
|
||||
src/GUI/fileselectwidget.cpp \
|
||||
src/GUI/temperaturegraph.cpp \
|
||||
src/GUI/trackitem.cpp \
|
||||
src/GUI/tooltip.cpp \
|
||||
src/GUI/routeitem.cpp \
|
||||
src/GUI/graphitem.cpp \
|
||||
src/GUI/pathitem.cpp \
|
||||
src/GUI/griditem.cpp \
|
||||
src/GUI/format.cpp \
|
||||
src/GUI/cadencegraph.cpp \
|
||||
src/GUI/powergraph.cpp \
|
||||
src/GUI/optionsdialog.cpp \
|
||||
src/GUI/colorbox.cpp \
|
||||
src/GUI/stylecombobox.cpp \
|
||||
src/GUI/oddspinbox.cpp \
|
||||
src/GUI/percentslider.cpp \
|
||||
src/GUI/elevationgraphitem.cpp \
|
||||
src/GUI/speedgraphitem.cpp \
|
||||
src/GUI/heartrategraphitem.cpp \
|
||||
src/GUI/temperaturegraphitem.cpp \
|
||||
src/GUI/cadencegraphitem.cpp \
|
||||
src/GUI/powergraphitem.cpp \
|
||||
src/GUI/nicenum.cpp \
|
||||
src/GUI/mapview.cpp \
|
||||
src/map/maplist.cpp \
|
||||
src/map/onlinemap.cpp \
|
||||
src/map/downloader.cpp \
|
||||
src/map/emptymap.cpp \
|
||||
src/map/offlinemap.cpp \
|
||||
src/map/tar.cpp \
|
||||
src/map/atlas.cpp \
|
||||
src/map/ozf.cpp \
|
||||
src/map/matrix.cpp \
|
||||
src/map/ellipsoid.cpp \
|
||||
src/map/datum.cpp \
|
||||
src/map/projection.cpp \
|
||||
src/map/mercator.cpp \
|
||||
src/map/transversemercator.cpp \
|
||||
src/map/utm.cpp \
|
||||
src/map/lambertconic.cpp \
|
||||
src/map/albersequal.cpp \
|
||||
src/map/lambertazimuthal.cpp \
|
||||
src/data/data.cpp \
|
||||
src/data/poi.cpp \
|
||||
src/data/track.cpp \
|
||||
src/data/route.cpp \
|
||||
src/data/path.cpp \
|
||||
src/data/gpxparser.cpp \
|
||||
src/data/tcxparser.cpp \
|
||||
src/data/csvparser.cpp \
|
||||
src/data/kmlparser.cpp \
|
||||
src/data/fitparser.cpp \
|
||||
src/data/igcparser.cpp \
|
||||
src/data/nmeaparser.cpp \
|
||||
src/data/str2int.cpp
|
||||
RESOURCES += gpxsee.qrc
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts \
|
||||
lang/gpxsee_sv.ts \
|
||||
lang/gpxsee_de.ts
|
||||
macx {
|
||||
ICON = icons/gpxsee.icns
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
@ -126,7 +194,11 @@ macx {
|
||||
icons/tcx.icns \
|
||||
icons/kml.icns \
|
||||
icons/fit.icns \
|
||||
pkg/maps.txt
|
||||
icons/igc.icns \
|
||||
icons/nmea.icns \
|
||||
pkg/maps.txt \
|
||||
pkg/ellipsoids.csv \
|
||||
pkg/datums.csv
|
||||
APP_RESOURCES.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
||||
}
|
||||
@ -135,6 +207,8 @@ win32 {
|
||||
icons/gpx.ico \
|
||||
icons/tcx.ico \
|
||||
icons/kml.ico \
|
||||
icons/fit.ico
|
||||
icons/fit.ico \
|
||||
icons/igc.ico \
|
||||
icons/nmea.ico
|
||||
}
|
||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||
|
@ -14,7 +14,14 @@
|
||||
<file>icons/arrow-left-double.png</file>
|
||||
<file>icons/arrow-right-double.png</file>
|
||||
<file>icons/view-fullscreen.png</file>
|
||||
<file>icons/office-chart-line-stacked.png</file>
|
||||
<file>icons/office-chart-line.png</file>
|
||||
<file>icons/preferences-desktop-display.png</file>
|
||||
<file>icons/flag_48.png</file>
|
||||
<file>icons/system-run.png</file>
|
||||
<file>icons/document-print-preview.png</file>
|
||||
<file>icons/view-filter.png</file>
|
||||
<file>lang/gpxsee_cs.qm</file>
|
||||
<file>lang/gpxsee_sv.qm</file>
|
||||
<file>lang/gpxsee_de.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
icons/document-print-preview.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/flag_48.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
icons/igc.icns
Normal file
BIN
icons/igc.ico
Normal file
After Width: | Height: | Size: 361 KiB |
145
icons/igc.svg
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="185"
|
||||
height="185"
|
||||
id="svg3390"
|
||||
version="1.1">
|
||||
<metadata
|
||||
id="metadata3404">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs3402" />
|
||||
<path
|
||||
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0"
|
||||
id="path3392"
|
||||
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867" />
|
||||
<rect
|
||||
style="fill:#ff3300;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect3426"
|
||||
width="120.3215"
|
||||
height="49.84631"
|
||||
x="16.573463"
|
||||
y="124.9782" />
|
||||
<g
|
||||
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)"
|
||||
id="g3828">
|
||||
<g
|
||||
id="g3715">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3717"
|
||||
cy="90.875"
|
||||
cx="113"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3719"
|
||||
cy="90.875"
|
||||
cx="113"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round" />
|
||||
</g>
|
||||
<polyline
|
||||
id="polyline3721"
|
||||
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4" />
|
||||
<g
|
||||
id="g3723">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3725"
|
||||
cy="125.854"
|
||||
cx="73.5"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3727"
|
||||
cy="125.854"
|
||||
cx="73.5"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||
</g>
|
||||
<g
|
||||
id="g3729">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3731"
|
||||
cy="172.375"
|
||||
cx="136.5"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3733"
|
||||
cy="172.375"
|
||||
cx="136.5"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||
</g>
|
||||
<g
|
||||
id="g3735">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3737"
|
||||
cy="186.39999"
|
||||
cx="60.700001"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3739"
|
||||
cy="186.39999"
|
||||
cx="60.700001"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||
</g>
|
||||
<g
|
||||
id="g3741">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3743"
|
||||
cy="154.354"
|
||||
cx="154.5"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3745"
|
||||
cy="154.354"
|
||||
cx="154.5"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||
</g>
|
||||
<g
|
||||
id="g3747">
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3749"
|
||||
cy="151.875"
|
||||
cx="96"
|
||||
style="fill:#000000" />
|
||||
<circle
|
||||
r="7.0209999"
|
||||
id="ellipse3751"
|
||||
cy="151.875"
|
||||
cx="96"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||
</g>
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="40.149723"
|
||||
y="155.86783"
|
||||
id="text3921"
|
||||
transform="scale(0.9437456,1.0596076)"><tspan
|
||||
y="155.86783"
|
||||
x="40.149723"
|
||||
id="tspan3448">IGC</tspan></text>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/nmea.icns
Normal file
BIN
icons/nmea.ico
Normal file
After Width: | Height: | Size: 361 KiB |
145
icons/nmea.svg
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
id="svg3390"
|
||||
height="185"
|
||||
width="185">
|
||||
<metadata
|
||||
id="metadata3404">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs3402" />
|
||||
<path
|
||||
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867"
|
||||
id="path3392"
|
||||
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0" />
|
||||
<rect
|
||||
y="124.9782"
|
||||
x="16.573463"
|
||||
height="49.84631"
|
||||
width="131.6837"
|
||||
id="rect3426"
|
||||
style="fill:#0083d7;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<g
|
||||
id="g3828"
|
||||
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)">
|
||||
<g
|
||||
id="g3715">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="113"
|
||||
cy="90.875"
|
||||
id="ellipse3717"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round"
|
||||
cx="113"
|
||||
cy="90.875"
|
||||
id="ellipse3719"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
<polyline
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4"
|
||||
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||
id="polyline3721" />
|
||||
<g
|
||||
id="g3723">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="73.5"
|
||||
cy="125.854"
|
||||
id="ellipse3725"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||
cx="73.5"
|
||||
cy="125.854"
|
||||
id="ellipse3727"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
<g
|
||||
id="g3729">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="136.5"
|
||||
cy="172.375"
|
||||
id="ellipse3731"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||
cx="136.5"
|
||||
cy="172.375"
|
||||
id="ellipse3733"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
<g
|
||||
id="g3735">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="60.700001"
|
||||
cy="186.39999"
|
||||
id="ellipse3737"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||
cx="60.700001"
|
||||
cy="186.39999"
|
||||
id="ellipse3739"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
<g
|
||||
id="g3741">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="154.5"
|
||||
cy="154.354"
|
||||
id="ellipse3743"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||
cx="154.5"
|
||||
cy="154.354"
|
||||
id="ellipse3745"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
<g
|
||||
id="g3747">
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
cx="96"
|
||||
cy="151.875"
|
||||
id="ellipse3749"
|
||||
r="7.0209999" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||
cx="96"
|
||||
cy="151.875"
|
||||
id="ellipse3751"
|
||||
r="7.0209999" />
|
||||
</g>
|
||||
</g>
|
||||
<text
|
||||
transform="scale(0.9437456,1.0596076)"
|
||||
id="text3921"
|
||||
y="155.86783"
|
||||
x="21.076782"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="155.86783"
|
||||
x="21.076782"
|
||||
id="tspan3429">NMEA</tspan></text>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 727 B |
BIN
icons/office-chart-line.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
icons/preferences-desktop-display.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/system-run.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
icons/view-filter.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
1108
lang/gpxsee_cs.ts
1496
lang/gpxsee_de.ts
Normal file
1496
lang/gpxsee_sv.ts
Normal file
123
pkg/datums.csv
Normal file
@ -0,0 +1,123 @@
|
||||
Adindan,4201,5,-162,-12,206
|
||||
Afgooye,4205,15,-43,-163,45
|
||||
Ain el Abd 1970,4204,14,-150,-251,-2
|
||||
Anna 1 Astro 1965,4708,2,-491,-22,435
|
||||
Arc 1950,4209,5,-143,-90,-294
|
||||
Arc 1960,4210,5,-160,-8,-300
|
||||
Ascension Island 1958,4712,14,-207,107,52
|
||||
Astro B4 Sorol Atoll,4707,14,114,-116,-333
|
||||
Astro Beacon 1945,4709,14,145,75,-272
|
||||
Astro DOS 71/4,4710,14,-320,550,-494
|
||||
Astronomic Stn 1952,4711,14,124,-234,-25
|
||||
Australian Geodetic 1966,4202,2,-133,-48,148
|
||||
Australian Geodetic 1984,4203,2,-134,-48,149
|
||||
Australian Geocentric 1994 (GDA94),4283,11,0,0,0
|
||||
Austrian,4312,3,594,84,471
|
||||
Bellevue (IGN),4714,14,-127,-769,472
|
||||
Bermuda 1957,4216,4,-73,213,296
|
||||
Bogota Observatory,4218,14,307,304,-318
|
||||
Campo Inchauspe,4221,14,-148,136,90
|
||||
Canton Astro 1966,4716,14,298,-304,-375
|
||||
Cape,4222,5,-136,-108,-292
|
||||
Cape Canaveral,4717,4,-2,150,181
|
||||
Carthage,4223,5,-263,6,431
|
||||
CH-1903,4149,3,674,15,405
|
||||
Chatham 1971,4672,14,175,-38,113
|
||||
Chua Astro,4224,14,-134,229,-29
|
||||
Corrego Alegre,4225,14,-206,172,-6
|
||||
Djakarta (Batavia),4211,3,-377,681,-50
|
||||
DOS 1968,,14,230,-199,-752
|
||||
Easter Island 1967,4719,14,211,147,111
|
||||
Egypt,,14,-130,-117,-151
|
||||
European 1950,4230,14,-87,-98,-121
|
||||
European 1950 (Mean France),,14,-87,-96,-120
|
||||
European 1950 (Spain and Portugal),,14,-84,-107,-120
|
||||
European 1979,4668,14,-86,-98,-119
|
||||
Finland Hayford,4123,14,-78,-231,-97
|
||||
Gandajika Base,4233,14,-133,-321,50
|
||||
Geodetic Datum 1949,4272,14,84,-22,209
|
||||
GGRS 87,4121,11,-199.87,74.79,246.62
|
||||
Guam 1963,4675,4,-100,-248,259
|
||||
GUX 1 Astro,4718,14,252,-209,-751
|
||||
Hartebeeshoek94,4148,20,0,0,0
|
||||
Hermannskogel,3906,3,653,-212,449
|
||||
Hjorsey 1955,4658,14,-73,46,-86
|
||||
Hong Kong 1963,4739,14,-156,-271,-189
|
||||
Hu-Tzu-Shan,4236,14,-634,-549,-201
|
||||
Indian Bangladesh,4682,6,289,734,257
|
||||
Indian Thailand,4240,6,214,836,303
|
||||
Israeli,4281,23,-235,-85,264
|
||||
Ireland 1965,4299,1,506,-122,611
|
||||
ISTS 073 Astro 1969,4724,14,208,-435,-229
|
||||
Johnston Island,4725,14,191,-77,-204
|
||||
Kandawala,4244,6,-97,787,86
|
||||
Kerguelen Island,4698,14,145,-187,103
|
||||
Kertau 1948,4245,7,-11,851,5
|
||||
L.C. 5 Astro,4726,4,42,124,147
|
||||
Liberia 1964,4251,5,-90,40,88
|
||||
Luzon Mindanao,,4,-133,-79,-72
|
||||
Luzon Philippines,4253,4,-133,-77,-51
|
||||
Mahe 1971,4256,5,41,-220,-134
|
||||
Marco Astro,4616,14,-289,-124,60
|
||||
Massawa,4262,3,639,405,60
|
||||
Merchich,4261,5,31,146,47
|
||||
Midway Astro 1961,4727,14,912,-58,1227
|
||||
Minna,4263,5,-92,-93,122
|
||||
NAD27 Alaska,,4,-5,135,172
|
||||
NAD27 Bahamas,,4,-4,154,178
|
||||
NAD27 Canada,,4,-10,158,187
|
||||
NAD27 Canal Zone,,4,0,125,201
|
||||
NAD27 Caribbean,,4,-7,152,178
|
||||
NAD27 Central,,4,0,125,194
|
||||
NAD27 CONUS,,4,-8,160,176
|
||||
NAD27 Cuba,,4,-9,152,178
|
||||
NAD27 Greenland,,4,11,114,195
|
||||
NAD27 Mexico,,4,-12,130,190
|
||||
NAD27 San Salvador,,4,1,140,165
|
||||
NAD83,4269,11,0,0,0
|
||||
Nahrwn Masirah Ilnd,,5,-247,-148,369
|
||||
Nahrwn Saudi Arbia,,5,-231,-196,482
|
||||
Nahrwn United Arab,,5,-249,-156,381
|
||||
Naparima BWI,4271,14,-2,374,172
|
||||
NGO1948,4273,27,315,-217,528
|
||||
NTF France,4275,24,-168,-60,320
|
||||
Norsk,4817,27,278,93,474
|
||||
NZGD1949,4272,14,84,-22,209
|
||||
NZGD2000,4167,20,0,0,0
|
||||
Observatorio 1966,4182,14,-425,-169,81
|
||||
Old Egyptian,4229,12,-130,110,-13
|
||||
Old Hawaiian,4135,4,61,-285,-181
|
||||
Oman,4232,5,-346,-1,224
|
||||
Ord Srvy Grt Britn,4277,0,375,-111,431
|
||||
Pico De Las Nieves,4728,14,-307,-92,127
|
||||
Pitcairn Astro 1967,4729,14,185,165,42
|
||||
Potsdam Rauenberg DHDN,4314,3,606,23,413
|
||||
Prov So Amrican 1956,4248,14,-288,175,-376
|
||||
Prov So Chilean 1963,4254,14,16,196,93
|
||||
Puerto Rico,4139,4,11,72,-101
|
||||
Pulkovo 1942 (1),4284,15,28,-130,-95
|
||||
Pulkovo 1942 (2),4284,15,28,-130,-95
|
||||
Qatar National,4285,14,-128,-283,22
|
||||
Qornoq,4287,14,164,138,-189
|
||||
Reunion,4626,14,94,-948,-1262
|
||||
Rijksdriehoeksmeting,4289,3,593,26,478
|
||||
Rome 1940,4806,14,-225,-65,9
|
||||
RT 90,4124,3,498,-36,568
|
||||
S42,4179,15,28,-121,-77
|
||||
Santo (DOS),4730,14,170,42,84
|
||||
Sao Braz,4184,14,-203,141,53
|
||||
Sapper Hill 1943,4292,14,-355,16,74
|
||||
Schwarzeck,4293,21,616,97,-251
|
||||
South American 1969,4291,16,-57,1,-41
|
||||
South Asia,,8,7,-10,-26
|
||||
Southeast Base,4615,14,-499,-249,314
|
||||
Southwest Base,4183,14,-104,167,-38
|
||||
Timbalai 1948,4298,6,-689,691,-46
|
||||
Tokyo,4301,3,-128,481,664
|
||||
Tristan Astro 1968,4734,14,-632,438,-609
|
||||
Viti Levu 1916,4731,5,51,391,-36
|
||||
Wake-Eniwetok 1960,4732,13,101,52,-39
|
||||
WGS 72,4322,19,0,0,5
|
||||
WGS 84,4326,20,0,0,0
|
||||
Yacare,4309,14,-155,171,37
|
||||
Zanderij,4311,14,-265,120,-358
|
|
30
pkg/ellipsoids.csv
Normal file
@ -0,0 +1,30 @@
|
||||
0,Airy 1830,6377563.396,299.3249646
|
||||
1,Modified Airy,6377340.189,299.3249646
|
||||
2,Australian National,6378160.0,298.25
|
||||
3,Bessel 1841,6377397.155,299.1528128
|
||||
4,Clarke 1866,6378206.4,294.9786982
|
||||
5,Clarke 1880,6378249.145,293.465
|
||||
6,Everest (India 1830),6377276.345,300.8017
|
||||
7,Everest (1948),6377304.063,300.8017
|
||||
8,Modified Fischer 1960,6378155.0,298.3
|
||||
9,Everest (Pakistan),6377309.613,300.8017
|
||||
10,Indonesian 1974,6378160.0,298.247
|
||||
11,GRS 80,6378137.0,298.257222101
|
||||
12,Helmert 1906,6378200.0,298.3
|
||||
13,Hough 1960,6378270.0,297.0
|
||||
14,International 1924,6378388.0,297.0
|
||||
15,Krassovsky 1940,6378245.0,298.3
|
||||
16,South American 1969,6378160.0,298.25
|
||||
17,Everest (Malaysia 1969),6377295.664,300.8017
|
||||
18,Everest (Sabah Sarawak),6377298.556,300.8017
|
||||
19,WGS 72,6378135.0,298.26
|
||||
20,WGS 84,6378137.0,298.257223563
|
||||
21,Bessel 1841 (Namibia),6377483.865,299.1528128
|
||||
22,Everest (India 1956),6377301.243,300.8017
|
||||
23,Clarke 1880 Palestine,6378300.789,293.466
|
||||
24,Clarke 1880 IGN,6378249.2,293.466021
|
||||
25,Hayford 1909,6378388.0,296.959263
|
||||
26,Clarke 1858,6378350.87,294.26
|
||||
27,Bessel 1841 (Norway),6377492.0176,299.1528
|
||||
28,Plessis 1817 (France),6376523.0,308.6409971
|
||||
29,Hayford 1924,6378388.0,297.0
|
|
@ -1,13 +1,16 @@
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "3.0"
|
||||
!define VERSION "4.18"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
; Compression method
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
; Required execution level
|
||||
RequestExecutionLevel admin
|
||||
@ -15,6 +18,14 @@ RequestExecutionLevel admin
|
||||
; The default installation directory
|
||||
InstallDir "$PROGRAMFILES\GPXSee"
|
||||
|
||||
; Installer executable info
|
||||
VIProductVersion "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductVersion" ${VERSION}
|
||||
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductName" "GPXSee"
|
||||
VIAddVersionKey "LegalCopyright" "GPXSee project"
|
||||
VIAddVersionKey "FileDescription" "GPXSee installer"
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
@ -26,6 +37,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
!define REGTCX "GPXSee.tcx"
|
||||
!define REGKML "GPXSee.kml"
|
||||
!define REGFIT "GPXSee.fit"
|
||||
!define REGIGC "GPXSee.igc"
|
||||
!define REGNMEA "GPXSee.nmea"
|
||||
|
||||
; Start menu page configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
@ -53,9 +66,15 @@ Var StartMenuFolder
|
||||
; Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Function .onInit
|
||||
${IfNot} ${AtLeastWin7}
|
||||
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; The stuff to install
|
||||
Section "GPXSee (required)" SEC_APP
|
||||
Section "GPXSee" SEC_APP
|
||||
|
||||
SectionIn RO
|
||||
|
||||
@ -65,6 +84,8 @@ Section "GPXSee (required)" SEC_APP
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File "maps.txt"
|
||||
File "ellipsoids.csv"
|
||||
File "datums.csv"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
@ -107,19 +128,28 @@ Section "GPXSee (required)" SEC_APP
|
||||
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||
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,5"
|
||||
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,6"
|
||||
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "QT libs" SEC_QT
|
||||
Section "QT framework" SEC_QT
|
||||
|
||||
SectionIn RO
|
||||
|
||||
File "Qt5Core.dll"
|
||||
File "Qt5Gui.dll"
|
||||
File "Qt5Widgets.dll"
|
||||
File "Qt5PrintSupport.dll"
|
||||
File "Qt5Network.dll"
|
||||
File "libGLESv2.dll"
|
||||
File /r "platforms"
|
||||
File /r "imageformats"
|
||||
File /r "printsupport"
|
||||
@ -128,6 +158,8 @@ SectionEnd
|
||||
|
||||
Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
SectionIn RO
|
||||
|
||||
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
||||
${If} ${RunningX64}
|
||||
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
|
||||
@ -141,12 +173,28 @@ Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
||||
SetOutPath $TEMP
|
||||
File "VC_redist.x86.exe"
|
||||
ExecWait '"$TEMP/VC_redist.x86.exe" /install /quiet /norestart'
|
||||
File "vcredist_x86.exe"
|
||||
ExecWait '"$TEMP\vcredist_x86.exe" /install /quiet /norestart'
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
done:
|
||||
SectionEnd
|
||||
|
||||
Section "OpenSSL" SEC_OPENSSL
|
||||
|
||||
File "libeay32.dll"
|
||||
File "ssleay32.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "ANGLE" SEC_ANGLE
|
||||
|
||||
File "libGLESv2.dll"
|
||||
File "libEGL.dll"
|
||||
File "D3DCompiler_47.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
@ -175,6 +223,10 @@ Section "Uninstall"
|
||||
DeleteRegKey HKCR ".kml"
|
||||
DeleteRegKey HKCR "${REGFIT}"
|
||||
DeleteRegKey HKCR ".fit"
|
||||
DeleteRegKey HKCR "${REGIGC}"
|
||||
DeleteRegKey HKCR ".igc"
|
||||
DeleteRegKey HKCR "${REGNMEA}"
|
||||
DeleteRegKey HKCR ".nmea"
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
@ -185,15 +237,21 @@ SectionEnd
|
||||
|
||||
;Language strings
|
||||
LangString DESC_QT ${LANG_ENGLISH} \
|
||||
"QT Library. Unselct only if you have QT already installed!"
|
||||
"QT cross-platform application framework."
|
||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||
"Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
|
||||
"Visual C++ 2015 runtime components. If already installed, will be skipped."
|
||||
LangString DESC_OPENSSL ${LANG_ENGLISH} \
|
||||
"OpenSSL library. Required for HTTPS to work."
|
||||
LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
@ -1,13 +1,16 @@
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "3.0"
|
||||
!define VERSION "4.18"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
; Compression method
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
; Required execution level
|
||||
RequestExecutionLevel admin
|
||||
@ -15,6 +18,14 @@ RequestExecutionLevel admin
|
||||
; The default installation directory
|
||||
InstallDir "$PROGRAMFILES64\GPXSee"
|
||||
|
||||
; Installer executable info
|
||||
VIProductVersion "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductVersion" ${VERSION}
|
||||
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductName" "GPXSee"
|
||||
VIAddVersionKey "LegalCopyright" "GPXSee project"
|
||||
VIAddVersionKey "FileDescription" "GPXSee installer (x64)"
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
@ -26,6 +37,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
!define REGTCX "GPXSee.tcx"
|
||||
!define REGKML "GPXSee.kml"
|
||||
!define REGFIT "GPXSee.fit"
|
||||
!define REGIGC "GPXSee.igc"
|
||||
!define REGNMEA "GPXSee.nmea"
|
||||
|
||||
; Start menu page configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
@ -54,6 +67,11 @@ Var StartMenuFolder
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Function .onInit
|
||||
${IfNot} ${AtLeastWin7}
|
||||
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
${If} ${RunningX64}
|
||||
SetRegView 64
|
||||
${Else}
|
||||
@ -63,7 +81,7 @@ Function .onInit
|
||||
FunctionEnd
|
||||
|
||||
; The stuff to install
|
||||
Section "GPXSee (required)" SEC_APP
|
||||
Section "GPXSee" SEC_APP
|
||||
|
||||
SectionIn RO
|
||||
|
||||
@ -73,6 +91,8 @@ Section "GPXSee (required)" SEC_APP
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File "maps.txt"
|
||||
File "ellipsoids.csv"
|
||||
File "datums.csv"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
@ -90,7 +110,7 @@ Section "GPXSee (required)" SEC_APP
|
||||
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
||||
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee (x64)"
|
||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
@ -115,19 +135,28 @@ Section "GPXSee (required)" SEC_APP
|
||||
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||
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,5"
|
||||
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,6"
|
||||
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "QT libs" SEC_QT
|
||||
Section "QT framework" SEC_QT
|
||||
|
||||
SectionIn RO
|
||||
|
||||
File "Qt5Core.dll"
|
||||
File "Qt5Gui.dll"
|
||||
File "Qt5Widgets.dll"
|
||||
File "Qt5PrintSupport.dll"
|
||||
File "Qt5Network.dll"
|
||||
File "libGLESv2.dll"
|
||||
File /r "platforms"
|
||||
File /r "imageformats"
|
||||
File /r "printsupport"
|
||||
@ -136,6 +165,8 @@ SectionEnd
|
||||
|
||||
Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
SectionIn RO
|
||||
|
||||
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
||||
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
|
||||
StrCmp $R0 "1" 0 +3
|
||||
@ -144,12 +175,28 @@ Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
||||
SetOutPath $TEMP
|
||||
File "VC_redist.x64.exe"
|
||||
ExecWait '"$TEMP/VC_redist.x64.exe" /install /quiet /norestart'
|
||||
File "vcredist_x64.exe"
|
||||
ExecWait '"$TEMP\vcredist_x64.exe" /install /quiet /norestart'
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
done:
|
||||
SectionEnd
|
||||
|
||||
Section "OpenSSL" SEC_OPENSSL
|
||||
|
||||
File "libeay32.dll"
|
||||
File "ssleay32.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "ANGLE" SEC_ANGLE
|
||||
|
||||
File "libGLESv2.dll"
|
||||
File "libEGL.dll"
|
||||
File "D3DCompiler_47.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
@ -179,6 +226,10 @@ Section "Uninstall"
|
||||
DeleteRegKey HKCR ".kml"
|
||||
DeleteRegKey HKCR "${REGFIT}"
|
||||
DeleteRegKey HKCR ".fit"
|
||||
DeleteRegKey HKCR "${REGIGC}"
|
||||
DeleteRegKey HKCR ".igc"
|
||||
DeleteRegKey HKCR "${REGNMEA}"
|
||||
DeleteRegKey HKCR ".nmea"
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
@ -189,15 +240,21 @@ SectionEnd
|
||||
|
||||
;Language strings
|
||||
LangString DESC_QT ${LANG_ENGLISH} \
|
||||
"QT Library. Unselct only if you have QT already installed!"
|
||||
"QT cross-platform application framework."
|
||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||
"Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
|
||||
"Visual C++ 2015 runtime components. If already installed, will be skipped."
|
||||
LangString DESC_OPENSSL ${LANG_ENGLISH} \
|
||||
"OpenSSL library. Required for HTTPS to work."
|
||||
LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
@ -1,2 +1,5 @@
|
||||
Thunderforest http://tile.thunderforest.com/outdoors/$z/$x/$y.png
|
||||
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png
|
||||
Open Topo Map https://a.tile.opentopomap.org/$z/$x/$y.png 17
|
||||
4UMaps http://4umaps.eu/$z/$x/$y.png 15
|
||||
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png 19
|
||||
USGS Topo https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png 15
|
||||
USGS Imagery https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y 15
|
||||
|
109
src/GUI/app.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
#include <QtGlobal>
|
||||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QLibraryInfo>
|
||||
#include "map/onlinemap.h"
|
||||
#include "map/downloader.h"
|
||||
#include "map/ellipsoid.h"
|
||||
#include "map/datum.h"
|
||||
#include "opengl.h"
|
||||
#include "gui.h"
|
||||
#include "config.h"
|
||||
#include "app.h"
|
||||
|
||||
|
||||
App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
_argc(argc), _argv(argv)
|
||||
{
|
||||
QTranslator *gpxsee = new QTranslator(this);
|
||||
QString locale = QLocale::system().name();
|
||||
gpxsee->load(QString(":/lang/gpxsee_") + locale);
|
||||
installTranslator(gpxsee);
|
||||
|
||||
QTranslator *qt = new QTranslator(this);
|
||||
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
|
||||
QLibraryInfo::TranslationsPath));
|
||||
installTranslator(qt);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
OnlineMap::setDownloader(new Downloader(this));
|
||||
OPENGL_SET_SAMPLES(4);
|
||||
loadDatums();
|
||||
|
||||
_gui = new GUI();
|
||||
}
|
||||
|
||||
App::~App()
|
||||
{
|
||||
delete _gui;
|
||||
}
|
||||
|
||||
void App::run()
|
||||
{
|
||||
_gui->show();
|
||||
|
||||
for (int i = 1; i < _argc; i++)
|
||||
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
|
||||
|
||||
exec();
|
||||
}
|
||||
|
||||
bool App::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *e = static_cast<QFileOpenEvent *>(event);
|
||||
return _gui->openFile(e->file());
|
||||
}
|
||||
|
||||
return QApplication::event(event);
|
||||
}
|
||||
|
||||
void App::loadDatums()
|
||||
{
|
||||
QString ef, df;
|
||||
bool ok = false;
|
||||
|
||||
if (QFile::exists(USER_ELLIPSOID_FILE))
|
||||
ef = USER_ELLIPSOID_FILE;
|
||||
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
|
||||
ef = GLOBAL_ELLIPSOID_FILE;
|
||||
else
|
||||
qWarning("No ellipsoids file found.");
|
||||
|
||||
if (QFile::exists(USER_DATUM_FILE))
|
||||
df = USER_DATUM_FILE;
|
||||
else if (QFile::exists(GLOBAL_DATUM_FILE))
|
||||
df = GLOBAL_DATUM_FILE;
|
||||
else
|
||||
qWarning("No datums file found.");
|
||||
|
||||
if (!ef.isNull() && !df.isNull()) {
|
||||
if (!Ellipsoid::loadList(ef)) {
|
||||
if (Ellipsoid::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
|
||||
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(ef), qPrintable(
|
||||
Ellipsoid::errorString()));
|
||||
} else {
|
||||
if (!Datum::loadList(df)) {
|
||||
if (Datum::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(df),
|
||||
Datum::errorLine(), qPrintable(Datum::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(df), qPrintable(
|
||||
Datum::errorString()));
|
||||
} else
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
qWarning("Maps based on a datum different from WGS84 won't work.");
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
#include <QApplication>
|
||||
|
||||
class GUI;
|
||||
class QTranslator;
|
||||
|
||||
class App : QApplication
|
||||
{
|
||||
@ -19,10 +18,11 @@ protected:
|
||||
bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
void loadDatums();
|
||||
|
||||
int &_argc;
|
||||
char **_argv;
|
||||
GUI *_gui;
|
||||
QTranslator *_translator;
|
||||
};
|
||||
|
||||
#endif // APP_H
|
@ -1,7 +1,7 @@
|
||||
#include <cmath>
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include "nicenum.h"
|
||||
#include "axisitem.h"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define AXISITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include "range.h"
|
||||
#include "common/range.h"
|
||||
|
||||
class AxisItem : public QGraphicsItem
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
#include "data.h"
|
||||
#include "data/data.h"
|
||||
#include "cadencegraphitem.h"
|
||||
#include "cadencegraph.h"
|
||||
|
||||
|
||||
CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
|
||||
{
|
||||
_units = Metric;
|
||||
_showTracks = true;
|
||||
|
||||
GraphView::setYUnits(tr("1/min"));
|
||||
@ -28,21 +28,16 @@ void CadenceGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||
{
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
const Graph &graph = data.tracks().at(i)->cadence();
|
||||
qreal sum = 0, w = 0;
|
||||
|
||||
if (graph.size() < 2) {
|
||||
skipColor();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 1; j < graph.size(); j++) {
|
||||
qreal ds = graph.at(j).s() - graph.at(j-1).s();
|
||||
sum += graph.at(j).y() * ds;
|
||||
w += ds;
|
||||
}
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||
CadenceGraphItem *gi = new CadenceGraphItem(graph, _graphType);
|
||||
GraphView::addGraph(gi, paths.at(i));
|
||||
|
||||
GraphView::loadGraph(graph, paths.at(i));
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.routes().count(); i++)
|
@ -13,7 +13,6 @@ public:
|
||||
QString label() const {return tr("Cadence");}
|
||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||
void clear();
|
||||
void setUnits(enum Units) {}
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
@ -24,7 +23,6 @@ private:
|
||||
|
||||
QList<QPointF> _avg;
|
||||
|
||||
enum Units _units;
|
||||
bool _showTracks;
|
||||
};
|
||||
|
26
src/GUI/cadencegraphitem.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "tooltip.h"
|
||||
#include "cadencegraphitem.h"
|
||||
|
||||
CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||
{
|
||||
qreal sum = 0;
|
||||
|
||||
for (int j = 1; j < graph.size(); j++)
|
||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
||||
_avg = sum/graph.last().s();
|
||||
|
||||
setToolTip(toolTip());
|
||||
}
|
||||
|
||||
QString CadenceGraphItem::toolTip() const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
|
||||
return tt.toString();
|
||||
}
|
23
src/GUI/cadencegraphitem.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef CADENCEGRAPHITEM_H
|
||||
#define CADENCEGRAPHITEM_H
|
||||
|
||||
#include "graphitem.h"
|
||||
|
||||
class CadenceGraphItem : public GraphItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CadenceGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
qreal max() const {return -bounds().top();}
|
||||
qreal avg() const {return _avg;}
|
||||
|
||||
private:
|
||||
QString toolTip() const;
|
||||
|
||||
qreal _avg;
|
||||
};
|
||||
|
||||
#endif // CADENCEGRAPHITEM_H
|
70
src/GUI/colorbox.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
#include <QStylePainter>
|
||||
#include <QStyleOptionComboBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QColorDialog>
|
||||
#include <QComboBox>
|
||||
#include "colorbox.h"
|
||||
|
||||
|
||||
ColorBox::ColorBox(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
_color = Qt::red;
|
||||
_alpha = true;
|
||||
|
||||
setSizePolicy(QSizePolicy::QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
QSize ColorBox::sizeHint() const
|
||||
{
|
||||
static QSize size;
|
||||
if (size.isValid())
|
||||
return size;
|
||||
|
||||
QComboBox cb;
|
||||
size = cb.sizeHint();
|
||||
return size;
|
||||
}
|
||||
|
||||
void ColorBox::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QStylePainter painter(this);
|
||||
|
||||
QStyleOptionComboBox option;
|
||||
option.initFrom(this);
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
|
||||
painter.setBrush(_color);
|
||||
painter.drawPrimitive(QStyle::PE_Frame, option);
|
||||
#else // Q_OS_MAC || Q_OS_WIN32
|
||||
// Fallback for some broken QT4 styles that do not draw the background
|
||||
painter.setBrush(_color);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.drawRect(event->rect().adjusted(2, 2, -2, -2));
|
||||
// If works (QT5 and most QT4 styles) overpaints the previous rectangle
|
||||
option.palette.setBrush(QPalette::Base, _color);
|
||||
painter.drawPrimitive(QStyle::PE_PanelLineEdit, option);
|
||||
painter.drawPrimitive(QStyle::PE_FrameLineEdit, option);
|
||||
#endif // Q_OS_MAC || Q_OS_WIN32
|
||||
}
|
||||
|
||||
void ColorBox::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
QColorDialog::ColorDialogOptions options = _alpha
|
||||
? QColorDialog::ShowAlphaChannel : (QColorDialog::ColorDialogOptions)0;
|
||||
QColor color = QColorDialog::getColor(_color, this, QString(), options);
|
||||
if (color.isValid()) {
|
||||
_color = color;
|
||||
update();
|
||||
emit colorChanged(_color);
|
||||
}
|
||||
}
|
||||
|
||||
void ColorBox::setColor(const QColor &color)
|
||||
{
|
||||
_color = color;
|
||||
update();
|
||||
}
|
31
src/GUI/colorbox.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef COLORBOX_H
|
||||
#define COLORBOX_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ColorBox : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ColorBox(QWidget *parent = 0);
|
||||
|
||||
const QColor &color() const {return _color;}
|
||||
void setColor(const QColor &color);
|
||||
void enableAlphaChannel(bool enable) {_alpha = enable;}
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void colorChanged(const QColor &color);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
QColor _color;
|
||||
bool _alpha;
|
||||
};
|
||||
|
||||
#endif // COLORBOX_H
|
@ -1,6 +1,8 @@
|
||||
#include <cmath>
|
||||
#include "data/data.h"
|
||||
#include "config.h"
|
||||
#include "data.h"
|
||||
#include "tooltip.h"
|
||||
#include "elevationgraphitem.h"
|
||||
#include "elevationgraph.h"
|
||||
|
||||
|
||||
@ -42,11 +44,8 @@ ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
|
||||
_showRoutes = true;
|
||||
_showTracks = true;
|
||||
|
||||
_units = Metric;
|
||||
|
||||
setYUnits();
|
||||
setYUnits(Metric);
|
||||
setYLabel(tr("Elevation"));
|
||||
|
||||
setMinYRange(50.0);
|
||||
}
|
||||
|
||||
@ -68,43 +67,25 @@ void ElevationGraph::setInfo()
|
||||
|
||||
void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
|
||||
{
|
||||
qreal ascent = 0, descent = 0;
|
||||
qreal min, max;
|
||||
|
||||
if (graph.size() < 2) {
|
||||
skipColor();
|
||||
return;
|
||||
}
|
||||
|
||||
max = min = graph.at(0).y();
|
||||
for (int j = 1; j < graph.size(); j++) {
|
||||
qreal cur = graph.at(j).y();
|
||||
qreal prev = graph.at(j-1).y();
|
||||
|
||||
if (cur > prev)
|
||||
ascent += cur - prev;
|
||||
if (cur < prev)
|
||||
descent += prev - cur;
|
||||
|
||||
if (cur < min)
|
||||
min = cur;
|
||||
if (cur > max)
|
||||
max = cur;
|
||||
}
|
||||
ElevationGraphItem *gi = new ElevationGraphItem(graph, _graphType);
|
||||
GraphView::addGraph(gi, path, type);
|
||||
|
||||
if (type == Track) {
|
||||
_trackAscent += ascent;
|
||||
_trackDescent += descent;
|
||||
_trackMax = nMax(_trackMax, max);
|
||||
_trackMin = nMin(_trackMin, min);
|
||||
_trackAscent += gi->ascent();
|
||||
_trackDescent += gi->descent();
|
||||
_trackMax = nMax(_trackMax, gi->max());
|
||||
_trackMin = nMin(_trackMin, gi->min());
|
||||
} else {
|
||||
_routeAscent += ascent;
|
||||
_routeDescent += descent;
|
||||
_routeMax = nMax(_routeMax, max);
|
||||
_routeMin = nMin(_routeMin, min);
|
||||
_routeAscent += gi->ascent();
|
||||
_routeDescent += gi->descent();
|
||||
_routeMax = nMax(_routeMax, gi->max());
|
||||
_routeMin = nMin(_routeMin, gi->min());
|
||||
}
|
||||
|
||||
GraphView::loadGraph(graph, path, type);
|
||||
}
|
||||
|
||||
void ElevationGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||
@ -135,9 +116,9 @@ void ElevationGraph::clear()
|
||||
GraphView::clear();
|
||||
}
|
||||
|
||||
void ElevationGraph::setYUnits()
|
||||
void ElevationGraph::setYUnits(Units units)
|
||||
{
|
||||
if (_units == Metric) {
|
||||
if (units == Metric) {
|
||||
GraphView::setYUnits(tr("m"));
|
||||
setYScale(1);
|
||||
} else {
|
||||
@ -146,15 +127,12 @@ void ElevationGraph::setYUnits()
|
||||
}
|
||||
}
|
||||
|
||||
void ElevationGraph::setUnits(enum Units units)
|
||||
void ElevationGraph::setUnits(Units units)
|
||||
{
|
||||
_units = units;
|
||||
|
||||
setYUnits();
|
||||
setYUnits(units);
|
||||
setInfo();
|
||||
GraphView::setUnits(units);
|
||||
|
||||
redraw();
|
||||
GraphView::setUnits(units);
|
||||
}
|
||||
|
||||
void ElevationGraph::showTracks(bool show)
|
@ -25,7 +25,7 @@ private:
|
||||
qreal ascent() const;
|
||||
qreal descent() const;
|
||||
|
||||
void setYUnits();
|
||||
void setYUnits(Units units);
|
||||
void setInfo();
|
||||
|
||||
void loadGraph(const Graph &graph, Type type, PathItem *path);
|
||||
@ -35,7 +35,6 @@ private:
|
||||
qreal _trackMax, _routeMax;
|
||||
qreal _trackMin, _routeMin;
|
||||
|
||||
enum Units _units;
|
||||
bool _showTracks, _showRoutes;
|
||||
};
|
||||
|
43
src/GUI/elevationgraphitem.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "tooltip.h"
|
||||
#include "elevationgraphitem.h"
|
||||
|
||||
ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||
{
|
||||
_ascent = _descent = 0;
|
||||
|
||||
for (int j = 1; j < graph.size(); j++) {
|
||||
qreal cur = graph.at(j).y();
|
||||
qreal prev = graph.at(j-1).y();
|
||||
|
||||
if (cur > prev)
|
||||
_ascent += cur - prev;
|
||||
if (cur < prev)
|
||||
_descent += prev - cur;
|
||||
}
|
||||
|
||||
setToolTip(toolTip(Metric));
|
||||
}
|
||||
|
||||
QString ElevationGraphItem::toolTip(Units units) const
|
||||
{
|
||||
ToolTip tt;
|
||||
qreal scale = (units == Metric) ? 1.0 : M2FT;
|
||||
QString su = (units == Metric) ? tr("m") : tr("ft");
|
||||
|
||||
tt.insert(tr("Ascent"), QString::number(ascent() * scale, 'f', 0)
|
||||
+ UNIT_SPACE + su);
|
||||
tt.insert(tr("Descent"), QString::number(descent() * scale, 'f', 0)
|
||||
+ UNIT_SPACE + su);
|
||||
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 0)
|
||||
+ UNIT_SPACE + su);
|
||||
tt.insert(tr("Minimum"), QString::number(min() * scale, 'f', 0)
|
||||
+ UNIT_SPACE + su);
|
||||
|
||||
return tt.toString();
|
||||
}
|
||||
|
||||
void ElevationGraphItem::setUnits(Units units)
|
||||
{
|
||||
setToolTip(toolTip(units));
|
||||
}
|
27
src/GUI/elevationgraphitem.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef ELEVATIONGRAPHITEM_H
|
||||
#define ELEVATIONGRAPHITEM_H
|
||||
|
||||
#include "graphitem.h"
|
||||
|
||||
class ElevationGraphItem : public GraphItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ElevationGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
qreal ascent() const {return _ascent;}
|
||||
qreal descent() const {return _descent;}
|
||||
qreal min() const {return -bounds().bottom();}
|
||||
qreal max() const {return -bounds().top();}
|
||||
|
||||
void setUnits(Units units);
|
||||
|
||||
private:
|
||||
QString toolTip(Units units) const;
|
||||
|
||||
qreal _ascent, _descent;
|
||||
};
|
||||
|
||||
#endif // ELEVATIONGRAPHITEM_H
|
@ -11,65 +11,76 @@
|
||||
#include <QMessageBox>
|
||||
#include <QTabWidget>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QLocale>
|
||||
#include "fileselectwidget.h"
|
||||
#include "units.h"
|
||||
#include "exportdialog.h"
|
||||
|
||||
|
||||
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
||||
: QDialog(parent), _printer(printer)
|
||||
ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
||||
: QDialog(parent), _export(exp)
|
||||
{
|
||||
int index;
|
||||
|
||||
_units = (QLocale::system().measurementSystem()
|
||||
== QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter;
|
||||
|
||||
_fileSelect = new FileSelectWidget();
|
||||
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
||||
_fileSelect->setFile(_printer->outputFileName());
|
||||
_fileSelect->setFile(_export->fileName);
|
||||
|
||||
_paperSize = new QComboBox();
|
||||
_paperSize->addItem("A2", QPrinter::A2);
|
||||
_paperSize->addItem("A3", QPrinter::A3);
|
||||
_paperSize->addItem("A4", QPrinter::A4);
|
||||
_paperSize->addItem("A5", QPrinter::A5);
|
||||
_paperSize->addItem("A6", QPrinter::A6);
|
||||
_paperSize->addItem("B3", QPrinter::B3);
|
||||
_paperSize->addItem("B4", QPrinter::B4);
|
||||
_paperSize->addItem("B5", QPrinter::B5);
|
||||
_paperSize->addItem("B6", QPrinter::B6);
|
||||
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
|
||||
_paperSize->addItem("Legal", QPrinter::Legal);
|
||||
_paperSize->addItem("Letter", QPrinter::Letter);
|
||||
if ((index = _paperSize->findData(_printer->paperSize())) >= 0)
|
||||
if ((index = _paperSize->findData(_export->paperSize)) >= 0)
|
||||
_paperSize->setCurrentIndex(index);
|
||||
|
||||
_resolution = new QComboBox();
|
||||
_resolution->addItem("300 DPI", 300);
|
||||
_resolution->addItem("600 DPI", 600);
|
||||
_resolution->addItem("1200 DPI", 1200);
|
||||
if ((index = _resolution->findData(_export->resolution)) >= 0)
|
||||
_resolution->setCurrentIndex(index);
|
||||
|
||||
_portrait = new QRadioButton(tr("Portrait"));
|
||||
_landscape = new QRadioButton(tr("Landscape"));
|
||||
QHBoxLayout *orientationLayout = new QHBoxLayout();
|
||||
orientationLayout->addWidget(_portrait);
|
||||
orientationLayout->addWidget(_landscape);
|
||||
if (_printer->orientation() == QPrinter::Portrait)
|
||||
if (_export->orientation == QPrinter::Portrait)
|
||||
_portrait->setChecked(true);
|
||||
else
|
||||
_landscape->setChecked(true);
|
||||
|
||||
qreal top, bottom, left, right;
|
||||
|
||||
_printer->getPageMargins(&left, &top, &right, &bottom, _units);
|
||||
QString us = _units == QPrinter::Inch ? tr("in") : tr("mm");
|
||||
_topMargin = new QDoubleSpinBox();
|
||||
_bottomMargin = new QDoubleSpinBox();
|
||||
_leftMargin = new QDoubleSpinBox();
|
||||
_rightMargin = new QDoubleSpinBox();
|
||||
_topMargin->setValue(top);
|
||||
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
|
||||
_topMargin->setSuffix(UNIT_SPACE + us);
|
||||
_bottomMargin->setValue(bottom);
|
||||
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
||||
_leftMargin->setValue(left);
|
||||
_leftMargin->setSuffix(UNIT_SPACE + us);
|
||||
_rightMargin->setValue(right);
|
||||
_rightMargin->setSuffix(UNIT_SPACE + us);
|
||||
if (_units == QPrinter::Inch) {
|
||||
if (_export->units == Imperial) {
|
||||
_topMargin->setValue(_export->margins.top() * MM2IN);
|
||||
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
|
||||
_leftMargin->setValue(_export->margins.left() * MM2IN);
|
||||
_rightMargin->setValue(_export->margins.right() * MM2IN);
|
||||
_topMargin->setSingleStep(0.1);
|
||||
_bottomMargin->setSingleStep(0.1);
|
||||
_leftMargin->setSingleStep(0.1);
|
||||
_rightMargin->setSingleStep(0.1);
|
||||
} else {
|
||||
_topMargin->setValue(_export->margins.top());
|
||||
_bottomMargin->setValue(_export->margins.bottom());
|
||||
_leftMargin->setValue(_export->margins.left());
|
||||
_rightMargin->setValue(_export->margins.right());
|
||||
}
|
||||
|
||||
QGridLayout *marginsLayout = new QGridLayout();
|
||||
@ -83,6 +94,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
||||
#endif // Q_OS_MAC
|
||||
QFormLayout *pageSetupLayout = new QFormLayout;
|
||||
pageSetupLayout->addRow(tr("Page size:"), _paperSize);
|
||||
pageSetupLayout->addRow(tr("Resolution:"), _resolution);
|
||||
pageSetupLayout->addRow(tr("Orientation:"), orientationLayout);
|
||||
pageSetupLayout->addRow(tr("Margins:"), marginsLayout);
|
||||
#ifdef Q_OS_MAC
|
||||
@ -163,13 +175,19 @@ void ExportDialog::accept()
|
||||
? QPrinter::Portrait : QPrinter::Landscape;
|
||||
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
|
||||
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
|
||||
int resolution = _resolution->itemData(_resolution->currentIndex()).toInt();
|
||||
|
||||
_printer->setOutputFormat(QPrinter::PdfFormat);
|
||||
_printer->setOutputFileName(_fileSelect->file());
|
||||
_printer->setPaperSize(paperSize);
|
||||
_printer->setOrientation(orientation);
|
||||
_printer->setPageMargins(_leftMargin->value(), _topMargin->value(),
|
||||
_rightMargin->value(), _bottomMargin->value(), _units);
|
||||
_export->fileName = _fileSelect->file();
|
||||
_export->paperSize = paperSize;
|
||||
_export->resolution = resolution;
|
||||
_export->orientation = orientation;
|
||||
if (_export->units == Imperial)
|
||||
_export->margins = MarginsF(_leftMargin->value() / MM2IN,
|
||||
_topMargin->value() / MM2IN, _rightMargin->value() / MM2IN,
|
||||
_bottomMargin->value() / MM2IN);
|
||||
else
|
||||
_export->margins = MarginsF(_leftMargin->value(), _topMargin->value(),
|
||||
_rightMargin->value(), _bottomMargin->value());
|
||||
|
||||
QDialog::accept();
|
||||
}
|
@ -3,18 +3,30 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPrinter>
|
||||
#include "margins.h"
|
||||
#include "units.h"
|
||||
|
||||
class QComboBox;
|
||||
class QRadioButton;
|
||||
class FileSelectWidget;
|
||||
class QDoubleSpinBox;
|
||||
|
||||
struct Export {
|
||||
QString fileName;
|
||||
QPrinter::PaperSize paperSize;
|
||||
QPrinter::Orientation orientation;
|
||||
MarginsF margins;
|
||||
int resolution;
|
||||
|
||||
Units units;
|
||||
};
|
||||
|
||||
class ExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportDialog(QPrinter *printer, QWidget *parent = 0);
|
||||
ExportDialog(Export *exp, QWidget *parent = 0);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
@ -22,12 +34,11 @@ public slots:
|
||||
private:
|
||||
bool checkFile();
|
||||
|
||||
QPrinter *_printer;
|
||||
|
||||
QPrinter::Unit _units;
|
||||
Export *_export;
|
||||
|
||||
FileSelectWidget *_fileSelect;
|
||||
QComboBox *_paperSize;
|
||||
QComboBox *_resolution;
|
||||
QRadioButton *_portrait;
|
||||
QRadioButton *_landscape;
|
||||
QDoubleSpinBox *_topMargin;
|
@ -1,8 +1,8 @@
|
||||
#include <QApplication>
|
||||
#include "coordinates.h"
|
||||
#include "common/coordinates.h"
|
||||
#include "format.h"
|
||||
|
||||
QString Format::timeSpan(qreal time)
|
||||
QString Format::timeSpan(qreal time, bool full)
|
||||
{
|
||||
unsigned h, m, s;
|
||||
|
||||
@ -10,7 +10,11 @@ QString Format::timeSpan(qreal time)
|
||||
m = (time - (h * 3600)) / 60;
|
||||
s = time - (h * 3600) - (m * 60);
|
||||
|
||||
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
||||
if (full || h)
|
||||
return QString("%1:%2:%3").arg(h, 2, 10, QChar('0'))
|
||||
.arg(m, 2, 10, QChar('0')).arg(s, 2, 10, QChar('0'));
|
||||
else
|
||||
return QString("%1:%2").arg(m, 2, 10, QChar('0'))
|
||||
.arg(s, 2, 10, QChar('0'));
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class Coordinates;
|
||||
|
||||
namespace Format
|
||||
{
|
||||
QString timeSpan(qreal time);
|
||||
QString timeSpan(qreal time, bool full = true);
|
||||
QString distance(qreal value, Units units);
|
||||
QString elevation(qreal value, Units units);
|
||||
QString coordinates(const Coordinates &value);
|
@ -2,22 +2,40 @@
|
||||
#include "graphitem.h"
|
||||
|
||||
|
||||
#define GRAPH_WIDTH 1
|
||||
#define HOVER_WIDTH 2
|
||||
|
||||
GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
|
||||
GraphItem::GraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent)
|
||||
: QGraphicsObject(parent)
|
||||
{
|
||||
_id = 0;
|
||||
_width = 1;
|
||||
|
||||
_pen = QPen(Qt::black, GRAPH_WIDTH);
|
||||
_pen = QPen(Qt::black, _width);
|
||||
|
||||
_type = Distance;
|
||||
_type = type;
|
||||
_graph = graph;
|
||||
_sx = 1.0; _sy = 1.0;
|
||||
|
||||
_time = true;
|
||||
for (int i = 0; i < _graph.size(); i++) {
|
||||
if (std::isnan(_graph.at(i).t())) {
|
||||
_time = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setZValue(1.0);
|
||||
|
||||
updatePath();
|
||||
updateShape();
|
||||
updateBounds();
|
||||
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void GraphItem::updateShape()
|
||||
{
|
||||
QPainterPathStroker s;
|
||||
s.setWidth(_width + 1);
|
||||
_shape = s.createStroke(_path);
|
||||
}
|
||||
|
||||
void GraphItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
@ -38,19 +56,39 @@ void GraphItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
|
||||
void GraphItem::setGraphType(GraphType type)
|
||||
{
|
||||
if (type == _type)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_type = type;
|
||||
updatePath();
|
||||
updateShape();
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
void GraphItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
|
||||
_pen.setColor(color);
|
||||
update();
|
||||
}
|
||||
|
||||
void GraphItem::setWidth(int width)
|
||||
{
|
||||
if (width == _width)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidth(width);
|
||||
|
||||
updateShape();
|
||||
}
|
||||
|
||||
qreal GraphItem::yAtX(qreal x)
|
||||
{
|
||||
int low = 0;
|
||||
@ -116,24 +154,24 @@ qreal GraphItem::distanceAtTime(qreal time)
|
||||
void GraphItem::emitSliderPositionChanged(qreal pos)
|
||||
{
|
||||
if (_type == Time) {
|
||||
if (_graph.hasTime()) {
|
||||
if (pos <= _graph.last().t())
|
||||
if (_time) {
|
||||
if (pos >= _graph.first().t() && pos <= _graph.last().t())
|
||||
emit sliderPositionChanged(distanceAtTime(pos));
|
||||
else
|
||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
||||
emit sliderPositionChanged(NAN);
|
||||
} else
|
||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
||||
emit sliderPositionChanged(NAN);
|
||||
} else
|
||||
emit sliderPositionChanged(pos);
|
||||
}
|
||||
|
||||
void GraphItem::selected(bool selected)
|
||||
void GraphItem::hover(bool hover)
|
||||
{
|
||||
if (selected) {
|
||||
_pen.setWidth(HOVER_WIDTH);
|
||||
if (hover) {
|
||||
_pen.setWidth(_width + 1);
|
||||
setZValue(zValue() + 1.0);
|
||||
} else {
|
||||
_pen.setWidth(GRAPH_WIDTH);
|
||||
_pen.setWidth(_width);
|
||||
setZValue(zValue() - 1.0);
|
||||
}
|
||||
|
||||
@ -149,13 +187,14 @@ void GraphItem::setScale(qreal sx, qreal sy)
|
||||
|
||||
_sx = sx; _sy = sy;
|
||||
updatePath();
|
||||
updateShape();
|
||||
}
|
||||
|
||||
void GraphItem::updatePath()
|
||||
{
|
||||
_path = QPainterPath();
|
||||
|
||||
if (_type == Time && !_graph.hasTime())
|
||||
if (_type == Time && !_time)
|
||||
return;
|
||||
|
||||
_path.moveTo(_graph.first().x(_type) * _sx, -_graph.first().y() * _sy);
|
||||
@ -165,7 +204,7 @@ void GraphItem::updatePath()
|
||||
|
||||
void GraphItem::updateBounds()
|
||||
{
|
||||
if (_type == Time && !_graph.hasTime()) {
|
||||
if (_type == Time && !_time) {
|
||||
_bounds = QRectF();
|
||||
return;
|
||||
}
|
||||
@ -183,3 +222,25 @@ void GraphItem::updateBounds()
|
||||
|
||||
_bounds = QRectF(QPointF(left, top), QPointF(right, bottom));
|
||||
}
|
||||
|
||||
void GraphItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width + 1);
|
||||
setZValue(zValue() + 1.0);
|
||||
update();
|
||||
|
||||
emit selected(true);
|
||||
}
|
||||
|
||||
void GraphItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width);
|
||||
setZValue(zValue() - 1.0);
|
||||
update();
|
||||
|
||||
emit selected(false);
|
||||
}
|
@ -3,51 +3,65 @@
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QPen>
|
||||
#include "graph.h"
|
||||
#include "data/graph.h"
|
||||
#include "units.h"
|
||||
|
||||
class GraphItem : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GraphItem(const Graph &graph, QGraphicsItem *parent = 0);
|
||||
GraphItem(const Graph &graph, GraphType type, QGraphicsItem *parent = 0);
|
||||
|
||||
QRectF boundingRect() const
|
||||
{return _path.boundingRect();}
|
||||
QPainterPath shape() const {return _shape;}
|
||||
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
const QRectF &bounds() const {return _bounds;}
|
||||
void setScale(qreal sx, qreal sy);
|
||||
|
||||
void setScale(qreal sx, qreal sy);
|
||||
void setGraphType(GraphType type);
|
||||
int id() const {return _id;}
|
||||
void setId(int id) {_id = id;}
|
||||
void setColor(const QColor &color);
|
||||
void setWidth(int width);
|
||||
virtual void setUnits(Units units) {Q_UNUSED(units);}
|
||||
|
||||
qreal yAtX(qreal x);
|
||||
qreal distanceAtTime(qreal time);
|
||||
|
||||
void redraw();
|
||||
|
||||
signals:
|
||||
void sliderPositionChanged(qreal);
|
||||
void selected(bool);
|
||||
|
||||
public slots:
|
||||
void emitSliderPositionChanged(qreal);
|
||||
void selected(bool selected);
|
||||
void hover(bool hover);
|
||||
|
||||
private:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
void updatePath();
|
||||
void updateShape();
|
||||
void updateBounds();
|
||||
|
||||
int _id;
|
||||
QPen _pen;
|
||||
int _width;
|
||||
|
||||
Graph _graph;
|
||||
GraphType _type;
|
||||
|
||||
QPainterPath _path;
|
||||
QPainterPath _shape;
|
||||
QRectF _bounds;
|
||||
qreal _sx, _sy;
|
||||
|
||||
bool _time;
|
||||
};
|
||||
|
||||
#endif // GRAPHITEM_H
|
@ -4,6 +4,7 @@
|
||||
#include <QList>
|
||||
#include "graphview.h"
|
||||
#include "units.h"
|
||||
#include "timetype.h"
|
||||
|
||||
class Data;
|
||||
class PathItem;
|
||||
@ -18,10 +19,12 @@ public:
|
||||
|
||||
virtual QString label() const = 0;
|
||||
virtual void loadData(const Data &data, const QList<PathItem *> &paths) = 0;
|
||||
virtual void clear() = 0;
|
||||
virtual void setUnits(enum Units units) = 0;
|
||||
virtual void showTracks(bool show) = 0;
|
||||
virtual void showRoutes(bool show) = 0;
|
||||
virtual void clear() {GraphView::clear();}
|
||||
virtual void setUnits(enum Units units) {GraphView::setUnits(units);}
|
||||
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
||||
virtual void setTimeType(enum TimeType type) {Q_UNUSED(type)}
|
||||
virtual void showTracks(bool show) {Q_UNUSED(show)}
|
||||
virtual void showRoutes(bool show) {Q_UNUSED(show)}
|
||||
};
|
||||
|
||||
#endif // GRAPHTAB_H
|
@ -3,15 +3,17 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEngine>
|
||||
#include <QPaintDevice>
|
||||
#include "data/graph.h"
|
||||
#include "opengl.h"
|
||||
#include "config.h"
|
||||
#include "axisitem.h"
|
||||
#include "slideritem.h"
|
||||
#include "sliderinfoitem.h"
|
||||
#include "infoitem.h"
|
||||
#include "griditem.h"
|
||||
#include "graph.h"
|
||||
#include "graphitem.h"
|
||||
#include "pathitem.h"
|
||||
#include "format.h"
|
||||
#include "graphview.h"
|
||||
|
||||
|
||||
@ -20,26 +22,31 @@
|
||||
GraphView::GraphView(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
_scene = new QGraphicsScene();
|
||||
_scene = new QGraphicsScene(this);
|
||||
setScene(_scene);
|
||||
|
||||
setBackgroundBrush(QBrush(Qt::white));
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
_xAxis = new AxisItem(AxisItem::X);
|
||||
_xAxis->setZValue(1.0);
|
||||
_xAxis->setZValue(2.0);
|
||||
_yAxis = new AxisItem(AxisItem::Y);
|
||||
_yAxis->setZValue(1.0);
|
||||
_yAxis->setZValue(2.0);
|
||||
_slider = new SliderItem();
|
||||
_slider->setZValue(2.0);
|
||||
_slider->setZValue(3.0);
|
||||
_sliderInfo = new SliderInfoItem(_slider);
|
||||
_sliderInfo->setZValue(2.0);
|
||||
_sliderInfo->setZValue(3.0);
|
||||
_info = new InfoItem();
|
||||
_grid = new GridItem();
|
||||
|
||||
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
||||
SLOT(emitSliderPositionChanged(const QPointF&)));
|
||||
|
||||
_width = 1;
|
||||
|
||||
_xScale = 1;
|
||||
_yScale = 1;
|
||||
_yOffset = 0;
|
||||
@ -133,7 +140,13 @@ void GraphView::setXUnits()
|
||||
void GraphView::setUnits(Units units)
|
||||
{
|
||||
_units = units;
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
_graphs.at(i)->setUnits(units);
|
||||
|
||||
setXUnits();
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void GraphView::setGraphType(GraphType type)
|
||||
@ -161,28 +174,34 @@ void GraphView::showGrid(bool show)
|
||||
_grid->setVisible(show);
|
||||
}
|
||||
|
||||
void GraphView::loadGraph(const Graph &graph, PathItem *path, int id)
|
||||
void GraphView::showSliderInfo(bool show)
|
||||
{
|
||||
if (graph.size() < 2)
|
||||
return;
|
||||
_sliderInfo->setVisible(show);
|
||||
}
|
||||
|
||||
GraphItem *gi = new GraphItem(graph);
|
||||
gi->setGraphType(_graphType);
|
||||
gi->setId(id);
|
||||
gi->setColor(_palette.color());
|
||||
void GraphView::addGraph(GraphItem *graph, PathItem *path, int id)
|
||||
{
|
||||
QColor color(_palette.nextColor());
|
||||
color.setAlpha(255);
|
||||
|
||||
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
|
||||
graph->setUnits(_units);
|
||||
graph->setId(id);
|
||||
graph->setColor(color);
|
||||
graph->setWidth(_width);
|
||||
|
||||
connect(this, SIGNAL(sliderPositionChanged(qreal)), graph,
|
||||
SLOT(emitSliderPositionChanged(qreal)));
|
||||
connect(gi, SIGNAL(sliderPositionChanged(qreal)), path,
|
||||
connect(graph, SIGNAL(sliderPositionChanged(qreal)), path,
|
||||
SLOT(moveMarker(qreal)));
|
||||
connect(path, SIGNAL(selected(bool)), gi, SLOT(selected(bool)));
|
||||
connect(path, SIGNAL(selected(bool)), graph, SLOT(hover(bool)));
|
||||
connect(graph, SIGNAL(selected(bool)), path, SLOT(hover(bool)));
|
||||
|
||||
_graphs.append(gi);
|
||||
_graphs.append(graph);
|
||||
|
||||
if (!_hide.contains(id)) {
|
||||
_visible.append(gi);
|
||||
_scene->addItem(gi);
|
||||
_bounds |= gi->bounds();
|
||||
_visible.append(graph);
|
||||
_scene->addItem(graph);
|
||||
_bounds |= graph->bounds();
|
||||
setXUnits();
|
||||
}
|
||||
}
|
||||
@ -220,11 +239,6 @@ void GraphView::showGraph(bool show, int id)
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::redraw()
|
||||
{
|
||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||
}
|
||||
|
||||
QRectF GraphView::bounds() const
|
||||
{
|
||||
QRectF br(_bounds);
|
||||
@ -232,6 +246,11 @@ QRectF GraphView::bounds() const
|
||||
return br;
|
||||
}
|
||||
|
||||
void GraphView::redraw()
|
||||
{
|
||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||
}
|
||||
|
||||
void GraphView::redraw(const QSizeF &size)
|
||||
{
|
||||
QRectF r;
|
||||
@ -319,11 +338,9 @@ void GraphView::mousePressEvent(QMouseEvent *e)
|
||||
QGraphicsView::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void GraphView::plot(QPainter *painter, const QRectF &target)
|
||||
void GraphView::plot(QPainter *painter, const QRectF &target, qreal scale)
|
||||
{
|
||||
qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
|
||||
/ SCREEN_DPI;
|
||||
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
|
||||
QSizeF canvas = QSizeF(target.width() / scale, target.height() / scale);
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
redraw(canvas);
|
||||
@ -367,22 +384,26 @@ void GraphView::updateSliderPosition()
|
||||
_slider->setVisible(false);
|
||||
}
|
||||
|
||||
if (_slider->isVisible())
|
||||
updateSliderInfo();
|
||||
}
|
||||
|
||||
void GraphView::updateSliderInfo()
|
||||
{
|
||||
_sliderInfo->setVisible(_visible.count() == 1);
|
||||
if (!_sliderInfo->isVisible())
|
||||
return;
|
||||
qreal r, y;
|
||||
|
||||
if (_visible.count() > 1) {
|
||||
r = 0;
|
||||
y = 0;
|
||||
} else {
|
||||
QRectF br(_visible.first()->bounds());
|
||||
if (br.height() < _minYRange)
|
||||
br.adjust(0, -(_minYRange/2 - br.height()/2), 0,
|
||||
_minYRange/2 - br.height()/2);
|
||||
|
||||
qreal y = _visible.first()->yAtX(_sliderPos);
|
||||
qreal r = (y - br.bottom()) / br.height();
|
||||
y = _visible.first()->yAtX(_sliderPos);
|
||||
r = (y - br.bottom()) / br.height();
|
||||
}
|
||||
|
||||
qreal pos = (_sliderPos / bounds().width()) * _slider->area().width();
|
||||
SliderInfoItem::Side s = (pos + _sliderInfo->boundingRect().width()
|
||||
@ -390,8 +411,11 @@ void GraphView::updateSliderInfo()
|
||||
|
||||
_sliderInfo->setSide(s);
|
||||
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
||||
_sliderInfo->setText(QString::number(-y * _yScale + _yOffset, 'f',
|
||||
_precision));
|
||||
_sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos,
|
||||
bounds().width() > 3600) : QString::number(_sliderPos * _xScale, 'f', 1)
|
||||
+ UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString()
|
||||
: QString::number(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE
|
||||
+ _yUnits);
|
||||
}
|
||||
|
||||
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||
@ -400,6 +424,8 @@ void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||
return;
|
||||
|
||||
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
||||
_sliderPos = qMax(_sliderPos, bounds().left());
|
||||
_sliderPos = qMin(_sliderPos, bounds().right());
|
||||
updateSliderPosition();
|
||||
|
||||
emit sliderPositionChanged(_sliderPos);
|
||||
@ -429,3 +455,44 @@ void GraphView::clearInfo()
|
||||
{
|
||||
_info->clear();
|
||||
}
|
||||
|
||||
void GraphView::setPalette(const Palette &palette)
|
||||
{
|
||||
_palette = palette;
|
||||
_palette.reset();
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++) {
|
||||
QColor color(_palette.nextColor());
|
||||
color.setAlpha(255);
|
||||
_graphs.at(i)->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::setGraphWidth(int width)
|
||||
{
|
||||
_width = width;
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
_graphs.at(i)->setWidth(width);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void GraphView::useOpenGL(bool use)
|
||||
{
|
||||
if (use)
|
||||
setViewport(new OPENGL_WIDGET);
|
||||
else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
||||
void GraphView::useAntiAliasing(bool use)
|
||||
{
|
||||
setRenderHint(QPainter::Antialiasing, use);
|
||||
}
|
||||
|
||||
void GraphView::setSliderColor(const QColor &color)
|
||||
{
|
||||
_slider->setColor(color);
|
||||
_sliderInfo->setColor(color);
|
||||
}
|
@ -4,9 +4,9 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include "data/graph.h"
|
||||
#include "palette.h"
|
||||
#include "units.h"
|
||||
#include "graph.h"
|
||||
|
||||
|
||||
class AxisItem;
|
||||
@ -25,15 +25,30 @@ public:
|
||||
GraphView(QWidget *parent = 0);
|
||||
~GraphView();
|
||||
|
||||
void loadGraph(const Graph &graph, PathItem *path, int id = 0);
|
||||
int count() const {return _graphs.count();}
|
||||
void redraw();
|
||||
bool isEmpty() const {return _graphs.isEmpty();}
|
||||
void clear();
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target, qreal scale);
|
||||
|
||||
void setPalette(const Palette &palette);
|
||||
void setGraphWidth(int width);
|
||||
void showGrid(bool show);
|
||||
void showSliderInfo(bool show);
|
||||
void useOpenGL(bool use);
|
||||
void useAntiAliasing(bool use);
|
||||
|
||||
void setSliderPosition(qreal pos);
|
||||
void setSliderColor(const QColor &color);
|
||||
|
||||
signals:
|
||||
void sliderPositionChanged(qreal);
|
||||
|
||||
protected:
|
||||
void addGraph(GraphItem *graph, PathItem *path, int id = 0);
|
||||
|
||||
void showGraph(bool show, int id = 0);
|
||||
void setGraphType(GraphType type);
|
||||
void setUnits(Units units);
|
||||
void showGrid(bool show);
|
||||
|
||||
const QString &yLabel() const {return _yLabel;}
|
||||
const QString &yUnits() const {return _yUnits;}
|
||||
@ -47,20 +62,15 @@ public:
|
||||
void setSliderPrecision(int precision) {_precision = precision;}
|
||||
void setMinYRange(qreal range) {_minYRange = range;}
|
||||
|
||||
qreal sliderPosition() const {return _sliderPos;}
|
||||
void setSliderPosition(qreal pos);
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target);
|
||||
|
||||
signals:
|
||||
void sliderPositionChanged(qreal);
|
||||
|
||||
protected:
|
||||
QRectF bounds() const;
|
||||
void redraw();
|
||||
void redraw(const QSizeF &size);
|
||||
void addInfo(const QString &key, const QString &value);
|
||||
void clearInfo();
|
||||
void skipColor() {_palette.color();}
|
||||
void skipColor() {_palette.nextColor();}
|
||||
|
||||
QList<GraphItem*> _graphs;
|
||||
GraphType _graphType;
|
||||
|
||||
private slots:
|
||||
void emitSliderPositionChanged(const QPointF &pos);
|
||||
@ -78,6 +88,7 @@ private:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
Units _units;
|
||||
qreal _xScale, _yScale;
|
||||
qreal _yOffset;
|
||||
QString _xUnits, _yUnits;
|
||||
@ -94,14 +105,11 @@ private:
|
||||
InfoItem *_info;
|
||||
GridItem *_grid;
|
||||
|
||||
QList<GraphItem*> _graphs;
|
||||
QList<GraphItem*> _visible;
|
||||
QSet<int> _hide;
|
||||
QRectF _bounds;
|
||||
Palette _palette;
|
||||
|
||||
Units _units;
|
||||
GraphType _graphType;
|
||||
int _width;
|
||||
};
|
||||
|
||||
#endif // GRAPHVIEW_H
|
@ -6,7 +6,9 @@
|
||||
|
||||
GridItem::GridItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void GridItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
1935
src/GUI/gui.cpp
Normal file
@ -6,10 +6,12 @@
|
||||
#include <QList>
|
||||
#include <QDate>
|
||||
#include <QPrinter>
|
||||
#include "data/graph.h"
|
||||
#include "data/poi.h"
|
||||
#include "units.h"
|
||||
#include "graph.h"
|
||||
#include "poi.h"
|
||||
#include "margins.h"
|
||||
#include "timetype.h"
|
||||
#include "exportdialog.h"
|
||||
#include "optionsdialog.h"
|
||||
|
||||
class QMenu;
|
||||
class QToolBar;
|
||||
@ -21,15 +23,16 @@ class QSignalMapper;
|
||||
class QPrinter;
|
||||
class FileBrowser;
|
||||
class GraphTab;
|
||||
class PathView;
|
||||
class MapView;
|
||||
class Map;
|
||||
class MapList;
|
||||
|
||||
class GUI : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GUI(QWidget *parent = 0);
|
||||
GUI();
|
||||
~GUI();
|
||||
|
||||
bool openFile(const QString &fileName);
|
||||
@ -45,16 +48,17 @@ private slots:
|
||||
void reloadFile();
|
||||
void openPOIFile();
|
||||
void closePOIFiles();
|
||||
void showMap(bool show);
|
||||
void showGraphs(bool show);
|
||||
void showGraphGrids(bool show);
|
||||
void showGraphSliderInfo(bool show);
|
||||
void showToolbars(bool show);
|
||||
void showFullscreen(bool show);
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show);
|
||||
void clearMapCache();
|
||||
void loadMap();
|
||||
void nextMap();
|
||||
void prevMap();
|
||||
void openOptions();
|
||||
|
||||
void mapChanged(int);
|
||||
void graphChanged(int);
|
||||
@ -65,6 +69,8 @@ private slots:
|
||||
void last();
|
||||
void first();
|
||||
|
||||
void setTotalTime() {setTimeType(Total);}
|
||||
void setMovingTime() {setTimeType(Moving);}
|
||||
void setMetricUnits() {setUnits(Metric);}
|
||||
void setImperialUnits() {setUnits(Imperial);}
|
||||
void setDistanceGraph() {setGraphType(Distance);}
|
||||
@ -87,7 +93,7 @@ private:
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void createStatusBar();
|
||||
void createPathView();
|
||||
void createMapView();
|
||||
void createGraphTabs();
|
||||
void createBrowser();
|
||||
|
||||
@ -98,19 +104,21 @@ private:
|
||||
void updateWindowTitle();
|
||||
void updateNavigationActions();
|
||||
void updateGraphTabs();
|
||||
void updatePathView();
|
||||
void updateMapView();
|
||||
|
||||
TimeType timeType() const;
|
||||
Units units() const;
|
||||
void setTimeType(TimeType type);
|
||||
void setUnits(Units units);
|
||||
void setGraphType(GraphType type);
|
||||
|
||||
qreal distance() const;
|
||||
qreal time() const;
|
||||
qreal movingTime() const;
|
||||
int mapIndex(const QString &name);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
const QString fileFormats() const;
|
||||
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
@ -120,9 +128,11 @@ private:
|
||||
QToolBar *_showToolBar;
|
||||
QToolBar *_navigationToolBar;
|
||||
QMenu *_poiFilesMenu;
|
||||
QMenu *_mapMenu;
|
||||
|
||||
QActionGroup *_fileActionGroup;
|
||||
QActionGroup *_navigationActionGroup;
|
||||
QActionGroup *_mapsActionGroup;
|
||||
QAction *_exitAction;
|
||||
QAction *_keysAction;
|
||||
QAction *_dataSourcesAction;
|
||||
@ -140,9 +150,11 @@ private:
|
||||
QAction *_showPOILabelsAction;
|
||||
QAction *_showMapAction;
|
||||
QAction *_fullscreenAction;
|
||||
QAction *_loadMapAction;
|
||||
QAction *_clearMapCacheAction;
|
||||
QAction *_showGraphsAction;
|
||||
QAction *_showGraphGridAction;
|
||||
QAction *_showGraphSliderInfoAction;
|
||||
QAction *_distanceGraphAction;
|
||||
QAction *_timeGraphAction;
|
||||
QAction *_showToolbarsAction;
|
||||
@ -152,6 +164,8 @@ private:
|
||||
QAction *_firstAction;
|
||||
QAction *_metricUnitsAction;
|
||||
QAction *_imperialUnitsAction;
|
||||
QAction *_totalTimeAction;
|
||||
QAction *_movingTimeAction;
|
||||
QAction *_nextMapAction;
|
||||
QAction *_prevMapAction;
|
||||
QAction *_showTracksAction;
|
||||
@ -159,25 +173,28 @@ private:
|
||||
QAction *_showWaypointsAction;
|
||||
QAction *_showWaypointLabelsAction;
|
||||
QAction *_showRouteWaypointsAction;
|
||||
QAction *_openOptionsAction;
|
||||
QAction *_mapsEnd;
|
||||
QList<QAction*> _mapActions;
|
||||
QList<QAction*> _poiFilesActions;
|
||||
|
||||
QSignalMapper *_poiFilesSM;
|
||||
QSignalMapper *_poiFilesSignalMapper;
|
||||
QSignalMapper *_mapsSignalMapper;
|
||||
|
||||
QLabel *_fileNameLabel;
|
||||
QLabel *_distanceLabel;
|
||||
QLabel *_timeLabel;
|
||||
|
||||
PathView *_pathView;
|
||||
MapView *_mapView;
|
||||
QTabWidget *_graphTabWidget;
|
||||
QList<GraphTab*> _tabs;
|
||||
|
||||
POI *_poi;
|
||||
QList<Map*> _maps;
|
||||
MapList *_ml;
|
||||
Map *_map;
|
||||
|
||||
FileBrowser *_browser;
|
||||
QList<QString> _files;
|
||||
Map *_currentMap;
|
||||
|
||||
int _trackCount;
|
||||
int _routeCount;
|
||||
@ -185,17 +202,17 @@ private:
|
||||
qreal _trackDistance;
|
||||
qreal _routeDistance;
|
||||
qreal _time;
|
||||
qreal _movingTime;
|
||||
DateRange _dateRange;
|
||||
QString _pathName;
|
||||
|
||||
qreal _sliderPos;
|
||||
|
||||
int _frameStyle;
|
||||
bool _showGraphs;
|
||||
|
||||
QString _exportFileName;
|
||||
QPrinter::PaperSize _exportPaperSize;
|
||||
QPrinter::Orientation _exportOrientation;
|
||||
MarginsF _exportMargins;
|
||||
Export _export;
|
||||
Options _options;
|
||||
};
|
||||
|
||||
#endif // GUI_H
|
@ -1,10 +1,10 @@
|
||||
#include "data.h"
|
||||
#include "data/data.h"
|
||||
#include "heartrategraphitem.h"
|
||||
#include "heartrategraph.h"
|
||||
|
||||
|
||||
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
|
||||
{
|
||||
_units = Metric;
|
||||
_showTracks = true;
|
||||
|
||||
GraphView::setYUnits(tr("1/min"));
|
||||
@ -28,21 +28,16 @@ void HeartRateGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||
{
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
const Graph &graph = data.tracks().at(i)->heartRate();
|
||||
qreal sum = 0, w = 0;
|
||||
|
||||
if (graph.size() < 2) {
|
||||
skipColor();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 1; j < graph.size(); j++) {
|
||||
qreal ds = graph.at(j).s() - graph.at(j-1).s();
|
||||
sum += graph.at(j).y() * ds;
|
||||
w += ds;
|
||||
}
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||
HeartRateGraphItem *gi = new HeartRateGraphItem(graph, _graphType);
|
||||
GraphView::addGraph(gi, paths.at(i));
|
||||
|
||||
GraphView::loadGraph(graph, paths.at(i));
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.routes().count(); i++)
|
@ -13,9 +13,7 @@ public:
|
||||
QString label() const {return tr("Heart rate");}
|
||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||
void clear();
|
||||
void setUnits(enum Units) {}
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
private:
|
||||
qreal avg() const;
|
||||
@ -24,7 +22,6 @@ private:
|
||||
|
||||
QList<QPointF> _avg;
|
||||
|
||||
enum Units _units;
|
||||
bool _showTracks;
|
||||
};
|
||||
|
26
src/GUI/heartrategraphitem.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "tooltip.h"
|
||||
#include "heartrategraphitem.h"
|
||||
|
||||
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||
{
|
||||
qreal sum = 0;
|
||||
|
||||
for (int j = 1; j < graph.size(); j++)
|
||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
||||
_avg = sum/graph.last().s();
|
||||
|
||||
setToolTip(toolTip());
|
||||
}
|
||||
|
||||
QString HeartRateGraphItem::toolTip() const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 0)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 0)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
|
||||
return tt.toString();
|
||||
}
|
23
src/GUI/heartrategraphitem.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef HEARTRATEGRAPHITEM_H
|
||||
#define HEARTRATEGRAPHITEM_H
|
||||
|
||||
#include "graphitem.h"
|
||||
|
||||
class HeartRateGraphItem : public GraphItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HeartRateGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
qreal max() const {return -bounds().top();}
|
||||
qreal avg() const {return _avg;}
|
||||
|
||||
private:
|
||||
QString toolTip() const;
|
||||
|
||||
qreal _avg;
|
||||
};
|
||||
|
||||
#endif // HEARTRATEGRAPHITEM_H
|
29
src/GUI/icons.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
|
||||
#define APP_ICON ":/icons/gpxsee.png"
|
||||
|
||||
// Toolbar/menu icons
|
||||
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
||||
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
||||
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
||||
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
||||
#define SHOW_POI_ICON ":/icons/flag.png"
|
||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line.png"
|
||||
#define QUIT_ICON ":/icons/application-exit.png"
|
||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
||||
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
||||
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
||||
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
||||
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
||||
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
|
||||
|
||||
// Options dialog icons
|
||||
#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png"
|
||||
#define POI_ICON ":/icons/flag_48.png"
|
||||
#define SYSTEM_ICON ":/icons/system-run.png"
|
||||
#define PRINT_EXPORT_ICON ":/icons/document-print-preview.png"
|
||||
#define DATA_ICON ":/icons/view-filter.png"
|
||||
|
||||
#endif /* ICONS_H */
|
@ -7,7 +7,9 @@
|
||||
|
||||
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void InfoItem::updateBoundingRect()
|
||||
@ -76,6 +78,7 @@ void InfoItem::insert(const QString &key, const QString &value)
|
||||
_list[i] = kv;
|
||||
|
||||
updateBoundingRect();
|
||||
update();
|
||||
}
|
||||
|
||||
void InfoItem::clear()
|
@ -10,18 +10,23 @@
|
||||
#define LAST_KEY Qt::Key_End
|
||||
#define MODIFIER Qt::ShiftModifier
|
||||
|
||||
#define QUIT_SHORTCUT QKeySequence::Quit
|
||||
#define OPEN_SHORTCUT QKeySequence::Open
|
||||
#define CLOSE_SHORTCUT QKeySequence::Close
|
||||
#define RELOAD_SHORTCUT QKeySequence::Refresh
|
||||
#define ZOOM_IN QKeySequence::ZoomIn
|
||||
#define ZOOM_OUT QKeySequence::ZoomOut
|
||||
|
||||
#define TOGGLE_GRAPH_TYPE_KEY Qt::Key_X
|
||||
#define TOGGLE_TIME_TYPE_KEY Qt::Key_T
|
||||
|
||||
#define QUIT_SHORTCUT QKeySequence(QKeySequence::Quit)
|
||||
#define OPEN_SHORTCUT QKeySequence(QKeySequence::Open)
|
||||
#define CLOSE_SHORTCUT QKeySequence(QKeySequence::Close)
|
||||
#define RELOAD_SHORTCUT QKeySequence(QKeySequence::Refresh)
|
||||
#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
|
||||
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
|
||||
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
|
||||
#define NEXT_MAP_SHORTCUT QKeySequence::Forward
|
||||
#define PREV_MAP_SHORTCUT QKeySequence::Back
|
||||
#define NEXT_MAP_SHORTCUT QKeySequence(QKeySequence::Forward)
|
||||
#define PREV_MAP_SHORTCUT QKeySequence(QKeySequence::Back)
|
||||
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
|
||||
#define DISTANCE_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_D)
|
||||
#define TIME_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_T)
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::META + Qt::CTRL + Qt::Key_F)
|
||||
#else // Q_OS_MAC
|
812
src/GUI/mapview.cpp
Normal file
@ -0,0 +1,812 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QWheelEvent>
|
||||
#include <QApplication>
|
||||
#include <QPixmapCache>
|
||||
#include <QScrollBar>
|
||||
#include "data/poi.h"
|
||||
#include "data/data.h"
|
||||
#include "map/map.h"
|
||||
#include "opengl.h"
|
||||
#include "trackitem.h"
|
||||
#include "routeitem.h"
|
||||
#include "waypointitem.h"
|
||||
#include "scaleitem.h"
|
||||
#include "keys.h"
|
||||
#include "mapview.h"
|
||||
|
||||
|
||||
#define MAX_DIGITAL_ZOOM 2
|
||||
#define MIN_DIGITAL_ZOOM -3
|
||||
#define MARGIN 10.0
|
||||
#define SCALE_OFFSET 7
|
||||
|
||||
MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
Q_ASSERT(map != 0);
|
||||
Q_ASSERT(poi != 0);
|
||||
|
||||
_scene = new QGraphicsScene(this);
|
||||
setScene(_scene);
|
||||
setCacheMode(QGraphicsView::CacheBackground);
|
||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setAcceptDrops(false);
|
||||
|
||||
_mapScale = new ScaleItem();
|
||||
_mapScale->setZValue(2.0);
|
||||
_scene->addItem(_mapScale);
|
||||
|
||||
_map = map;
|
||||
_map->load();
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
_poi = poi;
|
||||
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||
|
||||
_units = Metric;
|
||||
_opacity = 1.0;
|
||||
_backgroundColor = Qt::white;
|
||||
_markerColor = Qt::red;
|
||||
|
||||
_showMap = true;
|
||||
_showTracks = true;
|
||||
_showRoutes = true;
|
||||
_showWaypoints = true;
|
||||
_showWaypointLabels = true;
|
||||
_showPOI = true;
|
||||
_showPOILabels = true;
|
||||
_overlapPOIs = true;
|
||||
_showRouteWaypoints = true;
|
||||
_trackWidth = 3;
|
||||
_routeWidth = 3;
|
||||
_trackStyle = Qt::SolidLine;
|
||||
_routeStyle = Qt::DashLine;
|
||||
_waypointSize = 8;
|
||||
_waypointColor = Qt::black;
|
||||
_poiSize = 8;
|
||||
_poiColor = Qt::black;
|
||||
|
||||
_plot = false;
|
||||
_digitalZoom = 0;
|
||||
|
||||
_map->setBackgroundColor(_backgroundColor);
|
||||
_scene->setSceneRect(_map->bounds());
|
||||
|
||||
centerOn(_scene->sceneRect().center());
|
||||
}
|
||||
|
||||
void MapView::centerOn(const QPointF &pos)
|
||||
{
|
||||
QGraphicsView::centerOn(pos);
|
||||
|
||||
/* Fix the offset caused by QGraphicsView::centerOn() approximation */
|
||||
QPointF center = mapToScene(viewport()->rect().center());
|
||||
QPoint offset((int)(pos.x() - center.x()), (int)(pos.y() - center.y()));
|
||||
if (qAbs(offset.x()) == 1)
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value()
|
||||
+ offset.x());
|
||||
if (qAbs(offset.y()) == 1)
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value()
|
||||
+ offset.y());
|
||||
|
||||
_res = _map->resolution(pos);
|
||||
_mapScale->setResolution(_res);
|
||||
}
|
||||
|
||||
PathItem *MapView::addTrack(const Track &track)
|
||||
{
|
||||
if (track.isNull()) {
|
||||
_palette.nextColor();
|
||||
return 0;
|
||||
}
|
||||
|
||||
TrackItem *ti = new TrackItem(track, _map);
|
||||
_tracks.append(ti);
|
||||
_tr |= ti->path().boundingRect();
|
||||
ti->setColor(_palette.nextColor());
|
||||
ti->setWidth(_trackWidth);
|
||||
ti->setStyle(_trackStyle);
|
||||
ti->setUnits(_units);
|
||||
ti->setVisible(_showTracks);
|
||||
ti->setDigitalZoom(_digitalZoom);
|
||||
ti->setMarkerColor(_markerColor);
|
||||
_scene->addItem(ti);
|
||||
|
||||
if (_showTracks)
|
||||
addPOI(_poi->points(ti->path()));
|
||||
|
||||
return ti;
|
||||
}
|
||||
|
||||
PathItem *MapView::addRoute(const Route &route)
|
||||
{
|
||||
if (route.isNull()) {
|
||||
_palette.nextColor();
|
||||
return 0;
|
||||
}
|
||||
|
||||
RouteItem *ri = new RouteItem(route, _map);
|
||||
_routes.append(ri);
|
||||
_rr |= ri->path().boundingRect();
|
||||
ri->setColor(_palette.nextColor());
|
||||
ri->setWidth(_routeWidth);
|
||||
ri->setStyle(_routeStyle);
|
||||
ri->setUnits(_units);
|
||||
ri->setVisible(_showRoutes);
|
||||
ri->showWaypoints(_showRouteWaypoints);
|
||||
ri->showWaypointLabels(_showWaypointLabels);
|
||||
ri->setDigitalZoom(_digitalZoom);
|
||||
ri->setMarkerColor(_markerColor);
|
||||
_scene->addItem(ri);
|
||||
|
||||
if (_showRoutes)
|
||||
addPOI(_poi->points(ri->path()));
|
||||
|
||||
return ri;
|
||||
}
|
||||
|
||||
void MapView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||
{
|
||||
for (int i = 0; i < waypoints.count(); i++) {
|
||||
const Waypoint &w = waypoints.at(i);
|
||||
|
||||
WaypointItem *wi = new WaypointItem(w, _map);
|
||||
_waypoints.append(wi);
|
||||
_wr.unite(wi->waypoint().coordinates());
|
||||
wi->setZValue(1);
|
||||
wi->setSize(_waypointSize);
|
||||
wi->setColor(_waypointColor);
|
||||
wi->showLabel(_showWaypointLabels);
|
||||
wi->setUnits(_units);
|
||||
wi->setVisible(_showWaypoints);
|
||||
wi->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(wi);
|
||||
|
||||
if (_showWaypoints)
|
||||
addPOI(_poi->points(w));
|
||||
}
|
||||
}
|
||||
|
||||
QList<PathItem *> MapView::loadData(const Data &data)
|
||||
{
|
||||
QList<PathItem *> paths;
|
||||
qreal zoom = _map->zoom();
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++)
|
||||
paths.append(addTrack(*(data.tracks().at(i))));
|
||||
for (int i = 0; i < data.routes().count(); i++)
|
||||
paths.append(addRoute(*(data.routes().at(i))));
|
||||
addWaypoints(data.waypoints());
|
||||
|
||||
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
||||
return paths;
|
||||
|
||||
if (mapZoom() != zoom)
|
||||
rescale();
|
||||
else
|
||||
updatePOIVisibility();
|
||||
|
||||
centerOn(contentCenter());
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
qreal MapView::mapZoom() const
|
||||
{
|
||||
RectC br = _tr | _rr | _wr;
|
||||
|
||||
return _map->zoomFit(viewport()->size() - QSize(2*MARGIN, 2*MARGIN),
|
||||
br.isNull() ? RectC(_map->xy2ll(sceneRect().topLeft()),
|
||||
_map->xy2ll(sceneRect().bottomRight())) : br);
|
||||
}
|
||||
|
||||
QPointF MapView::contentCenter() const
|
||||
{
|
||||
RectC br = _tr | _rr | _wr;
|
||||
|
||||
return br.isNull() ? sceneRect().center() : _map->ll2xy(br.center());
|
||||
}
|
||||
|
||||
void MapView::updatePOIVisibility()
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it, jt;
|
||||
|
||||
if (!_showPOI)
|
||||
return;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->show();
|
||||
|
||||
if (!_overlapPOIs) {
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
|
||||
for (jt = _pois.constBegin(); jt != _pois.constEnd(); jt++) {
|
||||
if (it.value()->isVisible() && jt.value()->isVisible()
|
||||
&& it != jt && it.value()->collidesWithItem(jt.value()))
|
||||
jt.value()->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::rescale()
|
||||
{
|
||||
_scene->setSceneRect(_map->bounds());
|
||||
resetCachedContent();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void MapView::setPalette(const Palette &palette)
|
||||
{
|
||||
_palette = palette;
|
||||
_palette.reset();
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setColor(_palette.nextColor());
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setColor(_palette.nextColor());
|
||||
}
|
||||
|
||||
void MapView::setMap(Map *map)
|
||||
{
|
||||
QPointF pos = mapToScene(viewport()->rect().center());
|
||||
Coordinates center = _map->xy2ll(pos);
|
||||
qreal resolution = _map->resolution(pos);
|
||||
|
||||
_map->unload();
|
||||
disconnect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
_map = map;
|
||||
_map->load();
|
||||
_map->setBackgroundColor(_backgroundColor);
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||
|
||||
digitalZoom(0);
|
||||
|
||||
_map->zoomFit(resolution, center);
|
||||
_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();
|
||||
|
||||
centerOn(_map->ll2xy(center));
|
||||
|
||||
resetCachedContent();
|
||||
QPixmapCache::clear();
|
||||
}
|
||||
|
||||
void MapView::setPOI(POI *poi)
|
||||
{
|
||||
disconnect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||
connect(poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||
|
||||
_poi = poi;
|
||||
|
||||
updatePOI();
|
||||
}
|
||||
|
||||
void MapView::updatePOI()
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
|
||||
_scene->removeItem(it.value());
|
||||
delete it.value();
|
||||
}
|
||||
_pois.clear();
|
||||
|
||||
if (_showTracks)
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
addPOI(_poi->points(_tracks.at(i)->path()));
|
||||
if (_showRoutes)
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
addPOI(_poi->points(_routes.at(i)->path()));
|
||||
if (_showWaypoints)
|
||||
for (int i = 0; i< _waypoints.size(); i++)
|
||||
addPOI(_poi->points(_waypoints.at(i)->waypoint()));
|
||||
|
||||
updatePOIVisibility();
|
||||
}
|
||||
|
||||
void MapView::addPOI(const QList<Waypoint> &waypoints)
|
||||
{
|
||||
for (int i = 0; i < waypoints.size(); i++) {
|
||||
const Waypoint &w = waypoints.at(i);
|
||||
|
||||
if (_pois.contains(SearchPointer<Waypoint>(&w)))
|
||||
continue;
|
||||
|
||||
WaypointItem *pi = new WaypointItem(w, _map);
|
||||
pi->setZValue(1);
|
||||
pi->setSize(_poiSize);
|
||||
pi->setColor(_poiColor);
|
||||
pi->showLabel(_showPOILabels);
|
||||
pi->setVisible(_showPOI);
|
||||
pi->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(pi);
|
||||
|
||||
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::setUnits(enum Units units)
|
||||
{
|
||||
_units = units;
|
||||
|
||||
_mapScale->setUnits(units);
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks[i]->setUnits(units);
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes[i]->setUnits(units);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setUnits(units);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setUnits(units);
|
||||
}
|
||||
|
||||
void MapView::clearMapCache()
|
||||
{
|
||||
_map->clearCache();
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void MapView::digitalZoom(int zoom)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
if (zoom) {
|
||||
_digitalZoom += zoom;
|
||||
scale(pow(2, zoom), pow(2, zoom));
|
||||
} else {
|
||||
_digitalZoom = 0;
|
||||
resetTransform();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setDigitalZoom(_digitalZoom);
|
||||
|
||||
_mapScale->setDigitalZoom(_digitalZoom);
|
||||
}
|
||||
|
||||
void MapView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
|
||||
{
|
||||
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
|
||||
|
||||
if (_digitalZoom) {
|
||||
if (((_digitalZoom > 0 && zoom > 0) && (!shift || _digitalZoom
|
||||
>= MAX_DIGITAL_ZOOM)) || ((_digitalZoom < 0 && zoom < 0) && (!shift
|
||||
|| _digitalZoom <= MIN_DIGITAL_ZOOM)))
|
||||
return;
|
||||
|
||||
digitalZoom(zoom);
|
||||
} else {
|
||||
qreal os, ns;
|
||||
os = _map->zoom();
|
||||
ns = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
|
||||
|
||||
if (ns != os) {
|
||||
rescale();
|
||||
centerOn(_map->ll2xy(c) - (pos - viewport()->rect().center()));
|
||||
} else {
|
||||
if (shift)
|
||||
digitalZoom(zoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
static int deg = 0;
|
||||
|
||||
deg += event->delta() / 8;
|
||||
if (qAbs(deg) < 15)
|
||||
return;
|
||||
deg = 0;
|
||||
|
||||
Coordinates c = _map->xy2ll(mapToScene(event->pos()));
|
||||
zoom((event->delta() > 0) ? 1 : -1, event->pos(), c);
|
||||
}
|
||||
|
||||
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
|
||||
return;
|
||||
|
||||
Coordinates c = _map->xy2ll(mapToScene(event->pos()));
|
||||
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos(), c);
|
||||
}
|
||||
|
||||
void MapView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
int z;
|
||||
|
||||
QPoint pos = viewport()->rect().center();
|
||||
Coordinates c = _map->xy2ll(mapToScene(pos));
|
||||
|
||||
if (event->matches(ZOOM_IN))
|
||||
z = 1;
|
||||
else if (event->matches(ZOOM_OUT))
|
||||
z = -1;
|
||||
else if (_digitalZoom && event->key() == Qt::Key_Escape) {
|
||||
digitalZoom(0);
|
||||
return;
|
||||
} else {
|
||||
QGraphicsView::keyPressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
zoom(z, pos, c);
|
||||
}
|
||||
|
||||
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
bool hires)
|
||||
{
|
||||
QRect orig, adj;
|
||||
qreal ratio, diff, origRes, q;
|
||||
QPointF origScene, origPos;
|
||||
Coordinates origLL;
|
||||
|
||||
|
||||
// Enter plot mode
|
||||
setUpdatesEnabled(false);
|
||||
_plot = true;
|
||||
_map->setBlockingMode(true);
|
||||
|
||||
// Compute sizes & ratios
|
||||
orig = viewport()->rect();
|
||||
origPos = _mapScale->pos();
|
||||
|
||||
if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
|
||||
ratio = target.height() / target.width();
|
||||
diff = (orig.width() * ratio) - orig.height();
|
||||
adj = orig.adjusted(0, -diff/2, 0, diff/2);
|
||||
} else {
|
||||
ratio = target.width() / target.height();
|
||||
diff = (orig.height() * ratio) - orig.width();
|
||||
adj = orig.adjusted(-diff/2, 0, diff/2, 0);
|
||||
}
|
||||
q = (target.width() / scale) / adj.width();
|
||||
|
||||
// Adjust the view for printing
|
||||
if (hires) {
|
||||
origScene = mapToScene(orig.center());
|
||||
origLL = _map->xy2ll(origScene);
|
||||
origRes = _map->resolution(origScene);
|
||||
|
||||
QPointF s(painter->device()->logicalDpiX()
|
||||
/ (qreal)metric(QPaintDevice::PdmDpiX),
|
||||
painter->device()->logicalDpiY()
|
||||
/ (qreal)metric(QPaintDevice::PdmDpiY));
|
||||
adj = QRect(0, 0, adj.width() * s.x(), adj.height() * s.y());
|
||||
_map->zoomFit(adj.size(), _tr | _rr | _wr);
|
||||
rescale();
|
||||
|
||||
QPointF center = contentCenter();
|
||||
centerOn(center);
|
||||
adj.moveCenter(mapFromScene(center));
|
||||
|
||||
_mapScale->setDigitalZoom(-log2(s.x() / q));
|
||||
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()) * (s.x() / q),
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height()) * (s.x() / q)))));
|
||||
} else {
|
||||
_mapScale->setDigitalZoom(-log2(1.0 / q));
|
||||
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()) / q ,
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height()) / q))));
|
||||
}
|
||||
|
||||
// Print the view
|
||||
render(painter, target, adj);
|
||||
|
||||
// Revert view changes to display mode
|
||||
if (hires) {
|
||||
_map->zoomFit(origRes, origLL);
|
||||
rescale();
|
||||
centerOn(origScene);
|
||||
}
|
||||
_mapScale->setDigitalZoom(0);
|
||||
_mapScale->setPos(origPos);
|
||||
|
||||
// Exit plot mode
|
||||
_map->setBlockingMode(false);
|
||||
_plot = false;
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
void MapView::clear()
|
||||
{
|
||||
_pois.clear();
|
||||
_tracks.clear();
|
||||
_routes.clear();
|
||||
_waypoints.clear();
|
||||
|
||||
_scene->removeItem(_mapScale);
|
||||
_scene->clear();
|
||||
_scene->addItem(_mapScale);
|
||||
|
||||
_palette.reset();
|
||||
|
||||
_tr = RectC();
|
||||
_rr = RectC();
|
||||
_wr = RectC();
|
||||
|
||||
digitalZoom(0);
|
||||
}
|
||||
|
||||
void MapView::showTracks(bool show)
|
||||
{
|
||||
_showTracks = show;
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setVisible(show);
|
||||
|
||||
updatePOI();
|
||||
}
|
||||
|
||||
void MapView::showRoutes(bool show)
|
||||
{
|
||||
_showRoutes = show;
|
||||
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setVisible(show);
|
||||
|
||||
updatePOI();
|
||||
}
|
||||
|
||||
void MapView::showWaypoints(bool show)
|
||||
{
|
||||
_showWaypoints = show;
|
||||
|
||||
for (int i = 0; i < _waypoints.count(); i++)
|
||||
_waypoints.at(i)->setVisible(show);
|
||||
|
||||
updatePOI();
|
||||
}
|
||||
|
||||
void MapView::showWaypointLabels(bool show)
|
||||
{
|
||||
_showWaypointLabels = show;
|
||||
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->showLabel(show);
|
||||
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->showWaypointLabels(show);
|
||||
}
|
||||
|
||||
void MapView::showRouteWaypoints(bool show)
|
||||
{
|
||||
_showRouteWaypoints = show;
|
||||
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->showWaypoints(show);
|
||||
}
|
||||
|
||||
void MapView::showMap(bool show)
|
||||
{
|
||||
_showMap = show;
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void MapView::showPOI(bool show)
|
||||
{
|
||||
_showPOI = show;
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setVisible(show);
|
||||
|
||||
updatePOIVisibility();
|
||||
}
|
||||
|
||||
void MapView::showPOILabels(bool show)
|
||||
{
|
||||
_showPOILabels = show;
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->showLabel(show);
|
||||
|
||||
updatePOIVisibility();
|
||||
}
|
||||
|
||||
void MapView::setPOIOverlap(bool overlap)
|
||||
{
|
||||
_overlapPOIs = overlap;
|
||||
|
||||
updatePOIVisibility();
|
||||
}
|
||||
|
||||
void MapView::setTrackWidth(int width)
|
||||
{
|
||||
_trackWidth = width;
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setWidth(width);
|
||||
}
|
||||
|
||||
void MapView::setRouteWidth(int width)
|
||||
{
|
||||
_routeWidth = width;
|
||||
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setWidth(width);
|
||||
}
|
||||
|
||||
void MapView::setTrackStyle(Qt::PenStyle style)
|
||||
{
|
||||
_trackStyle = style;
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setStyle(style);
|
||||
}
|
||||
|
||||
void MapView::setRouteStyle(Qt::PenStyle style)
|
||||
{
|
||||
_routeStyle = style;
|
||||
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setStyle(style);
|
||||
}
|
||||
|
||||
void MapView::setWaypointSize(int size)
|
||||
{
|
||||
_waypointSize = size;
|
||||
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setSize(size);
|
||||
}
|
||||
|
||||
void MapView::setWaypointColor(const QColor &color)
|
||||
{
|
||||
_waypointColor = color;
|
||||
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setColor(color);
|
||||
}
|
||||
|
||||
void MapView::setPOISize(int size)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
_poiSize = size;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setSize(size);
|
||||
}
|
||||
|
||||
void MapView::setPOIColor(const QColor &color)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
_poiColor = color;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setColor(color);
|
||||
}
|
||||
|
||||
void MapView::setMapOpacity(int opacity)
|
||||
{
|
||||
_opacity = opacity / 100.0;
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void MapView::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
_backgroundColor = color;
|
||||
_map->setBackgroundColor(color);
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void MapView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
if (_showMap) {
|
||||
QRectF ir = rect.intersected(_map->bounds());
|
||||
|
||||
if (_opacity < 1.0 || ir != rect)
|
||||
painter->fillRect(rect, _backgroundColor);
|
||||
if (_opacity < 1.0)
|
||||
painter->setOpacity(_opacity);
|
||||
|
||||
_map->draw(painter, ir);
|
||||
} else
|
||||
painter->fillRect(rect, _backgroundColor);
|
||||
}
|
||||
|
||||
void MapView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
||||
qreal zoom = _map->zoom();
|
||||
if (mapZoom() != zoom)
|
||||
rescale();
|
||||
|
||||
centerOn(contentCenter());
|
||||
}
|
||||
|
||||
void MapView::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPointF scenePos = mapToScene(rect().bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height())));
|
||||
if (_mapScale->pos() != scenePos && !_plot)
|
||||
_mapScale->setPos(scenePos);
|
||||
|
||||
QGraphicsView::paintEvent(event);
|
||||
}
|
||||
|
||||
void MapView::scrollContentsBy(int dx, int dy)
|
||||
{
|
||||
QGraphicsView::scrollContentsBy(dx, dy);
|
||||
|
||||
QPointF center = mapToScene(viewport()->rect().center());
|
||||
qreal res = _map->resolution(center);
|
||||
|
||||
if (qMax(res, _res) / qMin(res, _res) > 1.1) {
|
||||
_mapScale->setResolution(res);
|
||||
_res = res;
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::useOpenGL(bool use)
|
||||
{
|
||||
if (use)
|
||||
setViewport(new OPENGL_WIDGET);
|
||||
else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
||||
void MapView::useAntiAliasing(bool use)
|
||||
{
|
||||
setRenderHint(QPainter::Antialiasing, use);
|
||||
}
|
||||
|
||||
void MapView::setMarkerColor(const QColor &color)
|
||||
{
|
||||
_markerColor = color;
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setMarkerColor(color);
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->setMarkerColor(color);
|
||||
}
|
||||
|
||||
void MapView::reloadMap()
|
||||
{
|
||||
resetCachedContent();
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
#ifndef TRACKVIEW_H
|
||||
#define TRACKVIEW_H
|
||||
#ifndef MAPVIEW_H
|
||||
#define MAPVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QVector>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include "common/rectc.h"
|
||||
#include "data/waypoint.h"
|
||||
#include "searchpointer.h"
|
||||
#include "units.h"
|
||||
#include "palette.h"
|
||||
#include "waypoint.h"
|
||||
|
||||
class Data;
|
||||
class POI;
|
||||
@ -20,31 +22,40 @@ class WaypointItem;
|
||||
class ScaleItem;
|
||||
class PathItem;
|
||||
|
||||
class PathView : public QGraphicsView
|
||||
class MapView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PathView(QWidget *parent = 0);
|
||||
~PathView();
|
||||
MapView(Map *map, POI *poi, QWidget *parent = 0);
|
||||
|
||||
QList<PathItem*> loadData(const Data &data);
|
||||
|
||||
void setPalette(const Palette &palette);
|
||||
void setPOI(POI *poi);
|
||||
void setMap(Map *map);
|
||||
void setUnits(enum Units units);
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target);
|
||||
|
||||
int trackCount() const {return _tracks.count();}
|
||||
int routeCount() const {return _routes.count();}
|
||||
int waypointCount() const {return _waypoints.count();}
|
||||
void plot(QPainter *painter, const QRectF &target, qreal scale, bool hires);
|
||||
|
||||
void clear();
|
||||
|
||||
public slots:
|
||||
void redraw();
|
||||
void setTrackWidth(int width);
|
||||
void setRouteWidth(int width);
|
||||
void setTrackStyle(Qt::PenStyle style);
|
||||
void setRouteStyle(Qt::PenStyle style);
|
||||
void setWaypointSize(int size);
|
||||
void setWaypointColor(const QColor &color);
|
||||
void setPOISize(int size);
|
||||
void setPOIColor(const QColor &color);
|
||||
void setMapOpacity(int opacity);
|
||||
void setBackgroundColor(const QColor &color);
|
||||
void useOpenGL(bool use);
|
||||
void useAntiAliasing(bool use);
|
||||
void setMarkerColor(const QColor &color);
|
||||
|
||||
public slots:
|
||||
void showMap(bool show);
|
||||
void showPOI(bool show);
|
||||
void setPOIOverlap(bool overlap);
|
||||
void showWaypointLabels(bool show);
|
||||
@ -53,28 +64,26 @@ public slots:
|
||||
void showRoutes(bool show);
|
||||
void showWaypoints(bool show);
|
||||
void showRouteWaypoints(bool show);
|
||||
void clearMapCache();
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
void reloadMap();
|
||||
|
||||
private:
|
||||
PathItem *addTrack(const Track &track);
|
||||
PathItem *addRoute(const Route &route);
|
||||
void addWaypoints(const QList<Waypoint> &waypoints);
|
||||
void addPOI(const QVector<Waypoint> &waypoints);
|
||||
void addPOI(const QList<Waypoint> &waypoints);
|
||||
void loadPOI();
|
||||
void clearPOI();
|
||||
|
||||
QRectF trackBoundingRect() const;
|
||||
QRectF routeBoundingRect() const;
|
||||
QRectF waypointBoundingRect() const;
|
||||
qreal trackScale() const;
|
||||
qreal routeScale() const;
|
||||
qreal waypointScale() const;
|
||||
qreal mapScale(int zoom) const;
|
||||
void rescale(qreal scale);
|
||||
qreal mapZoom() const;
|
||||
QPointF contentCenter() const;
|
||||
void rescale();
|
||||
void zoom(int z, const QPoint &pos);
|
||||
void centerOn(const QPointF &pos);
|
||||
void zoom(int zoom, const QPoint &pos, const Coordinates &c);
|
||||
void digitalZoom(int zoom);
|
||||
void updatePOIVisibility();
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
@ -83,24 +92,26 @@ private:
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
|
||||
QGraphicsScene *_scene;
|
||||
ScaleItem *_mapScale;
|
||||
QList<TrackItem*> _tracks;
|
||||
QList<RouteItem*> _routes;
|
||||
QList<WaypointItem*> _waypoints;
|
||||
QHash<Waypoint, WaypointItem*> _pois;
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*> _pois;
|
||||
|
||||
RectC _tr, _rr, _wr;
|
||||
qreal _res;
|
||||
|
||||
Map *_map;
|
||||
POI *_poi;
|
||||
|
||||
Palette _palette;
|
||||
|
||||
qreal _scale;
|
||||
int _zoom;
|
||||
|
||||
Units _units;
|
||||
|
||||
qreal _opacity;
|
||||
QColor _backgroundColor;
|
||||
bool _showMap;
|
||||
bool _showTracks;
|
||||
bool _showRoutes;
|
||||
bool _showWaypoints;
|
||||
@ -109,8 +120,18 @@ private:
|
||||
bool _showPOILabels;
|
||||
bool _overlapPOIs;
|
||||
bool _showRouteWaypoints;
|
||||
int _trackWidth;
|
||||
int _routeWidth;
|
||||
Qt::PenStyle _trackStyle;
|
||||
Qt::PenStyle _routeStyle;
|
||||
int _waypointSize;
|
||||
int _poiSize;
|
||||
QColor _waypointColor;
|
||||
QColor _poiColor;
|
||||
QColor _markerColor;
|
||||
|
||||
int _digitalZoom;
|
||||
bool _plot;
|
||||
};
|
||||
|
||||
#endif // TRACKVIEW_H
|
||||
#endif // MAPVIEW_H
|
@ -7,7 +7,7 @@
|
||||
|
||||
MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
|
||||
_color = Qt::red;
|
||||
}
|
||||
|
||||
QRectF MarkerItem::boundingRect() const
|
||||
@ -22,9 +22,15 @@ void MarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
||||
Q_UNUSED(widget);
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||
painter->setPen(QPen(Qt::red, WIDTH));
|
||||
painter->setPen(QPen(_color, WIDTH));
|
||||
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
|
||||
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
|
||||
|
||||
// painter->drawRect(boundingRect());
|
||||
}
|
||||
|
||||
void MarkerItem::setColor(const QColor &color)
|
||||
{
|
||||
_color = color;
|
||||
update();
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
#define MARKERITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QColor>
|
||||
|
||||
class MarkerItem : public QGraphicsItem
|
||||
{
|
||||
@ -11,6 +12,11 @@ public:
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
void setColor(const QColor &color);
|
||||
|
||||
private:
|
||||
QColor _color;
|
||||
};
|
||||
|
||||
#endif // MARKERITEM_H
|
@ -1,6 +1,5 @@
|
||||
#include <cmath>
|
||||
#include "misc.h"
|
||||
|
||||
#include "nicenum.h"
|
||||
|
||||
double niceNum(double x, int round)
|
||||
{
|
20
src/GUI/oddspinbox.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "oddspinbox.h"
|
||||
|
||||
OddSpinBox::OddSpinBox(QWidget *parent) : QSpinBox(parent)
|
||||
{
|
||||
setSingleStep(2);
|
||||
setMinimum(1);
|
||||
}
|
||||
|
||||
QValidator::State OddSpinBox::validate(QString &text, int &pos) const
|
||||
{
|
||||
Q_UNUSED(pos);
|
||||
bool ok;
|
||||
int val;
|
||||
|
||||
val = text.toInt(&ok);
|
||||
if (!ok || val < 0 || val % 2 == 0)
|
||||
return QValidator::Invalid;
|
||||
|
||||
return QValidator::Acceptable;
|
||||
}
|
15
src/GUI/oddspinbox.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef ODDSPINBOX_H
|
||||
#define ODDSPINBOX_H
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
class OddSpinBox : public QSpinBox
|
||||
{
|
||||
public:
|
||||
OddSpinBox(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
QValidator::State validate(QString &text, int &pos) const;
|
||||
};
|
||||
|
||||
#endif // ODDSPINBOX_H
|
26
src/GUI/opengl.h
Normal file
@ -0,0 +1,26 @@
|
||||
#include <QtGlobal>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#include <QGLWidget>
|
||||
#include <QGLFormat>
|
||||
#else
|
||||
#include <QOpenGLWidget>
|
||||
#include <QSurfaceFormat>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#define OPENGL_WIDGET QGLWidget
|
||||
#else
|
||||
#define OPENGL_WIDGET QOpenGLWidget
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#define OPENGL_SET_SAMPLES(samples) \
|
||||
{QGLFormat fmt; \
|
||||
fmt.setSamples(samples); \
|
||||
QGLFormat::setDefaultFormat(fmt);}
|
||||
#else
|
||||
#define OPENGL_SET_SAMPLES(samples) \
|
||||
{QSurfaceFormat fmt; \
|
||||
fmt.setSamples(samples);\
|
||||
QSurfaceFormat::setDefaultFormat(fmt);}
|
||||
#endif
|
551
src/GUI/optionsdialog.cpp
Normal file
@ -0,0 +1,551 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QStackedWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QSpinBox>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QRadioButton>
|
||||
#include <QLabel>
|
||||
#include <QSysInfo>
|
||||
#include "config.h"
|
||||
#include "icons.h"
|
||||
#include "colorbox.h"
|
||||
#include "stylecombobox.h"
|
||||
#include "oddspinbox.h"
|
||||
#include "percentslider.h"
|
||||
#include "optionsdialog.h"
|
||||
|
||||
|
||||
#define MENU_MARGIN 20
|
||||
#define MENU_ICON_SIZE 32
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
static QFrame *line()
|
||||
{
|
||||
QFrame *l = new QFrame();
|
||||
l->setFrameShape(QFrame::HLine);
|
||||
l->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
return l;
|
||||
}
|
||||
#endif
|
||||
|
||||
QWidget *OptionsDialog::createGeneralPage()
|
||||
{
|
||||
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
|
||||
_alwaysShowMap->setChecked(_options->alwaysShowMap);
|
||||
_alwaysShowMap->setToolTip("<p>" +
|
||||
tr("Show the map even when no files are loaded.") + "</p>");
|
||||
|
||||
QFormLayout *showMapLayout = new QFormLayout();
|
||||
showMapLayout->addWidget(_alwaysShowMap);
|
||||
|
||||
QWidget *generalTab = new QWidget();
|
||||
QVBoxLayout *generalTabLayout = new QVBoxLayout();
|
||||
generalTabLayout->addLayout(showMapLayout);
|
||||
generalTabLayout->addStretch();
|
||||
generalTab->setLayout(generalTabLayout);
|
||||
|
||||
QTabWidget *generalPage = new QTabWidget();
|
||||
generalPage->addTab(generalTab, tr("General"));
|
||||
|
||||
return generalPage;
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createAppearancePage()
|
||||
{
|
||||
// Paths
|
||||
_baseColor = new ColorBox();
|
||||
_baseColor->setColor(_options->palette.color());
|
||||
_colorOffset = new QDoubleSpinBox();
|
||||
_colorOffset->setMinimum(0);
|
||||
_colorOffset->setMaximum(1.0);
|
||||
_colorOffset->setSingleStep(0.01);
|
||||
_colorOffset->setValue(_options->palette.shift());
|
||||
QFormLayout *paletteLayout = new QFormLayout();
|
||||
paletteLayout->addRow(tr("Base color:"), _baseColor);
|
||||
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *colorBox = new QGroupBox(tr("Colors"));
|
||||
colorBox->setLayout(paletteLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_trackWidth = new QSpinBox();
|
||||
_trackWidth->setValue(_options->trackWidth);
|
||||
_trackWidth->setMinimum(1);
|
||||
_trackStyle = new StyleComboBox();
|
||||
_trackStyle->setValue(_options->trackStyle);
|
||||
QFormLayout *trackLayout = new QFormLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
trackLayout->addRow(tr("Track width:"), _trackWidth);
|
||||
trackLayout->addRow(tr("Track style:"), _trackStyle);
|
||||
#else // Q_OS_MAC
|
||||
trackLayout->addRow(tr("Width:"), _trackWidth);
|
||||
trackLayout->addRow(tr("Style:"), _trackStyle);
|
||||
QGroupBox *trackBox = new QGroupBox(tr("Tracks"));
|
||||
trackBox->setLayout(trackLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_routeWidth = new QSpinBox();
|
||||
_routeWidth->setValue(_options->routeWidth);
|
||||
_routeWidth->setMinimum(1);
|
||||
_routeStyle = new StyleComboBox();
|
||||
_routeStyle->setValue(_options->routeStyle);
|
||||
QFormLayout *routeLayout = new QFormLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
routeLayout->addRow(tr("Route width:"), _routeWidth);
|
||||
routeLayout->addRow(tr("Route style:"), _routeStyle);
|
||||
#else // Q_OS_MAC
|
||||
routeLayout->addRow(tr("Width:"), _routeWidth);
|
||||
routeLayout->addRow(tr("Style:"), _routeStyle);
|
||||
QGroupBox *routeBox = new QGroupBox(tr("Routes"));
|
||||
routeBox->setLayout(routeLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_pathAA = new QCheckBox(tr("Use anti-aliasing"));
|
||||
_pathAA->setChecked(_options->pathAntiAliasing);
|
||||
QFormLayout *pathAALayout = new QFormLayout();
|
||||
pathAALayout->addWidget(_pathAA);
|
||||
|
||||
QWidget *pathTab = new QWidget();
|
||||
QVBoxLayout *pathTabLayout = new QVBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
pathTabLayout->addLayout(paletteLayout);
|
||||
pathTabLayout->addWidget(line());
|
||||
pathTabLayout->addLayout(trackLayout);
|
||||
pathTabLayout->addWidget(line());
|
||||
pathTabLayout->addLayout(routeLayout);
|
||||
pathTabLayout->addWidget(line());
|
||||
#else // Q_OS_MAC
|
||||
pathTabLayout->addWidget(colorBox);
|
||||
pathTabLayout->addWidget(trackBox);
|
||||
pathTabLayout->addWidget(routeBox);
|
||||
#endif // Q_OS_MAC
|
||||
pathTabLayout->addLayout(pathAALayout);
|
||||
pathTabLayout->addStretch();
|
||||
pathTab->setLayout(pathTabLayout);
|
||||
|
||||
|
||||
// Waypoints
|
||||
_waypointSize = new QSpinBox();
|
||||
_waypointSize->setMinimum(1);
|
||||
_waypointSize->setValue(_options->waypointSize);
|
||||
_waypointColor = new ColorBox();
|
||||
_waypointColor->setColor(_options->waypointColor);
|
||||
QFormLayout *waypointLayout = new QFormLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
waypointLayout->addRow(tr("Waypoint color:"), _waypointColor);
|
||||
waypointLayout->addRow(tr("Waypoint size:"), _waypointSize);
|
||||
#else // Q_OS_MAC
|
||||
waypointLayout->addRow(tr("Color:"), _waypointColor);
|
||||
waypointLayout->addRow(tr("Size:"), _waypointSize);
|
||||
QGroupBox *waypointBox = new QGroupBox(tr("Waypoints"));
|
||||
waypointBox->setLayout(waypointLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_poiSize = new QSpinBox();
|
||||
_poiSize->setMinimum(1);
|
||||
_poiSize->setValue(_options->poiSize);
|
||||
_poiColor = new ColorBox();
|
||||
_poiColor->setColor(_options->poiColor);
|
||||
QFormLayout *poiLayout = new QFormLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
poiLayout->addRow(tr("POI color:"), _poiColor);
|
||||
poiLayout->addRow(tr("POI size:"), _poiSize);
|
||||
#else // Q_OS_MAC
|
||||
poiLayout->addRow(tr("Color:"), _poiColor);
|
||||
poiLayout->addRow(tr("Size:"), _poiSize);
|
||||
QGroupBox *poiBox = new QGroupBox(tr("POIs"));
|
||||
poiBox->setLayout(poiLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QWidget *pointTab = new QWidget();
|
||||
QVBoxLayout *pointTabLayout = new QVBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
pointTabLayout->addLayout(waypointLayout);
|
||||
pointTabLayout->addWidget(line());
|
||||
pointTabLayout->addLayout(poiLayout);
|
||||
#else // Q_OS_MAC
|
||||
pointTabLayout->addWidget(waypointBox);
|
||||
pointTabLayout->addWidget(poiBox);
|
||||
#endif // Q_OS_MAC
|
||||
pointTabLayout->addStretch();
|
||||
pointTab->setLayout(pointTabLayout);
|
||||
|
||||
|
||||
// Graphs
|
||||
_sliderColor = new ColorBox();
|
||||
_sliderColor->setColor(_options->sliderColor);
|
||||
_graphWidth = new QSpinBox();
|
||||
_graphWidth->setValue(_options->graphWidth);
|
||||
_graphWidth->setMinimum(1);
|
||||
|
||||
QFormLayout *graphLayout = new QFormLayout();
|
||||
graphLayout->addRow(tr("Line width:"), _graphWidth);
|
||||
graphLayout->addRow(tr("Slider color:"), _sliderColor);
|
||||
|
||||
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
|
||||
_graphAA->setChecked(_options->graphAntiAliasing);
|
||||
QFormLayout *graphAALayout = new QFormLayout();
|
||||
graphAALayout->addWidget(_graphAA);
|
||||
|
||||
QWidget *graphTab = new QWidget();
|
||||
QVBoxLayout *graphTabLayout = new QVBoxLayout();
|
||||
graphTabLayout->addLayout(graphLayout);
|
||||
graphTabLayout->addLayout(graphAALayout);
|
||||
graphTabLayout->addStretch();
|
||||
graphTab->setLayout(graphTabLayout);
|
||||
|
||||
|
||||
// Map
|
||||
_mapOpacity = new PercentSlider();
|
||||
_mapOpacity->setValue(_options->mapOpacity);
|
||||
_backgroundColor = new ColorBox();
|
||||
_backgroundColor->setColor(_options->backgroundColor);
|
||||
_backgroundColor->enableAlphaChannel(false);
|
||||
QFormLayout *mapLayout = new QFormLayout();
|
||||
mapLayout->addRow(tr("Background color:"), _backgroundColor);
|
||||
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
|
||||
|
||||
QWidget *mapTab = new QWidget();
|
||||
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
||||
mapTabLayout->addLayout(mapLayout);
|
||||
mapTabLayout->addStretch();
|
||||
mapTab->setLayout(mapTabLayout);
|
||||
|
||||
|
||||
QTabWidget *appearancePage = new QTabWidget();
|
||||
appearancePage->addTab(pathTab, tr("Paths"));
|
||||
appearancePage->addTab(pointTab, tr("Points"));
|
||||
appearancePage->addTab(graphTab, tr("Graphs"));
|
||||
appearancePage->addTab(mapTab, tr("Map"));
|
||||
|
||||
return appearancePage;
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createDataPage()
|
||||
{
|
||||
QString filterToolTip = tr("Moving average window size");
|
||||
|
||||
_elevationFilter = new OddSpinBox();
|
||||
_elevationFilter->setValue(_options->elevationFilter);
|
||||
_elevationFilter->setToolTip(filterToolTip);
|
||||
_speedFilter = new OddSpinBox();
|
||||
_speedFilter->setValue(_options->speedFilter);
|
||||
_speedFilter->setToolTip(filterToolTip);
|
||||
_heartRateFilter = new OddSpinBox();
|
||||
_heartRateFilter->setValue(_options->heartRateFilter);
|
||||
_heartRateFilter->setToolTip(filterToolTip);
|
||||
_cadenceFilter = new OddSpinBox();
|
||||
_cadenceFilter->setValue(_options->cadenceFilter);
|
||||
_cadenceFilter->setToolTip(filterToolTip);
|
||||
_powerFilter = new OddSpinBox();
|
||||
_powerFilter->setValue(_options->powerFilter);
|
||||
_powerFilter->setToolTip(filterToolTip);
|
||||
|
||||
QFormLayout *smoothLayout = new QFormLayout();
|
||||
smoothLayout->addRow(tr("Elevation:"), _elevationFilter);
|
||||
smoothLayout->addRow(tr("Speed:"), _speedFilter);
|
||||
smoothLayout->addRow(tr("Heart rate:"), _heartRateFilter);
|
||||
smoothLayout->addRow(tr("Cadence:"), _cadenceFilter);
|
||||
smoothLayout->addRow(tr("Power:"), _powerFilter);
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *smoothBox = new QGroupBox(tr("Smoothing"));
|
||||
smoothBox->setLayout(smoothLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_outlierEliminate = new QCheckBox(tr("Eliminate GPS outliers"));
|
||||
_outlierEliminate->setChecked(_options->outlierEliminate);
|
||||
|
||||
QFormLayout *outlierLayout = new QFormLayout();
|
||||
outlierLayout->addWidget(_outlierEliminate);
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *outlierBox = new QGroupBox(tr("Outlier elimination"));
|
||||
outlierBox->setLayout(outlierLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QWidget *filterTab = new QWidget();
|
||||
QVBoxLayout *filterTabLayout = new QVBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
filterTabLayout->addWidget(new QLabel(tr("Smoothing:")));
|
||||
filterTabLayout->addLayout(smoothLayout);
|
||||
filterTabLayout->addWidget(line());
|
||||
filterTabLayout->addLayout(outlierLayout);
|
||||
#else // Q_OS_MAC
|
||||
filterTabLayout->addWidget(smoothBox);
|
||||
filterTabLayout->addWidget(outlierBox);
|
||||
#endif // Q_OS_MAC
|
||||
filterTabLayout->addStretch();
|
||||
filterTab->setLayout(filterTabLayout);
|
||||
|
||||
|
||||
_pauseSpeed = new QDoubleSpinBox();
|
||||
_pauseSpeed->setDecimals(1);
|
||||
_pauseSpeed->setSingleStep(0.1);
|
||||
_pauseSpeed->setMinimum(0.1);
|
||||
if (_options->units == Imperial) {
|
||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2MIH);
|
||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("mi/h"));
|
||||
} else {
|
||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2KMH);
|
||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("km/h"));
|
||||
}
|
||||
_pauseInterval = new QSpinBox();
|
||||
_pauseInterval->setMinimum(1);
|
||||
_pauseInterval->setSuffix(UNIT_SPACE + tr("s"));
|
||||
_pauseInterval->setValue(_options->pauseInterval);
|
||||
|
||||
QFormLayout *pauseLayout = new QFormLayout();
|
||||
pauseLayout->addRow(tr("Minimal speed:"), _pauseSpeed);
|
||||
pauseLayout->addRow(tr("Minimal duration:"), _pauseInterval);
|
||||
|
||||
QWidget *pauseTab = new QWidget();
|
||||
pauseTab->setLayout(pauseLayout);
|
||||
|
||||
|
||||
QTabWidget *filterPage = new QTabWidget();
|
||||
filterPage->addTab(filterTab, tr("Filtering"));
|
||||
filterPage->addTab(pauseTab, tr("Pause detection"));
|
||||
|
||||
return filterPage;
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createPOIPage()
|
||||
{
|
||||
_poiRadius = new QDoubleSpinBox();
|
||||
_poiRadius->setSingleStep(1);
|
||||
_poiRadius->setDecimals(1);
|
||||
if (_options->units == Imperial) {
|
||||
_poiRadius->setValue(_options->poiRadius / MIINM);
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
|
||||
} else {
|
||||
_poiRadius->setValue(_options->poiRadius / KMINM);
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
||||
}
|
||||
|
||||
QFormLayout *poiLayout = new QFormLayout();
|
||||
poiLayout->addRow(tr("POI radius:"), _poiRadius);
|
||||
|
||||
QWidget *poiTab = new QWidget();
|
||||
poiTab->setLayout(poiLayout);
|
||||
|
||||
QTabWidget *poiPage = new QTabWidget();
|
||||
poiPage->addTab(poiTab, tr("POI"));
|
||||
|
||||
return poiPage;
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createExportPage()
|
||||
{
|
||||
_wysiwyg = new QRadioButton(tr("WYSIWYG"));
|
||||
_hires = new QRadioButton(tr("High-Resolution"));
|
||||
if (_options->hiresPrint)
|
||||
_hires->setChecked(true);
|
||||
else
|
||||
_wysiwyg->setChecked(true);
|
||||
QLabel *lw = new QLabel(tr("The printed area is approximately the display"
|
||||
" area. The map zoom level does not change."));
|
||||
QLabel *lh = new QLabel(tr("The zoom level will be changed so that"
|
||||
" the whole content (tracks/waypoints) fits to the printed area and"
|
||||
" the map resolution is as close as possible to the print resolution."));
|
||||
QFont f = lw->font();
|
||||
f.setPointSize(f.pointSize() - 1);
|
||||
lw->setWordWrap(true);
|
||||
lh->setWordWrap(true);
|
||||
lw->setFont(f);
|
||||
lh->setFont(f);
|
||||
|
||||
QVBoxLayout *modeTabLayout = new QVBoxLayout();
|
||||
modeTabLayout->addWidget(_wysiwyg);
|
||||
modeTabLayout->addWidget(lw);
|
||||
modeTabLayout->addSpacing(10);
|
||||
modeTabLayout->addWidget(_hires);
|
||||
modeTabLayout->addWidget(lh);
|
||||
modeTabLayout->addStretch();
|
||||
|
||||
QWidget *modeTab = new QWidget();
|
||||
modeTab->setLayout(modeTabLayout);
|
||||
|
||||
|
||||
_name = new QCheckBox(tr("Name"));
|
||||
_name->setChecked(_options->printName);
|
||||
_date = new QCheckBox(tr("Date"));
|
||||
_date->setChecked(_options->printDate);
|
||||
_distance = new QCheckBox(tr("Distance"));
|
||||
_distance->setChecked(_options->printDistance);
|
||||
_time = new QCheckBox(tr("Time"));
|
||||
_time->setChecked(_options->printTime);
|
||||
_movingTime = new QCheckBox(tr("Moving time"));
|
||||
_movingTime->setChecked(_options->printMovingTime);
|
||||
_itemCount = new QCheckBox(tr("Item count (>1)"));
|
||||
_itemCount->setChecked(_options->printItemCount);
|
||||
|
||||
QFormLayout *headerTabLayout = new QFormLayout();
|
||||
headerTabLayout->addWidget(_name);
|
||||
headerTabLayout->addWidget(_date);
|
||||
headerTabLayout->addWidget(_distance);
|
||||
headerTabLayout->addWidget(_time);
|
||||
headerTabLayout->addWidget(_movingTime);
|
||||
headerTabLayout->addItem(new QSpacerItem(10, 10));
|
||||
headerTabLayout->addWidget(_itemCount);
|
||||
QWidget *headerTab = new QWidget();
|
||||
headerTab->setLayout(headerTabLayout);
|
||||
|
||||
|
||||
_separateGraphPage = new QCheckBox(tr("Separate graph page"));
|
||||
_separateGraphPage->setChecked(_options->separateGraphPage);
|
||||
|
||||
QFormLayout *graphTabLayout = new QFormLayout();
|
||||
graphTabLayout->addWidget(_separateGraphPage);
|
||||
QWidget *graphTab = new QWidget();
|
||||
graphTab->setLayout(graphTabLayout);
|
||||
|
||||
|
||||
QTabWidget *exportPage = new QTabWidget();
|
||||
exportPage->addTab(modeTab, tr("Print mode"));
|
||||
exportPage->addTab(headerTab, tr("Header"));
|
||||
exportPage->addTab(graphTab, tr("Graphs"));
|
||||
|
||||
return exportPage;
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createSystemPage()
|
||||
{
|
||||
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
|
||||
_useOpenGL->setChecked(_options->useOpenGL);
|
||||
|
||||
_pixmapCache = new QSpinBox();
|
||||
_pixmapCache->setMinimum(16);
|
||||
_pixmapCache->setMaximum(1024);
|
||||
_pixmapCache->setSuffix(UNIT_SPACE + tr("MB"));
|
||||
_pixmapCache->setValue(_options->pixmapCache);
|
||||
|
||||
QFormLayout *cacheLayout = new QFormLayout();
|
||||
cacheLayout->addRow(tr("Image cache size:"), _pixmapCache);
|
||||
|
||||
QFormLayout *openGLLayout = new QFormLayout();
|
||||
openGLLayout->addWidget(_useOpenGL);
|
||||
|
||||
QWidget *systemTab = new QWidget();
|
||||
QVBoxLayout *systemTabLayout = new QVBoxLayout();
|
||||
systemTabLayout->addLayout(cacheLayout);
|
||||
systemTabLayout->addLayout(openGLLayout);
|
||||
systemTabLayout->addStretch();
|
||||
systemTab->setLayout(systemTabLayout);
|
||||
|
||||
QTabWidget *systemPage = new QTabWidget();
|
||||
systemPage->addTab(systemTab, tr("System"));
|
||||
|
||||
return systemPage;
|
||||
}
|
||||
|
||||
OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
||||
: QDialog(parent), _options(options)
|
||||
{
|
||||
QStackedWidget *pages = new QStackedWidget();
|
||||
pages->addWidget(createGeneralPage());
|
||||
pages->addWidget(createAppearancePage());
|
||||
pages->addWidget(createDataPage());
|
||||
pages->addWidget(createPOIPage());
|
||||
pages->addWidget(createExportPage());
|
||||
pages->addWidget(createSystemPage());
|
||||
|
||||
QListWidget *menu = new QListWidget();
|
||||
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
||||
new QListWidgetItem(QIcon(QPixmap(APP_ICON)), tr("General"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
|
||||
menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(POI_ICON)), tr("POI"), menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(PRINT_EXPORT_ICON)), tr("Print & Export"),
|
||||
menu);
|
||||
new QListWidgetItem(QIcon(QPixmap(SYSTEM_ICON)), tr("System"), menu);
|
||||
|
||||
QHBoxLayout *contentLayout = new QHBoxLayout();
|
||||
contentLayout->addWidget(menu);
|
||||
contentLayout->addWidget(pages);
|
||||
|
||||
menu->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
menu->setMaximumWidth(menu->sizeHintForColumn(0) + 2 * menu->frameWidth()
|
||||
+ MENU_MARGIN);
|
||||
pages->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
pages->setMinimumWidth(2 * menu->size().width());
|
||||
|
||||
connect(menu, SIGNAL(currentRowChanged(int)), pages,
|
||||
SLOT(setCurrentIndex(int)));
|
||||
menu->item(0)->setSelected(true);
|
||||
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addLayout(contentLayout);
|
||||
layout->addWidget(buttonBox);
|
||||
setLayout(layout);
|
||||
|
||||
setWindowTitle(tr("Options"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
void OptionsDialog::accept()
|
||||
{
|
||||
_options->alwaysShowMap = _alwaysShowMap->isChecked();
|
||||
|
||||
_options->palette.setColor(_baseColor->color());
|
||||
_options->palette.setShift(_colorOffset->value());
|
||||
_options->mapOpacity = _mapOpacity->value();
|
||||
_options->backgroundColor = _backgroundColor->color();
|
||||
_options->trackWidth = _trackWidth->value();
|
||||
_options->trackStyle = (Qt::PenStyle) _trackStyle->itemData(
|
||||
_trackStyle->currentIndex()).toInt();
|
||||
_options->routeWidth = _routeWidth->value();
|
||||
_options->routeStyle = (Qt::PenStyle) _routeStyle->itemData(
|
||||
_routeStyle->currentIndex()).toInt();
|
||||
_options->pathAntiAliasing = _pathAA->isChecked();
|
||||
_options->waypointSize = _waypointSize->value();
|
||||
_options->waypointColor = _waypointColor->color();
|
||||
_options->poiSize = _poiSize->value();
|
||||
_options->poiColor = _poiColor->color();
|
||||
_options->graphWidth = _graphWidth->value();
|
||||
_options->sliderColor = _sliderColor->color();
|
||||
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||
|
||||
_options->elevationFilter = _elevationFilter->value();
|
||||
_options->speedFilter = _speedFilter->value();
|
||||
_options->heartRateFilter = _heartRateFilter->value();
|
||||
_options->cadenceFilter = _cadenceFilter->value();
|
||||
_options->powerFilter = _powerFilter->value();
|
||||
_options->outlierEliminate = _outlierEliminate->isChecked();
|
||||
qreal pauseSpeed = (_options->units == Imperial)
|
||||
? _pauseSpeed->value() / MS2MIH : _pauseSpeed->value() / MS2KMH;
|
||||
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
|
||||
_options->pauseSpeed = pauseSpeed;
|
||||
_options->pauseInterval = _pauseInterval->value();
|
||||
|
||||
qreal poiRadius = (_options->units == Imperial)
|
||||
? _poiRadius->value() * MIINM : _poiRadius->value() * KMINM;
|
||||
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
||||
_options->poiRadius = poiRadius;
|
||||
|
||||
_options->useOpenGL = _useOpenGL->isChecked();
|
||||
_options->pixmapCache = _pixmapCache->value();
|
||||
|
||||
_options->hiresPrint = _hires->isChecked();
|
||||
_options->printName = _name->isChecked();
|
||||
_options->printDate = _date->isChecked();
|
||||
_options->printDistance = _distance->isChecked();
|
||||
_options->printTime = _time->isChecked();
|
||||
_options->printMovingTime = _movingTime->isChecked();
|
||||
_options->printItemCount = _itemCount->isChecked();
|
||||
_options->separateGraphPage = _separateGraphPage->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
129
src/GUI/optionsdialog.h
Normal file
@ -0,0 +1,129 @@
|
||||
#ifndef OPTIONSDIALOG_H
|
||||
#define OPTIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "palette.h"
|
||||
#include "units.h"
|
||||
|
||||
class ColorBox;
|
||||
class StyleComboBox;
|
||||
class OddSpinBox;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QRadioButton;
|
||||
class PercentSlider;
|
||||
|
||||
struct Options {
|
||||
// General
|
||||
bool alwaysShowMap;
|
||||
// Appearance
|
||||
Palette palette;
|
||||
int trackWidth;
|
||||
int routeWidth;
|
||||
Qt::PenStyle trackStyle;
|
||||
Qt::PenStyle routeStyle;
|
||||
QColor waypointColor;
|
||||
QColor poiColor;
|
||||
int waypointSize;
|
||||
int poiSize;
|
||||
int graphWidth;
|
||||
QColor sliderColor;
|
||||
bool pathAntiAliasing;
|
||||
bool graphAntiAliasing;
|
||||
int mapOpacity;
|
||||
QColor backgroundColor;
|
||||
// Data
|
||||
int elevationFilter;
|
||||
int speedFilter;
|
||||
int heartRateFilter;
|
||||
int cadenceFilter;
|
||||
int powerFilter;
|
||||
bool outlierEliminate;
|
||||
qreal pauseSpeed;
|
||||
int pauseInterval;
|
||||
// POI
|
||||
int poiRadius;
|
||||
// System
|
||||
bool useOpenGL;
|
||||
int pixmapCache;
|
||||
// Print/Export
|
||||
bool hiresPrint;
|
||||
bool printName;
|
||||
bool printDate;
|
||||
bool printDistance;
|
||||
bool printTime;
|
||||
bool printMovingTime;
|
||||
bool printItemCount;
|
||||
bool separateGraphPage;
|
||||
|
||||
Units units;
|
||||
};
|
||||
|
||||
class OptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OptionsDialog(Options *options, QWidget *parent = 0);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
||||
private:
|
||||
QWidget *createGeneralPage();
|
||||
QWidget *createAppearancePage();
|
||||
QWidget *createDataPage();
|
||||
QWidget *createPOIPage();
|
||||
QWidget *createSystemPage();
|
||||
QWidget *createExportPage();
|
||||
|
||||
Options *_options;
|
||||
|
||||
// General
|
||||
QCheckBox *_alwaysShowMap;
|
||||
// Appearance
|
||||
ColorBox *_baseColor;
|
||||
QDoubleSpinBox *_colorOffset;
|
||||
PercentSlider *_mapOpacity;
|
||||
ColorBox *_backgroundColor;
|
||||
QSpinBox *_trackWidth;
|
||||
StyleComboBox *_trackStyle;
|
||||
QSpinBox *_routeWidth;
|
||||
StyleComboBox *_routeStyle;
|
||||
QCheckBox *_pathAA;
|
||||
QSpinBox *_waypointSize;
|
||||
ColorBox *_waypointColor;
|
||||
QSpinBox *_poiSize;
|
||||
ColorBox *_poiColor;
|
||||
QSpinBox *_graphWidth;
|
||||
ColorBox *_sliderColor;
|
||||
QCheckBox *_graphAA;
|
||||
// Data
|
||||
OddSpinBox *_elevationFilter;
|
||||
OddSpinBox *_speedFilter;
|
||||
OddSpinBox *_heartRateFilter;
|
||||
OddSpinBox *_cadenceFilter;
|
||||
OddSpinBox *_powerFilter;
|
||||
QCheckBox *_outlierEliminate;
|
||||
QDoubleSpinBox *_pauseSpeed;
|
||||
QSpinBox *_pauseInterval;
|
||||
// POI
|
||||
QDoubleSpinBox *_poiRadius;
|
||||
// System
|
||||
QSpinBox *_pixmapCache;
|
||||
QCheckBox *_useOpenGL;
|
||||
// Print/Export
|
||||
QRadioButton *_wysiwyg;
|
||||
QRadioButton *_hires;
|
||||
QCheckBox *_name;
|
||||
QCheckBox *_date;
|
||||
QCheckBox *_distance;
|
||||
QCheckBox *_time;
|
||||
QCheckBox *_movingTime;
|
||||
QCheckBox *_itemCount;
|
||||
QCheckBox *_separateGraphPage;
|
||||
};
|
||||
|
||||
#endif // OPTIONSDIALOG_H
|
45
src/GUI/palette.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "palette.h"
|
||||
|
||||
Palette::Palette(const QColor &color, qreal shift)
|
||||
{
|
||||
_h = 0; _s = 0; _v = 0; _a = 1.0;
|
||||
|
||||
setColor(color);
|
||||
setShift(shift);
|
||||
|
||||
_state = _h;
|
||||
}
|
||||
|
||||
void Palette::setColor(const QColor &color)
|
||||
{
|
||||
if (color.isValid())
|
||||
color.getHsvF(&_h, &_s, &_v, &_a);
|
||||
}
|
||||
|
||||
void Palette::setShift(qreal shift)
|
||||
{
|
||||
if (shift >= 0 && shift <= 1.0)
|
||||
_shift = shift;
|
||||
}
|
||||
|
||||
QColor Palette::nextColor()
|
||||
{
|
||||
QColor ret = QColor::fromHsvF(_state, _s, _v, _a);
|
||||
|
||||
_state += _shift;
|
||||
_state -= (int) _state;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Palette::reset()
|
||||
{
|
||||
_state = _h;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const Palette &palette)
|
||||
{
|
||||
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
|
||||
<< ")";
|
||||
return dbg.space();
|
||||
}
|
33
src/GUI/palette.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef PALETTE_H
|
||||
#define PALETTE_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
|
||||
class Palette
|
||||
{
|
||||
public:
|
||||
Palette(const QColor &color = Qt::blue, qreal shift = 0.62);
|
||||
|
||||
QColor color() const {return QColor::fromHsvF(_h, _s, _v, _a).toRgb();}
|
||||
qreal shift() const {return _shift;}
|
||||
void setColor(const QColor &color);
|
||||
void setShift(qreal shift);
|
||||
|
||||
QColor nextColor();
|
||||
void reset();
|
||||
|
||||
bool operator==(const Palette &other) const
|
||||
{return (_h == other._h && _s == other._s && _v == other._v
|
||||
&& _a == other._a && _shift == other._shift);}
|
||||
bool operator!=(const Palette &other) const
|
||||
{return !(*this == other);}
|
||||
|
||||
private:
|
||||
qreal _h, _s, _v, _a, _shift;
|
||||
qreal _state;
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug dbg, const Palette &palette);
|
||||
|
||||
#endif // PALLETE_H
|
208
src/GUI/pathitem.cpp
Normal file
@ -0,0 +1,208 @@
|
||||
#include <cmath>
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
#include <QPainter>
|
||||
#include "map/map.h"
|
||||
#include "tooltip.h"
|
||||
#include "nicenum.h"
|
||||
#include "pathitem.h"
|
||||
|
||||
|
||||
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||
: QGraphicsObject(parent)
|
||||
{
|
||||
Q_ASSERT(path.count() >= 2);
|
||||
|
||||
_path = path;
|
||||
_map = map;
|
||||
_digitalZoom = 0;
|
||||
|
||||
_width = 3;
|
||||
QBrush brush(Qt::SolidPattern);
|
||||
_pen = QPen(brush, _width);
|
||||
|
||||
updatePainterPath(map);
|
||||
updateShape();
|
||||
|
||||
_marker = new MarkerItem(this);
|
||||
_marker->setPos(position(_path.at(0).distance()));
|
||||
_markerDistance = _path.at(0).distance();
|
||||
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void PathItem::updateShape()
|
||||
{
|
||||
QPainterPathStroker s;
|
||||
s.setWidth((_width + 1) * pow(2, -_digitalZoom));
|
||||
_shape = s.createStroke(_painterPath);
|
||||
}
|
||||
|
||||
void PathItem::updatePainterPath(Map *map)
|
||||
{
|
||||
_painterPath = QPainterPath();
|
||||
|
||||
_painterPath.moveTo(map->ll2xy(_path.first().coordinates()));
|
||||
for (int i = 1; i < _path.size(); i++)
|
||||
_painterPath.lineTo(map->ll2xy(_path.at(i).coordinates()));
|
||||
}
|
||||
|
||||
void PathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
painter->setPen(_pen);
|
||||
painter->drawPath(_painterPath);
|
||||
|
||||
/*
|
||||
QPen p = QPen(QBrush(Qt::red), 0);
|
||||
painter->setPen(p);
|
||||
painter->drawRect(boundingRect());
|
||||
*/
|
||||
}
|
||||
|
||||
void PathItem::setMap(Map *map)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
|
||||
_map = map;
|
||||
|
||||
updatePainterPath(map);
|
||||
updateShape();
|
||||
|
||||
_marker->setPos(position(_markerDistance));
|
||||
}
|
||||
|
||||
void PathItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
|
||||
_pen.setColor(color);
|
||||
update();
|
||||
}
|
||||
|
||||
void PathItem::setWidth(qreal width)
|
||||
{
|
||||
if (_width == width)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
|
||||
updateShape();
|
||||
}
|
||||
|
||||
void PathItem::setStyle(Qt::PenStyle style)
|
||||
{
|
||||
if (_pen.style() == style)
|
||||
return;
|
||||
|
||||
_pen.setStyle(style);
|
||||
update();
|
||||
}
|
||||
|
||||
void PathItem::setDigitalZoom(int zoom)
|
||||
{
|
||||
if (_digitalZoom == zoom)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_digitalZoom = zoom;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_marker->setScale(pow(2, -_digitalZoom));
|
||||
|
||||
updateShape();
|
||||
}
|
||||
|
||||
QPointF PathItem::position(qreal x) const
|
||||
{
|
||||
int low = 0;
|
||||
int high = _path.count() - 1;
|
||||
int mid = 0;
|
||||
|
||||
Q_ASSERT(high > low);
|
||||
Q_ASSERT(x >= _path.at(low).distance() && x <= _path.at(high).distance());
|
||||
|
||||
while (low <= high) {
|
||||
mid = low + ((high - low) / 2);
|
||||
qreal val = _path.at(mid).distance();
|
||||
if (val > x)
|
||||
high = mid - 1;
|
||||
else if (val < x)
|
||||
low = mid + 1;
|
||||
else
|
||||
return _map->ll2xy(_path.at(mid).coordinates());
|
||||
}
|
||||
|
||||
QLineF l;
|
||||
qreal p1, p2;
|
||||
if (_path.at(mid).distance() < x) {
|
||||
l = QLineF(_map->ll2xy(_path.at(mid).coordinates()),
|
||||
_map->ll2xy(_path.at(mid+1).coordinates()));
|
||||
p1 = _path.at(mid).distance(); p2 = _path.at(mid+1).distance();
|
||||
} else {
|
||||
l = QLineF(_map->ll2xy(_path.at(mid-1).coordinates()),
|
||||
_map->ll2xy(_path.at(mid).coordinates()));
|
||||
p1 = _path.at(mid-1).distance(); p2 = _path.at(mid).distance();
|
||||
}
|
||||
|
||||
return l.pointAt((x - p1) / (p2 - p1));
|
||||
}
|
||||
|
||||
void PathItem::moveMarker(qreal distance)
|
||||
{
|
||||
if (distance >= _path.first().distance()
|
||||
&& distance <= _path.last().distance()) {
|
||||
_marker->setVisible(true);
|
||||
_marker->setPos(position(distance));
|
||||
_markerDistance = distance;
|
||||
} else
|
||||
_marker->setVisible(false);
|
||||
}
|
||||
|
||||
void PathItem::setMarkerColor(const QColor &color)
|
||||
{
|
||||
_marker->setColor(color);
|
||||
}
|
||||
|
||||
void PathItem::hover(bool hover)
|
||||
{
|
||||
if (hover) {
|
||||
_pen.setWidth(_width + 1);
|
||||
setZValue(zValue() + 1.0);
|
||||
} else {
|
||||
_pen.setWidth(_width);
|
||||
setZValue(zValue() - 1.0);
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() + 1.0);
|
||||
update();
|
||||
|
||||
emit selected(true);
|
||||
}
|
||||
|
||||
void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() - 1.0);
|
||||
update();
|
||||
|
||||
emit selected(false);
|
||||
}
|
@ -3,49 +3,60 @@
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QPen>
|
||||
#include "data/path.h"
|
||||
#include "markeritem.h"
|
||||
#include "units.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class PathItem : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PathItem(QGraphicsItem *parent = 0);
|
||||
PathItem(const Path &path, Map *map, QGraphicsItem *parent = 0);
|
||||
|
||||
QPainterPath shape() const {return _shape;}
|
||||
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
const QPainterPath &path() const {return _path;}
|
||||
void showMarker(bool show) {_marker->setVisible(show);}
|
||||
void setScale(qreal scale);
|
||||
void setUnits(enum Units units);
|
||||
const Path &path() const {return _path;}
|
||||
|
||||
void setMap(Map *map);
|
||||
|
||||
void setColor(const QColor &color);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
void setMarkerColor(const QColor &color);
|
||||
|
||||
public slots:
|
||||
void moveMarker(qreal distance);
|
||||
void hover(bool hover);
|
||||
|
||||
signals:
|
||||
void selected(bool);
|
||||
|
||||
protected:
|
||||
void updateShape();
|
||||
|
||||
QPainterPath _path;
|
||||
QPainterPath _shape;
|
||||
QPen _pen;
|
||||
|
||||
Path _path;
|
||||
MarkerItem *_marker;
|
||||
|
||||
Units _units;
|
||||
qreal _distance;
|
||||
|
||||
private:
|
||||
QPointF position(qreal distance) const;
|
||||
void updatePainterPath(Map *map);
|
||||
void updateShape();
|
||||
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
Map *_map;
|
||||
qreal _markerDistance;
|
||||
int _digitalZoom;
|
||||
|
||||
qreal _width;
|
||||
QPen _pen;
|
||||
QPainterPath _shape;
|
||||
QPainterPath _painterPath;
|
||||
};
|
||||
|
||||
#endif // PATHITEM_H
|
48
src/GUI/percentslider.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include "units.h"
|
||||
#include "percentslider.h"
|
||||
|
||||
|
||||
static QString format(int value)
|
||||
{
|
||||
return QString::number(value) + UNIT_SPACE + QString("%");
|
||||
}
|
||||
|
||||
PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
_slider = new QSlider(Qt::Horizontal);
|
||||
_label = new QLabel();
|
||||
|
||||
_slider->setMinimum(0);
|
||||
_slider->setMaximum(100);
|
||||
|
||||
QFontMetrics fm(_label->font());
|
||||
_label->setFixedWidth(fm.boundingRect(format(_slider->maximum())).width());
|
||||
_label->setAlignment(Qt::AlignRight);
|
||||
|
||||
connect(_slider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabel(int)));
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout();
|
||||
layout->addWidget(_slider);
|
||||
layout->addWidget(_label);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void PercentSlider::updateLabel(int value)
|
||||
{
|
||||
_label->setText(format(value));
|
||||
}
|
||||
|
||||
int PercentSlider::value() const
|
||||
{
|
||||
return _slider->value();
|
||||
}
|
||||
|
||||
void PercentSlider::setValue(int value)
|
||||
{
|
||||
_slider->setValue(value);
|
||||
_label->setText(format(value));
|
||||
}
|
29
src/GUI/percentslider.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef PERCENTSLIDER_H
|
||||
#define PERCENTSLIDER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QSlider;
|
||||
class QLabel;
|
||||
|
||||
class PercentSlider : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PercentSlider(QWidget *parent = 0);
|
||||
|
||||
int value() const;
|
||||
|
||||
public slots:
|
||||
void setValue(int value);
|
||||
|
||||
private slots:
|
||||
void updateLabel(int value);
|
||||
|
||||
private:
|
||||
QSlider *_slider;
|
||||
QLabel *_label;
|
||||
};
|
||||
|
||||
#endif // PERCENTSLIDER_H
|
@ -1,10 +1,10 @@
|
||||
#include "data.h"
|
||||
#include "data/data.h"
|
||||
#include "powergraphitem.h"
|
||||
#include "powergraph.h"
|
||||
|
||||
|
||||
PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent)
|
||||
{
|
||||
_units = Metric;
|
||||
_showTracks = true;
|
||||
|
||||
GraphView::setYUnits(tr("W"));
|
||||
@ -28,21 +28,16 @@ void PowerGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||
{
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
const Graph &graph = data.tracks().at(i)->power();
|
||||
qreal sum = 0, w = 0;
|
||||
|
||||
if (graph.size() < 2) {
|
||||
skipColor();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 1; j < graph.size(); j++) {
|
||||
qreal ds = graph.at(j).s() - graph.at(j-1).s();
|
||||
sum += graph.at(j).y() * ds;
|
||||
w += ds;
|
||||
}
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||
PowerGraphItem *gi = new PowerGraphItem(graph, _graphType);
|
||||
GraphView::addGraph(gi, paths.at(i));
|
||||
|
||||
GraphView::loadGraph(graph, paths.at(i));
|
||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.routes().count(); i++)
|
@ -13,9 +13,7 @@ public:
|
||||
QString label() const {return tr("Power");}
|
||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||
void clear();
|
||||
void setUnits(enum Units) {}
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
private:
|
||||
qreal avg() const;
|
||||
@ -24,7 +22,6 @@ private:
|
||||
|
||||
QList<QPointF> _avg;
|
||||
|
||||
enum Units _units;
|
||||
bool _showTracks;
|
||||
};
|
||||
|
26
src/GUI/powergraphitem.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "tooltip.h"
|
||||
#include "powergraphitem.h"
|
||||
|
||||
PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||
{
|
||||
qreal sum = 0;
|
||||
|
||||
for (int j = 1; j < graph.size(); j++)
|
||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
||||
_avg = sum/graph.last().s();
|
||||
|
||||
setToolTip(toolTip());
|
||||
}
|
||||
|
||||
QString PowerGraphItem::toolTip() const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
|
||||
+ UNIT_SPACE + tr("1/min"));
|
||||
|
||||
return tt.toString();
|
||||
}
|
23
src/GUI/powergraphitem.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef POWERGRAPHITEM_H
|
||||
#define POWERGRAPHITEM_H
|
||||
|
||||
#include "graphitem.h"
|
||||
|
||||
class PowerGraphItem : public GraphItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PowerGraphItem(const Graph &graph, GraphType type,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
qreal max() const {return -bounds().top();}
|
||||
qreal avg() const {return _avg;}
|
||||
|
||||
private:
|
||||
QString toolTip() const;
|
||||
|
||||
qreal _avg;
|
||||
};
|
||||
|
||||
#endif // POWERGRAPHITEM_H
|
72
src/GUI/routeitem.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include <QPainter>
|
||||
#include "data/waypoint.h"
|
||||
#include "map/map.h"
|
||||
#include "format.h"
|
||||
#include "waypointitem.h"
|
||||
#include "tooltip.h"
|
||||
#include "routeitem.h"
|
||||
|
||||
|
||||
QString RouteItem::toolTip(Units units) const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
if (!_name.isEmpty())
|
||||
tt.insert(tr("Name"), _name);
|
||||
if (!_desc.isEmpty())
|
||||
tt.insert(tr("Description"), _desc);
|
||||
tt.insert(tr("Distance"), Format::distance(_path.last().distance(), units));
|
||||
|
||||
return tt.toString();
|
||||
}
|
||||
|
||||
RouteItem::RouteItem(const Route &route, Map *map, QGraphicsItem *parent)
|
||||
: PathItem(route.path(), map, parent)
|
||||
{
|
||||
const QVector<Waypoint> &waypoints = route.waypoints();
|
||||
|
||||
for (int i = 0; i < waypoints.size(); i++)
|
||||
new WaypointItem(waypoints.at(i), map, this);
|
||||
|
||||
_name = route.name();
|
||||
_desc = route.description();
|
||||
|
||||
setToolTip(toolTip(Metric));
|
||||
}
|
||||
|
||||
void RouteItem::setMap(Map *map)
|
||||
{
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++) {
|
||||
if (childs.at(i) != _marker) {
|
||||
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||
wi->setMap(map);
|
||||
}
|
||||
}
|
||||
|
||||
PathItem::setMap(map);
|
||||
}
|
||||
|
||||
void RouteItem::setUnits(enum Units units)
|
||||
{
|
||||
setToolTip(toolTip(units));
|
||||
}
|
||||
|
||||
void RouteItem::showWaypoints(bool show)
|
||||
{
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++)
|
||||
if (childs.at(i) != _marker)
|
||||
childs.at(i)->setVisible(show);
|
||||
}
|
||||
|
||||
void RouteItem::showWaypointLabels(bool show)
|
||||
{
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++) {
|
||||
if (childs.at(i) != _marker) {
|
||||
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||
wi->showLabel(show);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,27 @@
|
||||
#ifndef ROUTEITEM_H
|
||||
#define ROUTEITEM_H
|
||||
|
||||
#include "data/route.h"
|
||||
#include "pathitem.h"
|
||||
#include "route.h"
|
||||
#include "units.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class RouteItem : public PathItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RouteItem(const Route &route, QGraphicsItem *parent = 0);
|
||||
RouteItem(const Route &route, Map *map, QGraphicsItem *parent = 0);
|
||||
|
||||
void setUnits(enum Units units);
|
||||
void setScale(qreal scale);
|
||||
void setMap(Map *map);
|
||||
|
||||
void setUnits(Units units);
|
||||
void showWaypoints(bool show);
|
||||
void showWaypointLabels(bool show);
|
||||
|
||||
private:
|
||||
QString toolTip();
|
||||
QString toolTip(Units units) const;
|
||||
|
||||
QString _name;
|
||||
QString _desc;
|
@ -1,9 +1,7 @@
|
||||
#include <cmath>
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "rd.h"
|
||||
#include "wgs84.h"
|
||||
#include "tile.h"
|
||||
#include "misc.h"
|
||||
#include "nicenum.h"
|
||||
#include "scaleitem.h"
|
||||
|
||||
|
||||
@ -13,17 +11,12 @@
|
||||
#define SEGMENTS 3
|
||||
#define PADDING 4
|
||||
|
||||
static qreal zoom2resolution(int zoom, qreal y)
|
||||
{
|
||||
return (WGS84_RADIUS * 2 * M_PI / Tile::size()
|
||||
* cos(2 * atan(exp(deg2rad(y))) - M_PI/2)) / pow(2.0, zoom);
|
||||
}
|
||||
|
||||
ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
_units = Metric;
|
||||
_zoom = 0;
|
||||
_lat = 0;
|
||||
_res = 1.0;
|
||||
_digitalZoom = 0;
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
@ -96,7 +89,7 @@ QString ScaleItem::units() const
|
||||
|
||||
void ScaleItem::computeScale()
|
||||
{
|
||||
qreal res = zoom2resolution(_zoom, _lat);
|
||||
qreal res = _res * pow(2, -_digitalZoom);
|
||||
|
||||
if (_units == Imperial) {
|
||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
@ -121,20 +114,10 @@ void ScaleItem::computeScale()
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleItem::setZoom(int z, qreal lat)
|
||||
void ScaleItem::setResolution(qreal res)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
_zoom = z;
|
||||
_lat = lat;
|
||||
computeScale();
|
||||
updateBoundingRect();
|
||||
update();
|
||||
}
|
||||
|
||||
void ScaleItem::setZoom(int z)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
_zoom = z;
|
||||
_res = res;
|
||||
computeScale();
|
||||
updateBoundingRect();
|
||||
update();
|
||||
@ -148,3 +131,14 @@ void ScaleItem::setUnits(enum Units units)
|
||||
updateBoundingRect();
|
||||
update();
|
||||
}
|
||||
|
||||
void ScaleItem::setDigitalZoom(qreal zoom)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
_digitalZoom = zoom;
|
||||
computeScale();
|
||||
updateBoundingRect();
|
||||
update();
|
||||
|
||||
setScale(pow(2, -_digitalZoom));
|
||||
}
|
@ -13,22 +13,23 @@ public:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
void setZoom(int z);
|
||||
void setZoom(int z, qreal lat);
|
||||
void setResolution(qreal res);
|
||||
void setUnits(enum Units units);
|
||||
void setDigitalZoom(qreal zoom);
|
||||
|
||||
private:
|
||||
void updateBoundingRect();
|
||||
void computeScale();
|
||||
QString units() const;
|
||||
|
||||
int _zoom;
|
||||
qreal _lat;
|
||||
qreal _res;
|
||||
qreal _width;
|
||||
qreal _length;
|
||||
Units _units;
|
||||
bool _scale;
|
||||
|
||||
qreal _digitalZoom;
|
||||
|
||||
QRectF _boundingRect;
|
||||
};
|
||||
|
24
src/GUI/searchpointer.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef SEARCHPOINTER_H
|
||||
#define SEARCHPOINTER_H
|
||||
|
||||
template <class T>
|
||||
class SearchPointer
|
||||
{
|
||||
public:
|
||||
SearchPointer(const T *ptr) : _ptr(ptr) {}
|
||||
|
||||
const T *data() const {return _ptr;}
|
||||
bool operator==(const SearchPointer<T> &other) const
|
||||
{return *data() == *(other.data());}
|
||||
|
||||
private:
|
||||
const T *_ptr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline uint qHash(const SearchPointer<T> &t)
|
||||
{
|
||||
return ::qHash(*(t.data()));
|
||||
}
|
||||
|
||||
#endif // SEARCHPOINTER_H
|
152
src/GUI/settings.h
Normal file
@ -0,0 +1,152 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#define IMPERIAL_UNITS() \
|
||||
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
|
||||
|
||||
#define WINDOW_SETTINGS_GROUP "Window"
|
||||
#define WINDOW_SIZE_SETTING "size"
|
||||
#define WINDOW_SIZE_DEFAULT QSize(600, 800)
|
||||
#define WINDOW_POS_SETTING "pos"
|
||||
#define WINDOW_POS_DEFAULT QPoint(10, 10)
|
||||
|
||||
#define SETTINGS_SETTINGS_GROUP "Settings"
|
||||
#define TIME_TYPE_SETTING "timeType"
|
||||
#define TIME_TYPE_DEFAULT Total
|
||||
#define UNITS_SETTING "units"
|
||||
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
|
||||
#define SHOW_TOOLBARS_SETTING "toolbar"
|
||||
#define SHOW_TOOLBARS_DEFAULT true
|
||||
|
||||
#define GRAPH_SETTINGS_GROUP "Graph"
|
||||
#define SHOW_GRAPHS_SETTING "show"
|
||||
#define SHOW_GRAPHS_DEFAULT true
|
||||
#define GRAPH_TYPE_SETTING "type"
|
||||
#define GRAPH_TYPE_DEFAULT Distance
|
||||
#define SHOW_GRAPH_GRIDS_SETTING "grid"
|
||||
#define SHOW_GRAPH_GRIDS_DEFAULT true
|
||||
#define SHOW_GRAPH_SLIDER_INFO_SETTING "sliderInfo"
|
||||
#define SHOW_GRAPH_SLIDER_INFO_DEFAULT true
|
||||
|
||||
#define MAP_SETTINGS_GROUP "Map"
|
||||
#define CURRENT_MAP_SETTING "map"
|
||||
#define SHOW_MAP_SETTING "show"
|
||||
#define SHOW_MAP_DEFAULT true
|
||||
|
||||
#define POI_SETTINGS_GROUP "POI"
|
||||
#define OVERLAP_POI_SETTING "overlap"
|
||||
#define OVERLAP_POI_DEFAULT false
|
||||
#define LABELS_POI_SETTING "labels"
|
||||
#define LABELS_POI_DEFAULT true
|
||||
#define SHOW_POI_SETTING "show"
|
||||
#define SHOW_POI_DEFAULT false
|
||||
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
|
||||
#define DISABLED_POI_FILE_SETTING "file"
|
||||
|
||||
#define DATA_SETTINGS_GROUP "Data"
|
||||
#define SHOW_TRACKS_SETTING "tracks"
|
||||
#define SHOW_TRACKS_DEFAULT true
|
||||
#define SHOW_ROUTES_SETTING "routes"
|
||||
#define SHOW_ROUTES_DEFAULT true
|
||||
#define SHOW_WAYPOINTS_SETTING "waypoints"
|
||||
#define SHOW_WAYPOINTS_DEFAULT true
|
||||
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
|
||||
#define SHOW_ROUTE_WAYPOINTS_DEFAULT true
|
||||
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
|
||||
#define SHOW_WAYPOINT_LABELS_DEFAULT true
|
||||
|
||||
#define EXPORT_SETTINGS_GROUP "Export"
|
||||
#define PAPER_ORIENTATION_SETTING "orientation"
|
||||
#define PAPER_ORIENTATION_DEFAULT QPrinter::Portrait
|
||||
#define PAPER_SIZE_SETTING "size"
|
||||
#define PAPER_SIZE_DEFAULT (IMPERIAL_UNITS() ? QPrinter::Letter \
|
||||
: QPrinter::A4)
|
||||
#define MARGIN_LEFT_SETTING "marginLeft"
|
||||
#define MARGIN_LEFT_DEFAULT 5 /* mm */
|
||||
#define MARGIN_TOP_SETTING "marginTop"
|
||||
#define MARGIN_TOP_DEFAULT 5 /* mm */
|
||||
#define MARGIN_RIGHT_SETTING "marginRight"
|
||||
#define MARGIN_RIGHT_DEFAULT 5 /* mm */
|
||||
#define MARGIN_BOTTOM_SETTING "marginBottom"
|
||||
#define MARGIN_BOTTOM_DEFAULT 5 /* mm */
|
||||
#define EXPORT_FILENAME_SETTING "fileName"
|
||||
#define EXPORT_FILENAME_DEFAULT QString("%1/export.pdf"). \
|
||||
arg(QDir::currentPath())
|
||||
#define RESOLUTION_SETTING "resolution"
|
||||
#define RESOLUTION_DEFAULT 600
|
||||
|
||||
#define OPTIONS_SETTINGS_GROUP "Options"
|
||||
#define PALETTE_COLOR_SETTING "paletteColor"
|
||||
#define PALETTE_COLOR_DEFAULT QColor(Qt::blue)
|
||||
#define PALETTE_SHIFT_SETTING "paletteShift"
|
||||
#define PALETTE_SHIFT_DEFAULT 0.62
|
||||
#define MAP_OPACITY_SETTING "mapOpacity"
|
||||
#define MAP_OPACITY_DEFAULT 100
|
||||
#define BACKGROUND_COLOR_SETTING "backgroundColor"
|
||||
#define BACKGROUND_COLOR_DEFAULT QColor(Qt::white)
|
||||
#define TRACK_WIDTH_SETTING "trackWidth"
|
||||
#define TRACK_WIDTH_DEFAULT 3
|
||||
#define ROUTE_WIDTH_SETTING "routeWidth"
|
||||
#define ROUTE_WIDTH_DEFAULT 3
|
||||
#define TRACK_STYLE_SETTING "trackStyle"
|
||||
#define TRACK_STYLE_DEFAULT Qt::SolidLine
|
||||
#define ROUTE_STYLE_SETTING "routeStyle"
|
||||
#define ROUTE_STYLE_DEFAULT Qt::DotLine
|
||||
#define WAYPOINT_SIZE_SETTING "waypointSize"
|
||||
#define WAYPOINT_SIZE_DEFAULT 8
|
||||
#define WAYPOINT_COLOR_SETTING "waypointColor"
|
||||
#define WAYPOINT_COLOR_DEFAULT QColor(Qt::black)
|
||||
#define POI_SIZE_SETTING "poiSize"
|
||||
#define POI_SIZE_DEFAULT 8
|
||||
#define POI_COLOR_SETTING "poiColor"
|
||||
#define POI_COLOR_DEFAULT QColor(Qt::black)
|
||||
#define GRAPH_WIDTH_SETTING "graphWidth"
|
||||
#define GRAPH_WIDTH_DEFAULT 1
|
||||
#define PATH_AA_SETTING "pathAntiAliasing"
|
||||
#define PATH_AA_DEFAULT true
|
||||
#define GRAPH_AA_SETTING "graphAntiAliasing"
|
||||
#define GRAPH_AA_DEFAULT false
|
||||
#define ELEVATION_FILTER_SETTING "elevationFilter"
|
||||
#define ELEVATION_FILTER_DEFAULT 3
|
||||
#define SPEED_FILTER_SETTING "speedFilter"
|
||||
#define SPEED_FILTER_DEFAULT 5
|
||||
#define HEARTRATE_FILTER_SETTING "heartrateFilter"
|
||||
#define HEARTRATE_FILTER_DEFAULT 3
|
||||
#define CADENCE_FILTER_SETTING "cadenceFilter"
|
||||
#define CADENCE_FILTER_DEFAULT 3
|
||||
#define POWER_FILTER_SETTING "powerFilter"
|
||||
#define POWER_FILTER_DEFAULT 3
|
||||
#define OUTLIER_ELIMINATE_SETTING "outlierEliminate"
|
||||
#define OUTLIER_ELIMINATE_DEFAULT true
|
||||
#define PAUSE_SPEED_SETTING "pauseSpeed"
|
||||
#define PAUSE_SPEED_DEFAULT 0.5 /* m/s */
|
||||
#define PAUSE_INTERVAL_SETTING "pauseInterval"
|
||||
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
|
||||
#define POI_RADIUS_SETTING "poiRadius"
|
||||
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||
#define USE_OPENGL_SETTING "useOpenGL"
|
||||
#define USE_OPENGL_DEFAULT false
|
||||
#define PIXMAP_CACHE_SETTING "pixmapCache"
|
||||
#define PIXMAP_CACHE_DEFAULT 64 /* MB */
|
||||
#define HIRES_PRINT_SETTING "hiresPrint"
|
||||
#define HIRES_PRINT_DEFAULT false
|
||||
#define PRINT_NAME_SETTING "printName"
|
||||
#define PRINT_NAME_DEFAULT true
|
||||
#define PRINT_DATE_SETTING "printDate"
|
||||
#define PRINT_DATE_DEFAULT true
|
||||
#define PRINT_DISTANCE_SETTING "printDistance"
|
||||
#define PRINT_DISTANCE_DEFAULT true
|
||||
#define PRINT_TIME_SETTING "printTime"
|
||||
#define PRINT_TIME_DEFAULT true
|
||||
#define PRINT_MOVING_TIME_SETTING "printMovingTime"
|
||||
#define PRINT_MOVING_TIME_DEFAULT false
|
||||
#define PRINT_ITEM_COUNT_SETTING "printItemCount"
|
||||
#define PRINT_ITEM_COUNT_DEFAULT true
|
||||
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
|
||||
#define SEPARATE_GRAPH_PAGE_DEFAULT false
|
||||
#define SLIDER_COLOR_SETTING "sliderColor"
|
||||
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
||||
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
|
||||
#define ALWAYS_SHOW_MAP_DEFAULT true
|
||||
|
||||
#endif // SETTINGS_H
|