1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-05 07:02:51 +02:00

Compare commits

..

46 Commits
2.12 ... 2.16

Author SHA1 Message Date
0ce2f02178 version++ 2016-06-16 20:58:57 +02:00
1289762365 Added missing changes :-) 2016-06-16 20:47:32 +02:00
f0c3f9b8c8 Added temperature graphs
Fixed handling of GPX files with inconsistent trackpoint entries
2016-06-16 20:33:56 +02:00
31f6eeac26 Fixed infinite download loop on broken tile images
Added support for HTTP redirects
2016-06-16 20:32:11 +02:00
40803d68c1 Fixed slider/marker item inconsistency on file reload. 2016-06-06 20:38:10 +02:00
35dea229b4 Fixed printing on Windows XP 2016-05-29 19:35:38 +02:00
330b6547c4 Some more PDF export dialog polishing 2016-05-28 07:39:40 +02:00
498d33b77d PDF export dialog polishing 2016-05-27 22:45:58 +02:00
3592d9e68f Some more PDF info 2016-05-26 00:57:27 +02:00
7d38b55f60 Remove the PDF export dialog window superfluous "Help" button on Windows 2016-05-26 00:24:19 +02:00
82df1bec0e Improved PDF export dialog 2016-05-25 23:27:07 +02:00
82cbbbb52a Added basic PDF export settings 2016-05-24 03:01:22 +02:00
b8e404b789 Plots are now paper size agnostic 2016-05-22 15:47:23 +02:00
2ad94947d7 Make the file info and graph info having the same text size in plots. 2016-05-22 11:54:27 +02:00
b713da0012 Fixed QT4 compile issue 2016-05-21 16:18:48 +02:00
daf4ef894c Yet another bunch of print/PDF export improvements 2016-05-21 16:10:24 +02:00
eae8e23c6c Yet another print/pdf export fix 2016-05-21 00:28:06 +02:00
b9f7af33d7 Fixed graph shrinking on export/print 2016-05-20 23:47:37 +02:00
f334901db3 Print/pdf export related cosmetics 2016-05-20 22:44:03 +02:00
ffcba53b91 Added proper tile download for PDF exports/printing 2016-05-19 01:10:40 +02:00
f326c7e002 Added missing string localization
Code cleanup
2016-05-18 22:25:55 +02:00
15d4bd05f9 Keep the toolbar small 2016-05-17 00:45:49 +02:00
43bc7dd682 System defined toolbar style does't seem to be a that good idea... 2016-05-15 22:50:44 +02:00
a8cc02c1f9 Version++ 2016-05-15 22:40:49 +02:00
511deada2e Added printing support
"Save" is now "Export"
2016-05-15 22:38:15 +02:00
36937d8f2d Added support for maps in PDF export 2016-05-15 13:19:07 +02:00
969d87ec51 Improved toolbar style handling 2016-05-14 09:28:56 +02:00
07255aa8ae Some more code cleanup 2016-05-13 18:48:42 +02:00
e73f9448e9 Fixed plot region 2016-05-12 09:09:14 +02:00
ee9a8df51f Code cleanup 2016-05-12 09:03:05 +02:00
dcdd250858 Improved packaging scripts 2016-05-05 22:28:53 +02:00
6f73740da6 Program version (and some other stuff) now added by qmake. 2016-05-04 18:25:52 +02:00
6518fe3278 Added GPX file association 2016-05-03 10:18:51 +02:00
97e2215f0b File association stuff 2016-05-02 22:21:57 +02:00
21e7c00f66 Code cleanup 2016-04-30 10:54:07 +02:00
5daacc0a22 Program version now defined in the project file 2016-04-30 09:44:28 +02:00
1323f6ead8 Project structure refactoring 2016-04-29 22:49:37 +02:00
798f63aaff Fixed file open event handling on OS X
Installer files separation
2016-04-29 21:13:38 +02:00
b0abc976a5 Added remaining permanent settings 2016-04-28 08:49:06 +02:00
4c61e208ed More permanent settings 2016-04-26 20:55:29 +02:00
c997694e10 Merge branch 'master' of https://github.com/tumic0/GPXSee 2016-04-26 09:40:28 +02:00
a8d671556e Added permanent settings 2016-04-26 09:39:16 +02:00
2e4aeb57a8 Fixed broken file path handling on non-ASCII file systems. 2016-04-22 01:31:44 +02:00
e186a33340 Added screenshot + some more info 2016-04-20 09:27:57 +02:00
1b5bdc0f07 Better window title 2016-04-19 08:51:11 +02:00
5feec6ac0c Fixed broken registry handling in 64b uninstaller 2016-04-15 18:19:35 +02:00
52 changed files with 1614 additions and 423 deletions

66
Info.plist Normal file
View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>cz.wz.tumic.GPXSee</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>gpx</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/gpx+xml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>gpx.icns</string>
<key>CFBundleTypeName</key>
<string>GPS Exchange Format</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1</string>
<key>UTTypeDescription</key>
<string>GPS Exchange Format</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@ -2,12 +2,15 @@
GPX viewer and analyzer. GPX viewer and analyzer.
* User-definable map sources. * User-definable map sources.
* Track and elevation/speed graphs. * Track and elevation/speed/heart rate 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. * Export to PDF.
* Full-screen mode
* Native GUI for Windows, Mac OS X and Linux. * Native GUI for Windows, Mac OS X and Linux.
![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux.png)
## Build ## Build
### Linux/OS X ### Linux/OS X
```shell ```shell

6
build/env.bat Normal file
View File

@ -0,0 +1,6 @@
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
set PATH=C:\qt\qtbase\bin;%PATH%
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;%LIB%
set CL=/D_USING_V110_SDK71_

6
build/env64.bat Normal file
View File

@ -0,0 +1,6 @@
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
set PATH=C:\qt64\qtbase\bin;%PATH%
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;%LIB%
set CL=/D_USING_V110_SDK71_

View File

@ -1,4 +1,5 @@
TARGET = GPXSee TARGET = GPXSee
VERSION = 2.16
QT += core \ QT += core \
gui \ gui \
network network
@ -36,7 +37,14 @@ HEADERS += src/config.h \
src/palette.h \ src/palette.h \
src/heartrategraph.h \ src/heartrategraph.h \
src/range.h \ src/range.h \
src/cpuarch.h src/cpuarch.h \
src/settings.h \
src/app.h \
src/trackinfo.h \
src/exportdialog.h \
src/fileselectwidget.h \
src/margins.h \
src/temperaturegraph.h
SOURCES += src/main.cpp \ SOURCES += src/main.cpp \
src/gui.cpp \ src/gui.cpp \
src/gpx.cpp \ src/gpx.cpp \
@ -62,8 +70,25 @@ SOURCES += src/main.cpp \
src/waypointitem.cpp \ src/waypointitem.cpp \
src/palette.cpp \ src/palette.cpp \
src/heartrategraph.cpp \ src/heartrategraph.cpp \
src/range.cpp src/range.cpp \
src/app.cpp \
src/trackinfo.cpp \
src/exportdialog.cpp \
src/fileselectwidget.cpp \
src/temperaturegraph.cpp \
src/trackpoint.cpp
RESOURCES += gpxsee.qrc RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts TRANSLATIONS = lang/gpxsee_cs.ts
macx:ICON = icons/gpxsee.icns macx {
win32:RC_FILE = gpxsee.rc ICON = icons/gpxsee.icns
QMAKE_INFO_PLIST = Info.plist
APP_RESOURCES.files = icons/gpx.icns \
pkg/maps.txt
APP_RESOURCES.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_RESOURCES
}
win32 {
RC_ICONS = icons/gpxsee.ico \
icons/gpx.ico
}
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

View File

@ -2,8 +2,8 @@
<qresource prefix="/"> <qresource prefix="/">
<file>icons/dialog-close.png</file> <file>icons/dialog-close.png</file>
<file>icons/document-open.png</file> <file>icons/document-open.png</file>
<file>icons/document-save-as.png</file> <file>icons/document-print.png</file>
<file>icons/document-save.png</file> <file>icons/document-export.png</file>
<file>icons/flag.png</file> <file>icons/flag.png</file>
<file>icons/gpxsee.png</file> <file>icons/gpxsee.png</file>
<file>icons/application-exit.png</file> <file>icons/application-exit.png</file>

View File

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "icons/gpxsee.ico"

BIN
icons/document-export.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
icons/document-print.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

BIN
icons/gpx.icns Normal file

Binary file not shown.

