Compare commits
79 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
78
Info.plist
@ -74,7 +74,7 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>CFBundleTypeMIMETypes</key>
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>application/octet-stream</string>
|
<string>application/vnd.ant.fit</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleTypeIconFile</key>
|
<key>CFBundleTypeIconFile</key>
|
||||||
<string>fit.icns</string>
|
<string>fit.icns</string>
|
||||||
@ -83,6 +83,38 @@
|
|||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Viewer</string>
|
<string>Viewer</string>
|
||||||
</dict>
|
</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>
|
</array>
|
||||||
|
|
||||||
<key>UTImportedTypeDeclarations</key>
|
<key>UTImportedTypeDeclarations</key>
|
||||||
@ -168,7 +200,49 @@
|
|||||||
<string>fit</string>
|
<string>fit</string>
|
||||||
</array>
|
</array>
|
||||||
<key>public.mime-type</key>
|
<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>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
11
README.md
@ -1,13 +1,16 @@
|
|||||||
# GPXSee
|
# 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.
|
||||||
|
|
||||||
|
## Features
|
||||||
* User-definable map sources.
|
* User-definable map sources.
|
||||||
* Track and elevation/speed/heart rate graphs.
|
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
||||||
* Support for multiple tracks in one view.
|
* Support for multiple tracks in one view.
|
||||||
* Support for POI files.
|
* Support for POI files.
|
||||||
* Export to PDF.
|
* Print/export to PDF.
|
||||||
* Full-screen mode
|
* Full-screen mode.
|
||||||
* Native GUI for Windows, Mac OS X and Linux.
|
* Native GUI for Windows, Mac OS X and Linux.
|
||||||
|
* Opens GPX, TCX, FIT, KML, IGC, NMEA and Garmin CSV files.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
29
gpxsee.pro
@ -1,10 +1,12 @@
|
|||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
VERSION = 3.0
|
VERSION = 3.8
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
network
|
network
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
||||||
|
lessThan(QT_VERSION, 5.4): QT += opengl
|
||||||
|
macx: QT += opengl
|
||||||
HEADERS += src/config.h \
|
HEADERS += src/config.h \
|
||||||
src/icons.h \
|
src/icons.h \
|
||||||
src/gui.h \
|
src/gui.h \
|
||||||
@ -68,7 +70,13 @@ HEADERS += src/config.h \
|
|||||||
src/path.h \
|
src/path.h \
|
||||||
src/assert.h \
|
src/assert.h \
|
||||||
src/cadencegraph.h \
|
src/cadencegraph.h \
|
||||||
src/powergraph.h
|
src/powergraph.h \
|
||||||
|
src/igcparser.h \
|
||||||
|
src/nmeaparser.h \
|
||||||
|
src/optionsdialog.h \
|
||||||
|
src/colorbox.h \
|
||||||
|
src/stylecombobox.h \
|
||||||
|
src/opengl.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/poi.cpp \
|
src/poi.cpp \
|
||||||
@ -116,9 +124,16 @@ SOURCES += src/main.cpp \
|
|||||||
src/format.cpp \
|
src/format.cpp \
|
||||||
src/graph.cpp \
|
src/graph.cpp \
|
||||||
src/cadencegraph.cpp \
|
src/cadencegraph.cpp \
|
||||||
src/powergraph.cpp
|
src/powergraph.cpp \
|
||||||
|
src/igcparser.cpp \
|
||||||
|
src/path.cpp \
|
||||||
|
src/nmeaparser.cpp \
|
||||||
|
src/optionsdialog.cpp \
|
||||||
|
src/colorbox.cpp \
|
||||||
|
src/stylecombobox.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts \
|
||||||
|
lang/gpxsee_sv.ts
|
||||||
macx {
|
macx {
|
||||||
ICON = icons/gpxsee.icns
|
ICON = icons/gpxsee.icns
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
@ -126,6 +141,8 @@ macx {
|
|||||||
icons/tcx.icns \
|
icons/tcx.icns \
|
||||||
icons/kml.icns \
|
icons/kml.icns \
|
||||||
icons/fit.icns \
|
icons/fit.icns \
|
||||||
|
icons/igc.icns \
|
||||||
|
icons/nmea.icns \
|
||||||
pkg/maps.txt
|
pkg/maps.txt
|
||||||
APP_RESOURCES.path = Contents/Resources
|
APP_RESOURCES.path = Contents/Resources
|
||||||
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
||||||
@ -135,6 +152,8 @@ win32 {
|
|||||||
icons/gpx.ico \
|
icons/gpx.ico \
|
||||||
icons/tcx.ico \
|
icons/tcx.ico \
|
||||||
icons/kml.ico \
|
icons/kml.ico \
|
||||||
icons/fit.ico
|
icons/fit.ico \
|
||||||
|
icons/igc.ico \
|
||||||
|
icons/nmea.ico
|
||||||
}
|
}
|
||||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
<file>icons/arrow-right-double.png</file>
|
<file>icons/arrow-right-double.png</file>
|
||||||
<file>icons/view-fullscreen.png</file>
|
<file>icons/view-fullscreen.png</file>
|
||||||
<file>icons/office-chart-line-stacked.png</file>
|
<file>icons/office-chart-line-stacked.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>lang/gpxsee_cs.qm</file>
|
<file>lang/gpxsee_cs.qm</file>
|
||||||
|
<file>lang/gpxsee_sv.qm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</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 |
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 |
@ -67,89 +67,89 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>ExportDialog</name>
|
<name>ExportDialog</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="122"/>
|
<location filename="../src/exportdialog.cpp" line="120"/>
|
||||||
<source>Export to PDF</source>
|
<source>Export to PDF</source>
|
||||||
<translation>Exportovat do PDF</translation>
|
<translation>Exportovat do PDF</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="29"/>
|
<location filename="../src/exportdialog.cpp" line="25"/>
|
||||||
<source>PDF files (*.pdf);;All files (*)</source>
|
<source>PDF files (*.pdf);;All files (*)</source>
|
||||||
<translation>Soubory PDF (*.pdf);;Všechny soubory (*)</translation>
|
<translation>Soubory PDF (*.pdf);;Všechny soubory (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="42"/>
|
<location filename="../src/exportdialog.cpp" line="38"/>
|
||||||
<source>Portrait</source>
|
<source>Portrait</source>
|
||||||
<translation>Na výšku</translation>
|
<translation>Na výšku</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="43"/>
|
<location filename="../src/exportdialog.cpp" line="39"/>
|
||||||
<source>Landscape</source>
|
<source>Landscape</source>
|
||||||
<translation>Na šířku</translation>
|
<translation>Na šířku</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="85"/>
|
<location filename="../src/exportdialog.cpp" line="83"/>
|
||||||
<source>Page size:</source>
|
<source>Page size:</source>
|
||||||
<translation>Velikost stránky:</translation>
|
<translation>Velikost stránky:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="86"/>
|
<location filename="../src/exportdialog.cpp" line="84"/>
|
||||||
<source>Orientation:</source>
|
<source>Orientation:</source>
|
||||||
<translation>Orientace:</translation>
|
<translation>Orientace:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="82"/>
|
<location filename="../src/exportdialog.cpp" line="80"/>
|
||||||
<source>Page Setup</source>
|
<source>Page Setup</source>
|
||||||
<translation>Nastavení stránky</translation>
|
<translation>Nastavení stránky</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="55"/>
|
<location filename="../src/exportdialog.cpp" line="52"/>
|
||||||
<source>in</source>
|
<source>in</source>
|
||||||
<translation>in</translation>
|
<translation>in</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="55"/>
|
<location filename="../src/exportdialog.cpp" line="52"/>
|
||||||
<source>mm</source>
|
<source>mm</source>
|
||||||
<translation>mm</translation>
|
<translation>mm</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="87"/>
|
<location filename="../src/exportdialog.cpp" line="85"/>
|
||||||
<source>Margins:</source>
|
<source>Margins:</source>
|
||||||
<translation>Okraje:</translation>
|
<translation>Okraje:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="93"/>
|
<location filename="../src/exportdialog.cpp" line="91"/>
|
||||||
<source>File:</source>
|
<source>File:</source>
|
||||||
<translation>Soubor:</translation>
|
<translation>Soubor:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="100"/>
|
<location filename="../src/exportdialog.cpp" line="98"/>
|
||||||
<source>Output file</source>
|
<source>Output file</source>
|
||||||
<translation>Výstupní soubor</translation>
|
<translation>Výstupní soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="107"/>
|
<location filename="../src/exportdialog.cpp" line="105"/>
|
||||||
<source>Export</source>
|
<source>Export</source>
|
||||||
<translation>Exportovat</translation>
|
<translation>Exportovat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="129"/>
|
<location filename="../src/exportdialog.cpp" line="127"/>
|
||||||
<location filename="../src/exportdialog.cpp" line="139"/>
|
<location filename="../src/exportdialog.cpp" line="137"/>
|
||||||
<location filename="../src/exportdialog.cpp" line="144"/>
|
<location filename="../src/exportdialog.cpp" line="142"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>Chyba</translation>
|
<translation>Chyba</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="129"/>
|
<location filename="../src/exportdialog.cpp" line="127"/>
|
||||||
<source>No output file selected.</source>
|
<source>No output file selected.</source>
|
||||||
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
|
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="139"/>
|
<location filename="../src/exportdialog.cpp" line="137"/>
|
||||||
<source>%1 is a directory.</source>
|
<source>%1 is a directory.</source>
|
||||||
<translation>%1 je adresář.</translation>
|
<translation>%1 je adresář.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/exportdialog.cpp" line="144"/>
|
<location filename="../src/exportdialog.cpp" line="142"/>
|
||||||
<source>%1 is not writable.</source>
|
<source>%1 is not writable.</source>
|
||||||
<translation>%1 nelze zapsat.</translation>
|
<translation>%1 nelze zapsat.</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -190,280 +190,290 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GUI</name>
|
<name>GUI</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="550"/>
|
<location filename="../src/gui.cpp" line="552"/>
|
||||||
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
|
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
|
||||||
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
|
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="614"/>
|
<location filename="../src/gui.cpp" line="616"/>
|
||||||
<source>Open file</source>
|
<source>Open file</source>
|
||||||
<translation>Otevřít soubor</translation>
|
<translation>Otevřít soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="695"/>
|
<location filename="../src/gui.cpp" line="705"/>
|
||||||
<source>Open POI file</source>
|
<source>Open POI file</source>
|
||||||
<translation>Otevřít POI soubor</translation>
|
<translation>Otevřít POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="225"/>
|
<location filename="../src/gui.cpp" line="223"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>Otevřít</translation>
|
<translation>Otevřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="209"/>
|
<location filename="../src/gui.cpp" line="207"/>
|
||||||
<source>Quit</source>
|
<source>Quit</source>
|
||||||
<translation>Ukončit</translation>
|
<translation>Ukončit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="217"/>
|
<location filename="../src/gui.cpp" line="215"/>
|
||||||
<location filename="../src/gui.cpp" line="566"/>
|
<location filename="../src/gui.cpp" line="568"/>
|
||||||
<location filename="../src/gui.cpp" line="567"/>
|
<location filename="../src/gui.cpp" line="569"/>
|
||||||
<source>Keyboard controls</source>
|
<source>Keyboard controls</source>
|
||||||
<translation>Ovládací klávesy</translation>
|
<translation>Ovládací klávesy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="241"/>
|
<location filename="../src/gui.cpp" line="239"/>
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<translation>Zavřít</translation>
|
<translation>Zavřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="247"/>
|
<location filename="../src/gui.cpp" line="245"/>
|
||||||
<source>Reload</source>
|
<source>Reload</source>
|
||||||
<translation>Znovu načíst</translation>
|
<translation>Znovu načíst</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="476"/>
|
<location filename="../src/gui.cpp" line="478"/>
|
||||||
<source>Show</source>
|
<source>Show</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="398"/>
|
<location filename="../src/gui.cpp" line="399"/>
|
||||||
<location filename="../src/gui.cpp" line="470"/>
|
<location filename="../src/gui.cpp" line="472"/>
|
||||||
<source>File</source>
|
<source>File</source>
|
||||||
<translation>Soubor</translation>
|
<translation>Soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="111"/>
|
<location filename="../src/gui.cpp" line="102"/>
|
||||||
<source>Supported files (*.csv *.fit *.gpx *.kml *.tcx)</source>
|
|
||||||
<translation>Podporované soubory (*.csv *.fit *.gpx *.kml *.tcx)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../src/gui.cpp" line="112"/>
|
|
||||||
<source>FIT files (*.fit)</source>
|
<source>FIT files (*.fit)</source>
|
||||||
<translation>Soubory FIT (*.fit)</translation>
|
<translation>Soubory FIT (*.fit)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="215"/>
|
<location filename="../src/gui.cpp" line="103"/>
|
||||||
<location filename="../src/gui.cpp" line="589"/>
|
<source>IGC files (*.igc)</source>
|
||||||
<location filename="../src/gui.cpp" line="590"/>
|
<translation>Soubory IGC (*.igc)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="104"/>
|
||||||
|
<source>NMEA files (*.nmea)</source>
|
||||||
|
<translation>Soubory NMEA (*.nmea)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="213"/>
|
||||||
|
<location filename="../src/gui.cpp" line="591"/>
|
||||||
|
<location filename="../src/gui.cpp" line="592"/>
|
||||||
<source>Data sources</source>
|
<source>Data sources</source>
|
||||||
<translation>Zdroje dat</translation>
|
<translation>Zdroje dat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="255"/>
|
<location filename="../src/gui.cpp" line="253"/>
|
||||||
<source>Load POI file</source>
|
<source>Load POI file</source>
|
||||||
<translation>Nahrát POI soubor</translation>
|
<translation>Nahrát POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="258"/>
|
<location filename="../src/gui.cpp" line="256"/>
|
||||||
<source>Close POI files</source>
|
<source>Close POI files</source>
|
||||||
<translation>Zavřit POI soubory</translation>
|
<translation>Zavřit POI soubory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="260"/>
|
<location filename="../src/gui.cpp" line="258"/>
|
||||||
<source>Overlap POIs</source>
|
<source>Overlap POIs</source>
|
||||||
<translation>Překrývat POI</translation>
|
<translation>Překrývat POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="264"/>
|
<location filename="../src/gui.cpp" line="262"/>
|
||||||
<source>Show POI labels</source>
|
<source>Show POI labels</source>
|
||||||
<translation>Zobrazovat názvy POI</translation>
|
<translation>Zobrazit názvy POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="269"/>
|
<location filename="../src/gui.cpp" line="267"/>
|
||||||
<source>Show POIs</source>
|
<source>Show POIs</source>
|
||||||
<translation>Zobrazit POI</translation>
|
<translation>Zobrazit POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="278"/>
|
<location filename="../src/gui.cpp" line="276"/>
|
||||||
<source>Show map</source>
|
<source>Show map</source>
|
||||||
<translation>Zobrazit mapu</translation>
|
<translation>Zobrazit mapu</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="284"/>
|
<location filename="../src/gui.cpp" line="282"/>
|
||||||
<source>Clear tile cache</source>
|
<source>Clear tile cache</source>
|
||||||
<translation>Vymazat mezipaměť dlaždic</translation>
|
<translation>Vymazat mezipaměť dlaždic</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="293"/>
|
<location filename="../src/gui.cpp" line="291"/>
|
||||||
<location filename="../src/gui.cpp" line="297"/>
|
<location filename="../src/gui.cpp" line="295"/>
|
||||||
<location filename="../src/gui.cpp" line="576"/>
|
<location filename="../src/gui.cpp" line="578"/>
|
||||||
<source>Next map</source>
|
<source>Next map</source>
|
||||||
<translation>Následující mapa</translation>
|
<translation>Následující mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="304"/>
|
<location filename="../src/gui.cpp" line="302"/>
|
||||||
<source>Show tracks</source>
|
<source>Show tracks</source>
|
||||||
<translation>Zobrazit cesty</translation>
|
<translation>Zobrazit cesty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="308"/>
|
<location filename="../src/gui.cpp" line="306"/>
|
||||||
<source>Show routes</source>
|
<source>Show routes</source>
|
||||||
<translation>Zobrazit trasy</translation>
|
<translation>Zobrazit trasy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="312"/>
|
<location filename="../src/gui.cpp" line="310"/>
|
||||||
<source>Show waypoints</source>
|
<source>Show waypoints</source>
|
||||||
<translation>Zobrazit navigační body</translation>
|
<translation>Zobrazit navigační body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="316"/>
|
<location filename="../src/gui.cpp" line="314"/>
|
||||||
<source>Waypoint labels</source>
|
<source>Waypoint labels</source>
|
||||||
<translation>Názvy navigačních bodů</translation>
|
<translation>Názvy navigačních bodů</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="327"/>
|
<location filename="../src/gui.cpp" line="325"/>
|
||||||
<source>Show graphs</source>
|
<source>Show graphs</source>
|
||||||
<translation>Zobrazovat grafy</translation>
|
<translation>Zobrazit grafy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="349"/>
|
<location filename="../src/gui.cpp" line="347"/>
|
||||||
<source>Show grid</source>
|
<source>Show grid</source>
|
||||||
<translation>Zobrazit mřížku</translation>
|
<translation>Zobrazit mřížku</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="355"/>
|
<location filename="../src/gui.cpp" line="353"/>
|
||||||
<source>Show toolbars</source>
|
<source>Show toolbars</source>
|
||||||
<translation>Zobrazovat nástrojové lišty</translation>
|
<translation>Zobrazovat nástrojové lišty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="361"/>
|
<location filename="../src/gui.cpp" line="359"/>
|
||||||
<source>Metric</source>
|
<source>Metric</source>
|
||||||
<translation>Metrické</translation>
|
<translation>Metrické</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="366"/>
|
<location filename="../src/gui.cpp" line="364"/>
|
||||||
<source>Imperial</source>
|
<source>Imperial</source>
|
||||||
<translation>Imperiální</translation>
|
<translation>Imperiální</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="372"/>
|
<location filename="../src/gui.cpp" line="370"/>
|
||||||
<source>Fullscreen mode</source>
|
<source>Fullscreen mode</source>
|
||||||
<translation>Celoobrazovkový režim</translation>
|
<translation>Celoobrazovkový režim</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="380"/>
|
<location filename="../src/gui.cpp" line="376"/>
|
||||||
|
<source>Options...</source>
|
||||||
|
<translation>Nastavení...</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="381"/>
|
||||||
<source>Next</source>
|
<source>Next</source>
|
||||||
<translation>Následující</translation>
|
<translation>Následující</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="383"/>
|
<location filename="../src/gui.cpp" line="384"/>
|
||||||
<source>Previous</source>
|
<source>Previous</source>
|
||||||
<translation>Předchozí</translation>
|
<translation>Předchozí</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="387"/>
|
<location filename="../src/gui.cpp" line="388"/>
|
||||||
<source>Last</source>
|
<source>Last</source>
|
||||||
<translation>Poslední</translation>
|
<translation>Poslední</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="390"/>
|
<location filename="../src/gui.cpp" line="391"/>
|
||||||
<source>First</source>
|
<source>First</source>
|
||||||
<translation>První</translation>
|
<translation>První</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="412"/>
|
<location filename="../src/gui.cpp" line="413"/>
|
||||||
<source>Map</source>
|
<source>Map</source>
|
||||||
<translation>Mapa</translation>
|
<translation>Mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="419"/>
|
<location filename="../src/gui.cpp" line="420"/>
|
||||||
<source>Graph</source>
|
<source>Graph</source>
|
||||||
<translation>Graf</translation>
|
<translation>Graf</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="427"/>
|
<location filename="../src/gui.cpp" line="428"/>
|
||||||
<source>POI</source>
|
<source>POI</source>
|
||||||
<translation>POI</translation>
|
<translation>POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="428"/>
|
<location filename="../src/gui.cpp" line="429"/>
|
||||||
<source>POI files</source>
|
<source>POI files</source>
|
||||||
<translation>POI soubory</translation>
|
<translation>POI soubory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="439"/>
|
<location filename="../src/gui.cpp" line="440"/>
|
||||||
<source>Data</source>
|
<source>Data</source>
|
||||||
<translation>Data</translation>
|
<translation>Data</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="440"/>
|
<location filename="../src/gui.cpp" line="441"/>
|
||||||
<source>Display</source>
|
<source>Display</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="448"/>
|
<location filename="../src/gui.cpp" line="449"/>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Nastavení</translation>
|
<translation>Nastavení</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="449"/>
|
<location filename="../src/gui.cpp" line="450"/>
|
||||||
<source>Units</source>
|
<source>Units</source>
|
||||||
<translation>Jednotky</translation>
|
<translation>Jednotky</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="457"/>
|
<location filename="../src/gui.cpp" line="459"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation>Nápověda</translation>
|
<translation>Nápověda</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="578"/>
|
<location filename="../src/gui.cpp" line="580"/>
|
||||||
<source>Previous map</source>
|
<source>Previous map</source>
|
||||||
<translation>Předchozí mapa</translation>
|
<translation>Předchozí mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="113"/>
|
<location filename="../src/gui.cpp" line="1060"/>
|
||||||
|
<source>No files loaded</source>
|
||||||
|
<translation>Nejsou načteny žádné soubory</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="103"/>
|
||||||
<source>GPX files (*.gpx)</source>
|
<source>GPX files (*.gpx)</source>
|
||||||
<translation>Soubory GPX (*.gpx)</translation>
|
<translation>Soubory GPX (*.gpx)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="114"/>
|
<location filename="../src/gui.cpp" line="105"/>
|
||||||
<source>TCX files (*.tcx)</source>
|
<source>TCX files (*.tcx)</source>
|
||||||
<translation>Soubory TCX (*.tcx)</translation>
|
<translation>Soubory TCX (*.tcx)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="113"/>
|
<location filename="../src/gui.cpp" line="104"/>
|
||||||
<source>KML files (*.kml)</source>
|
<source>KML files (*.kml)</source>
|
||||||
<translation>Soubory KML (*.kml)</translation>
|
<translation>Soubory KML (*.kml)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="112"/>
|
<location filename="../src/gui.cpp" line="102"/>
|
||||||
<source>CSV files (*.csv)</source>
|
<source>CSV files (*.csv)</source>
|
||||||
<translation>Soubory CSV (*.csv)</translation>
|
<translation>Soubory CSV (*.csv)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="114"/>
|
<location filename="../src/gui.cpp" line="105"/>
|
||||||
<source>All files (*)</source>
|
<source>All files (*)</source>
|
||||||
<translation>Všechny soubory (*)</translation>
|
<translation>Všechny soubory (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="781"/>
|
<location filename="../src/gui.cpp" line="844"/>
|
||||||
<location filename="../src/gui.cpp" line="784"/>
|
<location filename="../src/gui.cpp" line="847"/>
|
||||||
<source>Date</source>
|
<source>Date</source>
|
||||||
<translation>Datum</translation>
|
<translation>Datum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="793"/>
|
<location filename="../src/gui.cpp" line="836"/>
|
||||||
<source>Routes</source>
|
<source>Routes</source>
|
||||||
<translation>Trasy</translation>
|
<translation>Trasy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<location filename="../src/gui.cpp" line="981"/>
|
|
||||||
<source>No GPX files loaded</source>
|
|
||||||
<translation>Nejsou načteny žádné GPX soubory</translation>
|
|
||||||
</message>
|
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui.cpp" line="985"/>
|
<location filename="../src/gui.cpp" line="1064"/>
|
||||||
<source>%n files</source>
|
<source>%n files</source>
|
||||||
<translation>
|
<translation>
|
||||||
<numerusform>%n soubor</numerusform>
|
<numerusform>%n soubor</numerusform>
|
||||||
@ -472,121 +482,131 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="569"/>
|
<location filename="../src/gui.cpp" line="571"/>
|
||||||
<source>Next file</source>
|
<source>Next file</source>
|
||||||
<translation>Následující soubor</translation>
|
<translation>Následující soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="546"/>
|
<location filename="../src/gui.cpp" line="548"/>
|
||||||
<source>Version </source>
|
<source>Version </source>
|
||||||
<translation>Verze </translation>
|
<translation>Verze </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="230"/>
|
<location filename="../src/gui.cpp" line="228"/>
|
||||||
<source>Print...</source>
|
<source>Print...</source>
|
||||||
<translation>Tisknout...</translation>
|
<translation>Tisknout...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="235"/>
|
<location filename="../src/gui.cpp" line="233"/>
|
||||||
<source>Export to PDF...</source>
|
<source>Export to PDF...</source>
|
||||||
<translation>Exportovat do PDF...</translation>
|
<translation>Exportovat do PDF...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="795"/>
|
<location filename="../src/gui.cpp" line="838"/>
|
||||||
<source>Waypoints</source>
|
<source>Waypoints</source>
|
||||||
<translation>Navigační body</translation>
|
<translation>Navigační body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="570"/>
|
<location filename="../src/gui.cpp" line="572"/>
|
||||||
<source>Previous file</source>
|
<source>Previous file</source>
|
||||||
<translation>Předchozí soubor</translation>
|
<translation>Předchozí soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="320"/>
|
<location filename="../src/gui.cpp" line="101"/>
|
||||||
|
<source>Supported files (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)</source>
|
||||||
|
<translation>Podporované soubory (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="318"/>
|
||||||
<source>Route waypoints</source>
|
<source>Route waypoints</source>
|
||||||
<translation>Body tras</translation>
|
<translation>Body tras</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="572"/>
|
<location filename="../src/gui.cpp" line="574"/>
|
||||||
<source>First file</source>
|
<source>First file</source>
|
||||||
<translation>První soubor</translation>
|
<translation>První soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="573"/>
|
<location filename="../src/gui.cpp" line="575"/>
|
||||||
<source>Last file</source>
|
<source>Last file</source>
|
||||||
<translation>Poslední soubor</translation>
|
<translation>Poslední soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="574"/>
|
<location filename="../src/gui.cpp" line="576"/>
|
||||||
<source>Append modifier</source>
|
<source>Append modifier</source>
|
||||||
<translation>Modifikátor nahradit/přidat</translation>
|
<translation>Modifikátor nahradit/přidat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="593"/>
|
<location filename="../src/gui.cpp" line="595"/>
|
||||||
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
|
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
|
||||||
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
|
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="596"/>
|
<location filename="../src/gui.cpp" line="598"/>
|
||||||
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
|
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
|
||||||
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
|
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="604"/>
|
<location filename="../src/gui.cpp" line="606"/>
|
||||||
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
|
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
|
||||||
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
|
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="684"/>
|
<location filename="../src/gui.cpp" line="694"/>
|
||||||
<source>Error loading data file:</source>
|
<source>Error loading data file:</source>
|
||||||
<translation>Datový soubor nelze načíst:</translation>
|
<translation>Datový soubor nelze načíst:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="687"/>
|
<location filename="../src/gui.cpp" line="697"/>
|
||||||
<location filename="../src/gui.cpp" line="712"/>
|
<location filename="../src/gui.cpp" line="722"/>
|
||||||
<source>Line: %1</source>
|
<source>Line: %1</source>
|
||||||
<translation>Řádka: %1</translation>
|
<translation>Řádka: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="709"/>
|
<location filename="../src/gui.cpp" line="719"/>
|
||||||
<source>Error loading POI file:</source>
|
<source>Error loading POI file:</source>
|
||||||
<translation>Soubor POI nelze načíst:</translation>
|
<translation>Soubor POI nelze načíst:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="791"/>
|
<location filename="../src/gui.cpp" line="830"/>
|
||||||
|
<source>Name</source>
|
||||||
|
<translation>Název</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="834"/>
|
||||||
<source>Tracks</source>
|
<source>Tracks</source>
|
||||||
<translation>Cesty</translation>
|
<translation>Cesty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="220"/>
|
<location filename="../src/gui.cpp" line="218"/>
|
||||||
<location filename="../src/gui.cpp" line="544"/>
|
<location filename="../src/gui.cpp" line="546"/>
|
||||||
<source>About GPXSee</source>
|
<source>About GPXSee</source>
|
||||||
<translation>O aplikaci GPXSee</translation>
|
<translation>O aplikaci GPXSee</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="481"/>
|
<location filename="../src/gui.cpp" line="483"/>
|
||||||
<source>Navigation</source>
|
<source>Navigation</source>
|
||||||
<translation>Navigace</translation>
|
<translation>Navigace</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="592"/>
|
<location filename="../src/gui.cpp" line="594"/>
|
||||||
<source>Map sources</source>
|
<source>Map sources</source>
|
||||||
<translation>Mapové zdroje</translation>
|
<translation>Mapové zdroje</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="603"/>
|
<location filename="../src/gui.cpp" line="605"/>
|
||||||
<source>POIs</source>
|
<source>POIs</source>
|
||||||
<translation>POI body</translation>
|
<translation>POI body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="335"/>
|
<location filename="../src/gui.cpp" line="333"/>
|
||||||
<location filename="../src/gui.cpp" line="798"/>
|
<location filename="../src/gui.cpp" line="854"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="342"/>
|
<location filename="../src/gui.cpp" line="340"/>
|
||||||
<location filename="../src/gui.cpp" line="800"/>
|
<location filename="../src/gui.cpp" line="856"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -594,48 +614,48 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GraphView</name>
|
<name>GraphView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="102"/>
|
<location filename="../src/graphview.cpp" line="108"/>
|
||||||
<source>m</source>
|
<source>m</source>
|
||||||
<translation>m</translation>
|
<translation>m</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="105"/>
|
<location filename="../src/graphview.cpp" line="111"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation>km</translation>
|
<translation>km</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="110"/>
|
<location filename="../src/graphview.cpp" line="116"/>
|
||||||
<source>ft</source>
|
<source>ft</source>
|
||||||
<translation>ft</translation>
|
<translation>ft</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="113"/>
|
<location filename="../src/graphview.cpp" line="119"/>
|
||||||
<source>mi</source>
|
<source>mi</source>
|
||||||
<translation>mi</translation>
|
<translation>mi</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="119"/>
|
<location filename="../src/graphview.cpp" line="125"/>
|
||||||
<source>s</source>
|
<source>s</source>
|
||||||
<translation>s</translation>
|
<translation>s</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="122"/>
|
<location filename="../src/graphview.cpp" line="128"/>
|
||||||
<source>min</source>
|
<source>min</source>
|
||||||
<translation>min</translation>
|
<translation>min</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="125"/>
|
<location filename="../src/graphview.cpp" line="131"/>
|
||||||
<source>h</source>
|
<source>h</source>
|
||||||
<translation>h</translation>
|
<translation>h</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="54"/>
|
<location filename="../src/graphview.cpp" line="60"/>
|
||||||
<location filename="../src/graphview.cpp" line="151"/>
|
<location filename="../src/graphview.cpp" line="157"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/graphview.cpp" line="153"/>
|
<location filename="../src/graphview.cpp" line="159"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -664,6 +684,158 @@
|
|||||||
<translation>Maximum</translation>
|
<translation>Maximum</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>OptionsDialog</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="34"/>
|
||||||
|
<source>Base color:</source>
|
||||||
|
<translation>Základní barva:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="35"/>
|
||||||
|
<source>Palette shift:</source>
|
||||||
|
<translation>Posun palety:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="47"/>
|
||||||
|
<source>Track width:</source>
|
||||||
|
<translation>Šířka cest:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="48"/>
|
||||||
|
<source>Track style:</source>
|
||||||
|
<translation>Styl cest:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="50"/>
|
||||||
|
<source>Tracks</source>
|
||||||
|
<translation>Cesty</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="60"/>
|
||||||
|
<source>Route width:</source>
|
||||||
|
<translation>Šířka tras:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="61"/>
|
||||||
|
<source>Route style:</source>
|
||||||
|
<translation>Styl tras:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="63"/>
|
||||||
|
<source>Routes</source>
|
||||||
|
<translation>Trasy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="67"/>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="99"/>
|
||||||
|
<source>Use anti-aliasing</source>
|
||||||
|
<translation>Vyhlazovat hrany</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="97"/>
|
||||||
|
<source>Line width:</source>
|
||||||
|
<translation>Šířka čar:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="113"/>
|
||||||
|
<source>Colors</source>
|
||||||
|
<translation>Barvy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="114"/>
|
||||||
|
<source>Paths</source>
|
||||||
|
<translation>Trasy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="115"/>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="180"/>
|
||||||
|
<source>Graphs</source>
|
||||||
|
<translation>Grafy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="127"/>
|
||||||
|
<source>mi</source>
|
||||||
|
<translation>mi</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="130"/>
|
||||||
|
<source>km</source>
|
||||||
|
<translation>km</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="134"/>
|
||||||
|
<source>POI radius:</source>
|
||||||
|
<translation>POI radius:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="140"/>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="221"/>
|
||||||
|
<source>POI</source>
|
||||||
|
<translation>POI</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="147"/>
|
||||||
|
<source>Name</source>
|
||||||
|
<translation>Název</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="149"/>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation>Datum</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="151"/>
|
||||||
|
<source>Distance</source>
|
||||||
|
<translation>Vzdálenost</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="153"/>
|
||||||
|
<source>Time</source>
|
||||||
|
<translation>Čas</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="155"/>
|
||||||
|
<source>Item count (>1)</source>
|
||||||
|
<translation>Počet objektů (>1)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="169"/>
|
||||||
|
<source>Separate graph page</source>
|
||||||
|
<translation>Samostatná stránka s grafy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="179"/>
|
||||||
|
<source>Header</source>
|
||||||
|
<translation>Záhlaví</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="187"/>
|
||||||
|
<source>Use OpenGL</source>
|
||||||
|
<translation>Používat OpenGL</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="203"/>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="224"/>
|
||||||
|
<source>System</source>
|
||||||
|
<translation>Systém</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="219"/>
|
||||||
|
<source>Appearance</source>
|
||||||
|
<translation>Vzhled</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="222"/>
|
||||||
|
<source>Print & Export</source>
|
||||||
|
<translation>Tisk a export</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/optionsdialog.cpp" line="251"/>
|
||||||
|
<source>Options</source>
|
||||||
|
<translation>Nastavení</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PowerGraph</name>
|
<name>PowerGraph</name>
|
||||||
<message>
|
<message>
|
||||||
@ -691,17 +863,17 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>RouteItem</name>
|
<name>RouteItem</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/routeitem.cpp" line="15"/>
|
<location filename="../src/routeitem.cpp" line="14"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Název</translation>
|
<translation>Název</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/routeitem.cpp" line="17"/>
|
<location filename="../src/routeitem.cpp" line="16"/>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Popis</translation>
|
<translation>Popis</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/routeitem.cpp" line="18"/>
|
<location filename="../src/routeitem.cpp" line="17"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -709,22 +881,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>ScaleItem</name>
|
<name>ScaleItem</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/scaleitem.cpp" line="90"/>
|
<location filename="../src/scaleitem.cpp" line="81"/>
|
||||||
<source>mi</source>
|
<source>mi</source>
|
||||||
<translation>mi</translation>
|
<translation>mi</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/scaleitem.cpp" line="91"/>
|
<location filename="../src/scaleitem.cpp" line="82"/>
|
||||||
<source>ft</source>
|
<source>ft</source>
|
||||||
<translation>ft</translation>
|
<translation>ft</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/scaleitem.cpp" line="93"/>
|
<location filename="../src/scaleitem.cpp" line="84"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation>km</translation>
|
<translation>km</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/scaleitem.cpp" line="94"/>
|
<location filename="../src/scaleitem.cpp" line="85"/>
|
||||||
<source>m</source>
|
<source>m</source>
|
||||||
<translation>m</translation>
|
<translation>m</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -795,27 +967,27 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>TrackItem</name>
|
<name>TrackItem</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/trackitem.cpp" line="14"/>
|
<location filename="../src/trackitem.cpp" line="12"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Název</translation>
|
<translation>Název</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/trackitem.cpp" line="16"/>
|
<location filename="../src/trackitem.cpp" line="14"/>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Popis</translation>
|
<translation>Popis</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/trackitem.cpp" line="17"/>
|
<location filename="../src/trackitem.cpp" line="15"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/trackitem.cpp" line="20"/>
|
<location filename="../src/trackitem.cpp" line="17"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/trackitem.cpp" line="23"/>
|
<location filename="../src/trackitem.cpp" line="19"/>
|
||||||
<source>Date</source>
|
<source>Date</source>
|
||||||
<translation>Datum</translation>
|
<translation>Datum</translation>
|
||||||
</message>
|
</message>
|
||||||
|
1022
lang/gpxsee_sv.ts
Normal file
@ -4,7 +4,7 @@
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "3.0"
|
!define VERSION "3.8"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}.exe"
|
OutFile "GPXSee-${VERSION}.exe"
|
||||||
@ -26,6 +26,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
|||||||
!define REGTCX "GPXSee.tcx"
|
!define REGTCX "GPXSee.tcx"
|
||||||
!define REGKML "GPXSee.kml"
|
!define REGKML "GPXSee.kml"
|
||||||
!define REGFIT "GPXSee.fit"
|
!define REGFIT "GPXSee.fit"
|
||||||
|
!define REGIGC "GPXSee.igc"
|
||||||
|
!define REGNMEA "GPXSee.nmea"
|
||||||
|
|
||||||
; Start menu page configuration
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -107,6 +109,14 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||||
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||||
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
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)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
@ -120,6 +130,8 @@ Section "QT libs" SEC_QT
|
|||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
File "libGLESv2.dll"
|
File "libGLESv2.dll"
|
||||||
|
File "libEGL.dll"
|
||||||
|
File "D3DCompiler_47.dll"
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
File /r "printsupport"
|
File /r "printsupport"
|
||||||
@ -175,6 +187,10 @@ Section "Uninstall"
|
|||||||
DeleteRegKey HKCR ".kml"
|
DeleteRegKey HKCR ".kml"
|
||||||
DeleteRegKey HKCR "${REGFIT}"
|
DeleteRegKey HKCR "${REGFIT}"
|
||||||
DeleteRegKey HKCR ".fit"
|
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)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@ -196,4 +212,4 @@ LangString DESC_APP ${LANG_ENGLISH} \
|
|||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "3.0"
|
!define VERSION "3.8"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
@ -26,6 +26,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
|||||||
!define REGTCX "GPXSee.tcx"
|
!define REGTCX "GPXSee.tcx"
|
||||||
!define REGKML "GPXSee.kml"
|
!define REGKML "GPXSee.kml"
|
||||||
!define REGFIT "GPXSee.fit"
|
!define REGFIT "GPXSee.fit"
|
||||||
|
!define REGIGC "GPXSee.igc"
|
||||||
|
!define REGNMEA "GPXSee.nmea"
|
||||||
|
|
||||||
; Start menu page configuration
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -115,7 +117,15 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||||
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||||
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
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)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@ -128,6 +138,8 @@ Section "QT libs" SEC_QT
|
|||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
File "libGLESv2.dll"
|
File "libGLESv2.dll"
|
||||||
|
File "libEGL.dll"
|
||||||
|
File "D3DCompiler_47.dll"
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
File /r "printsupport"
|
File /r "printsupport"
|
||||||
@ -179,6 +191,10 @@ Section "Uninstall"
|
|||||||
DeleteRegKey HKCR ".kml"
|
DeleteRegKey HKCR ".kml"
|
||||||
DeleteRegKey HKCR "${REGFIT}"
|
DeleteRegKey HKCR "${REGFIT}"
|
||||||
DeleteRegKey HKCR ".fit"
|
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)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@ -200,4 +216,4 @@ LangString DESC_APP ${LANG_ENGLISH} \
|
|||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
|
#include <QPixmapCache>
|
||||||
|
#include "opengl.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
@ -20,6 +22,8 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
|||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
|
QPixmapCache::setCacheLimit(65536);
|
||||||
|
OPENGL_SET_SAMPLES(4);
|
||||||
|
|
||||||
_gui = new GUI();
|
_gui = new GUI();
|
||||||
}
|
}
|
||||||
|
68
src/colorbox.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include <QStylePainter>
|
||||||
|
#include <QStyleOptionComboBox>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include "colorbox.h"
|
||||||
|
|
||||||
|
|
||||||
|
ColorBox::ColorBox(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
_color = Qt::red;
|
||||||
|
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;
|
||||||
|
|
||||||
|
QColor color = QColorDialog::getColor(_color, this, QString(),
|
||||||
|
QColorDialog::ShowAlphaChannel);
|
||||||
|
if (color.isValid()) {
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
emit colorChanged(_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColorBox::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
29
src/colorbox.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#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);
|
||||||
|
|
||||||
|
QSize sizeHint() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void colorChanged(const QColor &color);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor _color;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COLORBOX_H
|
@ -2,6 +2,10 @@
|
|||||||
#include "wgs84.h"
|
#include "wgs84.h"
|
||||||
#include "coordinates.h"
|
#include "coordinates.h"
|
||||||
|
|
||||||
|
#define MIN_LAT deg2rad(-90.0)
|
||||||
|
#define MAX_LAT deg2rad(90.0)
|
||||||
|
#define MIN_LON deg2rad(-180.0)
|
||||||
|
#define MAX_LON deg2rad(180.0)
|
||||||
|
|
||||||
qreal Coordinates::distanceTo(const Coordinates &c) const
|
qreal Coordinates::distanceTo(const Coordinates &c) const
|
||||||
{
|
{
|
||||||
@ -35,3 +39,31 @@ QDebug operator<<(QDebug dbg, const Coordinates &coordinates)
|
|||||||
|
|
||||||
return dbg.maybeSpace();
|
return dbg.maybeSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
|
||||||
|
{
|
||||||
|
qreal radDist = distance / WGS84_RADIUS;
|
||||||
|
|
||||||
|
qreal minLat = deg2rad(_lat) - radDist;
|
||||||
|
qreal maxLat = deg2rad(_lat) + radDist;
|
||||||
|
|
||||||
|
qreal minLon, maxLon;
|
||||||
|
if (minLat > MIN_LAT && maxLat < MAX_LAT) {
|
||||||
|
qreal deltaLon = asin(sin(radDist) / cos(_lat));
|
||||||
|
minLon = deg2rad(_lon) - deltaLon;
|
||||||
|
if (minLon < MIN_LON)
|
||||||
|
minLon += 2.0 * M_PI;
|
||||||
|
maxLon = deg2rad(_lon) + deltaLon;
|
||||||
|
if (maxLon > MAX_LON)
|
||||||
|
maxLon -= 2.0 * M_PI;
|
||||||
|
} else {
|
||||||
|
// a pole is within the distance
|
||||||
|
minLat = qMax(minLat, MIN_LAT);
|
||||||
|
maxLat = qMin(maxLat, MAX_LAT);
|
||||||
|
minLon = MIN_LON;
|
||||||
|
maxLon = MAX_LON;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QPair<Coordinates, Coordinates>(Coordinates(rad2deg(minLon),
|
||||||
|
rad2deg(minLat)), Coordinates(rad2deg(maxLon), rad2deg(maxLat)));
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
&& _lat <= 90.0) ? true : false;}
|
&& _lat <= 90.0) ? true : false;}
|
||||||
|
|
||||||
qreal distanceTo(const Coordinates &c) const;
|
qreal distanceTo(const Coordinates &c) const;
|
||||||
|
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;
|
||||||
|
|
||||||
QPointF toMercator() const;
|
QPointF toMercator() const;
|
||||||
static Coordinates fromMercator(const QPointF &m);
|
static Coordinates fromMercator(const QPointF &m);
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
bool CSVParser::loadFile(QFile *file)
|
bool CSVParser::loadFile(QFile *file)
|
||||||
{
|
{
|
||||||
bool res;
|
bool res;
|
||||||
int ln = 1;
|
|
||||||
|
|
||||||
_errorLine = 0;
|
_errorLine = 1;
|
||||||
_errorString.clear();
|
_errorString.clear();
|
||||||
|
|
||||||
while (!file->atEnd()) {
|
while (!file->atEnd()) {
|
||||||
@ -13,20 +12,17 @@ bool CSVParser::loadFile(QFile *file)
|
|||||||
QList<QByteArray> list = line.split(',');
|
QList<QByteArray> list = line.split(',');
|
||||||
if (list.size() < 3) {
|
if (list.size() < 3) {
|
||||||
_errorString = "Parse error";
|
_errorString = "Parse error";
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal lat = list[0].trimmed().toDouble(&res);
|
qreal lat = list[0].trimmed().toDouble(&res);
|
||||||
if (!res || (lat < -90.0 || lat > 90.0)) {
|
if (!res || (lat < -90.0 || lat > 90.0)) {
|
||||||
_errorString = "Invalid latitude";
|
_errorString = "Invalid latitude";
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qreal lon = list[1].trimmed().toDouble(&res);
|
qreal lon = list[1].trimmed().toDouble(&res);
|
||||||
if (!res || (lon < -180.0 || lon > 180.0)) {
|
if (!res || (lon < -180.0 || lon > 180.0)) {
|
||||||
_errorString = "Invalid longitude";
|
_errorString = "Invalid longitude";
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Waypoint wp(Coordinates(lon, lat));
|
Waypoint wp(Coordinates(lon, lat));
|
||||||
@ -41,7 +37,7 @@ bool CSVParser::loadFile(QFile *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_waypoints.append(wp);
|
_waypoints.append(wp);
|
||||||
ln++;
|
_errorLine++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "csvparser.h"
|
#include "csvparser.h"
|
||||||
#include "kmlparser.h"
|
#include "kmlparser.h"
|
||||||
#include "fitparser.h"
|
#include "fitparser.h"
|
||||||
|
#include "igcparser.h"
|
||||||
|
#include "nmeaparser.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
|
||||||
|
|
||||||
@ -21,6 +23,10 @@ Data::Data() : _errorLine(0)
|
|||||||
_waypointData));
|
_waypointData));
|
||||||
_parsers.insert("csv", new CSVParser(_trackData, _routeData,
|
_parsers.insert("csv", new CSVParser(_trackData, _routeData,
|
||||||
_waypointData));
|
_waypointData));
|
||||||
|
_parsers.insert("igc", new IGCParser(_trackData, _routeData,
|
||||||
|
_waypointData));
|
||||||
|
_parsers.insert("nmea", new NMEAParser(_trackData, _routeData,
|
||||||
|
_waypointData));
|
||||||
}
|
}
|
||||||
|
|
||||||
Data::~Data()
|
Data::~Data()
|
||||||
|
@ -17,25 +17,39 @@
|
|||||||
#define USER_AGENT \
|
#define USER_AGENT \
|
||||||
APP_NAME "/" APP_VERSION " (" PLATFORM_STR "; Qt " QT_VERSION_STR ")"
|
APP_NAME "/" APP_VERSION " (" PLATFORM_STR "; Qt " QT_VERSION_STR ")"
|
||||||
|
|
||||||
|
#define ATTR_REDIRECT QNetworkRequest::RedirectionTargetAttribute
|
||||||
|
#define ATTR_FILE QNetworkRequest::User
|
||||||
|
#define ATTR_ORIGIN (QNetworkRequest::Attribute)(QNetworkRequest::User + 1)
|
||||||
|
#define ATTR_LEVEL (QNetworkRequest::Attribute)(QNetworkRequest::User + 2)
|
||||||
|
|
||||||
|
#define MAX_REDIRECT_LEVEL 5
|
||||||
|
|
||||||
|
|
||||||
Downloader::Downloader()
|
Downloader::Downloader()
|
||||||
{
|
{
|
||||||
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
|
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
|
||||||
SLOT(downloadFinished(QNetworkReply*)));
|
SLOT(downloadFinished(QNetworkReply*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Downloader::doDownload(const Download &dl)
|
bool Downloader::doDownload(const Download &dl, const Redirect &redirect)
|
||||||
{
|
{
|
||||||
QUrl url(dl.url());
|
QUrl url(dl.url());
|
||||||
|
|
||||||
if (_errorDownloads.contains(url))
|
if (_errorDownloads.contains(url))
|
||||||
return false;
|
return false;
|
||||||
|
if (_currentDownloads.contains(url))
|
||||||
|
return false;
|
||||||
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
request.setAttribute(QNetworkRequest::User, QVariant(dl.file()));
|
request.setAttribute(ATTR_FILE, QVariant(dl.file()));
|
||||||
|
if (!redirect.isNull()) {
|
||||||
|
request.setAttribute(ATTR_ORIGIN, QVariant(redirect.origin()));
|
||||||
|
request.setAttribute(ATTR_LEVEL, QVariant(redirect.level()));
|
||||||
|
}
|
||||||
request.setRawHeader("User-Agent", USER_AGENT);
|
request.setRawHeader("User-Agent", USER_AGENT);
|
||||||
QNetworkReply *reply = _manager.get(request);
|
QNetworkReply *reply = _manager.get(request);
|
||||||
|
|
||||||
_currentDownloads.append(reply);
|
_currentDownloads.insert(url, reply);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,26 +72,49 @@ bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
|
|||||||
|
|
||||||
void Downloader::downloadFinished(QNetworkReply *reply)
|
void Downloader::downloadFinished(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
QUrl url = reply->url();
|
QUrl url = reply->request().url();
|
||||||
|
|
||||||
if (reply->error()) {
|
if (reply->error()) {
|
||||||
_errorDownloads.insert(url);
|
QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl();
|
||||||
fprintf(stderr, "Error downloading map tile: %s: %s\n",
|
if (origin.isEmpty()) {
|
||||||
url.toEncoded().constData(), qPrintable(reply->errorString()));
|
_errorDownloads.insert(url);
|
||||||
|
fprintf(stderr, "Error downloading map tile: %s: %s\n",
|
||||||
|
url.toEncoded().constData(), qPrintable(reply->errorString()));
|
||||||
|
} else {
|
||||||
|
_errorDownloads.insert(origin);
|
||||||
|
fprintf(stderr, "Error downloading map tile: %s -> %s: %s\n",
|
||||||
|
origin.toEncoded().constData(), url.toEncoded().constData(),
|
||||||
|
qPrintable(reply->errorString()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
QUrl redirect = reply->attribute(
|
QUrl location = reply->attribute(ATTR_REDIRECT).toUrl();
|
||||||
QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
QString filename = reply->request().attribute(ATTR_FILE)
|
||||||
QString filename = reply->request().attribute(QNetworkRequest::User)
|
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
if (!redirect.isEmpty()) {
|
if (!location.isEmpty()) {
|
||||||
Download dl(redirect, filename);
|
QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl();
|
||||||
doDownload(dl);
|
int level = reply->request().attribute(ATTR_LEVEL).toInt();
|
||||||
|
|
||||||
|
if (location == url) {
|
||||||
|
_errorDownloads.insert(url);
|
||||||
|
fprintf(stderr, "Error downloading map tile: %s: "
|
||||||
|
"redirect loop\n", url.toEncoded().constData());
|
||||||
|
} else if (level >= MAX_REDIRECT_LEVEL) {
|
||||||
|
_errorDownloads.insert(origin);
|
||||||
|
fprintf(stderr, "Error downloading map tile: %s: "
|
||||||
|
"redirect level limit reached\n",
|
||||||
|
origin.toEncoded().constData());
|
||||||
|
} else {
|
||||||
|
Redirect redirect(origin.isEmpty() ? url : origin, level + 1);
|
||||||
|
Download dl(location, filename);
|
||||||
|
doDownload(dl, redirect);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
if (!saveToDisk(filename, reply))
|
if (!saveToDisk(filename, reply))
|
||||||
_errorDownloads.insert(url);
|
_errorDownloads.insert(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentDownloads.removeAll(reply);
|
_currentDownloads.remove(url);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
if (_currentDownloads.isEmpty())
|
if (_currentDownloads.isEmpty())
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QList>
|
#include <QMap>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
|
|
||||||
@ -39,15 +39,32 @@ private slots:
|
|||||||
void downloadFinished(QNetworkReply *reply);
|
void downloadFinished(QNetworkReply *reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
class Redirect
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Redirect() : _level(0) {}
|
||||||
|
Redirect(const QUrl &origin, int level) :
|
||||||
|
_origin(origin), _level(level) {}
|
||||||
|
|
||||||
|
const QUrl &origin() const {return _origin;}
|
||||||
|
int level() const {return _level;}
|
||||||
|
|
||||||
|
bool isNull() const {return (_level == 0);}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QUrl _origin;
|
||||||
|
int _level;
|
||||||
|
};
|
||||||
|
|
||||||
Downloader();
|
Downloader();
|
||||||
Downloader(Downloader const&);
|
Downloader(Downloader const&);
|
||||||
void operator=(Downloader const&);
|
void operator=(Downloader const&);
|
||||||
|
|
||||||
bool doDownload(const Download &dl);
|
bool doDownload(const Download &dl, const Redirect &redirect = Redirect());
|
||||||
bool saveToDisk(const QString &filename, QIODevice *data);
|
bool saveToDisk(const QString &filename, QIODevice *data);
|
||||||
|
|
||||||
QNetworkAccessManager _manager;
|
QNetworkAccessManager _manager;
|
||||||
QList<QNetworkReply *> _currentDownloads;
|
QMap<QUrl, QNetworkReply *> _currentDownloads;
|
||||||
QSet<QUrl> _errorDownloads;
|
QSet<QUrl> _errorDownloads;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,23 +11,19 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include <QLocale>
|
|
||||||
#include "fileselectwidget.h"
|
#include "fileselectwidget.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "exportdialog.h"
|
#include "exportdialog.h"
|
||||||
|
|
||||||
|
|
||||||
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
||||||
: QDialog(parent), _printer(printer)
|
: QDialog(parent), _export(exp)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
_units = (QLocale::system().measurementSystem()
|
|
||||||
== QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter;
|
|
||||||
|
|
||||||
_fileSelect = new FileSelectWidget();
|
_fileSelect = new FileSelectWidget();
|
||||||
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
||||||
_fileSelect->setFile(_printer->outputFileName());
|
_fileSelect->setFile(_export->fileName);
|
||||||
|
|
||||||
_paperSize = new QComboBox();
|
_paperSize = new QComboBox();
|
||||||
_paperSize->addItem("A3", QPrinter::A3);
|
_paperSize->addItem("A3", QPrinter::A3);
|
||||||
@ -36,7 +32,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
|||||||
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
|
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
|
||||||
_paperSize->addItem("Legal", QPrinter::Legal);
|
_paperSize->addItem("Legal", QPrinter::Legal);
|
||||||
_paperSize->addItem("Letter", QPrinter::Letter);
|
_paperSize->addItem("Letter", QPrinter::Letter);
|
||||||
if ((index = _paperSize->findData(_printer->paperSize())) >= 0)
|
if ((index = _paperSize->findData(_export->paperSize)) >= 0)
|
||||||
_paperSize->setCurrentIndex(index);
|
_paperSize->setCurrentIndex(index);
|
||||||
|
|
||||||
_portrait = new QRadioButton(tr("Portrait"));
|
_portrait = new QRadioButton(tr("Portrait"));
|
||||||
@ -44,32 +40,34 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
|||||||
QHBoxLayout *orientationLayout = new QHBoxLayout();
|
QHBoxLayout *orientationLayout = new QHBoxLayout();
|
||||||
orientationLayout->addWidget(_portrait);
|
orientationLayout->addWidget(_portrait);
|
||||||
orientationLayout->addWidget(_landscape);
|
orientationLayout->addWidget(_landscape);
|
||||||
if (_printer->orientation() == QPrinter::Portrait)
|
if (_export->orientation == QPrinter::Portrait)
|
||||||
_portrait->setChecked(true);
|
_portrait->setChecked(true);
|
||||||
else
|
else
|
||||||
_landscape->setChecked(true);
|
_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();
|
_topMargin = new QDoubleSpinBox();
|
||||||
_bottomMargin = new QDoubleSpinBox();
|
_bottomMargin = new QDoubleSpinBox();
|
||||||
_leftMargin = new QDoubleSpinBox();
|
_leftMargin = new QDoubleSpinBox();
|
||||||
_rightMargin = new QDoubleSpinBox();
|
_rightMargin = new QDoubleSpinBox();
|
||||||
_topMargin->setValue(top);
|
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
|
||||||
_topMargin->setSuffix(UNIT_SPACE + us);
|
_topMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_bottomMargin->setValue(bottom);
|
|
||||||
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_leftMargin->setValue(left);
|
|
||||||
_leftMargin->setSuffix(UNIT_SPACE + us);
|
_leftMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_rightMargin->setValue(right);
|
|
||||||
_rightMargin->setSuffix(UNIT_SPACE + us);
|
_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);
|
_topMargin->setSingleStep(0.1);
|
||||||
_bottomMargin->setSingleStep(0.1);
|
_bottomMargin->setSingleStep(0.1);
|
||||||
_leftMargin->setSingleStep(0.1);
|
_leftMargin->setSingleStep(0.1);
|
||||||
_rightMargin->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();
|
QGridLayout *marginsLayout = new QGridLayout();
|
||||||
@ -164,12 +162,16 @@ void ExportDialog::accept()
|
|||||||
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
|
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
|
||||||
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
|
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
|
||||||
|
|
||||||
_printer->setOutputFormat(QPrinter::PdfFormat);
|
_export->fileName = _fileSelect->file();
|
||||||
_printer->setOutputFileName(_fileSelect->file());
|
_export->paperSize = paperSize;
|
||||||
_printer->setPaperSize(paperSize);
|
_export->orientation = orientation;
|
||||||
_printer->setOrientation(orientation);
|
if (_export->units == Imperial)
|
||||||
_printer->setPageMargins(_leftMargin->value(), _topMargin->value(),
|
_export->margins = MarginsF(_leftMargin->value() / MM2IN,
|
||||||
_rightMargin->value(), _bottomMargin->value(), _units);
|
_topMargin->value() / MM2IN, _rightMargin->value() / MM2IN,
|
||||||
|
_bottomMargin->value() / MM2IN);
|
||||||
|
else
|
||||||
|
_export->margins = MarginsF(_leftMargin->value(), _topMargin->value(),
|
||||||
|
_rightMargin->value(), _bottomMargin->value());
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,29 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#include "margins.h"
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QRadioButton;
|
class QRadioButton;
|
||||||
class FileSelectWidget;
|
class FileSelectWidget;
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
|
|
||||||
|
struct Export {
|
||||||
|
QString fileName;
|
||||||
|
QPrinter::PaperSize paperSize;
|
||||||
|
QPrinter::Orientation orientation;
|
||||||
|
MarginsF margins;
|
||||||
|
|
||||||
|
Units units;
|
||||||
|
};
|
||||||
|
|
||||||
class ExportDialog : public QDialog
|
class ExportDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExportDialog(QPrinter *printer, QWidget *parent = 0);
|
ExportDialog(Export *exp, QWidget *parent = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
@ -22,9 +33,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
bool checkFile();
|
bool checkFile();
|
||||||
|
|
||||||
QPrinter *_printer;
|
Export *_export;
|
||||||
|
|
||||||
QPrinter::Unit _units;
|
|
||||||
|
|
||||||
FileSelectWidget *_fileSelect;
|
FileSelectWidget *_fileSelect;
|
||||||
QComboBox *_paperSize;
|
QComboBox *_paperSize;
|
||||||
|
@ -14,6 +14,11 @@ FITParser::FITParser(QList<TrackData> &tracks, QList<RouteData> &routes,
|
|||||||
QList<Waypoint> &waypoints) : Parser(tracks, routes, waypoints)
|
QList<Waypoint> &waypoints) : Parser(tracks, routes, waypoints)
|
||||||
{
|
{
|
||||||
memset(_defs, 0, sizeof(_defs));
|
memset(_defs, 0, sizeof(_defs));
|
||||||
|
|
||||||
|
_device = 0;
|
||||||
|
_endian = 0;
|
||||||
|
_timestamp = 0;
|
||||||
|
_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FITParser::clearDefinitions()
|
void FITParser::clearDefinitions()
|
||||||
@ -335,10 +340,11 @@ bool FITParser::parseHeader()
|
|||||||
|
|
||||||
bool FITParser::loadFile(QFile *file)
|
bool FITParser::loadFile(QFile *file)
|
||||||
{
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
_device = file;
|
_device = file;
|
||||||
_endian = 0;
|
_endian = 0;
|
||||||
_timestamp = 0;
|
_timestamp = 0;
|
||||||
bool ret = true;
|
|
||||||
|
|
||||||
if (!parseHeader())
|
if (!parseHeader())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
|
||||||
QDebug operator<<(QDebug dbg, const GraphPoint &graphpoint)
|
QDebug operator<<(QDebug dbg, const GraphPoint &point)
|
||||||
{
|
{
|
||||||
dbg.nospace() << "GraphPoint(" << graphpoint.s() << ", "
|
dbg.nospace() << "GraphPoint(" << point.s() << ", " << point.t() << ", "
|
||||||
<< graphpoint.t() << ", " << graphpoint.y() << ")";
|
<< point.y() << ")";
|
||||||
|
|
||||||
return dbg.maybeSpace();
|
return dbg.maybeSpace();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(GraphPoint, Q_PRIMITIVE_TYPE);
|
Q_DECLARE_TYPEINFO(GraphPoint, Q_PRIMITIVE_TYPE);
|
||||||
QDebug operator<<(QDebug dbg, const GraphPoint &graphpoint);
|
QDebug operator<<(QDebug dbg, const GraphPoint &point);
|
||||||
|
|
||||||
|
|
||||||
class Graph : public QVector<GraphPoint>
|
class Graph : public QVector<GraphPoint>
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
#include "graphitem.h"
|
#include "graphitem.h"
|
||||||
|
|
||||||
|
|
||||||
#define GRAPH_WIDTH 1
|
|
||||||
#define HOVER_WIDTH 2
|
|
||||||
|
|
||||||
GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
|
GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
|
||||||
: QGraphicsObject(parent)
|
: QGraphicsObject(parent)
|
||||||
{
|
{
|
||||||
_id = 0;
|
_id = 0;
|
||||||
|
_width = 1;
|
||||||
|
|
||||||
_pen = QPen(Qt::black, GRAPH_WIDTH);
|
_pen = QPen(Qt::black, _width);
|
||||||
|
|
||||||
_type = Distance;
|
_type = Distance;
|
||||||
_graph = graph;
|
_graph = graph;
|
||||||
_sx = 1.0; _sy = 1.0;
|
_sx = 1.0; _sy = 1.0;
|
||||||
|
|
||||||
|
setZValue(1.0);
|
||||||
|
|
||||||
updatePath();
|
updatePath();
|
||||||
updateBounds();
|
updateBounds();
|
||||||
}
|
}
|
||||||
@ -51,6 +51,14 @@ void GraphItem::setColor(const QColor &color)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphItem::setWidth(int width)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_width = width;
|
||||||
|
_pen.setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
qreal GraphItem::yAtX(qreal x)
|
qreal GraphItem::yAtX(qreal x)
|
||||||
{
|
{
|
||||||
int low = 0;
|
int low = 0;
|
||||||
@ -117,12 +125,12 @@ void GraphItem::emitSliderPositionChanged(qreal pos)
|
|||||||
{
|
{
|
||||||
if (_type == Time) {
|
if (_type == Time) {
|
||||||
if (_graph.hasTime()) {
|
if (_graph.hasTime()) {
|
||||||
if (pos <= _graph.last().t())
|
if (pos >= _graph.first().t() && pos <= _graph.last().t())
|
||||||
emit sliderPositionChanged(distanceAtTime(pos));
|
emit sliderPositionChanged(distanceAtTime(pos));
|
||||||
else
|
else
|
||||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
emit sliderPositionChanged(NAN);
|
||||||
} else
|
} else
|
||||||
emit sliderPositionChanged(_graph.last().s() + 1);
|
emit sliderPositionChanged(NAN);
|
||||||
} else
|
} else
|
||||||
emit sliderPositionChanged(pos);
|
emit sliderPositionChanged(pos);
|
||||||
}
|
}
|
||||||
@ -130,10 +138,10 @@ void GraphItem::emitSliderPositionChanged(qreal pos)
|
|||||||
void GraphItem::selected(bool selected)
|
void GraphItem::selected(bool selected)
|
||||||
{
|
{
|
||||||
if (selected) {
|
if (selected) {
|
||||||
_pen.setWidth(HOVER_WIDTH);
|
_pen.setWidth(_width + 1);
|
||||||
setZValue(zValue() + 1.0);
|
setZValue(zValue() + 1.0);
|
||||||
} else {
|
} else {
|
||||||
_pen.setWidth(GRAPH_WIDTH);
|
_pen.setWidth(_width);
|
||||||
setZValue(zValue() - 1.0);
|
setZValue(zValue() - 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
int id() const {return _id;}
|
int id() const {return _id;}
|
||||||
void setId(int id) {_id = id;}
|
void setId(int id) {_id = id;}
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
|
void setWidth(int width);
|
||||||
|
|
||||||
qreal yAtX(qreal x);
|
qreal yAtX(qreal x);
|
||||||
qreal distanceAtTime(qreal time);
|
qreal distanceAtTime(qreal time);
|
||||||
@ -41,6 +42,7 @@ private:
|
|||||||
|
|
||||||
int _id;
|
int _id;
|
||||||
QPen _pen;
|
QPen _pen;
|
||||||
|
int _width;
|
||||||
|
|
||||||
Graph _graph;
|
Graph _graph;
|
||||||
GraphType _type;
|
GraphType _type;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include "opengl.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
#include "slideritem.h"
|
#include "slideritem.h"
|
||||||
@ -20,26 +22,30 @@
|
|||||||
GraphView::GraphView(QWidget *parent)
|
GraphView::GraphView(QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
_scene = new QGraphicsScene();
|
_scene = new QGraphicsScene(this);
|
||||||
setScene(_scene);
|
setScene(_scene);
|
||||||
|
|
||||||
|
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
|
setRenderHint(QPainter::Antialiasing, true);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
_xAxis = new AxisItem(AxisItem::X);
|
_xAxis = new AxisItem(AxisItem::X);
|
||||||
_xAxis->setZValue(1.0);
|
_xAxis->setZValue(2.0);
|
||||||
_yAxis = new AxisItem(AxisItem::Y);
|
_yAxis = new AxisItem(AxisItem::Y);
|
||||||
_yAxis->setZValue(1.0);
|
_yAxis->setZValue(2.0);
|
||||||
_slider = new SliderItem();
|
_slider = new SliderItem();
|
||||||
_slider->setZValue(2.0);
|
_slider->setZValue(3.0);
|
||||||
_sliderInfo = new SliderInfoItem(_slider);
|
_sliderInfo = new SliderInfoItem(_slider);
|
||||||
_sliderInfo->setZValue(2.0);
|
_sliderInfo->setZValue(3.0);
|
||||||
_info = new InfoItem();
|
_info = new InfoItem();
|
||||||
_grid = new GridItem();
|
_grid = new GridItem();
|
||||||
|
|
||||||
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
||||||
SLOT(emitSliderPositionChanged(const QPointF&)));
|
SLOT(emitSliderPositionChanged(const QPointF&)));
|
||||||
|
|
||||||
|
_width = 1;
|
||||||
|
|
||||||
_xScale = 1;
|
_xScale = 1;
|
||||||
_yScale = 1;
|
_yScale = 1;
|
||||||
_yOffset = 0;
|
_yOffset = 0;
|
||||||
@ -169,7 +175,8 @@ void GraphView::loadGraph(const Graph &graph, PathItem *path, int id)
|
|||||||
GraphItem *gi = new GraphItem(graph);
|
GraphItem *gi = new GraphItem(graph);
|
||||||
gi->setGraphType(_graphType);
|
gi->setGraphType(_graphType);
|
||||||
gi->setId(id);
|
gi->setId(id);
|
||||||
gi->setColor(_palette.color());
|
gi->setColor(_palette.nextColor());
|
||||||
|
gi->setWidth(_width);
|
||||||
|
|
||||||
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
|
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
|
||||||
SLOT(emitSliderPositionChanged(qreal)));
|
SLOT(emitSliderPositionChanged(qreal)));
|
||||||
@ -400,6 +407,8 @@ void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
||||||
|
_sliderPos = qMax(_sliderPos, bounds().left());
|
||||||
|
_sliderPos = qMin(_sliderPos, bounds().right());
|
||||||
updateSliderPosition();
|
updateSliderPosition();
|
||||||
|
|
||||||
emit sliderPositionChanged(_sliderPos);
|
emit sliderPositionChanged(_sliderPos);
|
||||||
@ -429,3 +438,31 @@ void GraphView::clearInfo()
|
|||||||
{
|
{
|
||||||
_info->clear();
|
_info->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphView::setPalette(const Palette &palette)
|
||||||
|
{
|
||||||
|
_palette = palette;
|
||||||
|
_palette.reset();
|
||||||
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
|
_graphs.at(i)->setColor(_palette.nextColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::setGraphWidth(int width)
|
||||||
|
{
|
||||||
|
_width = width;
|
||||||
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
|
_graphs.at(i)->setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::useOpenGL(bool use)
|
||||||
|
{
|
||||||
|
if (use) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
|
setViewport(new OPENGL_WIDGET);
|
||||||
|
} else
|
||||||
|
setViewport(new QWidget);
|
||||||
|
}
|
||||||
|
@ -35,6 +35,9 @@ public:
|
|||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
void showGrid(bool show);
|
void showGrid(bool show);
|
||||||
|
|
||||||
|
void setPalette(const Palette &palette);
|
||||||
|
void setGraphWidth(int width);
|
||||||
|
|
||||||
const QString &yLabel() const {return _yLabel;}
|
const QString &yLabel() const {return _yLabel;}
|
||||||
const QString &yUnits() const {return _yUnits;}
|
const QString &yUnits() const {return _yUnits;}
|
||||||
qreal yScale() const {return _yScale;}
|
qreal yScale() const {return _yScale;}
|
||||||
@ -52,6 +55,8 @@ public:
|
|||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target);
|
||||||
|
|
||||||
|
void useOpenGL(bool use);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sliderPositionChanged(qreal);
|
void sliderPositionChanged(qreal);
|
||||||
|
|
||||||
@ -60,7 +65,7 @@ protected:
|
|||||||
void redraw(const QSizeF &size);
|
void redraw(const QSizeF &size);
|
||||||
void addInfo(const QString &key, const QString &value);
|
void addInfo(const QString &key, const QString &value);
|
||||||
void clearInfo();
|
void clearInfo();
|
||||||
void skipColor() {_palette.color();}
|
void skipColor() {_palette.nextColor();}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void emitSliderPositionChanged(const QPointF &pos);
|
void emitSliderPositionChanged(const QPointF &pos);
|
||||||
@ -99,6 +104,7 @@ private:
|
|||||||
QSet<int> _hide;
|
QSet<int> _hide;
|
||||||
QRectF _bounds;
|
QRectF _bounds;
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
|
int _width;
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
GraphType _graphType;
|
GraphType _graphType;
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
GridItem::GridItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
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,
|
void GridItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
421
src/gui.cpp
@ -21,7 +21,6 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QPixmapCache>
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
@ -39,7 +38,6 @@
|
|||||||
#include "trackinfo.h"
|
#include "trackinfo.h"
|
||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "cpuarch.h"
|
#include "cpuarch.h"
|
||||||
#include "exportdialog.h"
|
|
||||||
#include "graphtab.h"
|
#include "graphtab.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
@ -72,6 +70,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
||||||
setWindowTitle(APP_NAME);
|
setWindowTitle(APP_NAME);
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
|
setAcceptDrops(true);
|
||||||
|
|
||||||
_trackCount = 0;
|
_trackCount = 0;
|
||||||
_routeCount = 0;
|
_routeCount = 0;
|
||||||
@ -87,15 +86,6 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
_exportPaperSize = (QLocale::system().measurementSystem()
|
|
||||||
== QLocale::ImperialSystem) ? QPrinter::Letter : QPrinter::A4;
|
|
||||||
_exportOrientation = QPrinter::Portrait;
|
|
||||||
_exportFileName = QString("%1/export.pdf").arg(QDir::currentPath());
|
|
||||||
_exportMargins = MarginsF(5.0, 5.0, 5.0, 5.0);
|
|
||||||
|
|
||||||
setAcceptDrops(true);
|
|
||||||
QPixmapCache::setCacheLimit(65536);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI::~GUI()
|
GUI::~GUI()
|
||||||
@ -108,16 +98,18 @@ GUI::~GUI()
|
|||||||
|
|
||||||
const QString GUI::fileFormats() const
|
const QString GUI::fileFormats() const
|
||||||
{
|
{
|
||||||
return tr("Supported files (*.csv *.fit *.gpx *.kml *.tcx)") + ";;"
|
return tr("Supported files (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)")
|
||||||
+ tr("CSV files (*.csv)") + ";;" + tr("FIT files (*.fit)") + ";;"
|
+ ";;" + tr("CSV files (*.csv)") + ";;" + tr("FIT files (*.fit)") + ";;"
|
||||||
+ tr("GPX files (*.gpx)") + ";;" + tr("KML files (*.kml)") + ";;"
|
+ tr("GPX files (*.gpx)") + ";;" + tr("IGC files (*.igc)") + ";;"
|
||||||
|
+ tr("KML files (*.kml)") + ";;" + tr("NMEA files (*.nmea)") + ";;"
|
||||||
+ tr("TCX files (*.tcx)") + ";;" + tr("All files (*)");
|
+ tr("TCX files (*.tcx)") + ";;" + tr("All files (*)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createBrowser()
|
void GUI::createBrowser()
|
||||||
{
|
{
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
filter << "*.gpx" << "*.tcx" << "*.kml" << "*.fit" << "*.csv";
|
filter << "*.gpx" << "*.tcx" << "*.kml" << "*.fit" << "*.csv" << "*.igc"
|
||||||
|
<< "*.nmea";
|
||||||
_browser = new FileBrowser(this);
|
_browser = new FileBrowser(this);
|
||||||
_browser->setFilter(filter);
|
_browser->setFilter(filter);
|
||||||
}
|
}
|
||||||
@ -143,8 +135,15 @@ void GUI::loadPOIs()
|
|||||||
else
|
else
|
||||||
list = globalDir.entryInfoList(QStringList(), QDir::Files);
|
list = globalDir.entryInfoList(QStringList(), QDir::Files);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); ++i)
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
_poi->loadFile(list.at(i).absoluteFilePath());
|
if (!_poi->loadFile(list.at(i).absoluteFilePath())) {
|
||||||
|
fprintf(stderr, "Error loading POI file: %s: %s\n",
|
||||||
|
qPrintable(list.at(i).fileName()),
|
||||||
|
qPrintable(_poi->errorString()));
|
||||||
|
if (_poi->errorLine())
|
||||||
|
fprintf(stderr, "Line: %d\n", _poi->errorLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createMapActions()
|
void GUI::createMapActions()
|
||||||
@ -196,7 +195,6 @@ void GUI::createActions()
|
|||||||
{
|
{
|
||||||
QActionGroup *ag;
|
QActionGroup *ag;
|
||||||
|
|
||||||
|
|
||||||
// Action Groups
|
// Action Groups
|
||||||
_fileActionGroup = new QActionGroup(this);
|
_fileActionGroup = new QActionGroup(this);
|
||||||
_fileActionGroup->setExclusive(false);
|
_fileActionGroup->setExclusive(false);
|
||||||
@ -375,6 +373,9 @@ void GUI::createActions()
|
|||||||
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
|
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showFullscreen(bool)));
|
SLOT(showFullscreen(bool)));
|
||||||
addAction(_fullscreenAction);
|
addAction(_fullscreenAction);
|
||||||
|
_openOptionsAction = new QAction(tr("Options..."), this);
|
||||||
|
connect(_openOptionsAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(openOptions()));
|
||||||
|
|
||||||
// Navigation actions
|
// Navigation actions
|
||||||
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
|
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
|
||||||
@ -451,8 +452,9 @@ void GUI::createMenus()
|
|||||||
unitsMenu->addAction(_imperialUnitsAction);
|
unitsMenu->addAction(_imperialUnitsAction);
|
||||||
settingsMenu->addSeparator();
|
settingsMenu->addSeparator();
|
||||||
settingsMenu->addAction(_showToolbarsAction);
|
settingsMenu->addAction(_showToolbarsAction);
|
||||||
settingsMenu->addSeparator();
|
|
||||||
settingsMenu->addAction(_fullscreenAction);
|
settingsMenu->addAction(_fullscreenAction);
|
||||||
|
settingsMenu->addSeparator();
|
||||||
|
settingsMenu->addAction(_openOptionsAction);
|
||||||
|
|
||||||
QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
|
QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
|
||||||
helpMenu->addAction(_dataSourcesAction);
|
helpMenu->addAction(_dataSourcesAction);
|
||||||
@ -673,6 +675,14 @@ bool GUI::loadFile(const QString &fileName)
|
|||||||
|
|
||||||
_waypointCount += data.waypoints().count();
|
_waypointCount += data.waypoints().count();
|
||||||
|
|
||||||
|
if (_pathName.isNull()) {
|
||||||
|
if (data.tracks().count() == 1 && !data.routes().count())
|
||||||
|
_pathName = data.tracks().first()->name();
|
||||||
|
else if (data.routes().count() == 1 && !data.tracks().count())
|
||||||
|
_pathName = data.routes().first()->routeData().name();
|
||||||
|
} else
|
||||||
|
_pathName = QString();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
updateNavigationActions();
|
updateNavigationActions();
|
||||||
@ -744,26 +754,67 @@ void GUI::printFile()
|
|||||||
plot(&printer);
|
plot(&printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::openOptions()
|
||||||
|
{
|
||||||
|
Options options(_options);
|
||||||
|
|
||||||
|
OptionsDialog dialog(&options, this);
|
||||||
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (options.palette != _options.palette) {
|
||||||
|
_pathView->setPalette(options.palette);
|
||||||
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
|
_tabs.at(i)->setPalette(options.palette);
|
||||||
|
}
|
||||||
|
if (options.trackWidth != _options.trackWidth)
|
||||||
|
_pathView->setTrackWidth(options.trackWidth);
|
||||||
|
if (options.routeWidth != _options.routeWidth)
|
||||||
|
_pathView->setRouteWidth(options.routeWidth);
|
||||||
|
if (options.trackStyle != _options.trackStyle)
|
||||||
|
_pathView->setTrackStyle(options.trackStyle);
|
||||||
|
if (options.routeStyle != _options.routeStyle)
|
||||||
|
_pathView->setRouteStyle(options.routeStyle);
|
||||||
|
if (options.pathAntiAliasing != _options.pathAntiAliasing)
|
||||||
|
_pathView->setRenderHint(QPainter::Antialiasing,
|
||||||
|
options.pathAntiAliasing);
|
||||||
|
if (options.graphWidth != _options.graphWidth)
|
||||||
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
|
_tabs.at(i)->setGraphWidth(options.graphWidth);
|
||||||
|
if (options.graphAntiAliasing != _options.graphAntiAliasing)
|
||||||
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
|
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
|
||||||
|
options.graphAntiAliasing);
|
||||||
|
|
||||||
|
if (options.poiRadius != _options.poiRadius)
|
||||||
|
_poi->setRadius(options.poiRadius);
|
||||||
|
|
||||||
|
if (options.useOpenGL != _options.useOpenGL) {
|
||||||
|
_pathView->useOpenGL(options.useOpenGL);
|
||||||
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
|
_tabs.at(i)->useOpenGL(options.useOpenGL);
|
||||||
|
}
|
||||||
|
|
||||||
|
_options = options;
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::exportFile()
|
void GUI::exportFile()
|
||||||
{
|
{
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
ExportDialog dialog(&_export, this);
|
||||||
printer.setCreator(QString(APP_NAME) + QString(" ") + QString(APP_VERSION));
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
printer.setOrientation(_exportOrientation);
|
return;
|
||||||
printer.setOutputFileName(_exportFileName);
|
|
||||||
printer.setPaperSize(_exportPaperSize);
|
|
||||||
printer.setPageMargins(_exportMargins.left(), _exportMargins.top(),
|
|
||||||
_exportMargins.right(), _exportMargins.bottom(), QPrinter::Millimeter);
|
|
||||||
ExportDialog dialog(&printer, this);
|
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
_exportFileName = printer.outputFileName();
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
_exportPaperSize = printer.paperSize();
|
printer.setCreator(QString(APP_NAME) + QString(" ")
|
||||||
_exportOrientation = printer.orientation();
|
+ QString(APP_VERSION));
|
||||||
printer.getPageMargins(&(_exportMargins.rleft()),
|
printer.setOrientation(_export.orientation);
|
||||||
&(_exportMargins.rtop()), &(_exportMargins.rright()),
|
printer.setOutputFileName(_export.fileName);
|
||||||
&(_exportMargins.rbottom()), QPrinter::Millimeter);
|
printer.setPaperSize(_export.paperSize);
|
||||||
plot(&printer);
|
printer.setPageMargins(_export.margins.left(), _export.margins.top(),
|
||||||
}
|
_export.margins.right(), _export.margins.bottom(), QPrinter::Millimeter);
|
||||||
|
|
||||||
|
plot(&printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::plot(QPrinter *printer)
|
void GUI::plot(QPrinter *printer)
|
||||||
@ -775,7 +826,19 @@ void GUI::plot(QPrinter *printer)
|
|||||||
qreal d = distance();
|
qreal d = distance();
|
||||||
qreal t = time();
|
qreal t = time();
|
||||||
|
|
||||||
if (_dateRange.first.isValid()) {
|
if (!_pathName.isNull() && _options.printName)
|
||||||
|
info.insert(tr("Name"), _pathName);
|
||||||
|
|
||||||
|
if (_options.printItemCount) {
|
||||||
|
if (_trackCount > 1)
|
||||||
|
info.insert(tr("Tracks"), QString::number(_trackCount));
|
||||||
|
if (_routeCount > 1)
|
||||||
|
info.insert(tr("Routes"), QString::number(_routeCount));
|
||||||
|
if (_waypointCount > 2)
|
||||||
|
info.insert(tr("Waypoints"), QString::number(_waypointCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_dateRange.first.isValid() && _options.printDate) {
|
||||||
if (_dateRange.first == _dateRange.second) {
|
if (_dateRange.first == _dateRange.second) {
|
||||||
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
|
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
|
||||||
info.insert(tr("Date"), _dateRange.first.toString(format));
|
info.insert(tr("Date"), _dateRange.first.toString(format));
|
||||||
@ -787,16 +850,9 @@ void GUI::plot(QPrinter *printer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_trackCount > 1)
|
if (d > 0 && _options.printDistance)
|
||||||
info.insert(tr("Tracks"), QString::number(_trackCount));
|
|
||||||
if (_routeCount > 1)
|
|
||||||
info.insert(tr("Routes"), QString::number(_routeCount));
|
|
||||||
if (_waypointCount > 2)
|
|
||||||
info.insert(tr("Waypoints"), QString::number(_waypointCount));
|
|
||||||
|
|
||||||
if (d > 0)
|
|
||||||
info.insert(tr("Distance"), Format::distance(d, units));
|
info.insert(tr("Distance"), Format::distance(d, units));
|
||||||
if (t > 0)
|
if (t > 0 && _options.printTime)
|
||||||
info.insert(tr("Time"), Format::timeSpan(t));
|
info.insert(tr("Time"), Format::timeSpan(t));
|
||||||
|
|
||||||
|
|
||||||
@ -809,7 +865,7 @@ void GUI::plot(QPrinter *printer)
|
|||||||
mh = ih / 2;
|
mh = ih / 2;
|
||||||
info.plot(&p, QRectF(0, 0, printer->width(), ih));
|
info.plot(&p, QRectF(0, 0, printer->width(), ih));
|
||||||
}
|
}
|
||||||
if (_graphTabWidget->isVisible()) {
|
if (_graphTabWidget->isVisible() && !_options.separateGraphPage) {
|
||||||
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
||||||
gh = (printer->width() > printer->height())
|
gh = (printer->width() > printer->height())
|
||||||
? 0.15 * r * (printer->height() - ih - 2*mh)
|
? 0.15 * r * (printer->height() - ih - 2*mh)
|
||||||
@ -821,6 +877,27 @@ void GUI::plot(QPrinter *printer)
|
|||||||
gh = 0;
|
gh = 0;
|
||||||
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
||||||
- (ih + 2*mh + gh)));
|
- (ih + 2*mh + gh)));
|
||||||
|
|
||||||
|
if (_graphTabWidget->isVisible() && _options.separateGraphPage) {
|
||||||
|
printer->newPage();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
for (int i = 0; i < _tabs.size(); i++)
|
||||||
|
if (_tabs.at(i)->count())
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
qreal sp = ratio * 20;
|
||||||
|
gh = qMin((printer->height() - ((cnt - 1) * sp))/(qreal)cnt,
|
||||||
|
0.20 * printer->height());
|
||||||
|
|
||||||
|
qreal y = 0;
|
||||||
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
|
if (_tabs.at(i)->count()) {
|
||||||
|
_tabs.at(i)->plot(&p, QRectF(0, y, printer->width(), gh));
|
||||||
|
y += gh + sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::reloadFile()
|
void GUI::reloadFile()
|
||||||
@ -832,6 +909,7 @@ void GUI::reloadFile()
|
|||||||
_routeDistance = 0;
|
_routeDistance = 0;
|
||||||
_time = 0;
|
_time = 0;
|
||||||
_dateRange = DateRange(QDate(), QDate());
|
_dateRange = DateRange(QDate(), QDate());
|
||||||
|
_pathName = QString();
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
_tabs.at(i)->clear();
|
_tabs.at(i)->clear();
|
||||||
@ -865,6 +943,7 @@ void GUI::closeFiles()
|
|||||||
_routeDistance = 0;
|
_routeDistance = 0;
|
||||||
_time = 0;
|
_time = 0;
|
||||||
_dateRange = DateRange(QDate(), QDate());
|
_dateRange = DateRange(QDate(), QDate());
|
||||||
|
_pathName = QString();
|
||||||
|
|
||||||
_sliderPos = 0;
|
_sliderPos = 0;
|
||||||
|
|
||||||
@ -978,7 +1057,7 @@ void GUI::clearMapCache()
|
|||||||
void GUI::updateStatusBarInfo()
|
void GUI::updateStatusBarInfo()
|
||||||
{
|
{
|
||||||
if (_files.count() == 0)
|
if (_files.count() == 0)
|
||||||
_fileNameLabel->setText(tr("No GPX files loaded"));
|
_fileNameLabel->setText(tr("No files loaded"));
|
||||||
else if (_files.count() == 1)
|
else if (_files.count() == 1)
|
||||||
_fileNameLabel->setText(_files.at(0));
|
_fileNameLabel->setText(_files.at(0));
|
||||||
else
|
else
|
||||||
@ -1107,6 +1186,9 @@ void GUI::updatePathView()
|
|||||||
|
|
||||||
void GUI::setUnits(Units units)
|
void GUI::setUnits(Units units)
|
||||||
{
|
{
|
||||||
|
_export.units = units;
|
||||||
|
_options.units = units;
|
||||||
|
|
||||||
_pathView->setUnits(units);
|
_pathView->setUnits(units);
|
||||||
for (int i = 0; i <_tabs.count(); i++)
|
for (int i = 0; i <_tabs.count(); i++)
|
||||||
_tabs.at(i)->setUnits(units);
|
_tabs.at(i)->setUnits(units);
|
||||||
@ -1227,57 +1309,131 @@ void GUI::dropEvent(QDropEvent *event)
|
|||||||
void GUI::writeSettings()
|
void GUI::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(APP_NAME, APP_NAME);
|
||||||
|
settings.clear();
|
||||||
|
|
||||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||||
settings.setValue(WINDOW_SIZE_SETTING, size());
|
if (size() != WINDOW_SIZE_DEFAULT)
|
||||||
settings.setValue(WINDOW_POS_SETTING, pos());
|
settings.setValue(WINDOW_SIZE_SETTING, size());
|
||||||
|
if (pos() != WINDOW_POS_DEFAULT)
|
||||||
|
settings.setValue(WINDOW_POS_SETTING, pos());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||||
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
if ((_imperialUnitsAction->isChecked() ? Imperial : Metric) !=
|
||||||
|
UNITS_DEFAULT)
|
||||||
|
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
||||||
? Imperial : Metric);
|
? Imperial : Metric);
|
||||||
settings.setValue(SHOW_TOOLBARS_SETTING, _showToolbarsAction->isChecked());
|
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
||||||
|
settings.setValue(SHOW_TOOLBARS_SETTING,
|
||||||
|
_showToolbarsAction->isChecked());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(MAP_SETTINGS_GROUP);
|
settings.beginGroup(MAP_SETTINGS_GROUP);
|
||||||
if (_currentMap)
|
if (_currentMap)
|
||||||
settings.setValue(CURRENT_MAP_SETTING, _currentMap->name());
|
settings.setValue(CURRENT_MAP_SETTING, _currentMap->name());
|
||||||
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
|
if (_showMapAction->isChecked() != SHOW_MAP_DEFAULT)
|
||||||
|
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(GRAPH_SETTINGS_GROUP);
|
settings.beginGroup(GRAPH_SETTINGS_GROUP);
|
||||||
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
|
if (_showGraphsAction->isChecked() != SHOW_GRAPHS_DEFAULT)
|
||||||
settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked()
|
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
|
||||||
? Time : Distance);
|
if ((_timeGraphAction->isChecked() ? Time : Distance) != GRAPH_TYPE_DEFAULT)
|
||||||
settings.setValue(SHOW_GRAPH_GRIDS_SETTING,
|
settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked()
|
||||||
_showGraphGridAction->isChecked());
|
? Time : Distance);
|
||||||
|
if (_showGraphGridAction->isChecked() != SHOW_GRAPH_GRIDS_DEFAULT)
|
||||||
|
settings.setValue(SHOW_GRAPH_GRIDS_SETTING,
|
||||||
|
_showGraphGridAction->isChecked());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(POI_SETTINGS_GROUP);
|
settings.beginGroup(POI_SETTINGS_GROUP);
|
||||||
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
|
if (_showPOIAction->isChecked() != SHOW_POI_DEFAULT)
|
||||||
settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked());
|
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
|
||||||
|
if (_overlapPOIAction->isChecked() != OVERLAP_POI_DEFAULT)
|
||||||
|
settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked());
|
||||||
|
|
||||||
settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX);
|
int j = 0;
|
||||||
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
|
for (int i = 0; i < _poiFilesActions.count(); i++) {
|
||||||
for (int i = 0, j = 0; i < _poiFilesActions.count(); i++) {
|
|
||||||
if (!_poiFilesActions.at(i)->isChecked()) {
|
if (!_poiFilesActions.at(i)->isChecked()) {
|
||||||
|
if (j == 0)
|
||||||
|
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
|
||||||
settings.setArrayIndex(j++);
|
settings.setArrayIndex(j++);
|
||||||
settings.setValue(DISABLED_POI_FILE_SETTING, _poi->files().at(i));
|
settings.setValue(DISABLED_POI_FILE_SETTING, _poi->files().at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.endArray();
|
if (j != 0)
|
||||||
|
settings.endArray();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(DATA_SETTINGS_GROUP);
|
settings.beginGroup(DATA_SETTINGS_GROUP);
|
||||||
settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked());
|
if (_showTracksAction->isChecked() != SHOW_TRACKS_DEFAULT)
|
||||||
settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked());
|
settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked());
|
||||||
settings.setValue(SHOW_WAYPOINTS_SETTING,
|
if (_showRoutesAction->isChecked() != SHOW_ROUTES_DEFAULT)
|
||||||
_showWaypointsAction->isChecked());
|
settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked());
|
||||||
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
|
if (_showWaypointsAction->isChecked() != SHOW_WAYPOINTS_DEFAULT)
|
||||||
_showWaypointLabelsAction->isChecked());
|
settings.setValue(SHOW_WAYPOINTS_SETTING,
|
||||||
settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING,
|
_showWaypointsAction->isChecked());
|
||||||
_showRouteWaypointsAction->isChecked());
|
if (_showWaypointLabelsAction->isChecked() != SHOW_WAYPOINT_LABELS_DEFAULT)
|
||||||
|
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
|
||||||
|
_showWaypointLabelsAction->isChecked());
|
||||||
|
if (_showRouteWaypointsAction->isChecked() != SHOW_ROUTE_WAYPOINTS_DEFAULT)
|
||||||
|
settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING,
|
||||||
|
_showRouteWaypointsAction->isChecked());
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(EXPORT_SETTINGS_GROUP);
|
||||||
|
if (_export.orientation != PAPER_ORIENTATION_DEFAULT)
|
||||||
|
settings.setValue(PAPER_ORIENTATION_SETTING, _export.orientation);
|
||||||
|
if (_export.paperSize != PAPER_SIZE_DEFAULT)
|
||||||
|
settings.setValue(PAPER_SIZE_SETTING, _export.paperSize);
|
||||||
|
if (_export.margins.left() != MARGIN_LEFT_DEFAULT)
|
||||||
|
settings.setValue(MARGIN_LEFT_SETTING, _export.margins.left());
|
||||||
|
if (_export.margins.top() != MARGIN_TOP_DEFAULT)
|
||||||
|
settings.setValue(MARGIN_TOP_SETTING, _export.margins.top());
|
||||||
|
if (_export.margins.right() != MARGIN_RIGHT_DEFAULT)
|
||||||
|
settings.setValue(MARGIN_RIGHT_SETTING, _export.margins.right());
|
||||||
|
if (_export.margins.bottom() != MARGIN_BOTTOM_DEFAULT)
|
||||||
|
settings.setValue(MARGIN_BOTTOM_SETTING, _export.margins.bottom());
|
||||||
|
if (_export.fileName != EXPORT_FILENAME_DEFAULT)
|
||||||
|
settings.setValue(EXPORT_FILENAME_SETTING, _export.fileName);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
|
||||||
|
if (_options.palette.color() != PALETTE_COLOR_DEFAULT)
|
||||||
|
settings.setValue(PALETTE_COLOR_SETTING, _options.palette.color());
|
||||||
|
if (_options.palette.shift() != PALETTE_SHIFT_DEFAULT)
|
||||||
|
settings.setValue(PALETTE_SHIFT_SETTING, _options.palette.shift());
|
||||||
|
if (_options.trackWidth != TRACK_WIDTH_DEFAULT)
|
||||||
|
settings.setValue(TRACK_WIDTH_SETTING, _options.trackWidth);
|
||||||
|
if (_options.routeWidth != ROUTE_WIDTH_DEFAULT)
|
||||||
|
settings.setValue(ROUTE_WIDTH_SETTING, _options.routeWidth);
|
||||||
|
if (_options.trackStyle != TRACK_STYLE_DEFAULT)
|
||||||
|
settings.setValue(TRACK_STYLE_SETTING, (int)_options.trackStyle);
|
||||||
|
if (_options.routeStyle != ROUTE_STYLE_DEFAULT)
|
||||||
|
settings.setValue(ROUTE_STYLE_SETTING, (int)_options.routeStyle);
|
||||||
|
if (_options.graphWidth != GRAPH_WIDTH_DEFAULT)
|
||||||
|
settings.setValue(GRAPH_WIDTH_SETTING, _options.graphWidth);
|
||||||
|
if (_options.pathAntiAliasing != PATH_AA_DEFAULT)
|
||||||
|
settings.setValue(PATH_AA_SETTING, _options.pathAntiAliasing);
|
||||||
|
if (_options.graphAntiAliasing != GRAPH_AA_DEFAULT)
|
||||||
|
settings.setValue(GRAPH_AA_SETTING, _options.graphAntiAliasing);
|
||||||
|
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
||||||
|
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
||||||
|
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
||||||
|
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
|
||||||
|
if (_options.printName != PRINT_NAME_DEFAULT)
|
||||||
|
settings.setValue(PRINT_NAME_SETTING, _options.printName);
|
||||||
|
if (_options.printDate != PRINT_DATE_DEFAULT)
|
||||||
|
settings.setValue(PRINT_DATE_SETTING, _options.printDate);
|
||||||
|
if (_options.printDistance != PRINT_DISTANCE_DEFAULT)
|
||||||
|
settings.setValue(PRINT_DISTANCE_SETTING, _options.printDistance);
|
||||||
|
if (_options.printTime != PRINT_TIME_DEFAULT)
|
||||||
|
settings.setValue(PRINT_TIME_SETTING, _options.printTime);
|
||||||
|
if (_options.printItemCount != PRINT_ITEM_COUNT_DEFAULT)
|
||||||
|
settings.setValue(PRINT_ITEM_COUNT_SETTING, _options.printItemCount);
|
||||||
|
if (_options.separateGraphPage != SEPARATE_GRAPH_PAGE_DEFAULT)
|
||||||
|
settings.setValue(SEPARATE_GRAPH_PAGE_SETTING,
|
||||||
|
_options.separateGraphPage);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,26 +1442,26 @@ void GUI::readSettings()
|
|||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(APP_NAME, APP_NAME);
|
||||||
|
|
||||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||||
resize(settings.value(WINDOW_SIZE_SETTING, QSize(600, 800)).toSize());
|
resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize());
|
||||||
move(settings.value(WINDOW_POS_SETTING, QPoint(10, 10)).toPoint());
|
move(settings.value(WINDOW_POS_SETTING, WINDOW_POS_DEFAULT).toPoint());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||||
Units u = QLocale::system().measurementSystem() == QLocale::ImperialSystem
|
if (settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt() == Imperial) {
|
||||||
? Imperial : Metric;
|
setUnits(Imperial);
|
||||||
if (settings.value(UNITS_SETTING, u).toInt() == Imperial) {
|
|
||||||
setImperialUnits();
|
|
||||||
_imperialUnitsAction->setChecked(true);
|
_imperialUnitsAction->setChecked(true);
|
||||||
} else
|
} else {
|
||||||
|
setUnits(Metric);
|
||||||
_metricUnitsAction->setChecked(true);
|
_metricUnitsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false)
|
}
|
||||||
|
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
|
||||||
showToolbars(false);
|
showToolbars(false);
|
||||||
else
|
else
|
||||||
_showToolbarsAction->setChecked(true);
|
_showToolbarsAction->setChecked(true);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(MAP_SETTINGS_GROUP);
|
settings.beginGroup(MAP_SETTINGS_GROUP);
|
||||||
if (settings.value(SHOW_MAP_SETTING, true).toBool() == true)
|
if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool())
|
||||||
_showMapAction->setChecked(true);
|
_showMapAction->setChecked(true);
|
||||||
if (_maps.count()) {
|
if (_maps.count()) {
|
||||||
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
|
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
|
||||||
@ -1318,31 +1474,33 @@ void GUI::readSettings()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(GRAPH_SETTINGS_GROUP);
|
settings.beginGroup(GRAPH_SETTINGS_GROUP);
|
||||||
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false)
|
if (!settings.value(SHOW_GRAPHS_SETTING, SHOW_GRAPHS_DEFAULT).toBool())
|
||||||
showGraphs(false);
|
showGraphs(false);
|
||||||
else
|
else
|
||||||
_showGraphsAction->setChecked(true);
|
_showGraphsAction->setChecked(true);
|
||||||
if (settings.value(GRAPH_TYPE_SETTING, Distance).toInt() == Time) {
|
if (settings.value(GRAPH_TYPE_SETTING, GRAPH_TYPE_DEFAULT).toInt()
|
||||||
|
== Time) {
|
||||||
setTimeGraph();
|
setTimeGraph();
|
||||||
_timeGraphAction->setChecked(true);
|
_timeGraphAction->setChecked(true);
|
||||||
} else
|
} else
|
||||||
_distanceGraphAction->setChecked(true);
|
_distanceGraphAction->setChecked(true);
|
||||||
if (settings.value(SHOW_GRAPH_GRIDS_SETTING, true).toBool() == false)
|
if (!settings.value(SHOW_GRAPH_GRIDS_SETTING, SHOW_GRAPH_GRIDS_DEFAULT)
|
||||||
|
.toBool())
|
||||||
showGraphGrids(false);
|
showGraphGrids(false);
|
||||||
else
|
else
|
||||||
_showGraphGridAction->setChecked(true);
|
_showGraphGridAction->setChecked(true);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(POI_SETTINGS_GROUP);
|
settings.beginGroup(POI_SETTINGS_GROUP);
|
||||||
if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false)
|
if (!settings.value(OVERLAP_POI_SETTING, OVERLAP_POI_DEFAULT).toBool())
|
||||||
_pathView->setPOIOverlap(false);
|
_pathView->setPOIOverlap(false);
|
||||||
else
|
else
|
||||||
_overlapPOIAction->setChecked(true);
|
_overlapPOIAction->setChecked(true);
|
||||||
if (settings.value(LABELS_POI_SETTING, true).toBool() == false)
|
if (!settings.value(LABELS_POI_SETTING, LABELS_POI_DEFAULT).toBool())
|
||||||
_pathView->showPOILabels(false);
|
_pathView->showPOILabels(false);
|
||||||
else
|
else
|
||||||
_showPOILabelsAction->setChecked(true);
|
_showPOILabelsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
|
if (settings.value(SHOW_POI_SETTING, SHOW_POI_DEFAULT).toBool())
|
||||||
_showPOIAction->setChecked(true);
|
_showPOIAction->setChecked(true);
|
||||||
else
|
else
|
||||||
_pathView->showPOI(false);
|
_pathView->showPOI(false);
|
||||||
@ -1362,31 +1520,110 @@ void GUI::readSettings()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(DATA_SETTINGS_GROUP);
|
settings.beginGroup(DATA_SETTINGS_GROUP);
|
||||||
if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false) {
|
if (!settings.value(SHOW_TRACKS_SETTING, SHOW_TRACKS_DEFAULT).toBool()) {
|
||||||
_pathView->showTracks(false);
|
_pathView->showTracks(false);
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
_tabs.at(i)->showTracks(false);
|
_tabs.at(i)->showTracks(false);
|
||||||
} else
|
} else
|
||||||
_showTracksAction->setChecked(true);
|
_showTracksAction->setChecked(true);
|
||||||
if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false) {
|
if (!settings.value(SHOW_ROUTES_SETTING, SHOW_ROUTES_DEFAULT).toBool()) {
|
||||||
_pathView->showRoutes(false);
|
_pathView->showRoutes(false);
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
_tabs.at(i)->showRoutes(false);
|
_tabs.at(i)->showRoutes(false);
|
||||||
} else
|
} else
|
||||||
_showRoutesAction->setChecked(true);
|
_showRoutesAction->setChecked(true);
|
||||||
if (settings.value(SHOW_WAYPOINTS_SETTING, true).toBool() == false)
|
if (!settings.value(SHOW_WAYPOINTS_SETTING, SHOW_WAYPOINTS_DEFAULT)
|
||||||
|
.toBool())
|
||||||
_pathView->showWaypoints(false);
|
_pathView->showWaypoints(false);
|
||||||
else
|
else
|
||||||
_showWaypointsAction->setChecked(true);
|
_showWaypointsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_WAYPOINT_LABELS_SETTING, true).toBool() == false)
|
if (!settings.value(SHOW_WAYPOINT_LABELS_SETTING,
|
||||||
|
SHOW_WAYPOINT_LABELS_DEFAULT).toBool())
|
||||||
_pathView->showWaypointLabels(false);
|
_pathView->showWaypointLabels(false);
|
||||||
else
|
else
|
||||||
_showWaypointLabelsAction->setChecked(true);
|
_showWaypointLabelsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_ROUTE_WAYPOINTS_SETTING, true).toBool() == false)
|
if (!settings.value(SHOW_ROUTE_WAYPOINTS_SETTING,
|
||||||
|
SHOW_ROUTE_WAYPOINTS_SETTING).toBool())
|
||||||
_pathView->showRouteWaypoints(false);
|
_pathView->showRouteWaypoints(false);
|
||||||
else
|
else
|
||||||
_showRouteWaypointsAction->setChecked(true);
|
_showRouteWaypointsAction->setChecked(true);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(EXPORT_SETTINGS_GROUP);
|
||||||
|
_export.orientation = (QPrinter::Orientation) settings.value(
|
||||||
|
PAPER_ORIENTATION_SETTING, PAPER_ORIENTATION_DEFAULT).toInt();
|
||||||
|
_export.paperSize = (QPrinter::PaperSize) settings.value(PAPER_SIZE_SETTING,
|
||||||
|
PAPER_SIZE_DEFAULT).toInt();
|
||||||
|
qreal ml = settings.value(MARGIN_LEFT_SETTING, MARGIN_LEFT_DEFAULT)
|
||||||
|
.toReal();
|
||||||
|
qreal mt = settings.value(MARGIN_TOP_SETTING, MARGIN_TOP_DEFAULT).toReal();
|
||||||
|
qreal mr = settings.value(MARGIN_RIGHT_SETTING, MARGIN_RIGHT_DEFAULT)
|
||||||
|
.toReal();
|
||||||
|
qreal mb = settings.value(MARGIN_BOTTOM_SETTING, MARGIN_BOTTOM_DEFAULT)
|
||||||
|
.toReal();
|
||||||
|
_export.margins = MarginsF(ml, mt, mr, mb);
|
||||||
|
_export.fileName = settings.value(EXPORT_FILENAME_SETTING,
|
||||||
|
EXPORT_FILENAME_DEFAULT).toString();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
|
||||||
|
QColor pc = settings.value(PALETTE_COLOR_SETTING, PALETTE_COLOR_DEFAULT)
|
||||||
|
.value<QColor>();
|
||||||
|
qreal ps = settings.value(PALETTE_SHIFT_SETTING, PALETTE_SHIFT_DEFAULT)
|
||||||
|
.toDouble();
|
||||||
|
_options.palette = Palette(pc, ps);
|
||||||
|
_options.trackWidth = settings.value(TRACK_WIDTH_SETTING,
|
||||||
|
TRACK_WIDTH_DEFAULT).toInt();
|
||||||
|
_options.routeWidth = settings.value(ROUTE_WIDTH_SETTING,
|
||||||
|
ROUTE_WIDTH_DEFAULT).toInt();
|
||||||
|
_options.trackStyle = (Qt::PenStyle) settings.value(TRACK_STYLE_SETTING,
|
||||||
|
(int)TRACK_STYLE_DEFAULT).toInt();
|
||||||
|
_options.routeStyle = (Qt::PenStyle) settings.value(ROUTE_STYLE_SETTING,
|
||||||
|
(int)ROUTE_STYLE_DEFAULT).toInt();
|
||||||
|
_options.pathAntiAliasing = settings.value(PATH_AA_SETTING, PATH_AA_DEFAULT)
|
||||||
|
.toBool();
|
||||||
|
_options.graphWidth = settings.value(GRAPH_WIDTH_SETTING,
|
||||||
|
GRAPH_WIDTH_DEFAULT).toInt();
|
||||||
|
_options.graphAntiAliasing = settings.value(GRAPH_AA_SETTING,
|
||||||
|
GRAPH_AA_DEFAULT).toBool();
|
||||||
|
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
|
||||||
|
.toInt();
|
||||||
|
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
|
||||||
|
.toBool();
|
||||||
|
_options.printName = settings.value(PRINT_NAME_SETTING, PRINT_NAME_DEFAULT)
|
||||||
|
.toBool();
|
||||||
|
_options.printDate = settings.value(PRINT_DATE_SETTING, PRINT_DATE_DEFAULT)
|
||||||
|
.toBool();
|
||||||
|
_options.printDistance = settings.value(PRINT_DISTANCE_SETTING,
|
||||||
|
PRINT_DISTANCE_DEFAULT).toBool();
|
||||||
|
_options.printTime = settings.value(PRINT_TIME_SETTING, PRINT_TIME_DEFAULT)
|
||||||
|
.toBool();
|
||||||
|
_options.printItemCount = settings.value(PRINT_ITEM_COUNT_SETTING,
|
||||||
|
PRINT_ITEM_COUNT_DEFAULT).toBool();
|
||||||
|
_options.separateGraphPage = settings.value(SEPARATE_GRAPH_PAGE_SETTING,
|
||||||
|
SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
|
||||||
|
|
||||||
|
_pathView->setPalette(_options.palette);
|
||||||
|
_pathView->setTrackWidth(_options.trackWidth);
|
||||||
|
_pathView->setRouteWidth(_options.routeWidth);
|
||||||
|
_pathView->setTrackStyle(_options.trackStyle);
|
||||||
|
_pathView->setRouteStyle(_options.routeStyle);
|
||||||
|
_pathView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
|
||||||
|
if (_options.useOpenGL)
|
||||||
|
_pathView->useOpenGL(true);
|
||||||
|
|
||||||
|
for (int i = 0; i < _tabs.count(); i++) {
|
||||||
|
_tabs.at(i)->setPalette(_options.palette);
|
||||||
|
_tabs.at(i)->setGraphWidth(_options.graphWidth);
|
||||||
|
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
|
||||||
|
_options.graphAntiAliasing);
|
||||||
|
if (_options.useOpenGL)
|
||||||
|
_tabs.at(i)->useOpenGL(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_poi->setRadius(_options.poiRadius);
|
||||||
|
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUI::mapIndex(const QString &name)
|
int GUI::mapIndex(const QString &name)
|
||||||
|
12
src/gui.h
@ -9,7 +9,8 @@
|
|||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
#include "margins.h"
|
#include "exportdialog.h"
|
||||||
|
#include "optionsdialog.h"
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
@ -55,6 +56,7 @@ private slots:
|
|||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void nextMap();
|
void nextMap();
|
||||||
void prevMap();
|
void prevMap();
|
||||||
|
void openOptions();
|
||||||
|
|
||||||
void mapChanged(int);
|
void mapChanged(int);
|
||||||
void graphChanged(int);
|
void graphChanged(int);
|
||||||
@ -159,6 +161,7 @@ private:
|
|||||||
QAction *_showWaypointsAction;
|
QAction *_showWaypointsAction;
|
||||||
QAction *_showWaypointLabelsAction;
|
QAction *_showWaypointLabelsAction;
|
||||||
QAction *_showRouteWaypointsAction;
|
QAction *_showRouteWaypointsAction;
|
||||||
|
QAction *_openOptionsAction;
|
||||||
QList<QAction*> _mapActions;
|
QList<QAction*> _mapActions;
|
||||||
QList<QAction*> _poiFilesActions;
|
QList<QAction*> _poiFilesActions;
|
||||||
|
|
||||||
@ -186,16 +189,15 @@ private:
|
|||||||
qreal _routeDistance;
|
qreal _routeDistance;
|
||||||
qreal _time;
|
qreal _time;
|
||||||
DateRange _dateRange;
|
DateRange _dateRange;
|
||||||
|
QString _pathName;
|
||||||
|
|
||||||
qreal _sliderPos;
|
qreal _sliderPos;
|
||||||
|
|
||||||
int _frameStyle;
|
int _frameStyle;
|
||||||
bool _showGraphs;
|
bool _showGraphs;
|
||||||
|
|
||||||
QString _exportFileName;
|
Export _export;
|
||||||
QPrinter::PaperSize _exportPaperSize;
|
Options _options;
|
||||||
QPrinter::Orientation _exportOrientation;
|
|
||||||
MarginsF _exportMargins;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUI_H
|
#endif // GUI_H
|
||||||
|
38
src/icons.h
@ -1,20 +1,28 @@
|
|||||||
#ifndef ICONS_H
|
#ifndef ICONS_H
|
||||||
#define ICONS_H
|
#define ICONS_H
|
||||||
|
|
||||||
#define APP_ICON ":/icons/gpxsee.png"
|
#define APP_ICON ":/icons/gpxsee.png"
|
||||||
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
|
||||||
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
// Toolbar/menu icons
|
||||||
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
||||||
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
||||||
#define SHOW_POI_ICON ":/icons/flag.png"
|
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
||||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
||||||
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line-stacked.png"
|
#define SHOW_POI_ICON ":/icons/flag.png"
|
||||||
#define QUIT_ICON ":/icons/application-exit.png"
|
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line-stacked.png"
|
||||||
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
#define QUIT_ICON ":/icons/application-exit.png"
|
||||||
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
||||||
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
||||||
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
||||||
#define FULLSCREEN_ICON ":/icons/view-fullscreen.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"
|
||||||
|
|
||||||
#endif /* ICONS_H */
|
#endif /* ICONS_H */
|
||||||
|
249
src/igcparser.cpp
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include "misc.h"
|
||||||
|
#include "igcparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
static bool readLat(const char *data, qreal &lat)
|
||||||
|
{
|
||||||
|
int d = str2int(data, 2);
|
||||||
|
int mi = str2int(data + 2, 2);
|
||||||
|
int mf = str2int(data + 4, 3);
|
||||||
|
if (d < 0 || mi < 0 || mf < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(data[7] == 'N' || data[7] == 'S'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lat = d + (((qreal)mi + (qreal)mf/1000) / 60);
|
||||||
|
if (lat > 90)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[7] == 'S')
|
||||||
|
lat = -lat;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readLon(const char *data, qreal &lon)
|
||||||
|
{
|
||||||
|
int d = str2int(data, 3);
|
||||||
|
int mi = str2int(data + 3, 2);
|
||||||
|
int mf = str2int(data + 5, 3);
|
||||||
|
if (d < 0 || mi < 0 || mf < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(data[8] == 'E' || data[8] == 'W'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lon = d + (((qreal)mi + (qreal)mf/1000) / 60);
|
||||||
|
if (lon > 180)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[8] == 'W')
|
||||||
|
lon = -lon;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readAltitude(const char *data, qreal &ele)
|
||||||
|
{
|
||||||
|
int p;
|
||||||
|
|
||||||
|
if (!(data[0] == 'A' || data[0] == 'V'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[1] == '-')
|
||||||
|
p = str2int(data + 2, 4);
|
||||||
|
else
|
||||||
|
p = str2int(data + 1, 5);
|
||||||
|
|
||||||
|
int g = str2int(data + 6, 5);
|
||||||
|
if (p < 0 || g < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[0] == 'A')
|
||||||
|
ele = (qreal)g;
|
||||||
|
else
|
||||||
|
ele = NAN;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readTimestamp(const char *data, QTime &time)
|
||||||
|
{
|
||||||
|
int h = str2int(data, 2);
|
||||||
|
int m = str2int(data + 2, 2);
|
||||||
|
int s = str2int(data + 4, 2);
|
||||||
|
|
||||||
|
if (h < 0 || m < 0 || s < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
time = QTime(h, m, s);
|
||||||
|
if (!time.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readARecord(const char *line, qint64 len)
|
||||||
|
{
|
||||||
|
if (len < 9 || line[0] != 'A')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (int i = 1; i < 7; i++)
|
||||||
|
if (!::isprint(line[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readHRecord(const char *line, int len)
|
||||||
|
{
|
||||||
|
if (len < 10 || ::strncmp(line, "HFDTE", 5))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
int d = str2int(line + 5, 2);
|
||||||
|
int m = str2int(line + 7, 2);
|
||||||
|
int y = str2int(line + 9, 2);
|
||||||
|
|
||||||
|
if (y < 0 || m < 0 || d < 0) {
|
||||||
|
_errorString = "Invalid date header format";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_date = QDate(y + 2000 < QDate::currentDate().year() ? 2000 + y : 1900 + y,
|
||||||
|
m, d);
|
||||||
|
if (!_date.isValid()) {
|
||||||
|
_errorString = "Invalid date";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readBRecord(const char *line, int len)
|
||||||
|
{
|
||||||
|
qreal lat, lon, ele;
|
||||||
|
QTime time;
|
||||||
|
|
||||||
|
|
||||||
|
if (len < 35)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!readTimestamp(line + 1, time)) {
|
||||||
|
_errorString = "Invalid timestamp";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readLat(line + 7, lat)) {
|
||||||
|
_errorString = "Invalid latitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!readLon(line + 15, lon)) {
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readAltitude(line + 24, ele)) {
|
||||||
|
_errorString = "Invalid altitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (time < _time)
|
||||||
|
_date = _date.addDays(1);
|
||||||
|
_time = time;
|
||||||
|
|
||||||
|
Trackpoint t(Coordinates(lon, lat));
|
||||||
|
t.setTimestamp(QDateTime(_date, _time, Qt::UTC));
|
||||||
|
t.setElevation(ele);
|
||||||
|
_tracks.last().append(t);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readCRecord(const char *line, int len)
|
||||||
|
{
|
||||||
|
qreal lat, lon;
|
||||||
|
|
||||||
|
|
||||||
|
if (len < 18)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!readLat(line + 1, lat)) {
|
||||||
|
_errorString = "Invalid latitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!readLon(line + 9, lon)) {
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(lat == 0 && lon == 0)) {
|
||||||
|
QByteArray ba(line + 18, len - 19);
|
||||||
|
|
||||||
|
Waypoint w(Coordinates(lon, lat));
|
||||||
|
w.setName(QString(ba.trimmed()));
|
||||||
|
_routes.last().append(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::loadFile(QFile *file)
|
||||||
|
{
|
||||||
|
qint64 len;
|
||||||
|
char line[76 + 2 + 1 + 1];
|
||||||
|
bool route = false, track = false;
|
||||||
|
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!file->atEnd()) {
|
||||||
|
len = file->readLine(line, sizeof(line));
|
||||||
|
|
||||||
|
if (len < 0) {
|
||||||
|
_errorString = "I/O error";
|
||||||
|
return false;
|
||||||
|
} else if (len > (qint64)sizeof(line) - 1) {
|
||||||
|
_errorString = "Line limit exceeded";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_errorLine == 1) {
|
||||||
|
if (!readARecord(line, len)) {
|
||||||
|
_errorString = "Invalid/missing A record";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (line[0] == 'H') {
|
||||||
|
if (!readHRecord(line, len))
|
||||||
|
return false;
|
||||||
|
} else if (line[0] == 'C') {
|
||||||
|
if (route) {
|
||||||
|
if (!readCRecord(line, len))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
route = true;
|
||||||
|
_routes.append(RouteData());
|
||||||
|
}
|
||||||
|
} else if (line[0] == 'B') {
|
||||||
|
if (_date.isNull()) {
|
||||||
|
_errorString = "Missing date header";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!track) {
|
||||||
|
_tracks.append(TrackData());
|
||||||
|
_time = QTime(0, 0);
|
||||||
|
track = true;
|
||||||
|
}
|
||||||
|
if (!readBRecord(line, len))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
33
src/igcparser.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef IGCPARSER_H
|
||||||
|
#define IGCPARSER_H
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
#include <QTime>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class IGCParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IGCParser(QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints) : Parser(tracks, routes, waypoints)
|
||||||
|
{_errorLine = 0;}
|
||||||
|
~IGCParser() {}
|
||||||
|
|
||||||
|
bool loadFile(QFile *file);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool readHRecord(const char *line, int len);
|
||||||
|
bool readBRecord(const char *line, int len);
|
||||||
|
bool readCRecord(const char *line, int len);
|
||||||
|
|
||||||
|
int _errorLine;
|
||||||
|
QString _errorString;
|
||||||
|
|
||||||
|
QDate _date;
|
||||||
|
QTime _time;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IGCPARSER_H
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoItem::updateBoundingRect()
|
void InfoItem::updateBoundingRect()
|
||||||
@ -76,6 +78,7 @@ void InfoItem::insert(const QString &key, const QString &value)
|
|||||||
_list[i] = kv;
|
_list[i] = kv;
|
||||||
|
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoItem::clear()
|
void InfoItem::clear()
|
||||||
|
@ -87,7 +87,7 @@ bool KMLParser::pointCoordinates(Waypoint &waypoint)
|
|||||||
|
|
||||||
for (vp = cp; cp <= ep; cp++) {
|
for (vp = cp; cp <= ep; cp++) {
|
||||||
if (*cp == ',') {
|
if (*cp == ',') {
|
||||||
if (c > 2)
|
if (c > 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
@ -145,7 +145,7 @@ bool KMLParser::lineCoordinates(TrackData &track)
|
|||||||
|
|
||||||
for (vp = cp; cp <= ep; cp++) {
|
for (vp = cp; cp <= ep; cp++) {
|
||||||
if (*cp == ',') {
|
if (*cp == ',') {
|
||||||
if (c > 2)
|
if (c > 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
@ -225,7 +225,7 @@ void KMLParser::point(Waypoint &waypoint)
|
|||||||
_reader.raiseError("Missing Point coordinates");
|
_reader.raiseError("Missing Point coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::Track(TrackData &track)
|
void KMLParser::track(TrackData &track)
|
||||||
{
|
{
|
||||||
const char mismatchError[] = "gx:coord/when element count mismatch";
|
const char mismatchError[] = "gx:coord/when element count mismatch";
|
||||||
int i = track.size();
|
int i = track.size();
|
||||||
@ -251,6 +251,28 @@ void KMLParser::Track(TrackData &track)
|
|||||||
_reader.raiseError(mismatchError);
|
_reader.raiseError(mismatchError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KMLParser::multiGeometry(const QString &name, const QString &desc,
|
||||||
|
const QDateTime timestamp)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Point") {
|
||||||
|
_waypoints.append(Waypoint());
|
||||||
|
Waypoint &w = _waypoints.last();
|
||||||
|
w.setName(name);
|
||||||
|
w.setDescription(desc);
|
||||||
|
w.setTimestamp(timestamp);
|
||||||
|
point(w);
|
||||||
|
} else if (_reader.name() == "LineString") {
|
||||||
|
_tracks.append(TrackData());
|
||||||
|
TrackData &t = _tracks.last();
|
||||||
|
t.setName(name);
|
||||||
|
t.setDescription(desc);
|
||||||
|
lineString(t);
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KMLParser::placemark()
|
void KMLParser::placemark()
|
||||||
{
|
{
|
||||||
QString name, desc;
|
QString name, desc;
|
||||||
@ -263,25 +285,27 @@ void KMLParser::placemark()
|
|||||||
desc = _reader.readElementText();
|
desc = _reader.readElementText();
|
||||||
else if (_reader.name() == "TimeStamp")
|
else if (_reader.name() == "TimeStamp")
|
||||||
timestamp = timeStamp();
|
timestamp = timeStamp();
|
||||||
|
else if (_reader.name() == "MultiGeometry")
|
||||||
|
multiGeometry(name, desc, timestamp);
|
||||||
else if (_reader.name() == "Point") {
|
else if (_reader.name() == "Point") {
|
||||||
_waypoints.append(Waypoint());
|
_waypoints.append(Waypoint());
|
||||||
Waypoint &waypoint = _waypoints.last();
|
Waypoint &w = _waypoints.last();
|
||||||
waypoint.setName(name);
|
w.setName(name);
|
||||||
waypoint.setDescription(desc);
|
w.setDescription(desc);
|
||||||
waypoint.setTimestamp(timestamp);
|
w.setTimestamp(timestamp);
|
||||||
point(waypoint);
|
point(w);
|
||||||
} else if (_reader.name() == "LineString") {
|
} else if (_reader.name() == "LineString") {
|
||||||
_tracks.append(TrackData());
|
_tracks.append(TrackData());
|
||||||
TrackData &track = _tracks.last();
|
TrackData &t = _tracks.last();
|
||||||
track.setName(name);
|
t.setName(name);
|
||||||
track.setDescription(desc);
|
t.setDescription(desc);
|
||||||
lineString(track);
|
lineString(t);
|
||||||
} else if (_reader.name() == "Track") {
|
} else if (_reader.name() == "Track") {
|
||||||
_tracks.append(TrackData());
|
_tracks.append(TrackData());
|
||||||
TrackData &track = _tracks.last();
|
TrackData &t = _tracks.last();
|
||||||
track.setName(name);
|
t.setName(name);
|
||||||
track.setDescription(desc);
|
t.setDescription(desc);
|
||||||
Track(track);
|
track(t);
|
||||||
} else
|
} else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,9 @@ private:
|
|||||||
void document();
|
void document();
|
||||||
void folder();
|
void folder();
|
||||||
void placemark();
|
void placemark();
|
||||||
void Track(TrackData &track);
|
void multiGeometry(const QString &name, const QString &desc,
|
||||||
|
const QDateTime timestamp);
|
||||||
|
void track(TrackData &track);
|
||||||
void lineString(TrackData &track);
|
void lineString(TrackData &track);
|
||||||
void point(Waypoint &waypoint);
|
void point(Waypoint &waypoint);
|
||||||
bool pointCoordinates(Waypoint &waypoint);
|
bool pointCoordinates(Waypoint &waypoint);
|
||||||
|
15
src/misc.cpp
@ -1,4 +1,5 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cctype>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
@ -33,3 +34,17 @@ double niceNum(double x, int round)
|
|||||||
|
|
||||||
return nf * pow(10.0, expv);
|
return nf * pow(10.0, expv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int str2int(const char *str, int len)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
for (const char *sp = str; sp < str + len; sp++) {
|
||||||
|
if (::isdigit(*sp))
|
||||||
|
res = res * 10 + *sp - '0';
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
#define MISC_H
|
#define MISC_H
|
||||||
|
|
||||||
double niceNum(double x, int round);
|
double niceNum(double x, int round);
|
||||||
|
int str2int(const char *str, int len);
|
||||||
|
|
||||||
#endif // MISC_H
|
#endif // MISC_H
|
||||||
|
527
src/nmeaparser.cpp
Normal file
@ -0,0 +1,527 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include "misc.h"
|
||||||
|
#include "nmeaparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
static bool validSentence(const char *line, int len)
|
||||||
|
{
|
||||||
|
const char *lp;
|
||||||
|
|
||||||
|
if (len < 12 || line[0] != '$')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (lp = line + len - 1; lp > line + 3; lp--)
|
||||||
|
if (!::isspace(*lp))
|
||||||
|
break;
|
||||||
|
if (*(lp-2) != '*' || !::isalnum(*(lp-1)) || !::isalnum(*(lp)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readFloat(const char *data, int len, qreal &f)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
f = QString(QByteArray::fromRawData(data, len)).toFloat(&ok);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readAltitude(const char *data, int len, qreal &ele)
|
||||||
|
{
|
||||||
|
if (!len) {
|
||||||
|
ele = NAN;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readFloat(data, len, ele)) {
|
||||||
|
_errorString = "Invalid altitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readGeoidHeight(const char *data, int len, qreal &gh)
|
||||||
|
{
|
||||||
|
if (!len) {
|
||||||
|
gh = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readFloat(data, len, gh)) {
|
||||||
|
_errorString = "Invalid geoid height";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readTime(const char *data, int len, QTime &time)
|
||||||
|
{
|
||||||
|
int h, m, s, ms = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (!len) {
|
||||||
|
time = QTime();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len < 6)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
h = str2int(data, 2);
|
||||||
|
m = str2int(data + 2, 2);
|
||||||
|
s = str2int(data + 4, 2);
|
||||||
|
if (h < 0 || m < 0 || s < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (len > 7 && data[6] == '.') {
|
||||||
|
if ((ms = str2int(data + 7, len - 7)) < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = QTime(h, m, s, ms);
|
||||||
|
if (!time.isValid())
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
_errorString = "Invalid time";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readDate(const char *data, int len, QDate &date)
|
||||||
|
{
|
||||||
|
int y, m, d;
|
||||||
|
|
||||||
|
|
||||||
|
if (!len) {
|
||||||
|
date = QDate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len < 6)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
d = str2int(data, 2);
|
||||||
|
m = str2int(data + 2, 2);
|
||||||
|
y = str2int(data + 4, len - 4);
|
||||||
|
if (d < 0 || m < 0 || y < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (len - 4 == 2)
|
||||||
|
date = QDate(y + 2000 < QDate::currentDate().year()
|
||||||
|
? 2000 + y : 1900 + y, m, d);
|
||||||
|
else
|
||||||
|
date = QDate(y, m, d);
|
||||||
|
if (!date.isValid())
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
_errorString = "Invalid date";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readLat(const char *data, int len, qreal &lat)
|
||||||
|
{
|
||||||
|
int d, mi;
|
||||||
|
qreal mf;
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
|
||||||
|
if (!len) {
|
||||||
|
lat = NAN;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len < 7 || data[4] != '.')
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
d = str2int(data, 2);
|
||||||
|
mi = str2int(data + 2, 2);
|
||||||
|
mf = QString(QByteArray::fromRawData(data + 4, len - 4)).toFloat(&ok);
|
||||||
|
if (d < 0 || mi < 0 || !ok)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
lat = d + (((qreal)mi + mf) / 60.0);
|
||||||
|
if (lat > 90)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
_errorString = "Invalid ltitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readNS(const char *data, int len, qreal &lat)
|
||||||
|
{
|
||||||
|
if (!len) {
|
||||||
|
lat = NAN;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len != 1 || !(*data == 'N' || *data == 'S')) {
|
||||||
|
_errorString = "Invalid N/S value";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*data == 'S')
|
||||||
|
lat = -lat;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readLon(const char *data, int len, qreal &lon)
|
||||||
|
{
|
||||||
|
int d, mi;
|
||||||
|
qreal mf;
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
|
||||||
|
if (!len) {
|
||||||
|
lon = NAN;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len < 8 || data[5] != '.')
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
d = str2int(data, 3);
|
||||||
|
mi = str2int(data + 3, 2);
|
||||||
|
mf = QString(QByteArray::fromRawData(data + 5, len - 5)).toFloat(&ok);
|
||||||
|
if (d < 0 || mi < 0 || !ok)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
lon = d + (((qreal)mi + mf) / 60.0);
|
||||||
|
if (lon > 180)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readEW(const char *data, int len, qreal &lon)
|
||||||
|
{
|
||||||
|
if (!len) {
|
||||||
|
lon = NAN;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len != 1 || !(*data == 'E' || *data == 'W')) {
|
||||||
|
_errorString = "Invalid E/W value";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*data == 'W')
|
||||||
|
lon = -lon;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readRMC(const char *line, int len)
|
||||||
|
{
|
||||||
|
int col = 1;
|
||||||
|
const char *vp = line;
|
||||||
|
qreal lat, lon;
|
||||||
|
QTime time;
|
||||||
|
QDate date;
|
||||||
|
bool valid = true;
|
||||||
|
|
||||||
|
for (const char *lp = line; lp < line + len; lp++) {
|
||||||
|
if (*lp == ',' || *lp == '*') {
|
||||||
|
switch (col) {
|
||||||
|
case 1:
|
||||||
|
if (!readTime(vp, lp - vp, time))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (*vp != 'A')
|
||||||
|
valid = false;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!readLat(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!readNS(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if (!readLon(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if (!readEW(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
if (!readDate(vp, lp - vp, date))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
col++;
|
||||||
|
vp = lp + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col < 9) {
|
||||||
|
_errorString = "Invalid RMC sentence";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!date.isNull()) {
|
||||||
|
if (_date.isNull() && !_time.isNull() && !_tracks.last().isEmpty())
|
||||||
|
_tracks.last().last().setTimestamp(QDateTime(date, _time, Qt::UTC));
|
||||||
|
_date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valid && !_GGA && !std::isnan(lat) && !std::isnan(lon)) {
|
||||||
|
Trackpoint t(Coordinates(lon, lat));
|
||||||
|
if (!_date.isNull() && !time.isNull())
|
||||||
|
t.setTimestamp(QDateTime(_date, time, Qt::UTC));
|
||||||
|
_tracks.last().append(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readGGA(const char *line, int len)
|
||||||
|
{
|
||||||
|
int col = 1;
|
||||||
|
const char *vp = line;
|
||||||
|
qreal lat, lon, ele, gh;
|
||||||
|
|
||||||
|
for (const char *lp = line; lp < line + len; lp++) {
|
||||||
|
if (*lp == ',' || *lp == '*') {
|
||||||
|
switch (col) {
|
||||||
|
case 1:
|
||||||
|
if (!readTime(vp, lp - vp, _time))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (!readLat(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!readNS(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!readLon(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if (!readEW(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
if (!readAltitude(vp, lp - vp, ele))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
if ((lp - vp) && !((lp - vp) == 1 && *vp == 'M')) {
|
||||||
|
_errorString = "Invalid altitude units";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
if (!readGeoidHeight(vp, lp - vp, gh))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
if ((lp - vp) && !((lp - vp) == 1 && *vp == 'M')) {
|
||||||
|
_errorString = "Invalid geoid height units";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
col++;
|
||||||
|
vp = lp + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col < 12) {
|
||||||
|
_errorString = "Invalid GGA sentence";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::isnan(lat) && !std::isnan(lon)) {
|
||||||
|
Trackpoint t(Coordinates(lon, lat));
|
||||||
|
if (!(_time.isNull() || _date.isNull()))
|
||||||
|
t.setTimestamp(QDateTime(_date, _time, Qt::UTC));
|
||||||
|
if (!std::isnan(ele))
|
||||||
|
t.setElevation(ele - gh);
|
||||||
|
_tracks.last().append(t);
|
||||||
|
|
||||||
|
_GGA = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readWPL(const char *line, int len)
|
||||||
|
{
|
||||||
|
int col = 1;
|
||||||
|
const char *vp = line;
|
||||||
|
qreal lat, lon;
|
||||||
|
QString name;
|
||||||
|
|
||||||
|
for (const char *lp = line; lp < line + len; lp++) {
|
||||||
|
if (*lp == ',' || *lp == '*') {
|
||||||
|
switch (col) {
|
||||||
|
case 1:
|
||||||
|
if (!readLat(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (!readNS(vp, lp - vp, lat))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!readLon(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!readEW(vp, lp - vp, lon))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
name = QString(QByteArray(vp, lp - vp));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
col++;
|
||||||
|
vp = lp + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col < 4) {
|
||||||
|
_errorString = "Invalid WPL sentence";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::isnan(lat) && !std::isnan(lon)) {
|
||||||
|
Waypoint w(Coordinates(lon, lat));
|
||||||
|
w.setName(name);
|
||||||
|
_waypoints.append(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::readZDA(const char *line, int len)
|
||||||
|
{
|
||||||
|
int col = 1;
|
||||||
|
const char *vp = line;
|
||||||
|
int d, m, y;
|
||||||
|
|
||||||
|
for (const char *lp = line; lp < line + len; lp++) {
|
||||||
|
if (*lp == ',' || *lp == '*') {
|
||||||
|
switch (col) {
|
||||||
|
case 2:
|
||||||
|
if (!(lp - vp))
|
||||||
|
return true;
|
||||||
|
if ((d = str2int(vp, lp - vp)) < 0) {
|
||||||
|
_errorString = "Invalid day";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!(lp - vp))
|
||||||
|
return true;
|
||||||
|
if ((m = str2int(vp, lp - vp)) < 0) {
|
||||||
|
_errorString = "Invalid month";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!(lp - vp))
|
||||||
|
return true;
|
||||||
|
if ((y = str2int(vp, lp - vp)) < 0) {
|
||||||
|
_errorString = "Invalid year";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
col++;
|
||||||
|
vp = lp + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col < 4) {
|
||||||
|
_errorString = "Invalid ZDA sentence";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_date = QDate(y, m, d);
|
||||||
|
if (!_date.isValid()) {
|
||||||
|
_errorString = "Invalid date";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NMEAParser::loadFile(QFile *file)
|
||||||
|
{
|
||||||
|
qint64 len;
|
||||||
|
char line[80 + 2 + 1 + 1];
|
||||||
|
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
_date = QDate();
|
||||||
|
_time = QTime();
|
||||||
|
_GGA = false;
|
||||||
|
|
||||||
|
_tracks.append(TrackData());
|
||||||
|
|
||||||
|
while (!file->atEnd()) {
|
||||||
|
len = file->readLine(line, sizeof(line));
|
||||||
|
|
||||||
|
if (len < 0) {
|
||||||
|
_errorString = "I/O error";
|
||||||
|
return false;
|
||||||
|
} else if (len > (qint64)sizeof(line) - 1) {
|
||||||
|
_errorString = "Line limit exceeded";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validSentence(line, len)) {
|
||||||
|
if (!memcmp(line + 3, "RMC,", 4)) {
|
||||||
|
if (!readRMC(line + 7, len))
|
||||||
|
return false;
|
||||||
|
} else if (!memcmp(line + 3, "GGA,", 4)) {
|
||||||
|
if (!readGGA(line + 7, len))
|
||||||
|
return false;
|
||||||
|
} else if (!memcmp(line + 3, "WPL,", 4)) {
|
||||||
|
if (!readWPL(line + 7, len))
|
||||||
|
return false;
|
||||||
|
} else if (!memcmp(line + 3, "ZDA,", 4)) {
|
||||||
|
if (!readZDA(line + 7, len))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_tracks.last().size() && !_waypoints.size()) {
|
||||||
|
_errorString = "No usable NMEA sentence found";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
43
src/nmeaparser.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef NMEAPARSER_H
|
||||||
|
#define NMEAPARSER_H
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class NMEAParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NMEAParser(QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints) : Parser(tracks, routes, waypoints)
|
||||||
|
{_errorLine = 0; _GGA = false;}
|
||||||
|
~NMEAParser() {}
|
||||||
|
|
||||||
|
bool loadFile(QFile *file);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool readEW(const char *data, int len, qreal &lon);
|
||||||
|
bool readLon(const char *data, int len, qreal &lon);
|
||||||
|
bool readNS(const char *data, int len, qreal &lat);
|
||||||
|
bool readLat(const char *data, int len, qreal &lat);
|
||||||
|
bool readDate(const char *data, int len, QDate &date);
|
||||||
|
bool readTime(const char *data, int len, QTime &time);
|
||||||
|
bool readAltitude(const char *data, int len, qreal &ele);
|
||||||
|
bool readGeoidHeight(const char *data, int len, qreal &gh);
|
||||||
|
|
||||||
|
bool readRMC(const char *line, int len);
|
||||||
|
bool readGGA(const char *line, int len);
|
||||||
|
bool readWPL(const char *line, int len);
|
||||||
|
bool readZDA(const char *line, int len);
|
||||||
|
|
||||||
|
int _errorLine;
|
||||||
|
QString _errorString;
|
||||||
|
|
||||||
|
QDate _date;
|
||||||
|
QTime _time;
|
||||||
|
bool _GGA;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMEAPARSER_H
|
26
src/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
|
284
src/optionsdialog.cpp
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include "config.h"
|
||||||
|
#include "icons.h"
|
||||||
|
#include "colorbox.h"
|
||||||
|
#include "stylecombobox.h"
|
||||||
|
#include "optionsdialog.h"
|
||||||
|
|
||||||
|
#define MENU_MARGIN 20
|
||||||
|
#define MENU_ICON_SIZE 32
|
||||||
|
|
||||||
|
|
||||||
|
QWidget *OptionsDialog::createAppearancePage()
|
||||||
|
{
|
||||||
|
_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);
|
||||||
|
|
||||||
|
QWidget *colorTab = new QWidget();
|
||||||
|
colorTab->setLayout(paletteLayout);
|
||||||
|
|
||||||
|
|
||||||
|
_trackWidth = new QSpinBox();
|
||||||
|
_trackWidth->setValue(_options->trackWidth);
|
||||||
|
_trackWidth->setMinimum(1);
|
||||||
|
_trackStyle = new StyleComboBox();
|
||||||
|
_trackStyle->setValue(_options->trackStyle);
|
||||||
|
QFormLayout *trackLayout = new QFormLayout();
|
||||||
|
trackLayout->addRow(tr("Track width:"), _trackWidth);
|
||||||
|
trackLayout->addRow(tr("Track style:"), _trackStyle);
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
QGroupBox *trackBox = new QGroupBox(tr("Tracks"));
|
||||||
|
trackBox->setLayout(trackLayout);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_routeWidth = new QSpinBox();
|
||||||
|
_routeWidth->setValue(_options->routeWidth);
|
||||||
|
_routeWidth->setMinimum(1);
|
||||||
|
_routeStyle = new StyleComboBox();
|
||||||
|
_routeStyle->setValue(_options->routeStyle);
|
||||||
|
QFormLayout *routeLayout = new QFormLayout();
|
||||||
|
routeLayout->addRow(tr("Route width:"), _routeWidth);
|
||||||
|
routeLayout->addRow(tr("Route style:"), _routeStyle);
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
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
|
||||||
|
QFrame *l1 = new QFrame();
|
||||||
|
l1->setFrameShape(QFrame::HLine);
|
||||||
|
l1->setFrameShadow(QFrame::Sunken);
|
||||||
|
QFrame *l2 = new QFrame();
|
||||||
|
l2->setFrameShape(QFrame::HLine);
|
||||||
|
l2->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
|
pathTabLayout->addLayout(trackLayout);
|
||||||
|
pathTabLayout->addWidget(l1);
|
||||||
|
pathTabLayout->addLayout(routeLayout);
|
||||||
|
pathTabLayout->addWidget(l2);
|
||||||
|
#else
|
||||||
|
pathTabLayout->addWidget(trackBox);
|
||||||
|
pathTabLayout->addWidget(routeBox);
|
||||||
|
#endif
|
||||||
|
pathTabLayout->addLayout(pathAALayout);
|
||||||
|
pathTab->setLayout(pathTabLayout);
|
||||||
|
|
||||||
|
_graphWidth = new QSpinBox();
|
||||||
|
_graphWidth->setValue(_options->graphWidth);
|
||||||
|
_graphWidth->setMinimum(1);
|
||||||
|
QFormLayout *graphLayout = new QFormLayout();
|
||||||
|
graphLayout->addRow(tr("Line width:"), _graphWidth);
|
||||||
|
|
||||||
|
_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);
|
||||||
|
|
||||||
|
QTabWidget *appearancePage = new QTabWidget();
|
||||||
|
appearancePage->addTab(colorTab, tr("Colors"));
|
||||||
|
appearancePage->addTab(pathTab, tr("Paths"));
|
||||||
|
appearancePage->addTab(graphTab, tr("Graphs"));
|
||||||
|
|
||||||
|
return appearancePage;
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
_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);
|
||||||
|
_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->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(headerTab, tr("Header"));
|
||||||
|
exportPage->addTab(graphTab, tr("Graphs"));
|
||||||
|
|
||||||
|
return exportPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *OptionsDialog::createSystemPage()
|
||||||
|
{
|
||||||
|
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
|
||||||
|
_useOpenGL->setChecked(false);
|
||||||
|
_useOpenGL->setEnabled(false);
|
||||||
|
} else
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
|
_useOpenGL->setChecked(_options->useOpenGL);
|
||||||
|
|
||||||
|
QFormLayout *systemLayout = new QFormLayout();
|
||||||
|
systemLayout->addWidget(_useOpenGL);
|
||||||
|
|
||||||
|
QWidget *systemTab = new QWidget();
|
||||||
|
systemTab->setLayout(systemLayout);
|
||||||
|
|
||||||
|
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(createAppearancePage());
|
||||||
|
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(APPEARANCE_ICON)), tr("Appearance"),
|
||||||
|
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->palette.setColor(_baseColor->color());
|
||||||
|
_options->palette.setShift(_colorOffset->value());
|
||||||
|
_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->graphWidth = _graphWidth->value();
|
||||||
|
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||||
|
|
||||||
|
if (_options->units == Imperial)
|
||||||
|
_options->poiRadius = _poiRadius->value() * MIINM;
|
||||||
|
else
|
||||||
|
_options->poiRadius = _poiRadius->value() * KMINM;
|
||||||
|
|
||||||
|
_options->useOpenGL = _useOpenGL->isChecked();
|
||||||
|
|
||||||
|
_options->printName = _name->isChecked();
|
||||||
|
_options->printDate = _date->isChecked();
|
||||||
|
_options->printDistance = _distance->isChecked();
|
||||||
|
_options->printTime = _time->isChecked();
|
||||||
|
_options->printItemCount = _itemCount->isChecked();
|
||||||
|
_options->separateGraphPage = _separateGraphPage->isChecked();
|
||||||
|
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
77
src/optionsdialog.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#ifndef OPTIONSDIALOG_H
|
||||||
|
#define OPTIONSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "palette.h"
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
|
class ColorBox;
|
||||||
|
class StyleComboBox;
|
||||||
|
class QSpinBox;
|
||||||
|
class QDoubleSpinBox;
|
||||||
|
class QComboBox;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
|
struct Options {
|
||||||
|
// Appearance
|
||||||
|
Palette palette;
|
||||||
|
int trackWidth;
|
||||||
|
int routeWidth;
|
||||||
|
Qt::PenStyle trackStyle;
|
||||||
|
Qt::PenStyle routeStyle;
|
||||||
|
int graphWidth;
|
||||||
|
bool pathAntiAliasing;
|
||||||
|
bool graphAntiAliasing;
|
||||||
|
// POI
|
||||||
|
int poiRadius;
|
||||||
|
// System
|
||||||
|
bool useOpenGL;
|
||||||
|
// Print/Export
|
||||||
|
bool printName;
|
||||||
|
bool printDate;
|
||||||
|
bool printDistance;
|
||||||
|
bool printTime;
|
||||||
|
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 *createAppearancePage();
|
||||||
|
QWidget *createPOIPage();
|
||||||
|
QWidget *createSystemPage();
|
||||||
|
QWidget *createExportPage();
|
||||||
|
|
||||||
|
Options *_options;
|
||||||
|
|
||||||
|
ColorBox *_baseColor;
|
||||||
|
QDoubleSpinBox *_colorOffset;
|
||||||
|
QSpinBox *_trackWidth;
|
||||||
|
StyleComboBox *_trackStyle;
|
||||||
|
QSpinBox *_routeWidth;
|
||||||
|
StyleComboBox *_routeStyle;
|
||||||
|
QCheckBox *_pathAA;
|
||||||
|
QSpinBox *_graphWidth;
|
||||||
|
QCheckBox *_graphAA;
|
||||||
|
QDoubleSpinBox *_poiRadius;
|
||||||
|
QCheckBox *_useOpenGL;
|
||||||
|
QCheckBox *_name;
|
||||||
|
QCheckBox *_date;
|
||||||
|
QCheckBox *_distance;
|
||||||
|
QCheckBox *_time;
|
||||||
|
QCheckBox *_itemCount;
|
||||||
|
QCheckBox *_separateGraphPage;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPTIONSDIALOG_H
|
@ -1,62 +1,46 @@
|
|||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
||||||
|
Palette::Palette(const QColor &color, qreal shift)
|
||||||
#define HUE_INIT 0.1f
|
|
||||||
#define HUE_INCREMENT 0.62f
|
|
||||||
#define SATURATION 0.99f
|
|
||||||
#define VALUE 0.99f
|
|
||||||
|
|
||||||
static unsigned hsv2rgb(float h, float s, float v)
|
|
||||||
{
|
{
|
||||||
unsigned hi;
|
_h = 0; _s = 0; _v = 0; _a = 1.0;
|
||||||
float r = 0, g = 0, b = 0, p, q, t, f;
|
|
||||||
|
|
||||||
hi = (unsigned)(h * 6.0f);
|
setColor(color);
|
||||||
f = h * 6.0f - hi;
|
setShift(shift);
|
||||||
p = v * (1.0f - s);
|
|
||||||
q = v * (1.0f - f * s);
|
|
||||||
t = v * (1.0f - (1.0f - f) * s);
|
|
||||||
|
|
||||||
switch (hi) {
|
_state = _h;
|
||||||
case 0:
|
|
||||||
r = v; g = t; b = p;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
r = q; g = v; b = p;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
r = p; g = v; b = t;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
r = p; g = q; b = v;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
r = t; g = p; b = v;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
r = v; g = p; b = q;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((unsigned)(r * 256) << 16)
|
|
||||||
+ ((unsigned)(g * 256) << 8)
|
|
||||||
+ (unsigned)(b * 256);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette::Palette()
|
void Palette::setColor(const QColor &color)
|
||||||
{
|
{
|
||||||
_hueState = HUE_INIT;
|
if (color.isValid())
|
||||||
|
color.getHsvF(&_h, &_s, &_v, &_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor Palette::color()
|
void Palette::setShift(qreal shift)
|
||||||
{
|
{
|
||||||
_hueState += HUE_INCREMENT;
|
if (shift >= 0 && shift <= 1.0)
|
||||||
_hueState -= (int) _hueState;
|
_shift = shift;
|
||||||
|
}
|
||||||
|
|
||||||
return QColor(hsv2rgb(_hueState, SATURATION, VALUE));
|
QColor Palette::nextColor()
|
||||||
|
{
|
||||||
|
QColor ret = QColor::fromHsvF(_state, _s, _v, _a);
|
||||||
|
|
||||||
|
_state += _shift;
|
||||||
|
_state -= (int) _state;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Palette::reset()
|
void Palette::reset()
|
||||||
{
|
{
|
||||||
_hueState = HUE_INIT;
|
_state = _h;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const Palette &palette)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
|
||||||
|
<< ")";
|
||||||
|
|
||||||
|
return dbg.maybeSpace();
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,32 @@
|
|||||||
#define PALETTE_H
|
#define PALETTE_H
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
class Palette
|
class Palette
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Palette();
|
Palette(const QColor &color = Qt::blue, qreal shift = 0.62);
|
||||||
QColor color();
|
|
||||||
|
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();
|
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:
|
private:
|
||||||
float _hueState;
|
qreal _h, _s, _v, _a, _shift;
|
||||||
|
qreal _state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const Palette &palette);
|
||||||
|
|
||||||
#endif // PALLETE_H
|
#endif // PALLETE_H
|
||||||
|
9
src/path.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "path.h"
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const PathPoint &point)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "PathPoint(" << point.distance() << ", "
|
||||||
|
<< point.coordinates() << ")";
|
||||||
|
|
||||||
|
return dbg.maybeSpace();
|
||||||
|
}
|
21
src/path.h
@ -4,6 +4,25 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include "coordinates.h"
|
#include "coordinates.h"
|
||||||
|
|
||||||
typedef QVector<Coordinates> Path;
|
class PathPoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PathPoint() :
|
||||||
|
_coordinates(Coordinates()), _distance(NAN) {}
|
||||||
|
PathPoint(const Coordinates &coordinates, qreal distance)
|
||||||
|
: _coordinates(coordinates), _distance(distance) {}
|
||||||
|
|
||||||
|
const Coordinates &coordinates() const {return _coordinates;}
|
||||||
|
qreal distance() const {return _distance;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Coordinates _coordinates;
|
||||||
|
qreal _distance;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_TYPEINFO(PathPoint, Q_PRIMITIVE_TYPE);
|
||||||
|
QDebug operator<<(QDebug dbg, const PathPoint &point);
|
||||||
|
|
||||||
|
typedef QVector<PathPoint> Path;
|
||||||
|
|
||||||
#endif // PATH_H
|
#endif // PATH_H
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <cmath>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -5,25 +6,19 @@
|
|||||||
#include "pathitem.h"
|
#include "pathitem.h"
|
||||||
|
|
||||||
|
|
||||||
#define PATH_WIDTH 3
|
|
||||||
#define HOVER_WIDTH 4
|
|
||||||
|
|
||||||
void PathItem::updateShape()
|
void PathItem::updateShape()
|
||||||
{
|
{
|
||||||
QPainterPathStroker s;
|
QPainterPathStroker s;
|
||||||
s.setWidth(HOVER_WIDTH * 1.0/scale());
|
s.setWidth((_width + 1) * 1.0/scale());
|
||||||
_shape = s.createStroke(_path);
|
_shape = s.createStroke(_path);
|
||||||
|
|
||||||
if (qMax(boundingRect().width(), boundingRect().height()) * scale() <= 768)
|
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
|
||||||
else
|
|
||||||
setCacheMode(QGraphicsItem::NoCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PathItem::PathItem(QGraphicsItem *parent) : QGraphicsObject(parent)
|
PathItem::PathItem(QGraphicsItem *parent) : QGraphicsObject(parent)
|
||||||
{
|
{
|
||||||
|
_width = 3;
|
||||||
|
|
||||||
QBrush brush(Qt::SolidPattern);
|
QBrush brush(Qt::SolidPattern);
|
||||||
_pen = QPen(brush, PATH_WIDTH);
|
_pen = QPen(brush, _width);
|
||||||
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
|
|
||||||
@ -53,7 +48,7 @@ void PathItem::setScale(qreal scale)
|
|||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
|
|
||||||
_pen.setWidthF(PATH_WIDTH * 1.0/scale);
|
_pen.setWidthF(_width * 1.0/scale);
|
||||||
QGraphicsItem::setScale(scale);
|
QGraphicsItem::setScale(scale);
|
||||||
_marker->setScale(1.0/scale);
|
_marker->setScale(1.0/scale);
|
||||||
|
|
||||||
@ -66,26 +61,76 @@ void PathItem::setColor(const QColor &color)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathItem::setWidth(int width)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_width = width;
|
||||||
|
_pen.setWidthF(_width * 1.0/scale());
|
||||||
|
|
||||||
|
updateShape();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathItem::setStyle(Qt::PenStyle style)
|
||||||
|
{
|
||||||
|
_pen.setStyle(style);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void PathItem::setUnits(enum Units units)
|
void PathItem::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointF PathItem::position(qreal x) const
|
||||||
|
{
|
||||||
|
int low = 0;
|
||||||
|
int high = _distance.count() - 1;
|
||||||
|
int mid = 0;
|
||||||
|
|
||||||
|
|
||||||
|
Q_ASSERT(_distance.count() == _path.elementCount());
|
||||||
|
Q_ASSERT(high > low);
|
||||||
|
Q_ASSERT(x >= _distance.at(low) && x <= _distance.at(high));
|
||||||
|
|
||||||
|
while (low <= high) {
|
||||||
|
mid = low + ((high - low) / 2);
|
||||||
|
qreal val = _distance.at(mid);
|
||||||
|
if (val > x)
|
||||||
|
high = mid - 1;
|
||||||
|
else if (val < x)
|
||||||
|
low = mid + 1;
|
||||||
|
else
|
||||||
|
return _path.elementAt(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF l;
|
||||||
|
qreal p1, p2;
|
||||||
|
if (_distance.at(mid) < x) {
|
||||||
|
l = QLineF(_path.elementAt(mid), _path.elementAt(mid+1));
|
||||||
|
p1 = _distance.at(mid); p2 = _distance.at(mid+1);
|
||||||
|
} else {
|
||||||
|
l = QLineF(_path.elementAt(mid-1), _path.elementAt(mid));
|
||||||
|
p1 = _distance.at(mid-1); p2 = _distance.at(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l.pointAt((x - p1) / (p2 - p1));
|
||||||
|
}
|
||||||
|
|
||||||
void PathItem::moveMarker(qreal distance)
|
void PathItem::moveMarker(qreal distance)
|
||||||
{
|
{
|
||||||
if (distance > _distance)
|
if (distance >= _distance.first() && distance <= _distance.last()) {
|
||||||
_marker->setVisible(false);
|
|
||||||
else {
|
|
||||||
_marker->setVisible(true);
|
_marker->setVisible(true);
|
||||||
_marker->setPos(_path.pointAtPercent(distance / _distance));
|
_marker->setPos(position(distance));
|
||||||
}
|
} else
|
||||||
|
_marker->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
|
||||||
_pen.setWidthF(HOVER_WIDTH * 1.0/scale());
|
_pen.setWidthF((_width + 1) * 1.0/scale());
|
||||||
setZValue(zValue() + 1.0);
|
setZValue(zValue() + 1.0);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
@ -96,7 +141,7 @@ void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
|
||||||
_pen.setWidthF(PATH_WIDTH * 1.0/scale());
|
_pen.setWidthF(_width * 1.0/scale());
|
||||||
setZValue(zValue() - 1.0);
|
setZValue(zValue() - 1.0);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ public:
|
|||||||
void setScale(qreal scale);
|
void setScale(qreal scale);
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
|
void setWidth(int width);
|
||||||
|
void setStyle(Qt::PenStyle style);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void moveMarker(qreal distance);
|
void moveMarker(qreal distance);
|
||||||
@ -34,18 +36,20 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void updateShape();
|
void updateShape();
|
||||||
|
|
||||||
|
QVector<qreal> _distance;
|
||||||
QPainterPath _path;
|
QPainterPath _path;
|
||||||
QPainterPath _shape;
|
|
||||||
QPen _pen;
|
|
||||||
|
|
||||||
MarkerItem *_marker;
|
MarkerItem *_marker;
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
qreal _distance;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QPointF position(qreal distance) const;
|
||||||
|
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
|
||||||
|
int _width;
|
||||||
|
QPen _pen;
|
||||||
|
QPainterPath _shape;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PATHITEM_H
|
#endif // PATHITEM_H
|
||||||
|
384
src/pathview.cpp
@ -1,7 +1,10 @@
|
|||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include "opengl.h"
|
||||||
#include "rd.h"
|
#include "rd.h"
|
||||||
|
#include "wgs84.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
@ -21,21 +24,20 @@ static QPoint mercator2tile(const QPointF &m, int z)
|
|||||||
{
|
{
|
||||||
QPoint tile;
|
QPoint tile;
|
||||||
|
|
||||||
tile.setX((int)(floor((m.x() + 180.0) / 360.0 * pow(2.0, z))));
|
tile.setX((int)(floor((m.x() + 180.0) / 360.0 * (1<<z))));
|
||||||
tile.setY((int)(floor((1.0 - (m.y() / 180.0)) / 2.0 * pow(2.0, z))));
|
tile.setY((int)(floor((1.0 - (m.y() / 180.0)) / 2.0 * (1<<z))));
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QPointF tile2mercator(const QPoint &tile, int z)
|
static QPointF tile2mercator(const QPoint &tile, int z)
|
||||||
{
|
{
|
||||||
Coordinates m;
|
QPointF m;
|
||||||
|
|
||||||
m.setLon(tile.x() / pow(2.0, z) * 360.0 - 180);
|
m.setX(((360.0 * tile.x()) / (qreal)(1<<z)) - 180.0);
|
||||||
qreal n = M_PI - 2.0 * M_PI * tile.y() / pow(2.0, z);
|
m.setY((1.0 - (2.0 * tile.y()) / (qreal)(1<<z)) * 180.0);
|
||||||
m.setLat(rad2deg(atan(0.5 * (exp(n) - exp(-n)))));
|
|
||||||
|
|
||||||
return m.toMercator();
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scale2zoom(qreal scale)
|
static int scale2zoom(qreal scale)
|
||||||
@ -50,6 +52,41 @@ static int scale2zoom(qreal scale)
|
|||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal mapScale(int zoom)
|
||||||
|
{
|
||||||
|
return ((360.0/(qreal)(1<<zoom))/(qreal)Tile::size());
|
||||||
|
}
|
||||||
|
|
||||||
|
static QRectF mapBounds()
|
||||||
|
{
|
||||||
|
return QRectF(QPointF(-180, -180), QSizeF(360, 360));
|
||||||
|
}
|
||||||
|
|
||||||
|
static qreal zoom2resolution(int zoom, qreal y)
|
||||||
|
{
|
||||||
|
return (WGS84_RADIUS * 2 * M_PI / Tile::size()
|
||||||
|
* cos(2.0 * atan(exp(deg2rad(y))) - M_PI/2)) / (qreal)(1<<zoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unite(QRectF &rect, const QPointF &p)
|
||||||
|
{
|
||||||
|
if (p.x() < rect.left())
|
||||||
|
rect.setLeft(p.x());
|
||||||
|
if (p.x() > rect.right())
|
||||||
|
rect.setRight(p.x());
|
||||||
|
if (p.y() > rect.bottom())
|
||||||
|
rect.setBottom(p.y());
|
||||||
|
if (p.y() < rect.top())
|
||||||
|
rect.setTop(p.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
static QRectF scaled(const QRectF &rect, qreal factor)
|
||||||
|
{
|
||||||
|
return QRectF(QPointF(rect.left() * factor, rect.top() * factor),
|
||||||
|
QSizeF(rect.width() * factor, rect.height() * factor));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PathView::PathView(QWidget *parent)
|
PathView::PathView(QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
@ -60,14 +97,14 @@ PathView::PathView(QWidget *parent)
|
|||||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setRenderHints(QPainter::Antialiasing);
|
setRenderHint(QPainter::Antialiasing, true);
|
||||||
setAcceptDrops(false);
|
setAcceptDrops(false);
|
||||||
|
|
||||||
_mapScale = new ScaleItem();
|
_mapScale = new ScaleItem();
|
||||||
_mapScale->setZValue(2.0);
|
_mapScale->setZValue(2.0);
|
||||||
|
|
||||||
_zoom = ZOOM_MAX;
|
_zoom = ZOOM_MAX;
|
||||||
_scale = mapScale(_zoom);
|
_res = 1.0;
|
||||||
_map = 0;
|
_map = 0;
|
||||||
_poi = 0;
|
_poi = 0;
|
||||||
|
|
||||||
@ -81,8 +118,14 @@ PathView::PathView(QWidget *parent)
|
|||||||
_showPOILabels = true;
|
_showPOILabels = true;
|
||||||
_overlapPOIs = true;
|
_overlapPOIs = true;
|
||||||
_showRouteWaypoints = true;
|
_showRouteWaypoints = true;
|
||||||
|
_trackWidth = 3;
|
||||||
|
_routeWidth = 3;
|
||||||
|
_trackStyle = Qt::SolidLine;
|
||||||
|
_routeStyle = Qt::DashLine;
|
||||||
|
|
||||||
_plot = false;
|
_plot = false;
|
||||||
|
|
||||||
|
_scene->setSceneRect(scaled(mapBounds(), 1.0 / mapScale(_zoom)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PathView::~PathView()
|
PathView::~PathView()
|
||||||
@ -94,16 +137,18 @@ PathView::~PathView()
|
|||||||
PathItem *PathView::addTrack(const Track &track)
|
PathItem *PathView::addTrack(const Track &track)
|
||||||
{
|
{
|
||||||
if (track.isNull()) {
|
if (track.isNull()) {
|
||||||
_palette.color();
|
_palette.nextColor();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackItem *ti = new TrackItem(track);
|
TrackItem *ti = new TrackItem(track);
|
||||||
_tracks.append(ti);
|
_tracks.append(ti);
|
||||||
_zoom = qMin(_zoom, scale2zoom(trackScale()));
|
_tr |= ti->path().boundingRect();
|
||||||
_scale = mapScale(_zoom);
|
_zoom = scale2zoom(contentsScale());
|
||||||
ti->setScale(1.0/_scale);
|
ti->setScale(1.0/mapScale(_zoom));
|
||||||
ti->setColor(_palette.color());
|
ti->setColor(_palette.nextColor());
|
||||||
|
ti->setWidth(_trackWidth);
|
||||||
|
ti->setStyle(_trackStyle);
|
||||||
ti->setVisible(_showTracks);
|
ti->setVisible(_showTracks);
|
||||||
_scene->addItem(ti);
|
_scene->addItem(ti);
|
||||||
|
|
||||||
@ -116,16 +161,18 @@ PathItem *PathView::addTrack(const Track &track)
|
|||||||
PathItem *PathView::addRoute(const Route &route)
|
PathItem *PathView::addRoute(const Route &route)
|
||||||
{
|
{
|
||||||
if (route.isNull()) {
|
if (route.isNull()) {
|
||||||
_palette.color();
|
_palette.nextColor();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteItem *ri = new RouteItem(route);
|
RouteItem *ri = new RouteItem(route);
|
||||||
_routes.append(ri);
|
_routes.append(ri);
|
||||||
_zoom = qMin(_zoom, scale2zoom(routeScale()));
|
_rr |= ri->path().boundingRect();
|
||||||
_scale = mapScale(_zoom);
|
_zoom = scale2zoom(contentsScale());
|
||||||
ri->setScale(1.0/_scale);
|
ri->setScale(1.0/mapScale(_zoom));
|
||||||
ri->setColor(_palette.color());
|
ri->setColor(_palette.nextColor());
|
||||||
|
ri->setWidth(_routeWidth);
|
||||||
|
ri->setStyle(_routeStyle);
|
||||||
ri->setVisible(_showRoutes);
|
ri->setVisible(_showRoutes);
|
||||||
ri->showWaypoints(_showRouteWaypoints);
|
ri->showWaypoints(_showRouteWaypoints);
|
||||||
ri->showWaypointLabels(_showWaypointLabels);
|
ri->showWaypointLabels(_showWaypointLabels);
|
||||||
@ -139,24 +186,25 @@ PathItem *PathView::addRoute(const Route &route)
|
|||||||
|
|
||||||
void PathView::addWaypoints(const QList<Waypoint> &waypoints)
|
void PathView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
|
qreal scale = mapScale(_zoom);
|
||||||
|
|
||||||
for (int i = 0; i < waypoints.count(); i++) {
|
for (int i = 0; i < waypoints.count(); i++) {
|
||||||
const Waypoint &w = waypoints.at(i);
|
const Waypoint &w = waypoints.at(i);
|
||||||
|
|
||||||
WaypointItem *wi = new WaypointItem(w);
|
WaypointItem *wi = new WaypointItem(w);
|
||||||
wi->setScale(1.0/_scale);
|
_waypoints.append(wi);
|
||||||
|
updateWaypointsBoundingRect(wi->coordinates());
|
||||||
|
wi->setScale(1.0/scale);
|
||||||
wi->setZValue(1);
|
wi->setZValue(1);
|
||||||
wi->showLabel(_showWaypointLabels);
|
wi->showLabel(_showWaypointLabels);
|
||||||
wi->setVisible(_showWaypoints);
|
wi->setVisible(_showWaypoints);
|
||||||
_scene->addItem(wi);
|
_scene->addItem(wi);
|
||||||
|
|
||||||
_waypoints.append(wi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_poi)
|
if (_poi)
|
||||||
addPOI(_poi->points(waypoints));
|
addPOI(_poi->points(waypoints));
|
||||||
|
|
||||||
_zoom = qMin(_zoom, scale2zoom(waypointScale()));
|
_zoom = scale2zoom(contentsScale());
|
||||||
_scale = mapScale(_zoom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PathItem *> PathView::loadData(const Data &data)
|
QList<PathItem *> PathView::loadData(const Data &data)
|
||||||
@ -167,144 +215,71 @@ QList<PathItem *> PathView::loadData(const Data &data)
|
|||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++)
|
for (int i = 0; i < data.tracks().count(); i++)
|
||||||
paths.append(addTrack(*(data.tracks().at(i))));
|
paths.append(addTrack(*(data.tracks().at(i))));
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
paths.append(addRoute(*(data.routes().at(i))));
|
paths.append(addRoute(*(data.routes().at(i))));
|
||||||
|
|
||||||
addWaypoints(data.waypoints());
|
addWaypoints(data.waypoints());
|
||||||
|
|
||||||
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
||||||
return paths;
|
return paths;
|
||||||
|
|
||||||
if ((_tracks.size() + _routes.size() > 1 && _zoom < zoom)
|
if (_zoom < zoom)
|
||||||
|| (_waypoints.size() && _zoom < zoom))
|
rescale(_zoom);
|
||||||
rescale(_scale);
|
|
||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
QRectF br = trackBoundingRect() | routeBoundingRect()
|
QPointF center = contentsCenter();
|
||||||
| waypointBoundingRect();
|
centerOn(center);
|
||||||
QRectF ba = br.adjusted(-Tile::size(), -Tile::size(), Tile::size(),
|
|
||||||
Tile::size());
|
|
||||||
_scene->setSceneRect(ba);
|
|
||||||
centerOn(ba.center());
|
|
||||||
|
|
||||||
_mapScale->setZoom(_zoom, -(br.center().ry() * _scale));
|
_res = zoom2resolution(_zoom, -(center.y() * mapScale(_zoom)));
|
||||||
|
_mapScale->setResolution(_res);
|
||||||
if (_mapScale->scene() != _scene)
|
if (_mapScale->scene() != _scene)
|
||||||
_scene->addItem(_mapScale);
|
_scene->addItem(_mapScale);
|
||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PathView::trackBoundingRect() const
|
void PathView::updateWaypointsBoundingRect(const QPointF &wp)
|
||||||
{
|
{
|
||||||
if (_tracks.empty())
|
if (_wr.isNull()) {
|
||||||
return QRectF();
|
if (_wp.isNull())
|
||||||
|
_wp = wp;
|
||||||
QRectF br = _tracks.at(0)->sceneBoundingRect();
|
else {
|
||||||
for (int i = 1; i < _tracks.size(); i++)
|
_wr = QRectF(_wp, wp).normalized();
|
||||||
br |= _tracks.at(i)->sceneBoundingRect();
|
_wp = QPointF();
|
||||||
|
}
|
||||||
return br;
|
} else
|
||||||
|
unite(_wr, wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PathView::routeBoundingRect() const
|
qreal PathView::contentsScale() const
|
||||||
{
|
{
|
||||||
if (_routes.empty())
|
QRectF br = _tr | _rr | _wr;
|
||||||
return QRectF();
|
if (!br.isNull() && !_wp.isNull())
|
||||||
|
unite(br, _wp);
|
||||||
|
|
||||||
QRectF br = _routes.at(0)->sceneBoundingRect();
|
if (br.isNull())
|
||||||
for (int i = 1; i < _routes.size(); i++)
|
|
||||||
br |= _routes.at(i)->sceneBoundingRect();
|
|
||||||
|
|
||||||
return br;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF PathView::waypointBoundingRect() const
|
|
||||||
{
|
|
||||||
qreal bottom, top, left, right;
|
|
||||||
|
|
||||||
if (_waypoints.empty())
|
|
||||||
return QRectF();
|
|
||||||
|
|
||||||
const QPointF &p = _waypoints.at(0)->pos();
|
|
||||||
bottom = p.y();
|
|
||||||
top = p.y();
|
|
||||||
left = p.x();
|
|
||||||
right = p.x();
|
|
||||||
|
|
||||||
for (int i = 1; i < _waypoints.size(); i++) {
|
|
||||||
const QPointF &p = _waypoints.at(i)->pos();
|
|
||||||
bottom = qMax(bottom, p.y());
|
|
||||||
top = qMin(top, p.y());
|
|
||||||
right = qMax(right, p.x());
|
|
||||||
left = qMin(left, p.x());
|
|
||||||
}
|
|
||||||
|
|
||||||
return QRectF(QPointF(left, top), QPointF(right, bottom));
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal PathView::trackScale() const
|
|
||||||
{
|
|
||||||
if (_tracks.empty())
|
|
||||||
return mapScale(ZOOM_MAX);
|
return mapScale(ZOOM_MAX);
|
||||||
|
|
||||||
QRectF br = _tracks.at(0)->path().boundingRect();
|
|
||||||
|
|
||||||
for (int i = 1; i < _tracks.size(); i++)
|
|
||||||
br |= _tracks.at(i)->path().boundingRect();
|
|
||||||
|
|
||||||
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
||||||
br.height() / (viewport()->height() - MARGIN/2));
|
br.height() / (viewport()->height() - MARGIN/2));
|
||||||
|
|
||||||
return qMax(sc.x(), sc.y());
|
return qMax(sc.x(), sc.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal PathView::routeScale() const
|
QPointF PathView::contentsCenter() const
|
||||||
{
|
{
|
||||||
if (_routes.empty())
|
QRectF br = _tr | _rr | _wr;
|
||||||
return mapScale(ZOOM_MAX);
|
if (!br.isNull() && !_wp.isNull())
|
||||||
|
unite(br, _wp);
|
||||||
|
|
||||||
QRectF br = _routes.at(0)->path().boundingRect();
|
qreal scale = mapScale(_zoom);
|
||||||
|
|
||||||
for (int i = 1; i < _routes.size(); i++)
|
if (br.isNull())
|
||||||
br |= _routes.at(i)->path().boundingRect();
|
return _wp / scale;
|
||||||
|
else
|
||||||
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
return scaled(br, 1.0/scale).center();
|
||||||
br.height() / (viewport()->height() - MARGIN/2));
|
|
||||||
|
|
||||||
return qMax(sc.x(), sc.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal PathView::waypointScale() const
|
|
||||||
{
|
|
||||||
qreal bottom, top, left, right;
|
|
||||||
|
|
||||||
if (_waypoints.size() < 2)
|
|
||||||
return mapScale(ZOOM_MAX);
|
|
||||||
|
|
||||||
const QPointF &p = _waypoints.at(0)->coordinates();
|
|
||||||
bottom = p.y();
|
|
||||||
top = p.y();
|
|
||||||
left = p.x();
|
|
||||||
right = p.x();
|
|
||||||
|
|
||||||
for (int i = 1; i < _waypoints.size(); i++) {
|
|
||||||
const QPointF &p = _waypoints.at(i)->coordinates();
|
|
||||||
bottom = qMax(bottom, p.y());
|
|
||||||
top = qMin(top, p.y());
|
|
||||||
right = qMax(right, p.x());
|
|
||||||
left = qMin(left, p.x());
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF br(QPointF(left, top), QPointF(right, bottom));
|
|
||||||
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
|
||||||
br.height() / (viewport()->height() - MARGIN/2));
|
|
||||||
|
|
||||||
return qMax(sc.x(), sc.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal PathView::mapScale(int zoom) const
|
|
||||||
{
|
|
||||||
return ((360.0/(qreal)(1<<zoom))/(qreal)Tile::size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathView::updatePOIVisibility()
|
void PathView::updatePOIVisibility()
|
||||||
@ -328,9 +303,12 @@ void PathView::updatePOIVisibility()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathView::rescale(qreal scale)
|
void PathView::rescale(int zoom)
|
||||||
{
|
{
|
||||||
_scale = scale;
|
_zoom = zoom;
|
||||||
|
qreal scale = mapScale(zoom);
|
||||||
|
|
||||||
|
_scene->setSceneRect(scaled(mapBounds(), 1.0 / scale));
|
||||||
|
|
||||||
for (int i = 0; i < _tracks.size(); i++)
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
_tracks.at(i)->setScale(1.0/scale);
|
_tracks.at(i)->setScale(1.0/scale);
|
||||||
@ -348,6 +326,17 @@ void PathView::rescale(qreal scale)
|
|||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathView::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 PathView::setPOI(POI *poi)
|
void PathView::setPOI(POI *poi)
|
||||||
{
|
{
|
||||||
if (_poi)
|
if (_poi)
|
||||||
@ -385,6 +374,8 @@ void PathView::updatePOI()
|
|||||||
|
|
||||||
void PathView::addPOI(const QVector<Waypoint> &waypoints)
|
void PathView::addPOI(const QVector<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
|
qreal scale = mapScale(_zoom);
|
||||||
|
|
||||||
for (int i = 0; i < waypoints.size(); i++) {
|
for (int i = 0; i < waypoints.size(); i++) {
|
||||||
const Waypoint &w = waypoints.at(i);
|
const Waypoint &w = waypoints.at(i);
|
||||||
|
|
||||||
@ -392,7 +383,7 @@ void PathView::addPOI(const QVector<Waypoint> &waypoints)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
WaypointItem *pi = new WaypointItem(w);
|
WaypointItem *pi = new WaypointItem(w);
|
||||||
pi->setScale(1.0/_scale);
|
pi->setScale(1.0/scale);
|
||||||
pi->setZValue(1);
|
pi->setZValue(1);
|
||||||
pi->showLabel(_showPOILabels);
|
pi->showLabel(_showPOILabels);
|
||||||
pi->setVisible(_showPOI);
|
pi->setVisible(_showPOI);
|
||||||
@ -438,15 +429,6 @@ void PathView::redraw()
|
|||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathView::rescale()
|
|
||||||
{
|
|
||||||
_zoom = qMin(qMin(scale2zoom(trackScale()), scale2zoom(routeScale())),
|
|
||||||
scale2zoom(waypointScale()));
|
|
||||||
|
|
||||||
rescale(mapScale(_zoom));
|
|
||||||
_mapScale->setZoom(_zoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathView::zoom(int z, const QPoint &pos)
|
void PathView::zoom(int z, const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
@ -455,23 +437,16 @@ void PathView::zoom(int z, const QPoint &pos)
|
|||||||
QPoint offset = pos - viewport()->rect().center();
|
QPoint offset = pos - viewport()->rect().center();
|
||||||
QPointF spos = mapToScene(pos);
|
QPointF spos = mapToScene(pos);
|
||||||
|
|
||||||
qreal scale = _scale;
|
qreal os = mapScale(_zoom);
|
||||||
_zoom = z;
|
_zoom = z;
|
||||||
|
|
||||||
rescale(mapScale(_zoom));
|
rescale(_zoom);
|
||||||
QRectF br = trackBoundingRect() | routeBoundingRect()
|
|
||||||
| waypointBoundingRect();
|
|
||||||
QRectF ba = br.adjusted(-Tile::size(), -Tile::size(), Tile::size(),
|
|
||||||
Tile::size());
|
|
||||||
_scene->setSceneRect(ba);
|
|
||||||
|
|
||||||
if (br.width() < viewport()->size().width()
|
QPointF center = (spos * (os/mapScale(_zoom))) - offset;
|
||||||
&& br.height() < viewport()->size().height())
|
centerOn(center);
|
||||||
centerOn(br.center());
|
|
||||||
else
|
|
||||||
centerOn((spos * (scale/_scale)) - offset);
|
|
||||||
|
|
||||||
_mapScale->setZoom(_zoom);
|
_res = zoom2resolution(_zoom, -(center.y() * mapScale(_zoom)));
|
||||||
|
_mapScale->setResolution(_res);
|
||||||
|
|
||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
}
|
}
|
||||||
@ -557,9 +532,11 @@ void PathView::clear()
|
|||||||
_palette.reset();
|
_palette.reset();
|
||||||
|
|
||||||
_zoom = ZOOM_MAX;
|
_zoom = ZOOM_MAX;
|
||||||
_scale = mapScale(_zoom);
|
_res = 1.0;
|
||||||
|
_tr = QRectF(); _rr = QRectF(); _wr = QRectF();
|
||||||
|
_wp = QPointF();
|
||||||
|
|
||||||
_scene->setSceneRect(QRectF());
|
_scene->setSceneRect(scaled(mapBounds(), 1.0 / mapScale(_zoom)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathView::showTracks(bool show)
|
void PathView::showTracks(bool show)
|
||||||
@ -634,6 +611,38 @@ void PathView::setPOIOverlap(bool overlap)
|
|||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathView::setTrackWidth(int width)
|
||||||
|
{
|
||||||
|
_trackWidth = width;
|
||||||
|
|
||||||
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
|
_tracks.at(i)->setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setRouteWidth(int width)
|
||||||
|
{
|
||||||
|
_routeWidth = width;
|
||||||
|
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
_routes.at(i)->setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setTrackStyle(Qt::PenStyle style)
|
||||||
|
{
|
||||||
|
_trackStyle = style;
|
||||||
|
|
||||||
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
|
_tracks.at(i)->setStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setRouteStyle(Qt::PenStyle style)
|
||||||
|
{
|
||||||
|
_routeStyle = style;
|
||||||
|
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
_routes.at(i)->setStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
void PathView::drawBackground(QPainter *painter, const QRectF &rect)
|
void PathView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||||
{
|
{
|
||||||
if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
@ -642,19 +651,19 @@ void PathView::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF rr(rect.topLeft() * _scale, rect.size());
|
qreal scale = mapScale(_zoom);
|
||||||
|
QRectF rr(rect.topLeft() * scale, rect.size());
|
||||||
QPoint tile = mercator2tile(QPointF(rr.topLeft().x(), -rr.topLeft().y()),
|
QPoint tile = mercator2tile(QPointF(rr.topLeft().x(), -rr.topLeft().y()),
|
||||||
_zoom);
|
_zoom);
|
||||||
QPointF tm = tile2mercator(tile, _zoom);
|
QPointF tm = tile2mercator(tile, _zoom);
|
||||||
QPoint tl = mapToScene(mapFromScene(QPointF(tm.x() / _scale,
|
QPoint tl = QPoint((int)(tm.x() / scale), (int)(-tm.y() / scale));
|
||||||
-tm.y() / _scale))).toPoint();
|
|
||||||
|
|
||||||
QList<Tile> tiles;
|
QList<Tile> tiles;
|
||||||
for (int i = 0; i <= rr.size().width() / Tile::size() + 1; i++) {
|
QSizeF s(rect.right() - tl.x(), rect.bottom() - tl.y());
|
||||||
for (int j = 0; j <= rr.size().height() / Tile::size() + 1; j++) {
|
for (int i = 0; i < ceil(s.width() / Tile::size()); i++)
|
||||||
|
for (int j = 0; j < ceil(s.height() / Tile::size()); j++)
|
||||||
tiles.append(Tile(QPoint(tile.x() + i, tile.y() + j), _zoom));
|
tiles.append(Tile(QPoint(tile.x() + i, tile.y() + j), _zoom));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_map->loadTiles(tiles, _plot);
|
_map->loadTiles(tiles, _plot);
|
||||||
|
|
||||||
@ -668,28 +677,21 @@ void PathView::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
|
|
||||||
void PathView::resizeEvent(QResizeEvent *event)
|
void PathView::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
|
||||||
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rescale();
|
int zoom = scale2zoom(contentsScale());
|
||||||
|
if (zoom != _zoom)
|
||||||
|
rescale(zoom);
|
||||||
|
|
||||||
QRectF br = trackBoundingRect() | routeBoundingRect()
|
QPointF center = contentsCenter();
|
||||||
| waypointBoundingRect();
|
centerOn(center);
|
||||||
QRectF ba = br.adjusted(-Tile::size(), -Tile::size(), Tile::size(),
|
|
||||||
Tile::size());
|
|
||||||
|
|
||||||
if (ba.width() < event->size().width()) {
|
_res = zoom2resolution(_zoom, -(center.y() * mapScale(_zoom)));
|
||||||
qreal diff = event->size().width() - ba.width();
|
_mapScale->setResolution(_res);
|
||||||
ba.adjust(-diff/2, 0, diff/2, 0);
|
|
||||||
}
|
|
||||||
if (ba.height() < event->size().height()) {
|
|
||||||
qreal diff = event->size().height() - ba.height();
|
|
||||||
ba.adjust(0, -diff/2, 0, diff/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
_scene->setSceneRect(ba);
|
|
||||||
|
|
||||||
centerOn(br.center());
|
|
||||||
resetCachedContent();
|
resetCachedContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,3 +705,27 @@ void PathView::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
QGraphicsView::paintEvent(event);
|
QGraphicsView::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathView::scrollContentsBy(int dx, int dy)
|
||||||
|
{
|
||||||
|
QGraphicsView::scrollContentsBy(dx, dy);
|
||||||
|
|
||||||
|
QPointF center = mapToScene(viewport()->rect().center());
|
||||||
|
qreal res = zoom2resolution(_zoom, -(center.y() * mapScale(_zoom)));
|
||||||
|
|
||||||
|
if (qMax(res, _res) / qMin(res, _res) > 1.1) {
|
||||||
|
_mapScale->setResolution(res);
|
||||||
|
_res = res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::useOpenGL(bool use)
|
||||||
|
{
|
||||||
|
if (use) {
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
|
setViewport(new OPENGL_WIDGET);
|
||||||
|
} else
|
||||||
|
setViewport(new QWidget);
|
||||||
|
}
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
|
|
||||||
QList<PathItem*> loadData(const Data &data);
|
QList<PathItem*> loadData(const Data &data);
|
||||||
|
|
||||||
|
void setPalette(const Palette &palette);
|
||||||
void setPOI(POI *poi);
|
void setPOI(POI *poi);
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
@ -42,6 +43,8 @@ public:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
void useOpenGL(bool use);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void redraw();
|
void redraw();
|
||||||
|
|
||||||
@ -53,6 +56,10 @@ public slots:
|
|||||||
void showRoutes(bool show);
|
void showRoutes(bool show);
|
||||||
void showWaypoints(bool show);
|
void showWaypoints(bool show);
|
||||||
void showRouteWaypoints(bool show);
|
void showRouteWaypoints(bool show);
|
||||||
|
void setTrackWidth(int width);
|
||||||
|
void setRouteWidth(int width);
|
||||||
|
void setTrackStyle(Qt::PenStyle style);
|
||||||
|
void setRouteStyle(Qt::PenStyle style);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePOI();
|
void updatePOI();
|
||||||
@ -65,17 +72,12 @@ private:
|
|||||||
void loadPOI();
|
void loadPOI();
|
||||||
void clearPOI();
|
void clearPOI();
|
||||||
|
|
||||||
QRectF trackBoundingRect() const;
|
qreal contentsScale() const;
|
||||||
QRectF routeBoundingRect() const;
|
QPointF contentsCenter() const;
|
||||||
QRectF waypointBoundingRect() const;
|
void rescale(int zoom);
|
||||||
qreal trackScale() const;
|
|
||||||
qreal routeScale() const;
|
|
||||||
qreal waypointScale() const;
|
|
||||||
qreal mapScale(int zoom) const;
|
|
||||||
void rescale(qreal scale);
|
|
||||||
void rescale();
|
|
||||||
void zoom(int z, const QPoint &pos);
|
void zoom(int z, const QPoint &pos);
|
||||||
void updatePOIVisibility();
|
void updatePOIVisibility();
|
||||||
|
void updateWaypointsBoundingRect(const QPointF &wp);
|
||||||
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||||
void wheelEvent(QWheelEvent *event);
|
void wheelEvent(QWheelEvent *event);
|
||||||
@ -83,6 +85,7 @@ private:
|
|||||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
void scrollContentsBy(int dx, int dy);
|
||||||
|
|
||||||
QGraphicsScene *_scene;
|
QGraphicsScene *_scene;
|
||||||
ScaleItem *_mapScale;
|
ScaleItem *_mapScale;
|
||||||
@ -91,14 +94,14 @@ private:
|
|||||||
QList<WaypointItem*> _waypoints;
|
QList<WaypointItem*> _waypoints;
|
||||||
QHash<Waypoint, WaypointItem*> _pois;
|
QHash<Waypoint, WaypointItem*> _pois;
|
||||||
|
|
||||||
|
int _zoom;
|
||||||
|
QRectF _tr, _rr, _wr;
|
||||||
|
QPointF _wp;
|
||||||
|
qreal _res;
|
||||||
|
|
||||||
Map *_map;
|
Map *_map;
|
||||||
POI *_poi;
|
POI *_poi;
|
||||||
|
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
|
|
||||||
qreal _scale;
|
|
||||||
int _zoom;
|
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
|
|
||||||
bool _showTracks;
|
bool _showTracks;
|
||||||
@ -109,6 +112,10 @@ private:
|
|||||||
bool _showPOILabels;
|
bool _showPOILabels;
|
||||||
bool _overlapPOIs;
|
bool _overlapPOIs;
|
||||||
bool _showRouteWaypoints;
|
bool _showRouteWaypoints;
|
||||||
|
int _trackWidth;
|
||||||
|
int _routeWidth;
|
||||||
|
Qt::PenStyle _trackStyle;
|
||||||
|
Qt::PenStyle _routeStyle;
|
||||||
|
|
||||||
bool _plot;
|
bool _plot;
|
||||||
};
|
};
|
||||||
|
40
src/poi.cpp
@ -10,7 +10,7 @@
|
|||||||
POI::POI(QObject *parent) : QObject(parent)
|
POI::POI(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
_errorLine = 0;
|
_errorLine = 0;
|
||||||
_radius = 0.01;
|
_radius = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool POI::loadFile(const QString &fileName)
|
bool POI::loadFile(const QString &fileName)
|
||||||
@ -66,11 +66,15 @@ QVector<Waypoint> POI::points(const PathItem *path) const
|
|||||||
const QPainterPath &pp = path->path();
|
const QPainterPath &pp = path->path();
|
||||||
|
|
||||||
for (int i = 0; i < pp.elementCount(); i++) {
|
for (int i = 0; i < pp.elementCount(); i++) {
|
||||||
Coordinates p = Coordinates::fromMercator(pp.elementAt(i));
|
const QPainterPath::Element &pe = pp.elementAt(i);
|
||||||
min[0] = p.lon() - _radius;
|
Coordinates p = Coordinates::fromMercator(QPointF(pe.x, -pe.y));
|
||||||
min[1] = -p.lat() - _radius;
|
|
||||||
max[0] = p.lon() + _radius;
|
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
|
||||||
max[1] = -p.lat() + _radius;
|
min[0] = br.first.lon();
|
||||||
|
min[1] = br.first.lat();
|
||||||
|
max[0] = br.second.lon();
|
||||||
|
max[1] = br.second.lat();
|
||||||
|
|
||||||
_tree.Search(min, max, cb, &set);
|
_tree.Search(min, max, cb, &set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,10 +96,13 @@ QVector<Waypoint> POI::points(const QList<WaypointItem*> &list)
|
|||||||
|
|
||||||
for (int i = 0; i < list.count(); i++) {
|
for (int i = 0; i < list.count(); i++) {
|
||||||
const Coordinates &p = list.at(i)->waypoint().coordinates();
|
const Coordinates &p = list.at(i)->waypoint().coordinates();
|
||||||
min[0] = p.lon() - _radius;
|
|
||||||
min[1] = p.lat() - _radius;
|
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
|
||||||
max[0] = p.lon() + _radius;
|
min[0] = br.first.lon();
|
||||||
max[1] = p.lat() + _radius;
|
min[1] = br.first.lat();
|
||||||
|
max[0] = br.second.lon();
|
||||||
|
max[1] = br.second.lat();
|
||||||
|
|
||||||
_tree.Search(min, max, cb, &set);
|
_tree.Search(min, max, cb, &set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,10 +123,13 @@ QVector<Waypoint> POI::points(const QList<Waypoint> &list) const
|
|||||||
|
|
||||||
for (int i = 0; i < list.count(); i++) {
|
for (int i = 0; i < list.count(); i++) {
|
||||||
const Coordinates &p = list.at(i).coordinates();
|
const Coordinates &p = list.at(i).coordinates();
|
||||||
min[0] = p.lon() - _radius;
|
|
||||||
min[1] = p.lat() - _radius;
|
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
|
||||||
max[0] = p.lon() + _radius;
|
min[0] = br.first.lon();
|
||||||
max[1] = p.lat() + _radius;
|
min[1] = br.first.lat();
|
||||||
|
max[0] = br.second.lon();
|
||||||
|
max[1] = br.second.lat();
|
||||||
|
|
||||||
_tree.Search(min, max, cb, &set);
|
_tree.Search(min, max, cb, &set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +178,7 @@ void POI::clear()
|
|||||||
emit pointsChanged();
|
emit pointsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void POI::setRadius(qreal radius)
|
void POI::setRadius(unsigned radius)
|
||||||
{
|
{
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ public:
|
|||||||
const QString &errorString() const {return _errorString;}
|
const QString &errorString() const {return _errorString;}
|
||||||
int errorLine() const {return _errorLine;}
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
qreal radius() const {return _radius;}
|
unsigned radius() const {return _radius;}
|
||||||
void setRadius(qreal radius);
|
void setRadius(unsigned radius);
|
||||||
|
|
||||||
QVector<Waypoint> points(const PathItem *path) const;
|
QVector<Waypoint> points(const PathItem *path) const;
|
||||||
QVector<Waypoint> points(const QList<WaypointItem*> &list) const;
|
QVector<Waypoint> points(const QList<WaypointItem*> &list) const;
|
||||||
@ -49,7 +49,7 @@ private:
|
|||||||
QStringList _files;
|
QStringList _files;
|
||||||
QList<FileIndex> _indexes;
|
QList<FileIndex> _indexes;
|
||||||
|
|
||||||
qreal _radius;
|
unsigned _radius;
|
||||||
|
|
||||||
QString _errorString;
|
QString _errorString;
|
||||||
int _errorLine;
|
int _errorLine;
|
||||||
|
@ -4,13 +4,16 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include "routedata.h"
|
#include "routedata.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
class Route
|
class Route
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Route(const RouteData &data);
|
Route(const RouteData &data);
|
||||||
|
|
||||||
const RouteData &route() const {return _data;}
|
const RouteData &routeData() const {return _data;}
|
||||||
|
const QVector<qreal> &distanceData() const {return _distance;}
|
||||||
|
|
||||||
Graph elevation() const;
|
Graph elevation() const;
|
||||||
|
|
||||||
qreal distance() const;
|
qreal distance() const;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include <QApplication>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
@ -12,11 +11,10 @@ QString RouteItem::toolTip()
|
|||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
if (!_name.isEmpty())
|
if (!_name.isEmpty())
|
||||||
tt.insert(qApp->translate("RouteItem", "Name"), _name);
|
tt.insert(tr("Name"), _name);
|
||||||
if (!_desc.isEmpty())
|
if (!_desc.isEmpty())
|
||||||
tt.insert(qApp->translate("RouteItem", "Description"), _desc);
|
tt.insert(tr("Description"), _desc);
|
||||||
tt.insert(qApp->translate("RouteItem", "Distance"),
|
tt.insert(tr("Distance"), Format::distance(_distance.last(), _units));
|
||||||
Format::distance(_distance, _units));
|
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
@ -24,29 +22,33 @@ QString RouteItem::toolTip()
|
|||||||
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
||||||
: PathItem(parent)
|
: PathItem(parent)
|
||||||
{
|
{
|
||||||
const RouteData &r = route.route();
|
const RouteData &r = route.routeData();
|
||||||
Q_ASSERT(r.count() >= 2);
|
const QVector<qreal> &d = route.distanceData();
|
||||||
QPointF p;
|
QPointF p;
|
||||||
|
|
||||||
|
|
||||||
|
Q_ASSERT(r.count() >= 2);
|
||||||
|
Q_ASSERT(r.size() == d.size());
|
||||||
|
|
||||||
_name = r.name();
|
_name = r.name();
|
||||||
_desc = r.description();
|
_desc = r.description();
|
||||||
|
|
||||||
new WaypointItem(r.at(0), this);
|
new WaypointItem(r.first(), this);
|
||||||
p = r.at(0).coordinates().toMercator();
|
p = r.first().coordinates().toMercator();
|
||||||
_path.moveTo(QPointF(p.x(), -p.y()));
|
_path.moveTo(QPointF(p.x(), -p.y()));
|
||||||
|
_distance.append(d.first());
|
||||||
for (int i = 1; i < r.size(); i++) {
|
for (int i = 1; i < r.size(); i++) {
|
||||||
|
if (r.at(i).coordinates() == r.at(i-1).coordinates())
|
||||||
|
continue;
|
||||||
p = r.at(i).coordinates().toMercator();
|
p = r.at(i).coordinates().toMercator();
|
||||||
_path.lineTo(QPointF(p.x(), -p.y()));
|
_path.lineTo(QPointF(p.x(), -p.y()));
|
||||||
|
_distance.append(d.at(i));
|
||||||
new WaypointItem(r.at(i), this);
|
new WaypointItem(r.at(i), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
_distance = route.distance();
|
_marker->setPos(_path.elementAt(0));
|
||||||
|
|
||||||
_marker->setPos(_path.pointAtPercent(0));
|
|
||||||
|
|
||||||
_pen.setStyle(Qt::DotLine);
|
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "rd.h"
|
|
||||||
#include "wgs84.h"
|
|
||||||
#include "tile.h"
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "scaleitem.h"
|
#include "scaleitem.h"
|
||||||
|
|
||||||
@ -13,17 +10,11 @@
|
|||||||
#define SEGMENTS 3
|
#define SEGMENTS 3
|
||||||
#define PADDING 4
|
#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)
|
ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
_zoom = 0;
|
_res = 1.0;
|
||||||
_lat = 0;
|
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
@ -96,45 +87,33 @@ QString ScaleItem::units() const
|
|||||||
|
|
||||||
void ScaleItem::computeScale()
|
void ScaleItem::computeScale()
|
||||||
{
|
{
|
||||||
qreal res = zoom2resolution(_zoom, _lat);
|
|
||||||
|
|
||||||
if (_units == Imperial) {
|
if (_units == Imperial) {
|
||||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
_length = niceNum((_res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
if (_length >= MIINFT) {
|
if (_length >= MIINFT) {
|
||||||
_length = niceNum((res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
_length = niceNum((_res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
_width = (_length / (res * M2FT * FT2MI));
|
_width = (_length / (_res * M2FT * FT2MI));
|
||||||
_scale = true;
|
_scale = true;
|
||||||
} else {
|
} else {
|
||||||
_width = (_length / (res * M2FT));
|
_width = (_length / (_res * M2FT));
|
||||||
_scale = false;
|
_scale = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_length = niceNum((res * SCALE_WIDTH) / SEGMENTS, 1);
|
_length = niceNum((_res * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
if (_length >= KMINM) {
|
if (_length >= KMINM) {
|
||||||
_length *= M2KM;
|
_length *= M2KM;
|
||||||
_width = (_length / (res * M2KM));
|
_width = (_length / (_res * M2KM));
|
||||||
_scale = true;
|
_scale = true;
|
||||||
} else {
|
} else {
|
||||||
_width = (_length / res);
|
_width = (_length / _res);
|
||||||
_scale = false;
|
_scale = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleItem::setZoom(int z, qreal lat)
|
void ScaleItem::setResolution(qreal res)
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_zoom = z;
|
_res = res;
|
||||||
_lat = lat;
|
|
||||||
computeScale();
|
|
||||||
updateBoundingRect();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScaleItem::setZoom(int z)
|
|
||||||
{
|
|
||||||
prepareGeometryChange();
|
|
||||||
_zoom = z;
|
|
||||||
computeScale();
|
computeScale();
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
update();
|
update();
|
||||||
|
@ -13,8 +13,7 @@ public:
|
|||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
|
|
||||||
void setZoom(int z);
|
void setResolution(qreal res);
|
||||||
void setZoom(int z, qreal lat);
|
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -22,8 +21,7 @@ private:
|
|||||||
void computeScale();
|
void computeScale();
|
||||||
QString units() const;
|
QString units() const;
|
||||||
|
|
||||||
int _zoom;
|
qreal _res;
|
||||||
qreal _lat;
|
|
||||||
qreal _width;
|
qreal _width;
|
||||||
qreal _length;
|
qreal _length;
|
||||||
Units _units;
|
Units _units;
|
||||||
|
@ -1,35 +1,108 @@
|
|||||||
#ifndef SETTINGS_H
|
#ifndef SETTINGS_H
|
||||||
#define SETTINGS_H
|
#define SETTINGS_H
|
||||||
|
|
||||||
|
#define IMPERIAL_UNITS() \
|
||||||
|
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
|
||||||
|
|
||||||
#define WINDOW_SETTINGS_GROUP "Window"
|
#define WINDOW_SETTINGS_GROUP "Window"
|
||||||
#define WINDOW_SIZE_SETTING "size"
|
#define WINDOW_SIZE_SETTING "size"
|
||||||
|
#define WINDOW_SIZE_DEFAULT QSize(600, 800)
|
||||||
#define WINDOW_POS_SETTING "pos"
|
#define WINDOW_POS_SETTING "pos"
|
||||||
|
#define WINDOW_POS_DEFAULT QPoint(10, 10)
|
||||||
|
|
||||||
#define SETTINGS_SETTINGS_GROUP "Settings"
|
#define SETTINGS_SETTINGS_GROUP "Settings"
|
||||||
#define UNITS_SETTING "units"
|
#define UNITS_SETTING "units"
|
||||||
|
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
|
||||||
#define SHOW_TOOLBARS_SETTING "toolbar"
|
#define SHOW_TOOLBARS_SETTING "toolbar"
|
||||||
|
#define SHOW_TOOLBARS_DEFAULT true
|
||||||
|
|
||||||
#define GRAPH_SETTINGS_GROUP "Graph"
|
#define GRAPH_SETTINGS_GROUP "Graph"
|
||||||
#define SHOW_GRAPHS_SETTING "show"
|
#define SHOW_GRAPHS_SETTING "show"
|
||||||
|
#define SHOW_GRAPHS_DEFAULT true
|
||||||
#define GRAPH_TYPE_SETTING "type"
|
#define GRAPH_TYPE_SETTING "type"
|
||||||
|
#define GRAPH_TYPE_DEFAULT Distance
|
||||||
#define SHOW_GRAPH_GRIDS_SETTING "grid"
|
#define SHOW_GRAPH_GRIDS_SETTING "grid"
|
||||||
|
#define SHOW_GRAPH_GRIDS_DEFAULT true
|
||||||
|
|
||||||
#define MAP_SETTINGS_GROUP "Map"
|
#define MAP_SETTINGS_GROUP "Map"
|
||||||
#define CURRENT_MAP_SETTING "map"
|
#define CURRENT_MAP_SETTING "map"
|
||||||
#define SHOW_MAP_SETTING "show"
|
#define SHOW_MAP_SETTING "show"
|
||||||
|
#define SHOW_MAP_DEFAULT true
|
||||||
|
|
||||||
#define POI_SETTINGS_GROUP "POI"
|
#define POI_SETTINGS_GROUP "POI"
|
||||||
#define OVERLAP_POI_SETTING "overlap"
|
#define OVERLAP_POI_SETTING "overlap"
|
||||||
|
#define OVERLAP_POI_DEFAULT false
|
||||||
#define LABELS_POI_SETTING "labels"
|
#define LABELS_POI_SETTING "labels"
|
||||||
|
#define LABELS_POI_DEFAULT true
|
||||||
#define SHOW_POI_SETTING "show"
|
#define SHOW_POI_SETTING "show"
|
||||||
|
#define SHOW_POI_DEFAULT false
|
||||||
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
|
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
|
||||||
#define DISABLED_POI_FILE_SETTING "file"
|
#define DISABLED_POI_FILE_SETTING "file"
|
||||||
|
|
||||||
#define DATA_SETTINGS_GROUP "Data"
|
#define DATA_SETTINGS_GROUP "Data"
|
||||||
#define SHOW_TRACKS_SETTING "tracks"
|
#define SHOW_TRACKS_SETTING "tracks"
|
||||||
|
#define SHOW_TRACKS_DEFAULT true
|
||||||
#define SHOW_ROUTES_SETTING "routes"
|
#define SHOW_ROUTES_SETTING "routes"
|
||||||
|
#define SHOW_ROUTES_DEFAULT true
|
||||||
#define SHOW_WAYPOINTS_SETTING "waypoints"
|
#define SHOW_WAYPOINTS_SETTING "waypoints"
|
||||||
|
#define SHOW_WAYPOINTS_DEFAULT true
|
||||||
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
|
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
|
||||||
|
#define SHOW_ROUTE_WAYPOINTS_DEFAULT true
|
||||||
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
|
#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 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 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 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 POI_RADIUS_SETTING "poiRadius"
|
||||||
|
#define POI_RADIUS_DEFAULT (IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||||
|
#define USE_OPENGL_SETTING "useOpenGL"
|
||||||
|
#define USE_OPENGL_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_ITEM_COUNT_SETTING "printItemCount"
|
||||||
|
#define PRINT_ITEM_COUNT_DEFAULT true
|
||||||
|
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
|
||||||
|
#define SEPARATE_GRAPH_PAGE_DEFAULT false
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -32,9 +32,11 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FONT_SIZE);
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
painter->setFont(font);
|
|
||||||
|
|
||||||
|
painter->setFont(font);
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter->setPen(Qt::red);
|
painter->setPen(Qt::red);
|
||||||
|
|
||||||
if (_side == Right)
|
if (_side == Right)
|
||||||
painter->drawText(SIZE, fm.height() - fm.descent(), _text);
|
painter->drawText(SIZE, fm.height() - fm.descent(), _text);
|
||||||
else
|
else
|
||||||
|
44
src/stylecombobox.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include <QPen>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include "stylecombobox.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define MIN_LINE_LENGTH 60
|
||||||
|
#define LINE_WIDTH_RATIO 7
|
||||||
|
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
|
||||||
|
|
||||||
|
StyleComboBox::StyleComboBox(QWidget *parent) : QComboBox(parent)
|
||||||
|
{
|
||||||
|
Qt::PenStyle styles[] = {Qt::SolidLine, Qt::DashLine, Qt::DotLine,
|
||||||
|
Qt::DashDotLine, Qt::DashDotDotLine};
|
||||||
|
|
||||||
|
QSize is = iconSize();
|
||||||
|
setIconSize(QSize(MIN_LINE_LENGTH, is.height()));
|
||||||
|
is = iconSize();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ARRAY_SIZE(styles); i++) {
|
||||||
|
QPixmap pm(is);
|
||||||
|
pm.fill(Qt::transparent);
|
||||||
|
|
||||||
|
QBrush brush(Qt::black);
|
||||||
|
QPen pen(brush, is.height() / LINE_WIDTH_RATIO, styles[i]);
|
||||||
|
|
||||||
|
QPainter painter(&pm);
|
||||||
|
painter.setPen(pen);
|
||||||
|
painter.drawLine(0, is.height() / 2, is.width(), is.height() / 2);
|
||||||
|
|
||||||
|
addItem(QIcon(pm), QString(), QVariant((int)styles[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StyleComboBox::setValue(Qt::PenStyle value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < count(); i++) {
|
||||||
|
if ((Qt::PenStyle) itemData(i).toInt() == value) {
|
||||||
|
setCurrentIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
src/stylecombobox.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef STYLECOMBOBOX_H
|
||||||
|
#define STYLECOMBOBOX_H
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
|
class StyleComboBox : public QComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
StyleComboBox(QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setValue(Qt::PenStyle value);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STYLECOMBOBOX_H
|
@ -213,13 +213,13 @@ QDateTime Track::date() const
|
|||||||
return (_data.size()) ? _data.first().timestamp() : QDateTime();
|
return (_data.size()) ? _data.first().timestamp() : QDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
Path Track::track() const
|
Path Track::path() const
|
||||||
{
|
{
|
||||||
Path ret;
|
Path ret;
|
||||||
|
|
||||||
for (int i = 0; i < _data.size(); i++)
|
for (int i = 0; i < _data.size(); i++)
|
||||||
if (!_outliers.contains(i))
|
if (!_outliers.contains(i))
|
||||||
ret.append(_data.at(i).coordinates());
|
ret.append(PathPoint(_data.at(i).coordinates(), _distance.at(i)));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class Track
|
|||||||
public:
|
public:
|
||||||
Track(const TrackData &data);
|
Track(const TrackData &data);
|
||||||
|
|
||||||
Path track() const;
|
Path path() const;
|
||||||
Graph elevation() const;
|
Graph elevation() const;
|
||||||
Graph speed() const;
|
Graph speed() const;
|
||||||
Graph heartRate() const;
|
Graph heartRate() const;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#include <QApplication>
|
|
||||||
#include <QCursor>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
@ -11,17 +9,14 @@ QString TrackItem::toolTip()
|
|||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
if (!_name.isEmpty())
|
if (!_name.isEmpty())
|
||||||
tt.insert(qApp->translate("TrackItem", "Name"), _name);
|
tt.insert(tr("Name"), _name);
|
||||||
if (!_desc.isEmpty())
|
if (!_desc.isEmpty())
|
||||||
tt.insert(qApp->translate("TrackItem", "Description"), _desc);
|
tt.insert(tr("Description"), _desc);
|
||||||
tt.insert(qApp->translate("TrackItem", "Distance"),
|
tt.insert(tr("Distance"), Format::distance(_distance.last(), _units));
|
||||||
Format::distance(_distance, _units));
|
|
||||||
if (_time > 0)
|
if (_time > 0)
|
||||||
tt.insert(qApp->translate("TrackItem", "Time"),
|
tt.insert(tr("Time"), Format::timeSpan(_time));
|
||||||
Format::timeSpan(_time));
|
|
||||||
if (!_date.isNull())
|
if (!_date.isNull())
|
||||||
tt.insert(qApp->translate("TrackItem", "Date"),
|
tt.insert(tr("Date"), _date.toString(Qt::SystemLocaleShortDate));
|
||||||
_date.toString(Qt::SystemLocaleShortDate));
|
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
@ -30,14 +25,18 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
|||||||
: PathItem(parent)
|
: PathItem(parent)
|
||||||
{
|
{
|
||||||
QPointF p;
|
QPointF p;
|
||||||
QVector<Coordinates> t = track.track();
|
const Path &path = track.path();
|
||||||
Q_ASSERT(t.count() >= 2);
|
Q_ASSERT(path.count() >= 2);
|
||||||
|
|
||||||
p = t.first().toMercator();
|
p = path.first().coordinates().toMercator();
|
||||||
_path.moveTo(QPointF(p.x(), -p.y()));
|
_path.moveTo(QPointF(p.x(), -p.y()));
|
||||||
for (int i = 1; i < t.size(); i++) {
|
_distance.append(path.first().distance());
|
||||||
p = t.at(i).toMercator();
|
for (int i = 1; i < path.size(); i++) {
|
||||||
|
if (path.at(i).coordinates() == path.at(i-1).coordinates())
|
||||||
|
continue;
|
||||||
|
p = path.at(i).coordinates().toMercator();
|
||||||
_path.lineTo(QPointF(p.x(), -p.y()));
|
_path.lineTo(QPointF(p.x(), -p.y()));
|
||||||
|
_distance.append(path.at(i).distance());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
@ -45,10 +44,9 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
|||||||
_name = track.name();
|
_name = track.name();
|
||||||
_desc = track.description();
|
_desc = track.description();
|
||||||
_date = track.date();
|
_date = track.date();
|
||||||
_distance = track.distance();
|
|
||||||
_time = track.time();
|
_time = track.time();
|
||||||
|
|
||||||
_marker->setPos(_path.pointAtPercent(0));
|
_marker->setPos(_path.elementAt(0));
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
}
|
}
|
||||||
|
12
src/units.h
@ -16,14 +16,14 @@ enum Units {
|
|||||||
#define H2S 0.000277777778 // h -> s
|
#define H2S 0.000277777778 // h -> s
|
||||||
#define MIN2S 0.016666666667 // min -> s
|
#define MIN2S 0.016666666667 // min -> s
|
||||||
|
|
||||||
#define KMINM 1000 // 1 km in m
|
#define KMINM 1000.0 // 1 km in m
|
||||||
#define MIINFT 5280 // 1 mi in ft
|
#define MIINFT 5280.0 // 1 mi in ft
|
||||||
#define MIINM 1609.344 // 1 mi in m
|
#define MIINM 1609.344 // 1 mi in m
|
||||||
#define MININS 60 // 1 min in s
|
#define MININS 60.0 // 1 min in s
|
||||||
#define HINS 3600 // 1 hins
|
#define HINS 3600.0 // 1 hins
|
||||||
|
|
||||||
#define C2FS 1.8 // Celsius to Farenheit - scale
|
#define C2FS 1.8 // Celsius to Farenheit - scale
|
||||||
#define C2FO 32 // Celsius to Farenheit - offset
|
#define C2FO 32.0 // Celsius to Farenheit - offset
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
#define UNIT_SPACE QString(" ")
|
#define UNIT_SPACE QString(" ")
|
||||||
|
@ -48,7 +48,7 @@ inline uint qHash(const Waypoint &key)
|
|||||||
return ::qHash(key.name());
|
return ::qHash(key.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug dbg, const Waypoint &Waypoint);
|
QDebug operator<<(QDebug dbg, const Waypoint &waypoint);
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(Waypoint, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(Waypoint, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
|