BIN
icons/gpx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="cs_CZ"> <TS version="2.0" language="cs_CZ">
<context> <context>
<name>ElevationGraph</name> <name>ElevationGraph</name>
<message> <message>
@ -56,301 +56,404 @@
<translation>Maximum</translation> <translation>Maximum</translation>
</message> </message>
</context> </context>
<context>
<name>ExportDialog</name>
<message>
<location filename="../src/exportdialog.cpp" line="121"/>
<source>Export to PDF</source>
<translation>Exportovat do PDF</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="29"/>
<source>PDF files (*.pdf);;All files (*)</source>
<translation>Soubory PDF (*.pdf);;Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="42"/>
<source>Portrait</source>
<translation>Na výšku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="43"/>
<source>Landscape</source>
<translation>Na šířku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="85"/>
<source>Page size:</source>
<translation>Velikost stránky:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="86"/>
<source>Orientation:</source>
<translation>Orientace:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="82"/>
<source>Page Setup</source>
<translation>Nastavení stránky</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="55"/>
<source>in</source>
<translation>in</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="55"/>
<source>mm</source>
<translation>mm</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="87"/>
<source>Margins:</source>
<translation>Okraje:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="93"/>
<source>File:</source>
<translation>Soubor:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="99"/>
<source>Output file</source>
<translation>Výstupní soubor</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="106"/>
<source>Export</source>
<translation>Exportovat</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="128"/>
<location filename="../src/exportdialog.cpp" line="138"/>
<location filename="../src/exportdialog.cpp" line="143"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="128"/>
<source>No output file selected.</source>
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="138"/>
<source>%1 is a directory.</source>
<translation>%1 je adresář.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="143"/>
<source>%1 is not writable.</source>
<translation>%1 nelze zapsat.</translation>
</message>
</context>
<context>
<name>FileSelectWidget</name>
<message>
<location filename="../src/fileselectwidget.cpp" line="15"/>
<source>Browse...</source>
<translation>Procházet...</translation>
</message>
<message>
<location filename="../src/fileselectwidget.cpp" line="28"/>
<source>Select file</source>
<translation>Vybrat soubor</translation>
</message>
</context>
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="448"/> <location filename="../src/gui.cpp" line="464"/>
<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="512"/> <location filename="../src/gui.cpp" line="528"/>
<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="208"/> <location filename="../src/gui.cpp" line="606"/>
<source>Save as</source>
<translation>Uložit jako</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="583"/>
<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="197"/> <location filename="../src/gui.cpp" line="204"/>
<source>Open</source> <source>Open</source>
<translation>Otevřít</translation> <translation>Otevřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="181"/> <location filename="../src/gui.cpp" line="188"/>
<source>Quit</source> <source>Quit</source>
<translation>Ukončit</translation> <translation>Ukončit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="189"/> <location filename="../src/gui.cpp" line="196"/>
<location filename="../src/gui.cpp" line="464"/> <location filename="../src/gui.cpp" line="480"/>
<location filename="../src/gui.cpp" line="465"/> <location filename="../src/gui.cpp" line="481"/>
<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="202"/> <location filename="../src/gui.cpp" line="220"/>
<source>Save</source>
<translation>Uložit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="214"/>
<source>Close</source> <source>Close</source>
<translation>Zavřít</translation> <translation>Zavřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="220"/> <location filename="../src/gui.cpp" line="226"/>
<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="379"/> <location filename="../src/gui.cpp" line="382"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="321"/> <location filename="../src/gui.cpp" line="323"/>
<location filename="../src/gui.cpp" line="370"/> <location filename="../src/gui.cpp" line="376"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="187"/> <location filename="../src/gui.cpp" line="194"/>
<location filename="../src/gui.cpp" line="487"/> <location filename="../src/gui.cpp" line="503"/>
<location filename="../src/gui.cpp" line="488"/> <location filename="../src/gui.cpp" line="504"/>
<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="228"/> <location filename="../src/gui.cpp" line="234"/>
<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="231"/> <location filename="../src/gui.cpp" line="237"/>
<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="234"/> <location filename="../src/gui.cpp" line="240"/>
<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="242"/> <location filename="../src/gui.cpp" line="248"/>
<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="248"/> <location filename="../src/gui.cpp" line="254"/>
<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="258"/> <location filename="../src/gui.cpp" line="263"/>
<location filename="../src/gui.cpp" line="262"/> <location filename="../src/gui.cpp" line="267"/>
<location filename="../src/gui.cpp" line="474"/> <location filename="../src/gui.cpp" line="490"/>
<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="269"/> <location filename="../src/gui.cpp" line="274"/>
<source>Show graphs</source> <source>Show graphs</source>
<translation>Zobrazovat grafy</translation> <translation>Zobrazovat grafy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="276"/> <location filename="../src/gui.cpp" line="280"/>
<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="283"/> <location filename="../src/gui.cpp" line="286"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="289"/> <location filename="../src/gui.cpp" line="291"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="295"/> <location filename="../src/gui.cpp" line="297"/>
<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="303"/> <location filename="../src/gui.cpp" line="305"/>
<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="306"/> <location filename="../src/gui.cpp" line="308"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="310"/> <location filename="../src/gui.cpp" line="312"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="313"/> <location filename="../src/gui.cpp" line="315"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="335"/> <location filename="../src/gui.cpp" line="337"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="342"/> <location filename="../src/gui.cpp" line="344"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="343"/> <location filename="../src/gui.cpp" line="345"/>
<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="351"/> <location filename="../src/gui.cpp" line="353"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="352"/> <location filename="../src/gui.cpp" line="354"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="361"/> <location filename="../src/gui.cpp" line="363"/>
<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="476"/> <location filename="../src/gui.cpp" line="426"/>
<source>Temperature</source>
<translation>Teplota</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="492"/>
<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="822"/> <location filename="../src/gui.cpp" line="691"/>
<location filename="../src/gui.cpp" line="694"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="871"/>
<source>No GPX files loaded</source> <source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation> <translation>Nejsou načteny žádné GPX soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="922"/> <location filename="../src/gui.cpp" line="423"/>
<source>Elevation</source> <source>Elevation</source>
<translation>Výška</translation> <translation>Výška</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="923"/> <location filename="../src/gui.cpp" line="424"/>
<source>Speed</source> <source>Speed</source>
<translation>Rychlost</translation> <translation>Rychlost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="924"/> <location filename="../src/gui.cpp" line="425"/>
<source>Heart rate</source> <source>Heart rate</source>
<translation>Tep</translation> <translation>Tep</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="467"/> <location filename="../src/gui.cpp" line="483"/>
<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="444"/> <location filename="../src/gui.cpp" line="460"/>
<source>Version </source> <source>Version </source>
<translation>Verze </translation> <translation>Verze </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="468"/> <location filename="../src/gui.cpp" line="209"/>
<source>Print...</source>
<translation>Tisknout...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="214"/>
<source>Export to PDF...</source>
<translation>Exportovat do PDF...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="484"/>
<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="470"/> <location filename="../src/gui.cpp" line="486"/>
<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="471"/> <location filename="../src/gui.cpp" line="487"/>
<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="472"/> <location filename="../src/gui.cpp" line="488"/>
<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="491"/> <location filename="../src/gui.cpp" line="507"/>
<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="494"/> <location filename="../src/gui.cpp" line="510"/>
<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="502"/> <location filename="../src/gui.cpp" line="518"/>
<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="513"/> <location filename="../src/gui.cpp" line="529"/>
<source>GPX files (*.gpx);;All files (*)</source> <source>GPX files (*.gpx);;All files (*)</source>
<translation>soubory GPX (*.gpx);;všechny soubory (*)</translation> <translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="574"/> <location filename="../src/gui.cpp" line="597"/>
<location filename="../src/gui.cpp" line="600"/> <location filename="../src/gui.cpp" line="623"/>
<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="584"/> <location filename="../src/gui.cpp" line="607"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source> <source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation> <translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="665"/> <location filename="../src/gui.cpp" line="697"/>
<location filename="../src/gui.cpp" line="837"/> <source>Tracks</source>
<translation>Počet tras</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="703"/>
<location filename="../src/gui.cpp" line="886"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="668"/> <location filename="../src/gui.cpp" line="883"/>
<location filename="../src/gui.cpp" line="670"/>
<location filename="../src/gui.cpp" line="672"/>
<location filename="../src/gui.cpp" line="674"/>
<location filename="../src/gui.cpp" line="834"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="671"/> <location filename="../src/gui.cpp" line="199"/>
<location filename="../src/gui.cpp" line="683"/> <location filename="../src/gui.cpp" line="458"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="673"/>
<location filename="../src/gui.cpp" line="685"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="192"/>
<location filename="../src/gui.cpp" line="442"/>
<source>About GPXSee</source> <source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation> <translation>O aplikaci GPXSee</translation>
</message> </message>
@ -360,74 +463,57 @@
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="490"/> <location filename="../src/gui.cpp" line="506"/>
<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="501"/> <location filename="../src/gui.cpp" line="517"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="664"/> <location filename="../src/gui.cpp" line="702"/>
<location filename="../src/gui.cpp" line="676"/> <location filename="../src/gui.cpp" line="705"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="666"/> <location filename="../src/gui.cpp" line="710"/>
<location filename="../src/gui.cpp" line="678"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="667"/> <location filename="../src/gui.cpp" line="890"/>
<location filename="../src/gui.cpp" line="679"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="680"/>
<location filename="../src/gui.cpp" line="682"/>
<location filename="../src/gui.cpp" line="684"/>
<location filename="../src/gui.cpp" line="686"/>
<location filename="../src/gui.cpp" line="841"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="669"/> <location filename="../src/gui.cpp" line="878"/>
<location filename="../src/gui.cpp" line="681"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="829"/>
<source>%1 tracks</source> <source>%1 tracks</source>
<translation>Počet tras: %1</translation> <translation>Počet tras: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="677"/> <location filename="../src/gui.cpp" line="706"/>
<location filename="../src/gui.cpp" line="844"/> <location filename="../src/gui.cpp" line="893"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="576"/> <location filename="../src/gui.cpp" line="599"/>
<location filename="../src/gui.cpp" line="601"/> <location filename="../src/gui.cpp" line="624"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="571"/> <location filename="../src/gui.cpp" line="594"/>
<source>Error loading GPX file: <source>Error loading GPX file:
%1</source> %1</source>
<translation>Soubor GPX nelze otevřít: <translation>Soubor GPX nelze otevřít:
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="597"/> <location filename="../src/gui.cpp" line="620"/>
<source>Error loading POI file: <source>Error loading POI file:
%1</source> %1</source>
<translation>Soubor POI nelze otevřít: <translation>Soubor POI nelze otevřít:
@ -485,22 +571,22 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../src/scaleitem.cpp" line="83"/> <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="83"/> <location filename="../src/scaleitem.cpp" line="81"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/scaleitem.cpp" line="85"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/scaleitem.cpp" line="85"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
@ -558,4 +644,62 @@
<translation>mi/h</translation> <translation>mi/h</translation>
</message> </message>
</context> </context>
<context>
<name>TemperatureGraph</name>
<message>
<location filename="../src/temperaturegraph.cpp" line="10"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="11"/>
<source>Temperature</source>
<translation>Teplota</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="18"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="20"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="22"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="77"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="80"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="85"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="88"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="97"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="100"/>
<source>F</source>
<translation>F</translation>
</message>
</context>
</TS> </TS>

View File

@ -3,9 +3,11 @@
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version
!define VERSION "2.16"
; The file to write ; The file to write
OutFile "install.exe" OutFile "GPXSee-${VERSION}.exe"
; Required execution level ; Required execution level
RequestExecutionLevel admin RequestExecutionLevel admin
@ -18,7 +20,9 @@ InstallDir "$PROGRAMFILES\GPXSee"
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir" InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller ; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee" !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; GPX file type registry entry
!define REGGPX "GPXSee.gpx"
; Start menu page configuration ; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -65,7 +69,7 @@ Section "GPXSee (required)" SEC_APP
; Write the uninstall keys for Windows ; Write the uninstall keys for Windows
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee" WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma" WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.12" WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1 WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1 WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
@ -79,6 +83,13 @@ Section "GPXSee (required)" SEC_APP
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
!insertmacro MUI_STARTMENU_WRITE_END !insertmacro MUI_STARTMENU_WRITE_END
; Associate .gpx files
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd
Section "QT libs" SEC_QT Section "QT libs" SEC_QT
@ -91,6 +102,7 @@ Section "QT libs" SEC_QT
File "libGLESv2.dll" File "libGLESv2.dll"
File /r "platforms" File /r "platforms"
File /r "imageformats" File /r "imageformats"
File /r "printsupport"
SectionEnd SectionEnd
@ -132,7 +144,12 @@ Section "Uninstall"
SetShellVarContext all SetShellVarContext all
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\*.*" Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove GPX file association
DeleteRegKey HKCR "${REGGPX}"
DeleteRegKey HKCR ".gpx"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd

View File

@ -3,9 +3,11 @@
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version
!define VERSION "2.16"
; The file to write ; The file to write
OutFile "install.exe" OutFile "GPXSee-${VERSION}_x64.exe"
; Required execution level ; Required execution level
RequestExecutionLevel admin RequestExecutionLevel admin
@ -18,7 +20,9 @@ InstallDir "$PROGRAMFILES64\GPXSee"
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir" InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller ; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee" !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; GPX file type registry entry
!define REGGPX "GPXSee.gpx"
; Start menu page configuration ; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -73,7 +77,7 @@ Section "GPXSee (required)" SEC_APP
; Write the uninstall keys for Windows ; Write the uninstall keys for Windows
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee" WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma" WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.12" WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1 WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1 WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
@ -87,6 +91,13 @@ Section "GPXSee (required)" SEC_APP
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
!insertmacro MUI_STARTMENU_WRITE_END !insertmacro MUI_STARTMENU_WRITE_END
; Associate .gpx files
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd
Section "QT libs" SEC_QT Section "QT libs" SEC_QT
@ -99,6 +110,7 @@ Section "QT libs" SEC_QT
File "libGLESv2.dll" File "libGLESv2.dll"
File /r "platforms" File /r "platforms"
File /r "imageformats" File /r "imageformats"
File /r "printsupport"
SectionEnd SectionEnd
@ -125,6 +137,7 @@ SectionEnd
Section "Uninstall" Section "Uninstall"
; Remove registry keys ; Remove registry keys
SetRegView 64
DeleteRegKey HKLM "${REGENTRY}" DeleteRegKey HKLM "${REGENTRY}"
DeleteRegKey HKLM SOFTWARE\GPXSee DeleteRegKey HKLM SOFTWARE\GPXSee
@ -135,7 +148,12 @@ Section "Uninstall"
SetShellVarContext all SetShellVarContext all
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\*.*" Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder" RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove GPX file association
DeleteRegKey HKCR "${REGGPX}"
DeleteRegKey HKCR ".gpx"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd SectionEnd

48
src/app.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <QtGlobal>
#include <QTranslator>
#include <QLocale>
#include <QFileOpenEvent>
#include "gui.h"
#include "app.h"
App::App(int &argc, char **argv) : QApplication(argc, argv),
_argc(argc), _argv(argv)
{
_translator = new QTranslator();
QString locale = QLocale::system().name();
_translator->load(QString(":/lang/gpxsee_") + locale);
installTranslator(_translator);
#ifdef Q_OS_MAC
setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC
_gui = new GUI();
}
App::~App()
{
delete _gui;
delete _translator;
}
void App::run()
{
_gui->show();
for (int i = 1; i < _argc; i++)
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
exec();
}
bool App::event(QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *e = static_cast<QFileOpenEvent *>(event);
return _gui->openFile(e->file());
}
return QApplication::event(event);
}

28
src/app.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef APP_H
#define APP_H
#include <QApplication>
class GUI;
class QTranslator;
class App : QApplication
{
Q_OBJECT
public:
App(int &argc, char **argv);
~App();
void run();
protected:
bool event(QEvent *event);
private:
int &_argc;
char **_argv;
GUI *_gui;
QTranslator *_translator;
};
#endif // APP_H

View File

@ -8,10 +8,10 @@
#define APP_NAME "GPXSee" #define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee" #define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
#define APP_VERSION "2.12"
#define FONT_FAMILY "Arial" #define FONT_FAMILY "Arial"
#define FONT_SIZE 12 #define FONT_SIZE 12
#define SCREEN_DPI 96.0
#define MAP_FILE QString("maps.txt") #define MAP_FILE QString("maps.txt")
#define POI_DIR QString("POI") #define POI_DIR QString("POI")

View File

@ -23,12 +23,12 @@ Downloader::Downloader()
SLOT(downloadFinished(QNetworkReply*))); SLOT(downloadFinished(QNetworkReply*)));
} }
void Downloader::doDownload(const Download &dl) bool Downloader::doDownload(const Download &dl)
{ {
QUrl url(dl.url()); QUrl url(dl.url());
if (_errorDownloads.contains(url)) if (_errorDownloads.contains(url))
return; return false;
QNetworkRequest request(url); QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::User, QVariant(dl.file())); request.setAttribute(QNetworkRequest::User, QVariant(dl.file()));
@ -36,6 +36,8 @@ void Downloader::doDownload(const Download &dl)
QNetworkReply *reply = _manager.get(request); QNetworkReply *reply = _manager.get(request);
_currentDownloads.append(reply); _currentDownloads.append(reply);
return true;
} }
bool Downloader::saveToDisk(const QString &filename, QIODevice *data) bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
@ -62,9 +64,16 @@ void Downloader::downloadFinished(QNetworkReply *reply)
fprintf(stderr, "Error downloading map tile: %s: %s\n", fprintf(stderr, "Error downloading map tile: %s: %s\n",
url.toEncoded().constData(), qPrintable(reply->errorString())); url.toEncoded().constData(), qPrintable(reply->errorString()));
} else { } else {
QUrl redirect = reply->attribute(
QNetworkRequest::RedirectionTargetAttribute).toUrl();
QString filename = reply->request().attribute(QNetworkRequest::User) QString filename = reply->request().attribute(QNetworkRequest::User)
.toString(); .toString();
saveToDisk(filename, reply);
if (!redirect.isEmpty()) {
Download dl(redirect, filename);
doDownload(dl);
} else
saveToDisk(filename, reply);
} }
_currentDownloads.removeAll(reply); _currentDownloads.removeAll(reply);
@ -74,8 +83,12 @@ void Downloader::downloadFinished(QNetworkReply *reply)
emit finished(); emit finished();
} }
void Downloader::get(const QList<Download> &list) bool Downloader::get(const QList<Download> &list)
{ {
bool finishEmitted = false;
for (int i = 0; i < list.count(); i++) for (int i = 0; i < list.count(); i++)
doDownload(list.at(i)); finishEmitted |= doDownload(list.at(i));
return finishEmitted;
} }

View File

@ -12,13 +12,13 @@
class Download class Download
{ {
public: public:
Download(const QString &url, const QString &file) Download(const QUrl &url, const QString &file)
{_url = url; _file = file;} {_url = url; _file = file;}
const QString& url() const {return _url;} const QUrl& url() const {return _url;}
const QString& file() const {return _file;} const QString& file() const {return _file;}
private: private:
QString _url; QUrl _url;
QString _file; QString _file;
}; };
@ -30,7 +30,7 @@ class Downloader : public QObject
public: public:
static Downloader& instance() static Downloader& instance()
{static Downloader i; return i;} {static Downloader i; return i;}
void get(const QList<Download> &list); bool get(const QList<Download> &list);
signals: signals:
void finished(); void finished();
@ -43,7 +43,7 @@ private:
Downloader(Downloader const&); Downloader(Downloader const&);
void operator=(Downloader const&); void operator=(Downloader const&);
void doDownload(const Download &dl); bool doDownload(const Download &dl);
bool saveToDisk(const QString &filename, QIODevice *data); bool saveToDisk(const QString &filename, QIODevice *data);
QNetworkAccessManager _manager; QNetworkAccessManager _manager;

174
src/exportdialog.cpp Normal file
View File

@ -0,0 +1,174 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QGridLayout>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QComboBox>
#include <QRadioButton>
#include <QPushButton>
#include <QFileInfo>
#include <QMessageBox>
#include <QTabWidget>
#include <QDoubleSpinBox>
#include <QLocale>
#include "fileselectwidget.h"
#include "units.h"
#include "exportdialog.h"
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
: QDialog(parent), _printer(printer)
{
int index;
_units = (QLocale::system().measurementSystem()
== QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter;
_fileSelect = new FileSelectWidget();
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
_fileSelect->setFile(_printer->outputFileName());
_paperSize = new QComboBox();
_paperSize->addItem("A3", QPrinter::A3);
_paperSize->addItem("A4", QPrinter::A4);
_paperSize->addItem("A5", QPrinter::A5);
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
_paperSize->addItem("Legal", QPrinter::Legal);
_paperSize->addItem("Letter", QPrinter::Letter);
if ((index = _paperSize->findData(_printer->paperSize())) >= 0)
_paperSize->setCurrentIndex(index);
_portrait = new QRadioButton(tr("Portrait"));
_landscape = new QRadioButton(tr("Landscape"));
QHBoxLayout *orientationLayout = new QHBoxLayout();
orientationLayout->addWidget(_portrait);
orientationLayout->addWidget(_landscape);
if (_printer->orientation() == QPrinter::Portrait)
_portrait->setChecked(true);
else
_landscape->setChecked(true);
qreal top, bottom, left, right;
_printer->getPageMargins(&left, &top, &right, &bottom, _units);
QString us = _units == QPrinter::Inch ? tr("in") : tr("mm");
_topMargin = new QDoubleSpinBox();
_bottomMargin = new QDoubleSpinBox();
_leftMargin = new QDoubleSpinBox();
_rightMargin = new QDoubleSpinBox();
_topMargin->setValue(top);
_topMargin->setSuffix(UNIT_SPACE + us);
_bottomMargin->setValue(bottom);
_bottomMargin->setSuffix(UNIT_SPACE + us);
_leftMargin->setValue(left);
_leftMargin->setSuffix(UNIT_SPACE + us);
_rightMargin->setValue(right);
_rightMargin->setSuffix(UNIT_SPACE + us);
if (_units == QPrinter::Inch) {
_topMargin->setSingleStep(0.1);
_bottomMargin->setSingleStep(0.1);
_leftMargin->setSingleStep(0.1);
_rightMargin->setSingleStep(0.1);
}
QGridLayout *marginsLayout = new QGridLayout();
marginsLayout->addWidget(_topMargin, 0, 0, 1, 2, Qt::AlignCenter);
marginsLayout->addWidget(_leftMargin, 1, 0, 1, 1, Qt::AlignRight);
marginsLayout->addWidget(_rightMargin, 1, 1, 1, 1, Qt::AlignLeft);
marginsLayout->addWidget(_bottomMargin, 2, 0, 1, 2, Qt::AlignCenter);
#ifndef Q_OS_MAC
QGroupBox *pageSetupBox = new QGroupBox(tr("Page Setup"));
#endif // Q_OS_MAC
QFormLayout *pageSetupLayout = new QFormLayout;
pageSetupLayout->addRow(tr("Page size:"), _paperSize);
pageSetupLayout->addRow(tr("Orientation:"), orientationLayout);
pageSetupLayout->addRow(tr("Margins:"), marginsLayout);
#ifdef Q_OS_MAC
QFrame *line = new QFrame();
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
pageSetupLayout->addRow(line);
pageSetupLayout->addRow(tr("File:"), _fileSelect);
#else // Q_OS_MAC
pageSetupBox->setLayout(pageSetupLayout);
#endif // Q_OS_MAC
#ifndef Q_OS_MAC
QGroupBox *outputFileBox = new QGroupBox(tr("Output file"));
QHBoxLayout *outputFileLayout = new QHBoxLayout();
outputFileLayout->addWidget(_fileSelect);
outputFileBox->setLayout(outputFileLayout);
#endif // Q_OS_MAC
QDialogButtonBox *buttonBox = new QDialogButtonBox();
buttonBox->addButton(tr("Export"), QDialogButtonBox::AcceptRole);
buttonBox->addButton(QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *layout = new QVBoxLayout;
#ifdef Q_OS_MAC
layout->addLayout(pageSetupLayout);
#else // Q_OS_MAC
layout->addWidget(pageSetupBox);
layout->addWidget(outputFileBox);
#endif // Q_OS_MAC
layout->addWidget(buttonBox);
setLayout(layout);
setWindowTitle(tr("Export to PDF"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
bool ExportDialog::checkFile()
{
if (_fileSelect->file().isEmpty()) {
QMessageBox::warning(this, tr("Error"), tr("No output file selected."));
return false;
}
QFile file(_fileSelect->file());
QFileInfo fi(file);
bool exists = fi.exists();
bool opened = false;
if (exists && fi.isDir()) {
QMessageBox::warning(this, tr("Error"), tr("%1 is a directory.")
.arg(file.fileName()));
return false;
} else if ((exists && !fi.isWritable())
|| !(opened = file.open(QFile::Append))) {
QMessageBox::warning(this, tr("Error"), tr("%1 is not writable.")
.arg(file.fileName()));
return false;
}
if (opened) {
file.close();
if (!exists)
file.remove();
}
return true;
}
void ExportDialog::accept()
{
if (!checkFile())
return;
QPrinter::Orientation orientation = _portrait->isChecked()
? QPrinter::Portrait : QPrinter::Landscape;
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
_printer->setOutputFormat(QPrinter::PdfFormat);
_printer->setOutputFileName(_fileSelect->file());
_printer->setPaperSize(paperSize);
_printer->setOrientation(orientation);
_printer->setPageMargins(_leftMargin->value(), _topMargin->value(),
_rightMargin->value(), _bottomMargin->value(), _units);
QDialog::accept();
}

39
src/exportdialog.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef EXPORTDIALOG_H
#define EXPORTDIALOG_H
#include <QDialog>
#include <QPrinter>
class QComboBox;
class QRadioButton;
class FileSelectWidget;
class QDoubleSpinBox;
class ExportDialog : public QDialog
{
Q_OBJECT
public:
ExportDialog(QPrinter *printer, QWidget *parent = 0);
public slots:
void accept();
private:
bool checkFile();
QPrinter *_printer;
QPrinter::Unit _units;
FileSelectWidget *_fileSelect;
QComboBox *_paperSize;
QRadioButton *_portrait;
QRadioButton *_landscape;
QDoubleSpinBox *_topMargin;
QDoubleSpinBox *_bottomMargin;
QDoubleSpinBox *_leftMargin;
QDoubleSpinBox *_rightMargin;
};
#endif // EXPORTDIALOG_H

33
src/fileselectwidget.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <QPushButton>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QFileInfo>
#include <QApplication>
#include <QFontMetrics>
#include "fileselectwidget.h"
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
{
QFontMetrics fm(QApplication::font());
_edit = new QLineEdit();
_edit->setMinimumWidth(fm.boundingRect(QDir::homePath()).width());
_button = new QPushButton(tr("Browse..."));
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));
QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin(0);
layout->addWidget(_edit);
layout->addWidget(_button);
setLayout(layout);
}
void FileSelectWidget::browse()
{
QFileInfo fi(_edit->text());
QString fileName = QFileDialog::getSaveFileName(this, tr("Select file"),
fi.dir().absolutePath(), _filter);
if (!fileName.isEmpty())
_edit->setText(fileName);
}

30
src/fileselectwidget.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef FILESELECTWIDGET_H
#define FILESELECTWIDGET_H
#include <QWidget>
#include <QLineEdit>
class QPushButton;
class FileSelectWidget : public QWidget
{
Q_OBJECT
public:
FileSelectWidget(QWidget *parent = 0);
QString file() {return _edit->text();}
void setFile(const QString &file) {_edit->setText(file);}
void setFilter(const QString &filter) {_filter = filter;}
private slots:
void browse();
private:
QLineEdit *_edit;
QPushButton *_button;
QString _filter;
};
#endif // FILESELECTWIDGET_H

View File

@ -1,7 +1,8 @@
#include <QGraphicsView> #include <QGraphicsView>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QEvent> #include <QEvent>
#include <QGraphicsSimpleTextItem> #include <QPaintEngine>
#include <QPaintDevice>
#include "config.h" #include "config.h"
#include "axisitem.h" #include "axisitem.h"
#include "slideritem.h" #include "slideritem.h"
@ -48,6 +49,7 @@ GraphView::GraphView(QWidget *parent)
_xScale = 1; _xScale = 1;
_yScale = 1; _yScale = 1;
_yOffset = 0;
_precision = 0; _precision = 0;
_minYRange = 0.01; _minYRange = 0.01;
@ -67,8 +69,6 @@ GraphView::~GraphView()
if (_info->scene() != _scene) if (_info->scene() != _scene)
delete _info; delete _info;
delete _scene;
} }
void GraphView::updateBounds(const QPointF &point) void GraphView::updateBounds(const QPointF &point)
@ -117,16 +117,6 @@ void GraphView::setYUnits(const QString &units)
createYLabel(); createYLabel();
} }
void GraphView::setXScale(qreal scale)
{
_xScale = scale;
}
void GraphView::setYScale(qreal scale)
{
_yScale = scale;
}
void GraphView::loadData(const QVector<QPointF> &data) void GraphView::loadData(const QVector<QPointF> &data)
{ {
QPainterPath path; QPainterPath path;
@ -183,7 +173,8 @@ void GraphView::redraw(const QSizeF &size)
_graphs.at(i)->resetTransform(); _graphs.at(i)->resetTransform();
rx = RangeF(_bounds.left() * _xScale, _bounds.right() * _xScale); rx = RangeF(_bounds.left() * _xScale, _bounds.right() * _xScale);
ry = RangeF(_bounds.top() * _yScale, _bounds.bottom() * _yScale); ry = RangeF(_bounds.top() * _yScale + _yOffset, _bounds.bottom() * _yScale
+ _yOffset);
if (ry.size() < _minYRange) if (ry.size() < _minYRange)
ry.resize(_minYRange); ry.resize(_minYRange);
@ -218,6 +209,8 @@ void GraphView::redraw(const QSizeF &size)
_scene->addItem(_yAxis); _scene->addItem(_yAxis);
_slider->setArea(r); _slider->setArea(r);
if (_sliderPos > _bounds.right() || _sliderPos < _bounds.left())
_slider->setVisible(false);
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(), _slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
r.bottom()); r.bottom());
_scene->addItem(_slider); _scene->addItem(_slider);
@ -240,17 +233,18 @@ void GraphView::resizeEvent(QResizeEvent *)
void GraphView::plot(QPainter *painter, const QRectF &target) void GraphView::plot(QPainter *painter, const QRectF &target)
{ {
qreal ratio = target.width() / target.height(); qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
QSizeF orig = _scene->sceneRect().size(); / SCREEN_DPI;
QSizeF canvas = QSizeF(orig.height() * ratio, orig.height()); QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
setUpdatesEnabled(false);
redraw(canvas); redraw(canvas);
_slider->hide(); if (_slider->pos().x() == _slider->area().left())
_info->hide(); _slider->hide();
_scene->render(painter, target, QRectF()); _scene->render(painter, target);
_slider->show(); _slider->show();
_info->show(); redraw();
redraw(orig); setUpdatesEnabled(true);
} }
void GraphView::clear() void GraphView::clear()
@ -311,7 +305,7 @@ void GraphView::updateSliderInfo()
{ {
_sliderInfo->setVisible(_graphs.size() == 1); _sliderInfo->setVisible(_graphs.size() == 1);
if (_graphs.size() != 1) if (!_slider->isVisible())
return; return;
const QPainterPath &path = _graphs.at(0)->path(); const QPainterPath &path = _graphs.at(0)->path();
@ -329,7 +323,8 @@ void GraphView::updateSliderInfo()
_sliderInfo->setSide(s); _sliderInfo->setSide(s);
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r)); _sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
_sliderInfo->setText(QString::number(-y * _yScale, 'f', _precision)); _sliderInfo->setText(QString::number(-y * _yScale + _yOffset, 'f',
_precision));
} }
void GraphView::emitSliderPositionChanged(const QPointF &pos) void GraphView::emitSliderPositionChanged(const QPointF &pos)

View File

@ -47,13 +47,15 @@ public:
const QString &yUnits() const {return _yUnits;} const QString &yUnits() const {return _yUnits;}
qreal xScale() const {return _xScale;} qreal xScale() const {return _xScale;}
qreal yScale() const {return _yScale;} qreal yScale() const {return _yScale;}
qreal yOffset() const {return _yOffset;}
void setXLabel(const QString &label); void setXLabel(const QString &label);
void setYLabel(const QString &label); void setYLabel(const QString &label);
void setXUnits(const QString &units); void setXUnits(const QString &units);
void setYUnits(const QString &units); void setYUnits(const QString &units);
void setXScale(qreal scale); void setXScale(qreal scale) {_xScale = scale;}
void setYScale(qreal scale); void setYScale(qreal scale) {_yScale = scale;}
void setYOffset(qreal offset) {_yOffset = offset;}
void setSliderPrecision(int precision) {_precision = precision;} void setSliderPrecision(int precision) {_precision = precision;}
void setMinYRange(qreal range) {_minYRange = range;} void setMinYRange(qreal range) {_minYRange = range;}
@ -85,6 +87,7 @@ private:
void updateSliderInfo(); void updateSliderInfo();
qreal _xScale, _yScale; qreal _xScale, _yScale;
qreal _yOffset;
QString _xUnits, _yUnits; QString _xUnits, _yUnits;
QString _xLabel, _yLabel; QString _xLabel, _yLabel;
int _precision; int _precision;

View File

@ -4,8 +4,10 @@
#include <QStatusBar> #include <QStatusBar>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QPrinter> #include <QPrintDialog>
#include <QPainter> #include <QPainter>
#include <QPaintEngine>
#include <QPaintDevice>
#include <QKeyEvent> #include <QKeyEvent>
#include <QSignalMapper> #include <QSignalMapper>
#include <QMenu> #include <QMenu>
@ -14,29 +16,27 @@
#include <QActionGroup> #include <QActionGroup>
#include <QAction> #include <QAction>
#include <QLabel> #include <QLabel>
#include <QSettings>
#include <QLocale>
#include "config.h" #include "config.h"
#include "icons.h" #include "icons.h"
#include "keys.h" #include "keys.h"
#include "settings.h"
#include "gpx.h" #include "gpx.h"
#include "map.h" #include "map.h"
#include "maplist.h" #include "maplist.h"
#include "elevationgraph.h" #include "elevationgraph.h"
#include "speedgraph.h" #include "speedgraph.h"
#include "heartrategraph.h" #include "heartrategraph.h"
#include "temperaturegraph.h"
#include "trackview.h" #include "trackview.h"
#include "infoitem.h" #include "trackinfo.h"
#include "filebrowser.h" #include "filebrowser.h"
#include "cpuarch.h" #include "cpuarch.h"
#include "exportdialog.h"
#include "gui.h" #include "gui.h"
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
struct GraphTab {
GraphView *view;
QString label;
};
static QString timeSpan(qreal time) static QString timeSpan(qreal time)
{ {
unsigned h, m, s; unsigned h, m, s;
@ -49,7 +49,6 @@ static QString timeSpan(qreal time)
.arg(s, 2, 10, QChar('0')); .arg(s, 2, 10, QChar('0'));
} }
GUI::GUI(QWidget *parent) : QMainWindow(parent) GUI::GUI(QWidget *parent) : QMainWindow(parent)
{ {
loadMaps(); loadMaps();
@ -62,13 +61,6 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
createTrackGraphs(); createTrackGraphs();
createStatusBar(); createStatusBar();
connect(_elevationGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_speedGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_heartRateGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
_browser = new FileBrowser(this); _browser = new FileBrowser(this);
_browser->setFilter(QStringList("*.gpx")); _browser->setFilter(QStringList("*.gpx"));
@ -84,6 +76,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
widget->setLayout(layout); widget->setLayout(layout);
setCentralWidget(widget); setCentralWidget(widget);
setWindowIcon(QIcon(QPixmap(APP_ICON)));
setWindowTitle(APP_NAME); setWindowTitle(APP_NAME);
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
@ -96,7 +89,21 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updateTrackView();
resize(600, 800); 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);
}
GUI::~GUI()
{
for (int i = 0; i < _tabs.size(); i++) {
if (_trackGraphs->indexOf(_tabs.at(i).first) < 0)
delete _tabs.at(i).first;
}
} }
void GUI::loadMaps() void GUI::loadMaps()
@ -141,9 +148,6 @@ void GUI::createMapActions()
} }
connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int))); connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int)));
_mapActions.at(0)->setChecked(true);
_currentMap = _maps.at(0);
} }
void GUI::createPOIFilesActions() void GUI::createPOIFilesActions()
@ -161,7 +165,6 @@ QAction *GUI::createPOIFileAction(int index)
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(), QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
this); this);
a->setCheckable(true); a->setCheckable(true);
a->setChecked(true);
_poiFilesSM->setMapping(a, index); _poiFilesSM->setMapping(a, index);
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map())); connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
@ -202,18 +205,17 @@ void GUI::createActions()
_openFileAction->setShortcut(OPEN_SHORTCUT); _openFileAction->setShortcut(OPEN_SHORTCUT);
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
addAction(_openFileAction); addAction(_openFileAction);
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)), _printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)),
tr("Save"), this); tr("Print..."), this);
_saveFileAction->setShortcut(SAVE_SHORTCUT); _printFileAction->setActionGroup(_fileActionGroup);
_saveFileAction->setActionGroup(_fileActionGroup); connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile())); addAction(_printFileAction);
addAction(_saveFileAction); _exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)), tr("Export to PDF..."), this);
tr("Save as"), this); _exportFileAction->setShortcut(EXPORT_SHORTCUT);
_saveAsAction->setShortcut(SAVE_AS_SHORTCUT); _exportFileAction->setActionGroup(_fileActionGroup);
_saveAsAction->setActionGroup(_fileActionGroup); connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); addAction(_exportFileAction);
addAction(_saveAsAction);
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
tr("Close"), this); tr("Close"), this);
_closeFileAction->setShortcut(CLOSE_SHORTCUT); _closeFileAction->setShortcut(CLOSE_SHORTCUT);
@ -257,7 +259,6 @@ void GUI::createActions()
_clearMapCacheAction->setEnabled(false); _clearMapCacheAction->setEnabled(false);
} else { } else {
createMapActions(); createMapActions();
_showMapAction->setChecked(true);
_nextMapAction = new QAction(tr("Next map"), this); _nextMapAction = new QAction(tr("Next map"), this);
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT); _nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
@ -272,14 +273,12 @@ void GUI::createActions()
// Settings actions // Settings actions
_showGraphsAction = new QAction(tr("Show graphs"), this); _showGraphsAction = new QAction(tr("Show graphs"), this);
_showGraphsAction->setCheckable(true); _showGraphsAction->setCheckable(true);
_showGraphsAction->setChecked(true);
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT); _showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
connect(_showGraphsAction, SIGNAL(triggered(bool)), this, connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
SLOT(showGraphs(bool))); SLOT(showGraphs(bool)));
addAction(_showGraphsAction); addAction(_showGraphsAction);
_showToolbarsAction = new QAction(tr("Show toolbars"), this); _showToolbarsAction = new QAction(tr("Show toolbars"), this);
_showToolbarsAction->setCheckable(true); _showToolbarsAction->setCheckable(true);
_showToolbarsAction->setChecked(true);
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this, connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
SLOT(showToolbars(bool))); SLOT(showToolbars(bool)));
QActionGroup *ag = new QActionGroup(this); QActionGroup *ag = new QActionGroup(this);
@ -287,7 +286,6 @@ void GUI::createActions()
_metricUnitsAction = new QAction(tr("Metric"), this); _metricUnitsAction = new QAction(tr("Metric"), this);
_metricUnitsAction->setCheckable(true); _metricUnitsAction->setCheckable(true);
_metricUnitsAction->setActionGroup(ag); _metricUnitsAction->setActionGroup(ag);
_metricUnitsAction->setChecked(true);
connect(_metricUnitsAction, SIGNAL(triggered()), this, connect(_metricUnitsAction, SIGNAL(triggered()), this,
SLOT(setMetricUnits())); SLOT(setMetricUnits()));
_imperialUnitsAction = new QAction(tr("Imperial"), this); _imperialUnitsAction = new QAction(tr("Imperial"), this);
@ -325,8 +323,8 @@ void GUI::createMenus()
_fileMenu = menuBar()->addMenu(tr("File")); _fileMenu = menuBar()->addMenu(tr("File"));
_fileMenu->addAction(_openFileAction); _fileMenu->addAction(_openFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_saveFileAction); _fileMenu->addAction(_printFileAction);
_fileMenu->addAction(_saveAsAction); _fileMenu->addAction(_exportFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_reloadFileAction); _fileMenu->addAction(_reloadFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
@ -371,30 +369,25 @@ void GUI::createMenus()
void GUI::createToolBars() void GUI::createToolBars()
{ {
#ifdef Q_OS_MAC
setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // Q_OS_MAC
_fileToolBar = addToolBar(tr("File")); _fileToolBar = addToolBar(tr("File"));
_fileToolBar->addAction(_openFileAction); _fileToolBar->addAction(_openFileAction);
_fileToolBar->addAction(_saveFileAction);
_fileToolBar->addAction(_reloadFileAction); _fileToolBar->addAction(_reloadFileAction);
_fileToolBar->addAction(_closeFileAction); _fileToolBar->addAction(_closeFileAction);
#ifdef Q_OS_MAC _fileToolBar->addAction(_printFileAction);
_fileToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // Q_OS_MAC
_showToolBar = addToolBar(tr("Show")); _showToolBar = addToolBar(tr("Show"));
_showToolBar->addAction(_showPOIAction); _showToolBar->addAction(_showPOIAction);
_showToolBar->addAction(_showMapAction); _showToolBar->addAction(_showMapAction);
#ifdef Q_OS_MAC
_showToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // Q_OS_MAC
_navigationToolBar = addToolBar(tr("Navigation")); _navigationToolBar = addToolBar(tr("Navigation"));
_navigationToolBar->addAction(_firstAction); _navigationToolBar->addAction(_firstAction);
_navigationToolBar->addAction(_prevAction); _navigationToolBar->addAction(_prevAction);
_navigationToolBar->addAction(_nextAction); _navigationToolBar->addAction(_nextAction);
_navigationToolBar->addAction(_lastAction); _navigationToolBar->addAction(_lastAction);
#ifdef Q_OS_MAC
_navigationToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // Q_OS_MAC
} }
void GUI::createTrackView() void GUI::createTrackView()
@ -403,9 +396,6 @@ void GUI::createTrackView()
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
_track->setFrameShape(QFrame::NoFrame); _track->setFrameShape(QFrame::NoFrame);
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
if (_showMapAction->isChecked())
_track->setMap(_currentMap);
} }
void GUI::createTrackGraphs() void GUI::createTrackGraphs()
@ -416,6 +406,8 @@ void GUI::createTrackGraphs()
_speedGraph->setFrameShape(QFrame::NoFrame); _speedGraph->setFrameShape(QFrame::NoFrame);
_heartRateGraph = new HeartRateGraph; _heartRateGraph = new HeartRateGraph;
_heartRateGraph->setFrameShape(QFrame::NoFrame); _heartRateGraph->setFrameShape(QFrame::NoFrame);
_temperatureGraph = new TemperatureGraph;
_temperatureGraph->setFrameShape(QFrame::NoFrame);
_trackGraphs = new QTabWidget; _trackGraphs = new QTabWidget;
connect(_trackGraphs, SIGNAL(currentChanged(int)), this, connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
@ -427,6 +419,20 @@ void GUI::createTrackGraphs()
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
_trackGraphs->setDocumentMode(true); _trackGraphs->setDocumentMode(true);
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
_tabs.append(GraphTab(_elevationGraph, tr("Elevation")));
_tabs.append(GraphTab(_speedGraph, tr("Speed")));
_tabs.append(GraphTab(_heartRateGraph, tr("Heart rate")));
_tabs.append(GraphTab(_temperatureGraph, tr("Temperature")));
connect(_elevationGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_speedGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_heartRateGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_temperatureGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
} }
void GUI::createStatusBar() void GUI::createStatusBar()
@ -547,6 +553,7 @@ bool GUI::openFile(const QString &fileName)
updateNavigationActions(); updateNavigationActions();
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updateTrackView();
@ -561,6 +568,7 @@ bool GUI::loadFile(const QString &fileName)
_elevationGraph->loadGPX(gpx); _elevationGraph->loadGPX(gpx);
_speedGraph->loadGPX(gpx); _speedGraph->loadGPX(gpx);
_heartRateGraph->loadGPX(gpx); _heartRateGraph->loadGPX(gpx);
_temperatureGraph->loadGPX(gpx);
updateGraphTabs(); updateGraphTabs();
_track->setHidden(false); _track->setHidden(false);
_track->loadGPX(gpx); _track->loadGPX(gpx);
@ -571,6 +579,11 @@ bool GUI::loadFile(const QString &fileName)
for (int i = 0; i < gpx.trackCount(); i++) { for (int i = 0; i < gpx.trackCount(); i++) {
_distance += gpx.track(i).distance(); _distance += gpx.track(i).distance();
_time += gpx.track(i).time(); _time += gpx.track(i).time();
const QDate &date = gpx.track(i).date().date();
if (_dateRange.first.isNull() || _dateRange.first > date)
_dateRange.first = date;
if (_dateRange.second.isNull() || _dateRange.second < date)
_dateRange.second = date;
} }
_trackCount += gpx.trackCount(); _trackCount += gpx.trackCount();
@ -634,82 +647,107 @@ void GUI::closePOIFiles()
_poi.clear(); _poi.clear();
} }
void GUI::saveAs() void GUI::printFile()
{
QString fileName = QFileDialog::getSaveFileName(this, "Export to PDF",
QString(), "*.pdf");
if (!fileName.isEmpty()) {
saveFile(fileName);
_saveFileName = fileName;
}
}
void GUI::saveFile()
{
if (_saveFileName.isEmpty())
emit saveAs();
else
saveFile(_saveFileName);
}
void GUI::saveFile(const QString &fileName)
{ {
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
printer.setPageSize(QPrinter::A4); QPrintDialog dialog(&printer, this);
printer.setOrientation(_track->orientation());
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
QPainter p(&printer); if (dialog.exec() == QDialog::Accepted)
plot(&printer);
}
_track->plot(&p, QRectF(0, 300, printer.width(), (0.80 * printer.height()) void GUI::exportFile()
- 400)); {
_elevationGraph->plot(&p, QRectF(0, 0.80 * printer.height(), QPrinter printer(QPrinter::HighResolution);
printer.width(), printer.height() * 0.20)); printer.setCreator(QString(APP_NAME) + QString(" ") + QString(APP_VERSION));
printer.setOrientation(_exportOrientation);
printer.setOutputFileName(_exportFileName);
printer.setPaperSize(_exportPaperSize);
printer.setPageMargins(_exportMargins.left(), _exportMargins.top(),
_exportMargins.right(), _exportMargins.bottom(), QPrinter::Millimeter);
ExportDialog dialog(&printer, this);
QGraphicsScene scene; if (dialog.exec() == QDialog::Accepted) {
InfoItem info; _exportFileName = printer.outputFileName();
if (_imperialUnitsAction->isChecked()) { _exportPaperSize = printer.paperSize();
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1) _exportOrientation = printer.orientation();
+ UNIT_SPACE + tr("mi")); printer.getPageMargins(&(_exportMargins.rleft()),
info.insert(tr("Time"), timeSpan(_time)); &(_exportMargins.rtop()), &(_exportMargins.rright()),
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent() &(_exportMargins.rbottom()), QPrinter::Millimeter);
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft")); plot(&printer);
info.insert(tr("Descent"), QString::number(_elevationGraph->descent()
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft"));
info.insert(tr("Maximum"), QString::number(_elevationGraph->max()
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft"));
info.insert(tr("Minimum"), QString::number(_elevationGraph->min()
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft"));
} else {
info.insert(tr("Distance"), QString::number(_distance * M2KM, 'f', 1)
+ UNIT_SPACE + tr("km"));
info.insert(tr("Time"), timeSpan(_time));
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent(),
'f', 0) + UNIT_SPACE + tr("m"));
info.insert(tr("Descent"), QString::number(_elevationGraph->descent(),
'f', 0) + UNIT_SPACE + tr("m"));
info.insert(tr("Maximum"), QString::number(_elevationGraph->max(), 'f',
0) + UNIT_SPACE + tr("m"));
info.insert(tr("Minimum"), QString::number(_elevationGraph->min(), 'f',
0) + UNIT_SPACE + tr("m"));
} }
scene.addItem(&info); }
scene.render(&p, QRectF(0, 0, printer.width(), 200));
void GUI::plot(QPrinter *printer)
{
QPainter p(printer);
TrackInfo info;
qreal ih, gh, mh, ratio;
if (_dateRange.first.isValid()) {
if (_dateRange.first == _dateRange.second) {
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
info.insert(tr("Date"), _dateRange.first.toString(format));
} else {
QString format = QLocale::system().dateFormat(QLocale::ShortFormat);
info.insert(tr("Date"), QString("%1 - %2")
.arg(_dateRange.first.toString(format),
_dateRange.second.toString(format)));
info.insert(tr("Tracks"), QString::number(_trackCount));
}
}
if (_distance > 0) {
if (_imperialUnitsAction->isChecked()) {
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f',
1) + UNIT_SPACE + tr("mi"));
} else {
info.insert(tr("Distance"), QString::number(_distance * M2KM, 'f',
1) + UNIT_SPACE + tr("km"));
}
}
if (_time > 0)
info.insert(tr("Time"), timeSpan(_time));
ratio = p.paintEngine()->paintDevice()->logicalDpiX() / SCREEN_DPI;
if (info.isEmpty()) {
ih = 0;
mh = 0;
} else {
ih = info.contentSize().height() * ratio;
mh = ih / 2;
info.plot(&p, QRectF(0, 0, printer->width(), ih));
}
if (_trackGraphs->isVisible()) {
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
gh = (printer->width() > printer->height())
? 0.15 * r * (printer->height() - ih - 2*mh)
: 0.15 * (printer->height() - ih - 2*mh);
gh = qMax(gh, ratio * 150);
GraphView *gv = static_cast<GraphView*>(_trackGraphs->currentWidget());
gv->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
} else
gh = 0;
_track->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
- (ih + 2*mh + gh)));
} }
void GUI::reloadFile() void GUI::reloadFile()
{ {
_distance = 0; _distance = 0;
_time = 0; _time = 0;
_dateRange = DateRange(QDate(), QDate());
_trackCount = 0; _trackCount = 0;
_elevationGraph->clear(); _elevationGraph->clear();
_speedGraph->clear(); _speedGraph->clear();
_heartRateGraph->clear(); _heartRateGraph->clear();
_temperatureGraph->clear();
_track->clear(); _track->clear();
_sliderPos = 0;
for (int i = 0; i < _files.size(); i++) { for (int i = 0; i < _files.size(); i++) {
if (!loadFile(_files.at(i))) { if (!loadFile(_files.at(i))) {
_files.removeAt(i); _files.removeAt(i);
@ -718,6 +756,7 @@ void GUI::reloadFile()
} }
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updateTrackView();
if (_files.isEmpty()) if (_files.isEmpty())
@ -730,6 +769,7 @@ void GUI::closeFiles()
{ {
_distance = 0; _distance = 0;
_time = 0; _time = 0;
_dateRange = DateRange(QDate(), QDate());
_trackCount = 0; _trackCount = 0;
_sliderPos = 0; _sliderPos = 0;
@ -737,6 +777,7 @@ void GUI::closeFiles()
_elevationGraph->clear(); _elevationGraph->clear();
_speedGraph->clear(); _speedGraph->clear();
_heartRateGraph->clear(); _heartRateGraph->clear();
_temperatureGraph->clear();
_track->clear(); _track->clear();
_files.clear(); _files.clear();
@ -748,6 +789,7 @@ void GUI::closeAll()
_fileActionGroup->setEnabled(false); _fileActionGroup->setEnabled(false);
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updateTrackView();
} }
@ -853,6 +895,15 @@ void GUI::updateStatusBarInfo()
_timeLabel->setText(timeSpan(_time)); _timeLabel->setText(timeSpan(_time));
} }
void GUI::updateWindowTitle()
{
if (_files.count() == 1)
setWindowTitle(QFileInfo(_files.at(0)).fileName()
+ QString(" - " APP_NAME));
else
setWindowTitle(APP_NAME);
}
void GUI::mapChanged(int index) void GUI::mapChanged(int index)
{ {
_currentMap = _maps.at(index); _currentMap = _maps.at(index);
@ -925,24 +976,19 @@ void GUI::updateNavigationActions()
void GUI::updateGraphTabs() void GUI::updateGraphTabs()
{ {
struct GraphTab tabs[] = {
{_elevationGraph, tr("Elevation")},
{_speedGraph, tr("Speed")},
{_heartRateGraph, tr("Heart rate")}
};
int index; int index;
GraphView *gv; GraphView *gv;
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) { for (int i = 0; i < _tabs.size(); i++) {
gv = tabs[i].view; gv = _tabs.at(i).first;
if (!gv->count() && (index = _trackGraphs->indexOf(gv)) >= 0) if (!gv->count() && (index = _trackGraphs->indexOf(gv)) >= 0)
_trackGraphs->removeTab(index); _trackGraphs->removeTab(index);
} }
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) { for (int i = 0; i < _tabs.size(); i++) {
gv = tabs[i].view; gv = _tabs.at(i).first;
if (gv->count() && _trackGraphs->indexOf(gv) < 0) if (gv->count() && _trackGraphs->indexOf(gv) < 0)
_trackGraphs->insertTab(i, gv, tabs[i].label); _trackGraphs->insertTab(i, gv, _tabs.at(i).second);
} }
if (_trackGraphs->count()) { if (_trackGraphs->count()) {
@ -966,6 +1012,7 @@ void GUI::setMetricUnits()
_elevationGraph->setUnits(Metric); _elevationGraph->setUnits(Metric);
_speedGraph->setUnits(Metric); _speedGraph->setUnits(Metric);
_heartRateGraph->setUnits(Metric); _heartRateGraph->setUnits(Metric);
_temperatureGraph->setUnits(Metric);
updateStatusBarInfo(); updateStatusBarInfo();
} }
@ -975,6 +1022,7 @@ void GUI::setImperialUnits()
_elevationGraph->setUnits(Imperial); _elevationGraph->setUnits(Imperial);
_speedGraph->setUnits(Imperial); _speedGraph->setUnits(Imperial);
_heartRateGraph->setUnits(Imperial); _heartRateGraph->setUnits(Imperial);
_temperatureGraph->setUnits(Imperial);
updateStatusBarInfo(); updateStatusBarInfo();
} }
@ -1050,3 +1098,116 @@ void GUI::keyPressEvent(QKeyEvent *event)
openFile(file); openFile(file);
} }
} }
void GUI::closeEvent(QCloseEvent *event)
{
writeSettings();
event->accept();
}
void GUI::writeSettings()
{
QSettings settings(APP_NAME, APP_NAME);
settings.beginGroup(WINDOW_SETTINGS_GROUP);
settings.setValue(WINDOW_SIZE_SETTING, size());
settings.setValue(WINDOW_POS_SETTING, pos());
settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
? Imperial : Metric);
settings.setValue(SHOW_TOOLBARS_SETTING, _showToolbarsAction->isChecked());
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (_currentMap)
settings.setValue(CURRENT_MAP_SETTING, _currentMap->name());
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX);
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
for (int i = 0, j = 0; i < _poiFilesActions.count(); i++) {
if (!_poiFilesActions.at(i)->isChecked()) {
settings.setArrayIndex(j++);
settings.setValue(DISABLED_POI_FILE_SETTING, _poi.files().at(i));
}
}
settings.endArray();
settings.endGroup();
}
void GUI::readSettings()
{
QSettings settings(APP_NAME, APP_NAME);
settings.beginGroup(WINDOW_SETTINGS_GROUP);
resize(settings.value(WINDOW_SIZE_SETTING, QSize(600, 800)).toSize());
move(settings.value(WINDOW_POS_SETTING, QPoint(10, 10)).toPoint());
settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
Units u = QLocale::system().measurementSystem() == QLocale::ImperialSystem
? Imperial : Metric;
if (settings.value(UNITS_SETTING, u).toInt() == Imperial) {
setImperialUnits();
_imperialUnitsAction->setChecked(true);
} else
_metricUnitsAction->setChecked(true);
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false) {
showToolbars(false);
_showToolbarsAction->setChecked(false);
} else
_showToolbarsAction->setChecked(true);
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false) {
showGraphs(false);
_showGraphsAction->setChecked(false);
} else
_showGraphsAction->setChecked(true);
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (settings.value(SHOW_MAP_SETTING, true).toBool() == true)
_showMapAction->setChecked(true);
if (_maps.count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->setChecked(true);
_currentMap = _maps.at(index);
if (_showMapAction->isChecked())
_track->setMap(_currentMap);
} else
_currentMap = 0;
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
_showPOIAction->setChecked(true);
for (int i = 0; i < _poiFilesActions.count(); i++)
_poiFilesActions.at(i)->setChecked(true);
int size = settings.beginReadArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
int index = _poi.files().indexOf(settings.value(
DISABLED_POI_FILE_SETTING).toString());
if (index >= 0) {
_poi.enableFile(_poi.files().at(index), false);
_poiFilesActions.at(index)->setChecked(false);
}
}
settings.endArray();
settings.endGroup();
}
int GUI::mapIndex(const QString &name)
{
for (int i = 0; i < _maps.count(); i++)
if (_maps.at(i)->name() == name)
return i;
return 0;
}

View File

@ -4,7 +4,10 @@
#include <QMainWindow> #include <QMainWindow>
#include <QString> #include <QString>
#include <QList> #include <QList>
#include <QDate>
#include <QPrinter>
#include "poi.h" #include "poi.h"
#include "margins.h"
class QMenu; class QMenu;
class QToolBar; class QToolBar;
@ -13,11 +16,13 @@ class QActionGroup;
class QAction; class QAction;
class QLabel; class QLabel;
class QSignalMapper; class QSignalMapper;
class QPrinter;
class FileBrowser; class FileBrowser;
class GraphView; class GraphView;
class ElevationGraph; class ElevationGraph;
class SpeedGraph; class SpeedGraph;
class HeartRateGraph; class HeartRateGraph;
class TemperatureGraph;
class TrackView; class TrackView;
class Map; class Map;
@ -27,6 +32,7 @@ class GUI : public QMainWindow
public: public:
GUI(QWidget *parent = 0); GUI(QWidget *parent = 0);
~GUI();
bool openFile(const QString &fileName); bool openFile(const QString &fileName);
@ -34,8 +40,8 @@ private slots:
void about(); void about();
void keys(); void keys();
void dataSources(); void dataSources();
void saveFile(); void printFile();
void saveAs(); void exportFile();
void openFile(); void openFile();
void closeAll(); void closeAll();
void reloadFile(); void reloadFile();
@ -65,9 +71,13 @@ private slots:
void sliderPositionChanged(qreal pos); void sliderPositionChanged(qreal pos);
private: private:
typedef QPair<GraphView *, QString> GraphTab;
typedef QPair<QDate, QDate> DateRange;
void loadMaps(); void loadMaps();
void loadPOIs(); void loadPOIs();
void closeFiles(); void closeFiles();
void plot(QPrinter *printer);
QAction *createPOIFileAction(int index); QAction *createPOIFileAction(int index);
void createPOIFilesActions(); void createPOIFilesActions();
@ -81,13 +91,19 @@ private:
bool openPOIFile(const QString &fileName); bool openPOIFile(const QString &fileName);
bool loadFile(const QString &fileName); bool loadFile(const QString &fileName);
void saveFile(const QString &fileName); void exportFile(const QString &fileName);
void updateStatusBarInfo(); void updateStatusBarInfo();
void updateWindowTitle();
void updateNavigationActions(); void updateNavigationActions();
void updateGraphTabs(); void updateGraphTabs();
void updateTrackView(); void updateTrackView();
void keyPressEvent(QKeyEvent * event); void keyPressEvent(QKeyEvent * event);
void closeEvent(QCloseEvent *event);
int mapIndex(const QString &name);
void readSettings();
void writeSettings();
QMenu *_fileMenu; QMenu *_fileMenu;
QMenu *_helpMenu; QMenu *_helpMenu;
@ -109,8 +125,8 @@ private:
QAction *_dataSourcesAction; QAction *_dataSourcesAction;
QAction *_aboutAction; QAction *_aboutAction;
QAction *_aboutQtAction; QAction *_aboutQtAction;
QAction *_saveFileAction; QAction *_printFileAction;
QAction *_saveAsAction; QAction *_exportFileAction;
QAction *_openFileAction; QAction *_openFileAction;
QAction *_closeFileAction; QAction *_closeFileAction;
QAction *_reloadFileAction; QAction *_reloadFileAction;
@ -139,27 +155,34 @@ private:
QLabel *_distanceLabel; QLabel *_distanceLabel;
QLabel *_timeLabel; QLabel *_timeLabel;
TrackView *_track;
ElevationGraph *_elevationGraph; ElevationGraph *_elevationGraph;
SpeedGraph *_speedGraph; SpeedGraph *_speedGraph;
HeartRateGraph *_heartRateGraph; HeartRateGraph *_heartRateGraph;
TrackView *_track; TemperatureGraph *_temperatureGraph;
QList<GraphTab> _tabs;
POI _poi; POI _poi;
QList<Map*> _maps; QList<Map*> _maps;
FileBrowser *_browser; FileBrowser *_browser;
QList<QString> _files; QList<QString> _files;
QString _saveFileName;
Map *_currentMap; Map *_currentMap;
int _trackCount;
qreal _distance; qreal _distance;
qreal _time; qreal _time;
int _trackCount; DateRange _dateRange;
qreal _sliderPos; qreal _sliderPos;
int _frameStyle; int _frameStyle;
bool _showGraphs; bool _showGraphs;
QString _exportFileName;
QPrinter::PaperSize _exportPaperSize;
QPrinter::Orientation _exportOrientation;
MarginsF _exportMargins;
}; };
#endif // GUI_H #endif // GUI_H

View File

@ -3,8 +3,8 @@
#define APP_ICON ":/icons/gpxsee.png" #define APP_ICON ":/icons/gpxsee.png"
#define OPEN_FILE_ICON ":/icons/document-open.png" #define OPEN_FILE_ICON ":/icons/document-open.png"
#define SAVE_FILE_ICON ":/icons/document-save.png" #define EXPORT_FILE_ICON ":/icons/document-export.png"
#define SAVE_AS_ICON ":/icons/document-save-as.png" #define PRINT_FILE_ICON ":/icons/document-print.png"
#define CLOSE_FILE_ICON ":/icons/dialog-close.png" #define CLOSE_FILE_ICON ":/icons/dialog-close.png"
#define SHOW_POI_ICON ":/icons/flag.png" #define SHOW_POI_ICON ":/icons/flag.png"
#define SHOW_MAP_ICON ":/icons/applications-internet.png" #define SHOW_MAP_ICON ":/icons/applications-internet.png"

View File

@ -15,6 +15,7 @@ public:
void insert(const QString &key, const QString &value); void insert(const QString &key, const QString &value);
void clear(); void clear();
bool isEmpty() {return _list.isEmpty();}
private: private:
void updateBoundingRect(); void updateBoundingRect();

View File

@ -12,10 +12,9 @@
#define QUIT_SHORTCUT QKeySequence::Quit #define QUIT_SHORTCUT QKeySequence::Quit
#define OPEN_SHORTCUT QKeySequence::Open #define OPEN_SHORTCUT QKeySequence::Open
#define SAVE_SHORTCUT QKeySequence::Save
#define SAVE_AS_SHORTCUT QKeySequence::SaveAs
#define CLOSE_SHORTCUT QKeySequence::Close #define CLOSE_SHORTCUT QKeySequence::Close
#define RELOAD_SHORTCUT QKeySequence::Refresh #define RELOAD_SHORTCUT QKeySequence::Refresh
#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P) #define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M) #define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
#define NEXT_MAP_SHORTCUT QKeySequence::Forward #define NEXT_MAP_SHORTCUT QKeySequence::Forward

View File

@ -1,28 +1,9 @@
#include <QApplication> #include "app.h"
#include <QTranslator>
#include <QLocale>
#include "gui.h"
#include "icons.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); App app(argc, argv);
app.run();
QString locale = QLocale::system().name(); return 0;
QTranslator translator;
translator.load(QString(":/lang/gpxsee_") + locale);
app.installTranslator(&translator);
#ifdef Q_OS_MAC
app.setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC
GUI gui;
gui.setWindowIcon(QIcon(QPixmap(APP_ICON)));
gui.show();
for (int i = 1; i < argc; i++)
gui.openFile(argv[i]);
return app.exec();
} }

View File

@ -25,36 +25,105 @@ void Map::emitLoaded()
emit loaded(); emit loaded();
} }
void Map::loadTiles(QList<Tile> &list) void Map::loadTiles(QList<Tile> &list, bool block)
{
if (block)
loadTilesSync(list);
else
loadTilesAsync(list);
}
void Map::loadTilesAsync(QList<Tile> &list)
{ {
QList<Download> dl; QList<Download> dl;
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); i++) {
Tile &t = list[i]; Tile &t = list[i];
QString file = TILES_DIR + QString("/%1/%2-%3-%4") QString file = tileFile(t);
.arg(_name).arg(t.zoom()).arg(t.xy().rx()).arg(t.xy().ry());
QFileInfo fi(file); QFileInfo fi(file);
if (fi.exists()) { if (!fi.exists()) {
if (!t.pixmap().load(file)) fillTile(t);
fprintf(stderr, "Error loading map tile: %s\n", dl.append(Download(tileUrl(t), file));
qPrintable(file)); } else
} else { loadTileFile(t, file);
t.pixmap() = QPixmap(TILE_SIZE, TILE_SIZE);
t.pixmap().fill();
QString url(_url);
url.replace("$z", QString::number(t.zoom()));
url.replace("$x", QString::number(t.xy().x()));
url.replace("$y", QString::number(t.xy().y()));
dl.append(Download(url, file));
}
} }
if (!dl.empty()) if (!dl.empty())
Downloader::instance().get(dl); Downloader::instance().get(dl);
} }
void Map::loadTilesSync(QList<Tile> &list)
{
QList<Download> dl;
for (int i = 0; i < list.size(); i++) {
Tile &t = list[i];
QString file = tileFile(t);
QFileInfo fi(file);
if (!fi.exists())
dl.append(Download(tileUrl(t), file));
else
loadTileFile(t, file);
}
if (dl.empty())
return;
QEventLoop wait;
connect(&Downloader::instance(), SIGNAL(finished()), &wait, SLOT(quit()));
if (Downloader::instance().get(dl))
wait.exec();
for (int i = 0; i < list.size(); i++) {
Tile &t = list[i];
if (t.pixmap().isNull()) {
QString file = tileFile(t);
QFileInfo fi(file);
if (!(fi.exists() && loadTileFile(t, file)))
fillTile(t);
}
}
}
void Map::fillTile(Tile &tile)
{
tile.pixmap() = QPixmap(TILE_SIZE, TILE_SIZE);
tile.pixmap().fill();
}
bool Map::loadTileFile(Tile &tile, const QString &file)
{
if (!tile.pixmap().load(file)) {
fprintf(stderr, "%s: error loading tile file\n", qPrintable(file));
return false;
}
return true;
}
QString Map::tileUrl(const Tile &tile)
{
QString url(_url);
url.replace("$z", QString::number(tile.zoom()));
url.replace("$x", QString::number(tile.xy().x()));
url.replace("$y", QString::number(tile.xy().y()));
return url;
}
QString Map::tileFile(const Tile &tile)
{
QString file = TILES_DIR + QString("/%1/%2-%3-%4").arg(_name)
.arg(tile.zoom()).arg(tile.xy().x()).arg(tile.xy().y());
return file;
}
void Map::clearCache() void Map::clearCache()
{ {
QString path = TILES_DIR + QString("/") + _name; QString path = TILES_DIR + QString("/") + _name;

View File

@ -10,7 +10,7 @@ public:
{_xy = xy; _zoom = zoom;} {_xy = xy; _zoom = zoom;}
int zoom() const {return _zoom;} int zoom() const {return _zoom;}
QPoint& xy() {return _xy;} const QPoint& xy() const {return _xy;}
QPixmap& pixmap() {return _pixmap;} QPixmap& pixmap() {return _pixmap;}
private: private:
@ -29,7 +29,7 @@ public:
const QString &url = QString()); const QString &url = QString());
const QString &name() const {return _name;} const QString &name() const {return _name;}
void loadTiles(QList<Tile> &list); void loadTiles(QList<Tile> &list, bool block);
void clearCache(); void clearCache();
signals: signals:
@ -39,6 +39,14 @@ private slots:
void emitLoaded(); void emitLoaded();
private: private:
QString tileUrl(const Tile &tile);
QString tileFile(const Tile &tile);
bool loadTileFile(Tile &tile, const QString &file);
void fillTile(Tile &tile);
void loadTilesAsync(QList<Tile> &list);
void loadTilesSync(QList<Tile> &list);
QString _name; QString _name;
QString _url; QString _url;
}; };

9
src/margins.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "margins.h"
QDebug operator<<(QDebug dbg, const MarginsF &margins)
{
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
<< ", " << margins.right() << margins.bottom() << ")";
return dbg.maybeSpace();
}

30
src/margins.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef MARGINS_H
#define MARGINS_H
#include <QtGlobal>
#include <QDebug>
class MarginsF
{
public:
MarginsF() {_left = 0; _top = 0; _right = 0; _bottom = 0;}
MarginsF(qreal left, qreal top, qreal right, qreal bottom)
{_left = left, _top = top; _right = right; _bottom = bottom;}
qreal left() const {return _left;}
qreal top() const {return _top;}
qreal right() const {return _right;}
qreal bottom() const {return _bottom;}
qreal &rleft() {return _left;}
qreal &rtop() {return _top;}
qreal &rright() {return _right;}
qreal &rbottom() {return _bottom;}
private:
qreal _left, _top, _right, _bottom;
};
QDebug operator<<(QDebug dbg, const MarginsF &margins);
#endif // MARGINS_H

View File

@ -7,6 +7,8 @@ void Parser::handleExtensionData(QStringRef element, const QString &value)
_track->last().speed = value.toDouble(); _track->last().speed = value.toDouble();
else if (element == "hr" || element == "heartrate") else if (element == "hr" || element == "heartrate")
_track->last().heartRate = value.toDouble(); _track->last().heartRate = value.toDouble();
else if (element == "atemp" || element == "temp")
_track->last().temperature = value.toDouble();
} }
void Parser::handleTrekPointData(QStringRef element, const QString &value) void Parser::handleTrekPointData(QStringRef element, const QString &value)
@ -42,7 +44,7 @@ void Parser::handleWayPointAttributes(const QXmlStreamAttributes &attr)
void Parser::tpExtension() void Parser::tpExtension()
{ {
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {
if (_reader.name() == "hr") if (_reader.name() == "hr" || _reader.name() == "atemp")
handleExtensionData(_reader.name(), _reader.readElementText()); handleExtensionData(_reader.name(), _reader.readElementText());
else else
_reader.skipCurrentElement(); _reader.skipCurrentElement();
@ -53,7 +55,7 @@ void Parser::extensions()
{ {
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {
if (_reader.name() == "speed" || _reader.name() == "hr" if (_reader.name() == "speed" || _reader.name() == "hr"
|| _reader.name() == "heartrate") || _reader.name() == "heartrate" || _reader.name() == "temp")
handleExtensionData(_reader.name(), _reader.readElementText()); handleExtensionData(_reader.name(), _reader.readElementText());
else if (_reader.name() == "TrackPointExtension") else if (_reader.name() == "TrackPointExtension")
tpExtension(); tpExtension();

View File

@ -67,14 +67,12 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
for (int i = 0; i < SEGMENTS; i += 2) for (int i = 0; i < SEGMENTS; i += 2)
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width, painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
SCALE_HEIGHT), Qt::black); SCALE_HEIGHT), Qt::black);
if (aa)
painter->setRenderHint(QPainter::Antialiasing, true);
/* /*
painter->setPen(Qt::red); painter->setPen(Qt::red);
painter->drawRect(boundingRect()); painter->drawRect(boundingRect());
*/ */
if (aa)
painter->setRenderHint(QPainter::Antialiasing, true);
} }
QString ScaleItem::units() const QString ScaleItem::units() const

22
src/settings.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#define WINDOW_SETTINGS_GROUP "Window"
#define WINDOW_SIZE_SETTING "size"
#define WINDOW_POS_SETTING "pos"
#define SETTINGS_SETTINGS_GROUP "Settings"
#define UNITS_SETTING "units"
#define SHOW_TOOLBARS_SETTING "toolbar"
#define SHOW_GRAPHS_SETTING "graphs"
#define MAP_SETTINGS_GROUP "Map"
#define CURRENT_MAP_SETTING "map"
#define SHOW_MAP_SETTING "show"
#define POI_SETTINGS_GROUP "POI"
#define SHOW_POI_SETTING "show"
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
#define DISABLED_POI_FILE_SETTING "file"
#endif // SETTINGS_H

115
src/temperaturegraph.cpp Normal file
View File

@ -0,0 +1,115 @@
#include "gpx.h"
#include "temperaturegraph.h"
TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphView(parent)
{
_units = Metric;
setYUnits();
setXLabel(tr("Distance"));
setYLabel(tr("Temperature"));
setSliderPrecision(1);
}
void TemperatureGraph::addInfo()
{
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
redraw();
}
void TemperatureGraph::loadGPX(const GPX &gpx)
{
for (int i = 0; i < gpx.trackCount(); i++) {
QVector<QPointF> data;
qreal sum = 0, w = 0;
gpx.track(i).temperatureGraph(data);
if (data.count() < 2) {
skipColor();
continue;
}
for (int j = 1; j < data.size(); j++) {
sum += data.at(j).y() * (data.at(j).x() - data.at(j-1).x());
w += data.at(j).x() - data.at(j-1).x();
}
_avg.append(QPointF(gpx.track(i).distance(), sum/w));
loadData(data);
}
setXUnits();
addInfo();
}
qreal TemperatureGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
for (it = _avg.begin(); it != _avg.end(); it++) {
sum += it->y() * it->x();
w += it->x();
}
return (sum / w);
}
void TemperatureGraph::clear()
{
_avg.clear();
GraphView::clear();
}
void TemperatureGraph::setXUnits()
{
if (_units == Metric) {
if (bounds().width() < KMINM) {
GraphView::setXUnits(tr("m"));
setXScale(1);
} else {
GraphView::setXUnits(tr("km"));
setXScale(M2KM);
}
} else {
if (bounds().width() < MIINM) {
GraphView::setXUnits(tr("ft"));
setXScale(M2FT);
} else {
GraphView::setXUnits(tr("mi"));
setXScale(M2MI);
}
}
}
void TemperatureGraph::setYUnits()
{
if (_units == Metric) {
GraphView::setYUnits(QString::fromUtf8("\xC2\xB0") + tr("C"));
setYScale(1);
setYOffset(0);
} else {
GraphView::setYUnits(QString::fromUtf8("\xC2\xB0") + tr("F"));
setYScale(C2FS);
setYOffset(C2FO);
}
}
void TemperatureGraph::setUnits(enum Units units)
{
_units = units;
setXUnits();
setYUnits();
clearInfo();
addInfo();
}

33
src/temperaturegraph.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef TEMPERATUREGRAPH_H
#define TEMPERATUREGRAPH_H
#include "units.h"
#include "graphview.h"
class GPX;
class TemperatureGraph : public GraphView
{
Q_OBJECT
public:
TemperatureGraph(QWidget *parent = 0);
void loadGPX(const GPX &gpx);
void clear();
void setUnits(enum Units units);
qreal avg() const;
qreal min() const {return bounds().top();}
qreal max() const {return bounds().bottom();}
private:
void setXUnits();
void setYUnits();
void addInfo();
QList<QPointF> _avg;
enum Units _units;
};
#endif // TEMPERATUREGRAPH_H

View File

@ -99,15 +99,13 @@ void Track::elevationGraph(QVector<QPointF> &graph) const
if (!_data.size()) if (!_data.size())
return; return;
if (!_data.at(0).hasElevation()) if (_data.at(0).hasElevation())
return; raw.append(QPointF(0, _data.at(0).elevation - _data.at(0).geoidheight));
raw.append(QPointF(0, _data.at(0).elevation - _data.at(0).geoidheight));
for (int i = 1; i < _data.size(); i++) { for (int i = 1; i < _data.size(); i++) {
dist += _dd.at(i-1); dist += _dd.at(i-1);
if (!_data.at(i).hasElevation()) if (_data.at(i).hasElevation())
return; raw.append(QPointF(dist, _data.at(i).elevation
raw.append(QPointF(dist, _data.at(i).elevation - _data.at(i).geoidheight));
- _data.at(i).geoidheight));
} }
graph = filter(raw, WINDOW_EF); graph = filter(raw, WINDOW_EF);
@ -124,15 +122,18 @@ void Track::speedGraph(QVector<QPointF> &graph) const
raw.append(QPointF(0, 0)); raw.append(QPointF(0, 0));
for (int i = 1; i < _data.size(); i++) { for (int i = 1; i < _data.size(); i++) {
ds = _dd.at(i-1); ds = _dd.at(i-1);
dt = _data.at(i-1).timestamp.msecsTo(_data.at(i).timestamp) / 1000.0;
dist += ds; dist += ds;
if (!_data.at(i).hasSpeed()) { if (_data.at(i).hasSpeed())
v = _data.at(i).speed;
else if (_data.at(i).hasTimestamp()) {
dt = _data.at(i-1).timestamp.msecsTo(_data.at(i).timestamp)
/ 1000.0;
if (dt == 0) if (dt == 0)
continue; continue;
v = ds / dt; v = ds / dt;
} else } else
v = _data.at(i).speed; continue;
raw.append(QPointF(dist, v)); raw.append(QPointF(dist, v));
} }
@ -148,19 +149,33 @@ void Track::heartRateGraph(QVector<QPointF> &graph) const
if (!_data.size()) if (!_data.size())
return; return;
if (!_data.at(0).hasHeartRate()) if (_data.at(0).hasHeartRate())
return; raw.append(QPointF(0, _data.at(0).heartRate));
raw.append(QPointF(0, _data.at(0).heartRate));
for (int i = 1; i < _data.count(); i++) { for (int i = 1; i < _data.count(); i++) {
if (!_data.at(i).hasHeartRate())
return;
dist += _dd.at(i-1); dist += _dd.at(i-1);
raw.append(QPointF(dist, _data.at(i).heartRate)); if (_data.at(i).hasHeartRate())
raw.append(QPointF(dist, _data.at(i).heartRate));
} }
graph = filter(eliminate(raw, WINDOW_HE), WINDOW_HF); graph = filter(eliminate(raw, WINDOW_HE), WINDOW_HF);
} }
void Track::temperatureGraph(QVector<QPointF> &graph) const
{
qreal dist = 0;
if (!_data.size())
return;
if (_data.at(0).hasTemperature())
graph.append(QPointF(0, _data.at(0).temperature));
for (int i = 1; i < _data.size(); i++) {
dist += _dd.at(i-1);
if (_data.at(i).hasTemperature())
graph.append(QPointF(dist, _data.at(i).temperature));
}
}
void Track::track(QVector<QPointF> &track) const void Track::track(QVector<QPointF> &track) const
{ {
for (int i = 0; i < _data.size(); i++) for (int i = 0; i < _data.size(); i++)

View File

@ -13,6 +13,7 @@ public:
void elevationGraph(QVector<QPointF> &graph) const; void elevationGraph(QVector<QPointF> &graph) const;
void speedGraph(QVector<QPointF> &graph) const; void speedGraph(QVector<QPointF> &graph) const;
void heartRateGraph(QVector<QPointF> &graph) const; void heartRateGraph(QVector<QPointF> &graph) const;
void temperatureGraph(QVector<QPointF> &graph) const;
void track(QVector<QPointF> &track) const; void track(QVector<QPointF> &track) const;
qreal distance() const {return _distance;} qreal distance() const {return _distance;}
qreal time() const; qreal time() const;

40
src/trackinfo.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <QPaintEngine>
#include <QPaintDevice>
#include "config.h"
#include "infoitem.h"
#include "trackinfo.h"
TrackInfo::TrackInfo(QObject *parent) : QGraphicsScene(parent)
{
_info = new InfoItem();
addItem(_info);
}
void TrackInfo::insert(const QString &key, const QString &value)
{
_info->insert(key, value);
}
void TrackInfo::plot(QPainter *painter, const QRectF &target)
{
qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
/ SCREEN_DPI;
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
qAbs(canvas.height() - sceneRect().height()));
QRectF adj = sceneRect().adjusted(0, -diff.height()/2, diff.width(),
diff.height()/2);
render(painter, target, adj);
}
bool TrackInfo::isEmpty() const
{
return _info->isEmpty();
}
QSizeF TrackInfo::contentSize() const
{
return sceneRect().size();
}

24
src/trackinfo.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef TRACKINFO_H
#define TRACKINFO_H
#include <QGraphicsScene>
class InfoItem;
class TrackInfo : public QGraphicsScene
{
Q_OBJECT
public:
TrackInfo(QObject *parent = 0);
void insert(const QString &key, const QString &value);
void plot(QPainter *painter, const QRectF &target);
bool isEmpty() const;
QSizeF contentSize() const;
private:
InfoItem *_info;
};
#endif // TRACKINFO_H

11
src/trackpoint.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "trackpoint.h"
QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
{
dbg.nospace() << "Trackpoint(" << trackpoint.coordinates << ", "
<< trackpoint.timestamp << ", " << trackpoint.elevation << ", "
<< trackpoint.geoidheight << ", " << trackpoint.speed << ", "
<< trackpoint.heartRate << ", " << trackpoint.temperature << ")";
return dbg.maybeSpace();
}

View File

@ -3,6 +3,7 @@
#include <QPointF> #include <QPointF>
#include <QDateTime> #include <QDateTime>
#include <QDebug>
#include <cmath> #include <cmath>
class Trackpoint class Trackpoint
@ -13,11 +14,14 @@ public:
geoidheight = 0; geoidheight = 0;
speed = NAN; speed = NAN;
heartRate = NAN; heartRate = NAN;
temperature = NAN;
} }
bool hasTimestamp() const {return !timestamp.isNull();}
bool hasElevation() const {return !std::isnan(elevation);} bool hasElevation() const {return !std::isnan(elevation);}
bool hasSpeed() const {return !std::isnan(speed);} bool hasSpeed() const {return !std::isnan(speed);}
bool hasHeartRate() const {return !std::isnan(heartRate);} bool hasHeartRate() const {return !std::isnan(heartRate);}
bool hasTemperature() const {return !std::isnan(temperature);}
QPointF coordinates; QPointF coordinates;
QDateTime timestamp; QDateTime timestamp;
@ -25,6 +29,9 @@ public:
qreal geoidheight; qreal geoidheight;
qreal speed; qreal speed;
qreal heartRate; qreal heartRate;
qreal temperature;
}; };
QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint);
#endif // TRACKPOINT_H #endif // TRACKPOINT_H

View File

@ -36,11 +36,14 @@ TrackView::TrackView(QWidget *parent)
_map = 0; _map = 0;
_maxPath = 0; _maxPath = 0;
_maxDistance = 0; _maxDistance = 0;
_plot = false;
} }
TrackView::~TrackView() TrackView::~TrackView()
{ {
delete _scene; if (_mapScale->scene() != _scene)
delete _mapScale;
} }
void TrackView::addTrack(const QVector<QPointF> &track) void TrackView::addTrack(const QVector<QPointF> &track)
@ -294,7 +297,8 @@ void TrackView::setMap(Map *map)
{ {
_map = map; _map = map;
if (_map) if (_map)
connect(_map, SIGNAL(loaded()), this, SLOT(redraw())); connect(_map, SIGNAL(loaded()), this, SLOT(redraw()),
Qt::UniqueConnection);
resetCachedContent(); resetCachedContent();
} }
@ -342,48 +346,38 @@ void TrackView::wheelEvent(QWheelEvent *event)
resetCachedContent(); resetCachedContent();
} }
void TrackView::setTrackLineWidth(qreal width)
{
for (int i = 0; i < _paths.size(); i++) {
QPen pen(_paths.at(i)->pen());
pen.setWidthF(width);
_paths.at(i)->setPen(pen);
}
}
void TrackView::plot(QPainter *painter, const QRectF &target) void TrackView::plot(QPainter *painter, const QRectF &target)
{ {
QRectF orig, adj; QRect orig, adj;
qreal ratio, diff; qreal ratio, diff;
_scene->removeItem(_mapScale);
orig = _scene->itemsBoundingRect().adjusted(0, 0, 0,
_mapScale->boundingRect().height());
_scene->addItem(_mapScale);
if (target.width()/target.height() > orig.width()/orig.height()) { orig = viewport()->rect();
ratio = target.width()/target.height();
diff = qAbs((orig.height() * ratio) - orig.width()); if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
adj = orig.adjusted(-diff/2, 0, diff/2, 0);
} else {
ratio = target.height()/target.width(); ratio = target.height()/target.width();
diff = fabs((orig.width() * ratio) - orig.height()); diff = (orig.width() * ratio) - orig.height();
adj = orig.adjusted(0, -diff/2, 0, diff/2); adj = orig.adjusted(0, -diff/2, 0, diff/2);
} else {
ratio = target.width() / target.height();
diff = (orig.height() * ratio) - orig.width();
adj = orig.adjusted(-diff/2, 0, diff/2, 0);
} }
_mapScale->setPos(adj.bottomRight() setUpdatesEnabled(false);
+ QPoint(-_mapScale->boundingRect().width(), _plot = true;
-_mapScale->boundingRect().height()));
setTrackLineWidth(0); QPointF pos = _mapScale->pos();
_scene->render(painter, target, adj); _mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
setTrackLineWidth(TRACK_WIDTH * _scale); -(SCALE_OFFSET + _mapScale->boundingRect().width()),
} -(SCALE_OFFSET + _mapScale->boundingRect().height())))));
enum QPrinter::Orientation TrackView::orientation() const render(painter, target, adj);
{
return (sceneRect().width() > sceneRect().height()) _mapScale->setPos(pos);
? QPrinter::Landscape : QPrinter::Portrait;
_plot = false;
setUpdatesEnabled(true);
} }
void TrackView::clearPOI() void TrackView::clearPOI()
@ -439,18 +433,17 @@ void TrackView::movePositionMarker(qreal val)
void TrackView::drawBackground(QPainter *painter, const QRectF &rect) void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
{ {
if ((_paths.isEmpty() && _locations.isEmpty())|| !_map) { if ((_paths.isEmpty() && _locations.isEmpty()) || !_map) {
painter->fillRect(rect, Qt::white); painter->fillRect(rect, Qt::white);
return; return;
} }
painter->setWorldMatrixEnabled(false);
QRectF rr(rect.topLeft() * _scale, rect.size()); 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 = mapFromScene(QPointF(tm.x() / _scale, -tm.y() / _scale)); QPoint tl = mapToScene(mapFromScene(QPointF(tm.x() / _scale,
-tm.y() / _scale))).toPoint();
QList<Tile> tiles; QList<Tile> tiles;
for (int i = 0; i <= rr.size().width() / TILE_SIZE + 1; i++) { for (int i = 0; i <= rr.size().width() / TILE_SIZE + 1; i++) {
@ -459,12 +452,12 @@ void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
} }
} }
_map->loadTiles(tiles); _map->loadTiles(tiles, _plot);
for (int i = 0; i < tiles.count(); i++) { for (int i = 0; i < tiles.count(); i++) {
Tile &t = tiles[i]; Tile &t = tiles[i];
QPoint tp(tl.x() + (t.xy().rx() - tile.rx()) * TILE_SIZE, QPoint tp(tl.x() + (t.xy().x() - tile.x()) * TILE_SIZE,
tl.y() + (t.xy().ry() - tile.ry()) * TILE_SIZE); tl.y() + (t.xy().y() - tile.y()) * TILE_SIZE);
painter->drawPixmap(tp, t.pixmap()); painter->drawPixmap(tp, t.pixmap());
} }
} }
@ -496,9 +489,10 @@ void TrackView::resizeEvent(QResizeEvent *e)
void TrackView::paintEvent(QPaintEvent *e) void TrackView::paintEvent(QPaintEvent *e)
{ {
QPointF scenePos = mapToScene(rect().bottomLeft() + QPoint(SCALE_OFFSET, QPointF scenePos = mapToScene(rect().bottomRight() + QPoint(
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
-(SCALE_OFFSET + _mapScale->boundingRect().height()))); -(SCALE_OFFSET + _mapScale->boundingRect().height())));
if (_mapScale->pos() != scenePos) if (_mapScale->pos() != scenePos && !_plot)
_mapScale->setPos(scenePos); _mapScale->setPos(scenePos);
QGraphicsView::paintEvent(e); QGraphicsView::paintEvent(e);

View File

@ -5,7 +5,6 @@
#include <QVector> #include <QVector>
#include <QHash> #include <QHash>
#include <QList> #include <QList>
#include <QPrinter>
#include "units.h" #include "units.h"
#include "palette.h" #include "palette.h"
#include "waypoint.h" #include "waypoint.h"
@ -35,7 +34,6 @@ public:
void setUnits(enum Units units); void setUnits(enum Units units);
void plot(QPainter *painter, const QRectF &target); void plot(QPainter *painter, const QRectF &target);
enum QPrinter::Orientation orientation() const;
int trackCount() const {return _paths.count();} int trackCount() const {return _paths.count();}
int waypointCount() const {return _locations.count();} int waypointCount() const {return _locations.count();}
@ -57,9 +55,6 @@ private:
void rescale(qreal scale); void rescale(qreal scale);
void rescale(); void rescale();
void showMarkers(bool show);
void setTrackLineWidth(qreal width);
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect); void drawBackground(QPainter *painter, const QRectF &rect);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
@ -81,6 +76,8 @@ private:
qreal _scale; qreal _scale;
int _zoom; int _zoom;
bool _plot;
}; };
#endif // TRACKVIEW_H #endif // TRACKVIEW_H

View File

@ -12,13 +12,17 @@ enum Units {
#define MS2KMH 3.600000000000 // m/s -> km/h #define MS2KMH 3.600000000000 // m/s -> km/h
#define MS2MIH 2.236936290000 // m/s -> mi/h #define MS2MIH 2.236936290000 // m/s -> mi/h
#define FT2MI 0.000189393939 // ft -> mi #define FT2MI 0.000189393939 // ft -> mi
#define MM2IN 0.039370100000 // mm -> in
#define KMINM 1000 // 1 km in m #define KMINM 1000 // 1 km in m
#define MIINFT 5280 // 1 mi in ft #define MIINFT 5280 // 1 mi in ft
#define MIINM 1609.344 // 1mi in m #define MIINM 1609.344 // 1mi in m
#define C2FS 1.8 // Celsius to Farenheit - scale
#define C2FO 32 // Celsius to Farenheit - offset
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#define UNIT_SPACE " " #define UNIT_SPACE QString(" ")
#else // Q_OS_WIN32 #else // Q_OS_WIN32
#define UNIT_SPACE QString::fromUtf8("\xE2\x80\x89") #define UNIT_SPACE QString::fromUtf8("\xE2\x80\x89")
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32