mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-01 13:29:16 +02:00
Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
330b6547c4 | |||
498d33b77d | |||
3592d9e68f | |||
7d38b55f60 | |||
82df1bec0e | |||
82cbbbb52a | |||
b8e404b789 | |||
2ad94947d7 | |||
b713da0012 | |||
daf4ef894c | |||
eae8e23c6c | |||
b9f7af33d7 | |||
f334901db3 | |||
ffcba53b91 | |||
f326c7e002 | |||
15d4bd05f9 | |||
43bc7dd682 | |||
a8cc02c1f9 | |||
511deada2e | |||
36937d8f2d | |||
969d87ec51 | |||
07255aa8ae | |||
e73f9448e9 | |||
ee9a8df51f | |||
dcdd250858 | |||
6f73740da6 | |||
6518fe3278 | |||
97e2215f0b | |||
21e7c00f66 | |||
5daacc0a22 | |||
1323f6ead8 | |||
798f63aaff | |||
b0abc976a5 | |||
4c61e208ed | |||
c997694e10 | |||
a8d671556e | |||
2e4aeb57a8 | |||
e186a33340 | |||
1b5bdc0f07 | |||
5feec6ac0c | |||
5997ba21f2 | |||
37d9bf1b9b | |||
2bf93f891a | |||
11a9d75d8f | |||
23576cd52c | |||
47bcd0cfaf | |||
043d1f49a6 | |||
339144f7f8 |
66
Info.plist
Normal file
66
Info.plist
Normal 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>
|
@ -2,12 +2,15 @@
|
||||
GPX viewer and analyzer.
|
||||
|
||||
* 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 POI files.
|
||||
* Export to PDF.
|
||||
* Full-screen mode
|
||||
* Native GUI for Windows, Mac OS X and Linux.
|
||||
|
||||

|
||||
|
||||
## Build
|
||||
### Linux/OS X
|
||||
```shell
|
||||
|
6
build/env.bat
Normal file
6
build/env.bat
Normal 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
6
build/env64.bat
Normal 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_
|
31
gpxsee.pro
31
gpxsee.pro
@ -1,4 +1,5 @@
|
||||
TARGET = GPXSee
|
||||
VERSION = 2.14
|
||||
QT += core \
|
||||
gui \
|
||||
network
|
||||
@ -35,7 +36,14 @@ HEADERS += src/config.h \
|
||||
src/waypointitem.h \
|
||||
src/palette.h \
|
||||
src/heartrategraph.h \
|
||||
src/range.h
|
||||
src/range.h \
|
||||
src/cpuarch.h \
|
||||
src/settings.h \
|
||||
src/app.h \
|
||||
src/trackinfo.h \
|
||||
src/exportdialog.h \
|
||||
src/fileselectwidget.h \
|
||||
src/margins.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/gui.cpp \
|
||||
src/gpx.cpp \
|
||||
@ -61,8 +69,23 @@ SOURCES += src/main.cpp \
|
||||
src/waypointitem.cpp \
|
||||
src/palette.cpp \
|
||||
src/heartrategraph.cpp \
|
||||
src/range.cpp
|
||||
src/range.cpp \
|
||||
src/app.cpp \
|
||||
src/trackinfo.cpp \
|
||||
src/exportdialog.cpp \
|
||||
src/fileselectwidget.cpp
|
||||
RESOURCES += gpxsee.qrc
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||
macx:ICON = icons/gpxsee.icns
|
||||
win32:RC_FILE = gpxsee.rc
|
||||
macx {
|
||||
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\\\"
|
||||
|
@ -2,8 +2,8 @@
|
||||
<qresource prefix="/">
|
||||
<file>icons/dialog-close.png</file>
|
||||
<file>icons/document-open.png</file>
|
||||
<file>icons/document-save-as.png</file>
|
||||
<file>icons/document-save.png</file>
|
||||
<file>icons/document-print.png</file>
|
||||
<file>icons/document-export.png</file>
|
||||
<file>icons/flag.png</file>
|
||||
<file>icons/gpxsee.png</file>
|
||||
<file>icons/application-exit.png</file>
|
||||
@ -13,6 +13,7 @@
|
||||
<file>icons/arrow-right.png</file>
|
||||
<file>icons/arrow-left-double.png</file>
|
||||
<file>icons/arrow-right-double.png</file>
|
||||
<file>icons/view-fullscreen.png</file>
|
||||
<file>lang/gpxsee_cs.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
icons/document-export.png
Normal file
BIN
icons/document-export.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 865 B |
BIN
icons/document-print.png
Normal file
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
BIN
icons/gpx.icns
Normal file
Binary file not shown.
BIN
icons/gpx.ico
Normal file
BIN
icons/gpx.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
BIN
icons/view-fullscreen.png
Normal file
BIN
icons/view-fullscreen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 381 B |
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="cs_CZ">
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>ElevationGraph</name>
|
||||
<message>
|
||||
@ -57,365 +57,458 @@
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GUI</name>
|
||||
<name>ExportDialog</name>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="192"/>
|
||||
<source>About Qt</source>
|
||||
<translation>O Qt</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="122"/>
|
||||
<source>Export to PDF</source>
|
||||
<translation>Exportovat do PDF</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="418"/>
|
||||
<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>
|
||||
<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/gui.cpp" line="477"/>
|
||||
<source>Open file</source>
|
||||
<translation>Otevřít soubor</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="42"/>
|
||||
<source>Portrait</source>
|
||||
<translation>Na výšku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="206"/>
|
||||
<source>Save as</source>
|
||||
<translation>Uložit jako</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="43"/>
|
||||
<source>Landscape</source>
|
||||
<translation>Na šířku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="548"/>
|
||||
<source>Open POI file</source>
|
||||
<translation>Otevřít POI soubor</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="85"/>
|
||||
<source>Page size:</source>
|
||||
<translation>Velikost stránky:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="197"/>
|
||||
<source>Open</source>
|
||||
<translation>Otevřít</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="86"/>
|
||||
<source>Orientation:</source>
|
||||
<translation>Orientace:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="180"/>
|
||||
<source>Quit</source>
|
||||
<translation>Ukončit</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="82"/>
|
||||
<source>Page Setup</source>
|
||||
<translation>Nastavení stránky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="187"/>
|
||||
<location filename="../src/gui.cpp" line="434"/>
|
||||
<location filename="../src/gui.cpp" line="435"/>
|
||||
<source>Keyboard controls</source>
|
||||
<translation>Ovládací klávesy</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="55"/>
|
||||
<source>in</source>
|
||||
<translation>in</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="201"/>
|
||||
<source>Save</source>
|
||||
<translation>Uložit</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="55"/>
|
||||
<source>mm</source>
|
||||
<translation>mm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="211"/>
|
||||
<source>Close</source>
|
||||
<translation>Zavřít</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="87"/>
|
||||
<source>Margins:</source>
|
||||
<translation>Okraje:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="216"/>
|
||||
<source>Reload</source>
|
||||
<translation>Znovu načíst</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="93"/>
|
||||
<source>File:</source>
|
||||
<translation>Soubor:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="354"/>
|
||||
<source>Show</source>
|
||||
<translation>Zobrazit</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="99"/>
|
||||
<source>Output file</source>
|
||||
<translation>Výstupní soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="297"/>
|
||||
<location filename="../src/gui.cpp" line="345"/>
|
||||
<source>File</source>
|
||||
<translation>Soubor</translation>
|
||||
<location filename="../src/exportdialog.cpp" line="106"/>
|
||||
<source>Export</source>
|
||||
<translation>Exportovat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="185"/>
|
||||
<location filename="../src/gui.cpp" line="452"/>
|
||||
<location filename="../src/gui.cpp" line="453"/>
|
||||
<source>Data sources</source>
|
||||
<translation>Zdroje dat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="223"/>
|
||||
<source>Load POI file</source>
|
||||
<translation>Nahrát POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="226"/>
|
||||
<source>Close POI files</source>
|
||||
<translation>Zavřit POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="229"/>
|
||||
<source>Show POIs</source>
|
||||
<translation>Zobrazit POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="236"/>
|
||||
<source>Show map</source>
|
||||
<translation>Zobrazit mapu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="241"/>
|
||||
<source>Clear tile cache</source>
|
||||
<translation>Vymazat mezipaměť dlaždic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="253"/>
|
||||
<source>Show graphs</source>
|
||||
<translation>Zobrazovat grafy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="259"/>
|
||||
<source>Show toolbars</source>
|
||||
<translation>Zobrazovat nástrojové lišty</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="266"/>
|
||||
<source>Metric</source>
|
||||
<translation>Metrické</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="272"/>
|
||||
<source>Imperial</source>
|
||||
<translation>Imperiální</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="279"/>
|
||||
<source>Next</source>
|
||||
<translation>Následující</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="282"/>
|
||||
<source>Previous</source>
|
||||
<translation>Předchozí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="286"/>
|
||||
<source>Last</source>
|
||||
<translation>Poslední</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="289"/>
|
||||
<source>First</source>
|
||||
<translation>První</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="311"/>
|
||||
<source>Map</source>
|
||||
<translation>Mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="318"/>
|
||||
<source>POI</source>
|
||||
<translation>POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="319"/>
|
||||
<source>POI files</source>
|
||||
<translation>POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="327"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="328"/>
|
||||
<source>Units</source>
|
||||
<translation>Jednotky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="335"/>
|
||||
<source>Help</source>
|
||||
<translation>Nápověda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="756"/>
|
||||
<source>No GPX files loaded</source>
|
||||
<translation>Nejsou načteny žádné GPX soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="838"/>
|
||||
<source>Elevation</source>
|
||||
<translation>Výška</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="839"/>
|
||||
<source>Speed</source>
|
||||
<translation>Rychlost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="840"/>
|
||||
<source>Heart rate</source>
|
||||
<translation>Tep</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="437"/>
|
||||
<source>Next file</source>
|
||||
<translation>Následující soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="438"/>
|
||||
<source>Previous file</source>
|
||||
<translation>Předchozí soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="440"/>
|
||||
<source>First file</source>
|
||||
<translation>První soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="441"/>
|
||||
<source>Last file</source>
|
||||
<translation>Poslední soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="442"/>
|
||||
<source>Append modifier</source>
|
||||
<translation>Modifikátor nahradit/přidat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="456"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="459"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="467"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="478"/>
|
||||
<source>GPX files (*.gpx);;All files (*)</source>
|
||||
<translation>soubory GPX (*.gpx);;všechny soubory (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="539"/>
|
||||
<location filename="../src/gui.cpp" line="565"/>
|
||||
<source>Line: %1</source>
|
||||
<translation>Řádka: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="549"/>
|
||||
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
|
||||
<translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="630"/>
|
||||
<location filename="../src/gui.cpp" line="771"/>
|
||||
<source>mi</source>
|
||||
<translation>mi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="633"/>
|
||||
<location filename="../src/gui.cpp" line="635"/>
|
||||
<location filename="../src/gui.cpp" line="637"/>
|
||||
<location filename="../src/gui.cpp" line="639"/>
|
||||
<location filename="../src/gui.cpp" line="768"/>
|
||||
<source>ft</source>
|
||||
<translation>ft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="636"/>
|
||||
<location filename="../src/gui.cpp" line="648"/>
|
||||
<source>Maximum</source>
|
||||
<translation>Maximum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="638"/>
|
||||
<location filename="../src/gui.cpp" line="650"/>
|
||||
<source>Minimum</source>
|
||||
<translation>Minimum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="190"/>
|
||||
<location filename="../src/gui.cpp" line="414"/>
|
||||
<source>About GPXSee</source>
|
||||
<translation>O aplikaci GPXSee</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="361"/>
|
||||
<source>Navigation</source>
|
||||
<translation>Navigace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="416"/>
|
||||
<source>GPX viewer and analyzer</source>
|
||||
<translation>Prohlížeč a analyzátor GPX</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="455"/>
|
||||
<source>Map sources</source>
|
||||
<translation>Mapové zdroje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="466"/>
|
||||
<source>POIs</source>
|
||||
<translation>POI body</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="629"/>
|
||||
<location filename="../src/gui.cpp" line="641"/>
|
||||
<source>Distance</source>
|
||||
<translation>Vzdálenost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="631"/>
|
||||
<location filename="../src/gui.cpp" line="643"/>
|
||||
<source>Time</source>
|
||||
<translation>Čas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="632"/>
|
||||
<location filename="../src/gui.cpp" line="644"/>
|
||||
<source>Ascent</source>
|
||||
<translation>Stoupání</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="645"/>
|
||||
<location filename="../src/gui.cpp" line="647"/>
|
||||
<location filename="../src/gui.cpp" line="649"/>
|
||||
<location filename="../src/gui.cpp" line="651"/>
|
||||
<location filename="../src/gui.cpp" line="775"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="634"/>
|
||||
<location filename="../src/gui.cpp" line="646"/>
|
||||
<source>Descent</source>
|
||||
<translation>Klesání</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="763"/>
|
||||
<source>%1 tracks</source>
|
||||
<translation>Počet tras: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="642"/>
|
||||
<location filename="../src/gui.cpp" line="778"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="541"/>
|
||||
<location filename="../src/gui.cpp" line="566"/>
|
||||
<location filename="../src/exportdialog.cpp" line="129"/>
|
||||
<location filename="../src/exportdialog.cpp" line="139"/>
|
||||
<location filename="../src/exportdialog.cpp" line="144"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="536"/>
|
||||
<location filename="../src/exportdialog.cpp" line="129"/>
|
||||
<source>No output file selected.</source>
|
||||
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/exportdialog.cpp" line="139"/>
|
||||
<source>%1 is a directory.</source>
|
||||
<translation>%1 je adresář.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/exportdialog.cpp" line="144"/>
|
||||
<source>%1 is not writable.</source>
|
||||
<translation>%1 nelze zapsat.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSelectWidget</name>
|
||||
<message>
|
||||
<location filename="../src/fileselectwidget.cpp" line="10"/>
|
||||
<source>Browse...</source>
|
||||
<translation>Procházet...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/fileselectwidget.cpp" line="22"/>
|
||||
<source>Select file</source>
|
||||
<translation>Vybrat soubor</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GUI</name>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="458"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="522"/>
|
||||
<source>Open file</source>
|
||||
<translation>Otevřít soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="599"/>
|
||||
<source>Open POI file</source>
|
||||
<translation>Otevřít POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="203"/>
|
||||
<source>Open</source>
|
||||
<translation>Otevřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="187"/>
|
||||
<source>Quit</source>
|
||||
<translation>Ukončit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="195"/>
|
||||
<location filename="../src/gui.cpp" line="474"/>
|
||||
<location filename="../src/gui.cpp" line="475"/>
|
||||
<source>Keyboard controls</source>
|
||||
<translation>Ovládací klávesy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="219"/>
|
||||
<source>Close</source>
|
||||
<translation>Zavřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="225"/>
|
||||
<source>Reload</source>
|
||||
<translation>Znovu načíst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="381"/>
|
||||
<source>Show</source>
|
||||
<translation>Zobrazit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="322"/>
|
||||
<location filename="../src/gui.cpp" line="375"/>
|
||||
<source>File</source>
|
||||
<translation>Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="193"/>
|
||||
<location filename="../src/gui.cpp" line="497"/>
|
||||
<location filename="../src/gui.cpp" line="498"/>
|
||||
<source>Data sources</source>
|
||||
<translation>Zdroje dat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="233"/>
|
||||
<source>Load POI file</source>
|
||||
<translation>Nahrát POI soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="236"/>
|
||||
<source>Close POI files</source>
|
||||
<translation>Zavřit POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="239"/>
|
||||
<source>Show POIs</source>
|
||||
<translation>Zobrazit POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="247"/>
|
||||
<source>Show map</source>
|
||||
<translation>Zobrazit mapu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="253"/>
|
||||
<source>Clear tile cache</source>
|
||||
<translation>Vymazat mezipaměť dlaždic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="262"/>
|
||||
<location filename="../src/gui.cpp" line="266"/>
|
||||
<location filename="../src/gui.cpp" line="484"/>
|
||||
<source>Next map</source>
|
||||
<translation>Následující mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="273"/>
|
||||
<source>Show graphs</source>
|
||||
<translation>Zobrazovat grafy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="279"/>
|
||||
<source>Show toolbars</source>
|
||||
<translation>Zobrazovat nástrojové lišty</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="285"/>
|
||||
<source>Metric</source>
|
||||
<translation>Metrické</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="290"/>
|
||||
<source>Imperial</source>
|
||||
<translation>Imperiální</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="296"/>
|
||||
<source>Fullscreen mode</source>
|
||||
<translation>Celoobrazovkový režim</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="304"/>
|
||||
<source>Next</source>
|
||||
<translation>Následující</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="307"/>
|
||||
<source>Previous</source>
|
||||
<translation>Předchozí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="311"/>
|
||||
<source>Last</source>
|
||||
<translation>Poslední</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="314"/>
|
||||
<source>First</source>
|
||||
<translation>První</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="336"/>
|
||||
<source>Map</source>
|
||||
<translation>Mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="343"/>
|
||||
<source>POI</source>
|
||||
<translation>POI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="344"/>
|
||||
<source>POI files</source>
|
||||
<translation>POI soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="352"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="353"/>
|
||||
<source>Units</source>
|
||||
<translation>Jednotky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="362"/>
|
||||
<source>Help</source>
|
||||
<translation>Nápověda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="486"/>
|
||||
<source>Previous map</source>
|
||||
<translation>Předchozí mapa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="684"/>
|
||||
<location filename="../src/gui.cpp" line="687"/>
|
||||
<source>Date</source>
|
||||
<translation>Datum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="860"/>
|
||||
<source>No GPX files loaded</source>
|
||||
<translation>Nejsou načteny žádné GPX soubory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="420"/>
|
||||
<source>Elevation</source>
|
||||
<translation>Výška</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="421"/>
|
||||
<source>Speed</source>
|
||||
<translation>Rychlost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="422"/>
|
||||
<source>Heart rate</source>
|
||||
<translation>Tep</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="477"/>
|
||||
<source>Next file</source>
|
||||
<translation>Následující soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="454"/>
|
||||
<source>Version </source>
|
||||
<translation>Verze </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="208"/>
|
||||
<source>Print...</source>
|
||||
<translation>Tisknout...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="213"/>
|
||||
<source>Export to PDF...</source>
|
||||
<translation>Exportovat do PDF...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="478"/>
|
||||
<source>Previous file</source>
|
||||
<translation>Předchozí soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="480"/>
|
||||
<source>First file</source>
|
||||
<translation>První soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="481"/>
|
||||
<source>Last file</source>
|
||||
<translation>Poslední soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="482"/>
|
||||
<source>Append modifier</source>
|
||||
<translation>Modifikátor nahradit/přidat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="501"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="504"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="512"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="523"/>
|
||||
<source>GPX files (*.gpx);;All files (*)</source>
|
||||
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="590"/>
|
||||
<location filename="../src/gui.cpp" line="616"/>
|
||||
<source>Line: %1</source>
|
||||
<translation>Řádka: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="600"/>
|
||||
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
|
||||
<translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="690"/>
|
||||
<source>Tracks</source>
|
||||
<translation>Počet tras</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="696"/>
|
||||
<location filename="../src/gui.cpp" line="875"/>
|
||||
<source>mi</source>
|
||||
<translation>mi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="872"/>
|
||||
<source>ft</source>
|
||||
<translation>ft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="198"/>
|
||||
<location filename="../src/gui.cpp" line="452"/>
|
||||
<source>About GPXSee</source>
|
||||
<translation>O aplikaci GPXSee</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="385"/>
|
||||
<source>Navigation</source>
|
||||
<translation>Navigace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="500"/>
|
||||
<source>Map sources</source>
|
||||
<translation>Mapové zdroje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="511"/>
|
||||
<source>POIs</source>
|
||||
<translation>POI body</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="695"/>
|
||||
<location filename="../src/gui.cpp" line="698"/>
|
||||
<source>Distance</source>
|
||||
<translation>Vzdálenost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="703"/>
|
||||
<source>Time</source>
|
||||
<translation>Čas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="879"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="867"/>
|
||||
<source>%1 tracks</source>
|
||||
<translation>Počet tras: %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="699"/>
|
||||
<location filename="../src/gui.cpp" line="882"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="592"/>
|
||||
<location filename="../src/gui.cpp" line="617"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="587"/>
|
||||
<source>Error loading GPX file:
|
||||
%1</source>
|
||||
<translation>Soubor GPX nelze otevřít:
|
||||
%1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/gui.cpp" line="562"/>
|
||||
<location filename="../src/gui.cpp" line="613"/>
|
||||
<source>Error loading POI file:
|
||||
%1</source>
|
||||
<translation>Soubor POI nelze otevřít:
|
||||
@ -473,22 +566,22 @@
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<location filename="../src/scaleitem.cpp" line="81"/>
|
||||
<source>mi</source>
|
||||
<translation>mi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<location filename="../src/scaleitem.cpp" line="81"/>
|
||||
<source>ft</source>
|
||||
<translation>ft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/scaleitem.cpp" line="85"/>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<source>km</source>
|
||||
<translation>km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/scaleitem.cpp" line="85"/>
|
||||
<location filename="../src/scaleitem.cpp" line="83"/>
|
||||
<source>m</source>
|
||||
<translation>m</translation>
|
||||
</message>
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "2.14"
|
||||
|
||||
; The file to write
|
||||
OutFile "install.exe"
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
|
||||
; Required execution level
|
||||
RequestExecutionLevel admin
|
||||
@ -18,7 +20,9 @@ InstallDir "$PROGRAMFILES\GPXSee"
|
||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
|
||||
; 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
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
@ -65,7 +69,7 @@ Section "GPXSee (required)" SEC_APP
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.11"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||
@ -79,6 +83,13 @@ Section "GPXSee (required)" SEC_APP
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||
!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
|
||||
|
||||
Section "QT libs" SEC_QT
|
||||
@ -132,7 +143,12 @@ Section "Uninstall"
|
||||
SetShellVarContext all
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $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
|
||||
|
176
pkg/gpxsee64.nsi
Normal file
176
pkg/gpxsee64.nsi
Normal file
@ -0,0 +1,176 @@
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "2.14"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
||||
; Required execution level
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; The default installation directory
|
||||
InstallDir "$PROGRAMFILES64\GPXSee"
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
|
||||
; Registry key for uninstaller
|
||||
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
||||
; GPX file type registry entry
|
||||
!define REGGPX "GPXSee.gpx"
|
||||
|
||||
; Start menu page configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\GPXSee"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "GPXSee"
|
||||
|
||||
Var StartMenuFolder
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "licence.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Function .onInit
|
||||
${If} ${RunningX64}
|
||||
SetRegView 64
|
||||
${Else}
|
||||
MessageBox MB_OK "The 64b version of GPXSee can not be run on 32b systems."
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; The stuff to install
|
||||
Section "GPXSee (required)" SEC_APP
|
||||
|
||||
SectionIn RO
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File "maps.txt"
|
||||
|
||||
; Write the installation path into the registry
|
||||
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
||||
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||
!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
|
||||
|
||||
Section "QT libs" SEC_QT
|
||||
|
||||
File "Qt5Core.dll"
|
||||
File "Qt5Gui.dll"
|
||||
File "Qt5Widgets.dll"
|
||||
File "Qt5PrintSupport.dll"
|
||||
File "Qt5Network.dll"
|
||||
File "libGLESv2.dll"
|
||||
File /r "platforms"
|
||||
File /r "imageformats"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
||||
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
|
||||
StrCmp $R0 "1" 0 +3
|
||||
DetailPrint "Visual C++ 2015 Redistributable is already installed, skipping install."
|
||||
Goto done
|
||||
|
||||
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
||||
SetOutPath $TEMP
|
||||
File "VC_redist.x64.exe"
|
||||
ExecWait '"$TEMP/VC_redist.x64.exe" /install /quiet /norestart'
|
||||
|
||||
done:
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; Remove registry keys
|
||||
SetRegView 64
|
||||
DeleteRegKey HKLM "${REGENTRY}"
|
||||
DeleteRegKey HKLM SOFTWARE\GPXSee
|
||||
|
||||
; Remove directories used
|
||||
RMDir /r "$INSTDIR"
|
||||
|
||||
; Remove Start menu entries
|
||||
SetShellVarContext all
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
Delete "$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
|
||||
|
||||
;-------------------------------
|
||||
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_QT ${LANG_ENGLISH} \
|
||||
"QT Library. Unselct only if you have QT already installed!"
|
||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||
"Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
48
src/app.cpp
Normal file
48
src/app.cpp
Normal 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
28
src/app.h
Normal 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
|
@ -2,13 +2,16 @@
|
||||
#define CONFIG_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QString>
|
||||
|
||||
#define APP_NAME "GPXSee"
|
||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||
#define APP_VERSION "2.11"
|
||||
|
||||
#define FONT_FAMILY "Arial"
|
||||
#define FONT_SIZE 12
|
||||
#define SCREEN_DPI 96.0
|
||||
|
||||
#define MAP_FILE QString("maps.txt")
|
||||
#define POI_DIR QString("POI")
|
||||
|
42
src/cpuarch.h
Normal file
42
src/cpuarch.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef CPUARCH_H
|
||||
#define CPUARCH_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
|
||||
#if defined(__arm64__)
|
||||
#define CPU_ARCH_STR "arm64"
|
||||
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM)
|
||||
#define CPU_ARCH_STR "arm"
|
||||
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) \
|
||||
|| defined(_M_X64)
|
||||
#define CPU_ARCH_STR "x86_64"
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
#define CPU_ARCH_STR "i386"
|
||||
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
|
||||
#define CPU_ARCH_STR "ia64"
|
||||
#elif defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
|
||||
#define CPU_ARCH_STR "mips64"
|
||||
#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000)
|
||||
#define CPU_ARCH_STR "mips"
|
||||
#elif defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
|
||||
#define CPU_ARCH_STR "power64"
|
||||
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \
|
||||
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \
|
||||
|| defined(_M_MPPC) || defined(_M_PPC)
|
||||
#define CPU_ARCH_STR "power"
|
||||
#else
|
||||
#define CPU_ARCH_STR "unknown"
|
||||
#endif
|
||||
|
||||
#define CPU_ARCH QString(CPU_ARCH_STR)
|
||||
|
||||
#else // QT_VERSION < 5.4
|
||||
|
||||
#include <QSysInfo>
|
||||
#define CPU_ARCH QSysInfo::buildCpuArchitecture()
|
||||
|
||||
#endif // QT_VERSION < 5.4
|
||||
|
||||
#endif // CPUARCH_H
|
@ -23,12 +23,12 @@ Downloader::Downloader()
|
||||
SLOT(downloadFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
void Downloader::doDownload(const Download &dl)
|
||||
bool Downloader::doDownload(const Download &dl)
|
||||
{
|
||||
QUrl url(dl.url());
|
||||
|
||||
if (_errorDownloads.contains(url))
|
||||
return;
|
||||
return false;
|
||||
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::User, QVariant(dl.file()));
|
||||
@ -36,6 +36,8 @@ void Downloader::doDownload(const Download &dl)
|
||||
QNetworkReply *reply = _manager.get(request);
|
||||
|
||||
_currentDownloads.append(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
|
||||
@ -74,8 +76,12 @@ void Downloader::downloadFinished(QNetworkReply *reply)
|
||||
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++)
|
||||
doDownload(list.at(i));
|
||||
finishEmitted |= doDownload(list.at(i));
|
||||
|
||||
return finishEmitted;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class Downloader : public QObject
|
||||
public:
|
||||
static Downloader& instance()
|
||||
{static Downloader i; return i;}
|
||||
void get(const QList<Download> &list);
|
||||
bool get(const QList<Download> &list);
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
@ -43,7 +43,7 @@ private:
|
||||
Downloader(Downloader const&);
|
||||
void operator=(Downloader const&);
|
||||
|
||||
void doDownload(const Download &dl);
|
||||
bool doDownload(const Download &dl);
|
||||
bool saveToDisk(const QString &filename, QIODevice *data);
|
||||
|
||||
QNetworkAccessManager _manager;
|
||||
|
174
src/exportdialog.cpp
Normal file
174
src/exportdialog.cpp
Normal 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
39
src/exportdialog.h
Normal 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
33
src/fileselectwidget.cpp
Normal 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
30
src/fileselectwidget.h
Normal 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
|
@ -1,7 +1,8 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QEvent>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
#include <QPaintEngine>
|
||||
#include <QPaintDevice>
|
||||
#include "config.h"
|
||||
#include "axisitem.h"
|
||||
#include "slideritem.h"
|
||||
@ -67,8 +68,6 @@ GraphView::~GraphView()
|
||||
|
||||
if (_info->scene() != _scene)
|
||||
delete _info;
|
||||
|
||||
delete _scene;
|
||||
}
|
||||
|
||||
void GraphView::updateBounds(const QPointF &point)
|
||||
@ -240,17 +239,18 @@ void GraphView::resizeEvent(QResizeEvent *)
|
||||
|
||||
void GraphView::plot(QPainter *painter, const QRectF &target)
|
||||
{
|
||||
qreal ratio = target.width() / target.height();
|
||||
QSizeF orig = _scene->sceneRect().size();
|
||||
QSizeF canvas = QSizeF(orig.height() * ratio, orig.height());
|
||||
qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
|
||||
/ SCREEN_DPI;
|
||||
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
redraw(canvas);
|
||||
_slider->hide();
|
||||
_info->hide();
|
||||
_scene->render(painter, target, QRectF());
|
||||
if (_slider->pos().x() == _slider->area().left())
|
||||
_slider->hide();
|
||||
_scene->render(painter, target);
|
||||
_slider->show();
|
||||
_info->show();
|
||||
redraw(orig);
|
||||
redraw();
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
void GraphView::clear()
|
||||
|
529
src/gui.cpp
529
src/gui.cpp
@ -4,8 +4,10 @@
|
||||
#include <QStatusBar>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
#include <QPainter>
|
||||
#include <QPaintEngine>
|
||||
#include <QPaintDevice>
|
||||
#include <QKeyEvent>
|
||||
#include <QSignalMapper>
|
||||
#include <QMenu>
|
||||
@ -14,9 +16,12 @@
|
||||
#include <QActionGroup>
|
||||
#include <QAction>
|
||||
#include <QLabel>
|
||||
#include <QSettings>
|
||||
#include <QLocale>
|
||||
#include "config.h"
|
||||
#include "icons.h"
|
||||
#include "keys.h"
|
||||
#include "settings.h"
|
||||
#include "gpx.h"
|
||||
#include "map.h"
|
||||
#include "maplist.h"
|
||||
@ -24,18 +29,13 @@
|
||||
#include "speedgraph.h"
|
||||
#include "heartrategraph.h"
|
||||
#include "trackview.h"
|
||||
#include "infoitem.h"
|
||||
#include "trackinfo.h"
|
||||
#include "filebrowser.h"
|
||||
#include "cpuarch.h"
|
||||
#include "exportdialog.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
struct GraphTab {
|
||||
GraphView *view;
|
||||
QString label;
|
||||
};
|
||||
|
||||
static QString timeSpan(qreal time)
|
||||
{
|
||||
unsigned h, m, s;
|
||||
@ -48,7 +48,6 @@ static QString timeSpan(qreal time)
|
||||
.arg(s, 2, 10, QChar('0'));
|
||||
}
|
||||
|
||||
|
||||
GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
loadMaps();
|
||||
@ -61,24 +60,22 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
||||
createTrackGraphs();
|
||||
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->setFilter(QStringList("*.gpx"));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(_track);
|
||||
layout->addWidget(_trackGraphs);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
#ifdef Q_OS_WIN32
|
||||
layout->setSpacing(0);
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
QWidget *widget = new QWidget;
|
||||
widget->setLayout(layout);
|
||||
setCentralWidget(widget);
|
||||
|
||||
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
||||
setWindowTitle(APP_NAME);
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
|
||||
@ -91,7 +88,21 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
||||
updateGraphTabs();
|
||||
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()
|
||||
@ -136,9 +147,6 @@ void GUI::createMapActions()
|
||||
}
|
||||
|
||||
connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int)));
|
||||
|
||||
_mapActions.at(0)->setChecked(true);
|
||||
_currentMap = _maps.at(0);
|
||||
}
|
||||
|
||||
void GUI::createPOIFilesActions()
|
||||
@ -156,7 +164,6 @@ QAction *GUI::createPOIFileAction(int index)
|
||||
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
|
||||
this);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(true);
|
||||
|
||||
_poiFilesSM->setMapping(a, index);
|
||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||
@ -178,8 +185,9 @@ void GUI::createActions()
|
||||
|
||||
// General actions
|
||||
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
||||
_exitAction->setShortcut(QKeySequence::Quit);
|
||||
_exitAction->setShortcut(QUIT_SHORTCUT);
|
||||
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
addAction(_exitAction);
|
||||
|
||||
// Help & About
|
||||
_dataSourcesAction = new QAction(tr("Data sources"), this);
|
||||
@ -189,34 +197,36 @@ void GUI::createActions()
|
||||
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
|
||||
tr("About GPXSee"), this);
|
||||
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||
_aboutQtAction = new QAction(QIcon(QPixmap(QT_ICON)), tr("About Qt"), this);
|
||||
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
|
||||
// File related actions
|
||||
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||
tr("Open"), this);
|
||||
_openFileAction->setShortcut(QKeySequence::Open);
|
||||
_openFileAction->setShortcut(OPEN_SHORTCUT);
|
||||
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)),
|
||||
tr("Save"), this);
|
||||
_saveFileAction->setShortcut(QKeySequence::Save);
|
||||
_saveFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
|
||||
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)),
|
||||
tr("Save as"), this);
|
||||
_saveAsAction->setShortcut(QKeySequence::SaveAs);
|
||||
_saveAsAction->setActionGroup(_fileActionGroup);
|
||||
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||
addAction(_openFileAction);
|
||||
_printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)),
|
||||
tr("Print..."), this);
|
||||
_printFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
|
||||
addAction(_printFileAction);
|
||||
_exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
|
||||
tr("Export to PDF..."), this);
|
||||
_exportFileAction->setShortcut(EXPORT_SHORTCUT);
|
||||
_exportFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
|
||||
addAction(_exportFileAction);
|
||||
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
|
||||
tr("Close"), this);
|
||||
_closeFileAction->setShortcut(QKeySequence::Close);
|
||||
_closeFileAction->setShortcut(CLOSE_SHORTCUT);
|
||||
_closeFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll()));
|
||||
addAction(_closeFileAction);
|
||||
_reloadFileAction = new QAction(QIcon(QPixmap(RELOAD_FILE_ICON)),
|
||||
tr("Reload"), this);
|
||||
_reloadFileAction->setShortcut(QKeySequence::Refresh);
|
||||
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
|
||||
_reloadFileAction->setActionGroup(_fileActionGroup);
|
||||
connect(_reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
|
||||
addAction(_reloadFileAction);
|
||||
|
||||
// POI actions
|
||||
_openPOIAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||
@ -228,16 +238,18 @@ void GUI::createActions()
|
||||
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
||||
tr("Show POIs"), this);
|
||||
_showPOIAction->setCheckable(true);
|
||||
_showPOIAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
||||
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
|
||||
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
|
||||
addAction(_showPOIAction);
|
||||
createPOIFilesActions();
|
||||
|
||||
// Map actions
|
||||
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
||||
this);
|
||||
_showMapAction->setCheckable(true);
|
||||
_showMapAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||
_showMapAction->setShortcut(SHOW_MAP_SHORTCUT);
|
||||
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
|
||||
addAction(_showMapAction);
|
||||
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
|
||||
connect(_clearMapCacheAction, SIGNAL(triggered()), this,
|
||||
SLOT(clearMapCache()));
|
||||
@ -246,19 +258,26 @@ void GUI::createActions()
|
||||
_clearMapCacheAction->setEnabled(false);
|
||||
} else {
|
||||
createMapActions();
|
||||
_showMapAction->setChecked(true);
|
||||
|
||||
_nextMapAction = new QAction(tr("Next map"), this);
|
||||
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
|
||||
connect(_nextMapAction, SIGNAL(triggered()), this, SLOT(nextMap()));
|
||||
addAction(_nextMapAction);
|
||||
_prevMapAction = new QAction(tr("Next map"), this);
|
||||
_prevMapAction->setShortcut(PREV_MAP_SHORTCUT);
|
||||
connect(_prevMapAction, SIGNAL(triggered()), this, SLOT(prevMap()));
|
||||
addAction(_prevMapAction);
|
||||
}
|
||||
|
||||
// Settings actions
|
||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||
_showGraphsAction->setCheckable(true);
|
||||
_showGraphsAction->setChecked(true);
|
||||
_showGraphsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
|
||||
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
|
||||
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showGraphs(bool)));
|
||||
addAction(_showGraphsAction);
|
||||
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
||||
_showToolbarsAction->setCheckable(true);
|
||||
_showToolbarsAction->setChecked(true);
|
||||
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showToolbars(bool)));
|
||||
QActionGroup *ag = new QActionGroup(this);
|
||||
@ -266,7 +285,6 @@ void GUI::createActions()
|
||||
_metricUnitsAction = new QAction(tr("Metric"), this);
|
||||
_metricUnitsAction->setCheckable(true);
|
||||
_metricUnitsAction->setActionGroup(ag);
|
||||
_metricUnitsAction->setChecked(true);
|
||||
connect(_metricUnitsAction, SIGNAL(triggered()), this,
|
||||
SLOT(setMetricUnits()));
|
||||
_imperialUnitsAction = new QAction(tr("Imperial"), this);
|
||||
@ -274,6 +292,13 @@ void GUI::createActions()
|
||||
_imperialUnitsAction->setActionGroup(ag);
|
||||
connect(_imperialUnitsAction, SIGNAL(triggered()), this,
|
||||
SLOT(setImperialUnits()));
|
||||
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
||||
tr("Fullscreen mode"), this);
|
||||
_fullscreenAction->setCheckable(true);
|
||||
_fullscreenAction->setShortcut(FULLSCREEN_SHORTCUT);
|
||||
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showFullscreen(bool)));
|
||||
addAction(_fullscreenAction);
|
||||
|
||||
// Navigation actions
|
||||
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
|
||||
@ -297,8 +322,8 @@ void GUI::createMenus()
|
||||
_fileMenu = menuBar()->addMenu(tr("File"));
|
||||
_fileMenu->addAction(_openFileAction);
|
||||
_fileMenu->addSeparator();
|
||||
_fileMenu->addAction(_saveFileAction);
|
||||
_fileMenu->addAction(_saveAsAction);
|
||||
_fileMenu->addAction(_printFileAction);
|
||||
_fileMenu->addAction(_exportFileAction);
|
||||
_fileMenu->addSeparator();
|
||||
_fileMenu->addAction(_reloadFileAction);
|
||||
_fileMenu->addSeparator();
|
||||
@ -331,56 +356,55 @@ void GUI::createMenus()
|
||||
_settingsMenu->addSeparator();
|
||||
_settingsMenu->addAction(_showToolbarsAction);
|
||||
_settingsMenu->addAction(_showGraphsAction);
|
||||
_settingsMenu->addSeparator();
|
||||
_settingsMenu->addAction(_fullscreenAction);
|
||||
|
||||
_helpMenu = menuBar()->addMenu(tr("Help"));
|
||||
_helpMenu->addAction(_dataSourcesAction);
|
||||
_helpMenu->addAction(_keysAction);
|
||||
_helpMenu->addSeparator();
|
||||
_helpMenu->addAction(_aboutAction);
|
||||
_helpMenu->addAction(_aboutQtAction);
|
||||
}
|
||||
|
||||
void GUI::createToolBars()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_fileToolBar = addToolBar(tr("File"));
|
||||
_fileToolBar->addAction(_openFileAction);
|
||||
_fileToolBar->addAction(_saveFileAction);
|
||||
_fileToolBar->addAction(_reloadFileAction);
|
||||
_fileToolBar->addAction(_closeFileAction);
|
||||
#ifdef Q_OS_MAC
|
||||
_fileToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
_fileToolBar->addAction(_printFileAction);
|
||||
|
||||
_showToolBar = addToolBar(tr("Show"));
|
||||
_showToolBar->addAction(_showPOIAction);
|
||||
_showToolBar->addAction(_showMapAction);
|
||||
#ifdef Q_OS_MAC
|
||||
_showToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_navigationToolBar = addToolBar(tr("Navigation"));
|
||||
_navigationToolBar->addAction(_firstAction);
|
||||
_navigationToolBar->addAction(_prevAction);
|
||||
_navigationToolBar->addAction(_nextAction);
|
||||
_navigationToolBar->addAction(_lastAction);
|
||||
#ifdef Q_OS_MAC
|
||||
_navigationToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void GUI::createTrackView()
|
||||
{
|
||||
_track = new TrackView(this);
|
||||
|
||||
if (_showMapAction->isChecked())
|
||||
_track->setMap(_currentMap);
|
||||
#ifdef Q_OS_WIN32
|
||||
_track->setFrameShape(QFrame::NoFrame);
|
||||
#endif // Q_OS_WIN32
|
||||
}
|
||||
|
||||
void GUI::createTrackGraphs()
|
||||
{
|
||||
_elevationGraph = new ElevationGraph;
|
||||
_elevationGraph->setFrameShape(QFrame::NoFrame);
|
||||
_speedGraph = new SpeedGraph;
|
||||
_speedGraph->setFrameShape(QFrame::NoFrame);
|
||||
_heartRateGraph = new HeartRateGraph;
|
||||
_heartRateGraph->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
_trackGraphs = new QTabWidget;
|
||||
connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
|
||||
@ -389,6 +413,20 @@ void GUI::createTrackGraphs()
|
||||
_trackGraphs->setFixedHeight(200);
|
||||
_trackGraphs->setSizePolicy(
|
||||
QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
|
||||
#ifdef Q_OS_WIN32
|
||||
_trackGraphs->setDocumentMode(true);
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
_tabs.append(GraphTab(_elevationGraph, tr("Elevation")));
|
||||
_tabs.append(GraphTab(_speedGraph, tr("Speed")));
|
||||
_tabs.append(GraphTab(_heartRateGraph, tr("Heart rate")));
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
void GUI::createStatusBar()
|
||||
@ -412,8 +450,10 @@ void GUI::about()
|
||||
QMessageBox msgBox(this);
|
||||
|
||||
msgBox.setWindowTitle(tr("About GPXSee"));
|
||||
msgBox.setText(QString("<h3>") + QString(APP_NAME " " APP_VERSION)
|
||||
+ QString("</h3><p>") + tr("GPX viewer and analyzer") + QString("<p/>"));
|
||||
msgBox.setText(QString("<h2>") + QString(APP_NAME) + QString("</h2><p>")
|
||||
+ QString("<p>") + tr("Version ") + APP_VERSION + QString(" (")
|
||||
+ CPU_ARCH + QString(", Qt ") + QString(QT_VERSION_STR)
|
||||
+ QString(")</p>"));
|
||||
msgBox.setInformativeText(QString("<table width=\"300\"><tr><td>")
|
||||
+ tr("GPXSee is distributed under the terms of the GNU General Public "
|
||||
"License version 3. For more info about GPXSee visit the project "
|
||||
@ -438,9 +478,14 @@ void GUI::keys()
|
||||
+ QString("</td><td><i>SPACE</i></td></tr><tr><td>") + tr("Previous file")
|
||||
+ QString("</td><td><i>BACKSPACE</i></td></tr><tr><td>")
|
||||
+ tr("First file") + QString("</td><td><i>HOME</i></td></tr><tr><td>")
|
||||
+ tr("Last file") + QString("</td><td><i>END</i></td></tr><tr><td></td>"
|
||||
"<td></td></tr><tr><td>") + tr("Append modifier")
|
||||
+ QString("</td><td><i>SHIFT</i></td></tr></table></div>"));
|
||||
+ tr("Last file") + QString("</td><td><i>END</i></td></tr><tr><td>")
|
||||
+ tr("Append modifier") + QString("</td><td><i>SHIFT</i></td></tr>"
|
||||
"<tr><td></td><td></td></tr><tr><td>")
|
||||
+ tr("Next map") + QString("</td><td><i>")
|
||||
+ _nextMapAction->shortcut().toString() + QString("</i></td></tr><tr><td>")
|
||||
+ tr("Previous map") + QString("</td><td><i>")
|
||||
+ _prevMapAction->shortcut().toString() + QString("</i></td></tr>"
|
||||
"</table></div>"));
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
@ -502,6 +547,7 @@ bool GUI::openFile(const QString &fileName)
|
||||
|
||||
updateNavigationActions();
|
||||
updateStatusBarInfo();
|
||||
updateWindowTitle();
|
||||
updateGraphTabs();
|
||||
updateTrackView();
|
||||
|
||||
@ -526,6 +572,11 @@ bool GUI::loadFile(const QString &fileName)
|
||||
for (int i = 0; i < gpx.trackCount(); i++) {
|
||||
_distance += gpx.track(i).distance();
|
||||
_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();
|
||||
@ -589,75 +640,97 @@ void GUI::closePOIFiles()
|
||||
_poi.clear();
|
||||
}
|
||||
|
||||
void GUI::saveAs()
|
||||
{
|
||||
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)
|
||||
void GUI::printFile()
|
||||
{
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
printer.setPageSize(QPrinter::A4);
|
||||
printer.setOrientation(_track->orientation());
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setOutputFileName(fileName);
|
||||
QPrintDialog dialog(&printer, this);
|
||||
|
||||
QPainter p(&printer);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
plot(&printer);
|
||||
}
|
||||
|
||||
_track->plot(&p, QRectF(0, 300, printer.width(), (0.80 * printer.height())
|
||||
- 400));
|
||||
_elevationGraph->plot(&p, QRectF(0, 0.80 * printer.height(),
|
||||
printer.width(), printer.height() * 0.20));
|
||||
void GUI::exportFile()
|
||||
{
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
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;
|
||||
InfoItem info;
|
||||
if (_imperialUnitsAction->isChecked()) {
|
||||
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1)
|
||||
+ UNIT_SPACE + tr("mi"));
|
||||
info.insert(tr("Time"), timeSpan(_time));
|
||||
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent()
|
||||
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft"));
|
||||
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"));
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
_exportFileName = printer.outputFileName();
|
||||
_exportPaperSize = printer.paperSize();
|
||||
_exportOrientation = printer.orientation();
|
||||
printer.getPageMargins(&(_exportMargins.rleft()),
|
||||
&(_exportMargins.rtop()), &(_exportMargins.rright()),
|
||||
&(_exportMargins.rbottom()), QPrinter::Millimeter);
|
||||
plot(&printer);
|
||||
}
|
||||
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()
|
||||
{
|
||||
_distance = 0;
|
||||
_time = 0;
|
||||
_dateRange = DateRange(QDate(), QDate());
|
||||
_trackCount = 0;
|
||||
|
||||
_elevationGraph->clear();
|
||||
@ -673,6 +746,7 @@ void GUI::reloadFile()
|
||||
}
|
||||
|
||||
updateStatusBarInfo();
|
||||
updateWindowTitle();
|
||||
updateGraphTabs();
|
||||
updateTrackView();
|
||||
if (_files.isEmpty())
|
||||
@ -685,6 +759,7 @@ void GUI::closeFiles()
|
||||
{
|
||||
_distance = 0;
|
||||
_time = 0;
|
||||
_dateRange = DateRange(QDate(), QDate());
|
||||
_trackCount = 0;
|
||||
|
||||
_sliderPos = 0;
|
||||
@ -703,6 +778,7 @@ void GUI::closeAll()
|
||||
|
||||
_fileActionGroup->setEnabled(false);
|
||||
updateStatusBarInfo();
|
||||
updateWindowTitle();
|
||||
updateGraphTabs();
|
||||
updateTrackView();
|
||||
}
|
||||
@ -744,6 +820,34 @@ void GUI::showToolbars(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::showFullscreen(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
_frameStyle = _track->frameStyle();
|
||||
_showGraphs = _showGraphsAction->isChecked();
|
||||
|
||||
statusBar()->hide();
|
||||
menuBar()->hide();
|
||||
showToolbars(false);
|
||||
showGraphs(false);
|
||||
_showGraphsAction->setChecked(false);
|
||||
_track->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
showFullScreen();
|
||||
} else {
|
||||
statusBar()->show();
|
||||
menuBar()->show();
|
||||
if (_showToolbarsAction->isChecked())
|
||||
showToolbars(true);
|
||||
_showGraphsAction->setChecked(_showGraphs);
|
||||
if (_showGraphsAction->isEnabled())
|
||||
showGraphs(_showGraphs);
|
||||
_track->setFrameStyle(_frameStyle);
|
||||
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::clearMapCache()
|
||||
{
|
||||
_currentMap->clearCache();
|
||||
@ -780,6 +884,15 @@ void GUI::updateStatusBarInfo()
|
||||
_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)
|
||||
{
|
||||
_currentMap = _maps.at(index);
|
||||
@ -788,6 +901,24 @@ void GUI::mapChanged(int index)
|
||||
_track->setMap(_currentMap);
|
||||
}
|
||||
|
||||
void GUI::nextMap()
|
||||
{
|
||||
if (_maps.count() < 2)
|
||||
return;
|
||||
int next = (_maps.indexOf(_currentMap) + 1) % _maps.count();
|
||||
_mapActions.at(next)->setChecked(true);
|
||||
mapChanged(next);
|
||||
}
|
||||
|
||||
void GUI::prevMap()
|
||||
{
|
||||
if (_maps.count() < 2)
|
||||
return;
|
||||
int prev = (_maps.indexOf(_currentMap) + _maps.count() - 1) % _maps.count();
|
||||
_mapActions.at(prev)->setChecked(true);
|
||||
mapChanged(prev);
|
||||
}
|
||||
|
||||
void GUI::poiFileChecked(int index)
|
||||
{
|
||||
_poi.enableFile(_poi.files().at(index),
|
||||
@ -834,37 +965,29 @@ void GUI::updateNavigationActions()
|
||||
|
||||
void GUI::updateGraphTabs()
|
||||
{
|
||||
struct GraphTab tabs[] = {
|
||||
{_elevationGraph, tr("Elevation")},
|
||||
{_speedGraph, tr("Speed")},
|
||||
{_heartRateGraph, tr("Heart rate")}
|
||||
};
|
||||
int index;
|
||||
GraphView *gv;
|
||||
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
|
||||
gv = tabs[i].view;
|
||||
for (int i = 0; i < _tabs.size(); i++) {
|
||||
gv = _tabs.at(i).first;
|
||||
if (!gv->count() && (index = _trackGraphs->indexOf(gv)) >= 0)
|
||||
_trackGraphs->removeTab(index);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
|
||||
gv = tabs[i].view;
|
||||
for (int i = 0; i < _tabs.size(); i++) {
|
||||
gv = _tabs.at(i).first;
|
||||
if (gv->count() && _trackGraphs->indexOf(gv) < 0)
|
||||
_trackGraphs->insertTab(i, gv, tabs[i].label);
|
||||
_trackGraphs->insertTab(i, gv, _tabs.at(i).second);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
|
||||
if (tabs[i].view->count()) {
|
||||
if (_showGraphsAction->isChecked())
|
||||
_trackGraphs->setHidden(false);
|
||||
_showGraphsAction->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (_trackGraphs->count()) {
|
||||
if (_showGraphsAction->isChecked())
|
||||
_trackGraphs->setHidden(false);
|
||||
_showGraphsAction->setEnabled(true);
|
||||
} else {
|
||||
_trackGraphs->setHidden(true);
|
||||
_showGraphsAction->setEnabled(false);
|
||||
}
|
||||
|
||||
_trackGraphs->setHidden(true);
|
||||
_showGraphsAction->setEnabled(false);
|
||||
}
|
||||
|
||||
void GUI::updateTrackView()
|
||||
@ -947,6 +1070,13 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
||||
case LAST_KEY:
|
||||
file = _browser->last();
|
||||
break;
|
||||
|
||||
case Qt::Key_Escape:
|
||||
if (_fullscreenAction->isChecked()) {
|
||||
_fullscreenAction->setChecked(false);
|
||||
showFullscreen(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!file.isNull()) {
|
||||
@ -955,3 +1085,116 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
||||
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;
|
||||
}
|
||||
|
46
src/gui.h
46
src/gui.h
@ -4,7 +4,10 @@
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QDate>
|
||||
#include <QPrinter>
|
||||
#include "poi.h"
|
||||
#include "margins.h"
|
||||
|
||||
class QMenu;
|
||||
class QToolBar;
|
||||
@ -13,6 +16,7 @@ class QActionGroup;
|
||||
class QAction;
|
||||
class QLabel;
|
||||
class QSignalMapper;
|
||||
class QPrinter;
|
||||
class FileBrowser;
|
||||
class GraphView;
|
||||
class ElevationGraph;
|
||||
@ -27,6 +31,7 @@ class GUI : public QMainWindow
|
||||
|
||||
public:
|
||||
GUI(QWidget *parent = 0);
|
||||
~GUI();
|
||||
|
||||
bool openFile(const QString &fileName);
|
||||
|
||||
@ -34,8 +39,8 @@ private slots:
|
||||
void about();
|
||||
void keys();
|
||||
void dataSources();
|
||||
void saveFile();
|
||||
void saveAs();
|
||||
void printFile();
|
||||
void exportFile();
|
||||
void openFile();
|
||||
void closeAll();
|
||||
void reloadFile();
|
||||
@ -45,7 +50,10 @@ private slots:
|
||||
void showMap(bool checked);
|
||||
void showGraphs(bool checked);
|
||||
void showToolbars(bool checked);
|
||||
void showFullscreen(bool checked);
|
||||
void clearMapCache();
|
||||
void nextMap();
|
||||
void prevMap();
|
||||
|
||||
void mapChanged(int);
|
||||
void graphChanged(int);
|
||||
@ -62,9 +70,13 @@ private slots:
|
||||
void sliderPositionChanged(qreal pos);
|
||||
|
||||
private:
|
||||
typedef QPair<GraphView *, QString> GraphTab;
|
||||
typedef QPair<QDate, QDate> DateRange;
|
||||
|
||||
void loadMaps();
|
||||
void loadPOIs();
|
||||
void closeFiles();
|
||||
void plot(QPrinter *printer);
|
||||
|
||||
QAction *createPOIFileAction(int index);
|
||||
void createPOIFilesActions();
|
||||
@ -78,13 +90,19 @@ private:
|
||||
|
||||
bool openPOIFile(const QString &fileName);
|
||||
bool loadFile(const QString &fileName);
|
||||
void saveFile(const QString &fileName);
|
||||
void exportFile(const QString &fileName);
|
||||
void updateStatusBarInfo();
|
||||
void updateWindowTitle();
|
||||
void updateNavigationActions();
|
||||
void updateGraphTabs();
|
||||
void updateTrackView();
|
||||
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
int mapIndex(const QString &name);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
QMenu *_fileMenu;
|
||||
QMenu *_helpMenu;
|
||||
@ -106,8 +124,8 @@ private:
|
||||
QAction *_dataSourcesAction;
|
||||
QAction *_aboutAction;
|
||||
QAction *_aboutQtAction;
|
||||
QAction *_saveFileAction;
|
||||
QAction *_saveAsAction;
|
||||
QAction *_printFileAction;
|
||||
QAction *_exportFileAction;
|
||||
QAction *_openFileAction;
|
||||
QAction *_closeFileAction;
|
||||
QAction *_reloadFileAction;
|
||||
@ -115,6 +133,7 @@ private:
|
||||
QAction *_closePOIAction;
|
||||
QAction *_showPOIAction;
|
||||
QAction *_showMapAction;
|
||||
QAction *_fullscreenAction;
|
||||
QAction *_clearMapCacheAction;
|
||||
QAction *_showGraphsAction;
|
||||
QAction *_showToolbarsAction;
|
||||
@ -124,6 +143,8 @@ private:
|
||||
QAction *_firstAction;
|
||||
QAction *_metricUnitsAction;
|
||||
QAction *_imperialUnitsAction;
|
||||
QAction *_nextMapAction;
|
||||
QAction *_prevMapAction;
|
||||
QList<QAction*> _mapActions;
|
||||
QList<QAction*> _poiFilesActions;
|
||||
|
||||
@ -133,24 +154,33 @@ private:
|
||||
QLabel *_distanceLabel;
|
||||
QLabel *_timeLabel;
|
||||
|
||||
TrackView *_track;
|
||||
ElevationGraph *_elevationGraph;
|
||||
SpeedGraph *_speedGraph;
|
||||
HeartRateGraph *_heartRateGraph;
|
||||
TrackView *_track;
|
||||
QList<GraphTab> _tabs;
|
||||
|
||||
POI _poi;
|
||||
QList<Map*> _maps;
|
||||
|
||||
FileBrowser *_browser;
|
||||
QList<QString> _files;
|
||||
QString _saveFileName;
|
||||
Map *_currentMap;
|
||||
|
||||
int _trackCount;
|
||||
qreal _distance;
|
||||
qreal _time;
|
||||
int _trackCount;
|
||||
DateRange _dateRange;
|
||||
|
||||
qreal _sliderPos;
|
||||
|
||||
int _frameStyle;
|
||||
bool _showGraphs;
|
||||
|
||||
QString _exportFileName;
|
||||
QPrinter::PaperSize _exportPaperSize;
|
||||
QPrinter::Orientation _exportOrientation;
|
||||
MarginsF _exportMargins;
|
||||
};
|
||||
|
||||
#endif // GUI_H
|
||||
|
13
src/icons.h
13
src/icons.h
@ -1,12 +1,10 @@
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#define APP_ICON ":/icons/gpxsee.png"
|
||||
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
||||
#define SAVE_FILE_ICON ":/icons/document-save.png"
|
||||
#define SAVE_AS_ICON ":/icons/document-save-as.png"
|
||||
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
||||
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
||||
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
||||
#define SHOW_POI_ICON ":/icons/flag.png"
|
||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||
@ -16,11 +14,6 @@
|
||||
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
||||
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
||||
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#define QT_ICON ":/trolltech/qmessagebox/images/qtlogo-64.png"
|
||||
#else
|
||||
#define QT_ICON ":/qt-project.org/qmessagebox/images/qtlogo-64.png"
|
||||
#endif
|
||||
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
|
||||
|
||||
#endif /* ICONS_H */
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
|
||||
void insert(const QString &key, const QString &value);
|
||||
void clear();
|
||||
bool isEmpty() {return _list.isEmpty();}
|
||||
|
||||
private:
|
||||
void updateBoundingRect();
|
||||
|
29
src/keys.h
29
src/keys.h
@ -1,10 +1,29 @@
|
||||
#ifndef KEYS_H
|
||||
#define KEYS_H
|
||||
|
||||
#define NEXT_KEY Qt::Key_Space
|
||||
#define PREV_KEY Qt::Key_Backspace
|
||||
#define FIRST_KEY Qt::Key_Home
|
||||
#define LAST_KEY Qt::Key_End
|
||||
#define MODIFIER Qt::ShiftModifier
|
||||
#include <Qt>
|
||||
#include <QKeySequence>
|
||||
|
||||
#define NEXT_KEY Qt::Key_Space
|
||||
#define PREV_KEY Qt::Key_Backspace
|
||||
#define FIRST_KEY Qt::Key_Home
|
||||
#define LAST_KEY Qt::Key_End
|
||||
#define MODIFIER Qt::ShiftModifier
|
||||
|
||||
#define QUIT_SHORTCUT QKeySequence::Quit
|
||||
#define OPEN_SHORTCUT QKeySequence::Open
|
||||
#define CLOSE_SHORTCUT QKeySequence::Close
|
||||
#define RELOAD_SHORTCUT QKeySequence::Refresh
|
||||
#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
|
||||
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
|
||||
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
|
||||
#define NEXT_MAP_SHORTCUT QKeySequence::Forward
|
||||
#define PREV_MAP_SHORTCUT QKeySequence::Back
|
||||
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
|
||||
#ifdef Q_OS_MAC
|
||||
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::META + Qt::CTRL + Qt::Key_F)
|
||||
#else // Q_OS_MAC
|
||||
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::Key_F11)
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
#endif // KEYS_H
|
||||
|
27
src/main.cpp
27
src/main.cpp
@ -1,28 +1,9 @@
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include "gui.h"
|
||||
#include "icons.h"
|
||||
|
||||
#include "app.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
App app(argc, argv);
|
||||
app.run();
|
||||
|
||||
QString locale = QLocale::system().name();
|
||||
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();
|
||||
return 0;
|
||||
}
|
||||
|
100
src/map.cpp
100
src/map.cpp
@ -25,29 +25,26 @@ void Map::emitLoaded()
|
||||
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;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Tile &t = list[i];
|
||||
QString file = TILES_DIR + QString("/%1/%2-%3-%4")
|
||||
.arg(_name).arg(t.zoom()).arg(t.xy().rx()).arg(t.xy().ry());
|
||||
QString file = tileFile(t);
|
||||
QFileInfo fi(file);
|
||||
|
||||
if (fi.exists()) {
|
||||
if (!t.pixmap().load(file))
|
||||
fprintf(stderr, "Error loading map tile: %s\n",
|
||||
qPrintable(file));
|
||||
} else {
|
||||
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 (!(fi.exists() && loadTileFile(t, file))) {
|
||||
fillTile(t);
|
||||
dl.append(Download(tileUrl(t), file));
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +52,75 @@ void Map::loadTiles(QList<Tile> &list)
|
||||
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() && loadTileFile(t, file)))
|
||||
dl.append(Download(tileUrl(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()
|
||||
{
|
||||
QString path = TILES_DIR + QString("/") + _name;
|
||||
|
12
src/map.h
12
src/map.h
@ -10,7 +10,7 @@ public:
|
||||
{_xy = xy; _zoom = zoom;}
|
||||
|
||||
int zoom() const {return _zoom;}
|
||||
QPoint& xy() {return _xy;}
|
||||
const QPoint& xy() const {return _xy;}
|
||||
QPixmap& pixmap() {return _pixmap;}
|
||||
|
||||
private:
|
||||
@ -29,7 +29,7 @@ public:
|
||||
const QString &url = QString());
|
||||
|
||||
const QString &name() const {return _name;}
|
||||
void loadTiles(QList<Tile> &list);
|
||||
void loadTiles(QList<Tile> &list, bool block);
|
||||
void clearCache();
|
||||
|
||||
signals:
|
||||
@ -39,6 +39,14 @@ private slots:
|
||||
void emitLoaded();
|
||||
|
||||
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 _url;
|
||||
};
|
||||
|
9
src/margins.cpp
Normal file
9
src/margins.cpp
Normal 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
30
src/margins.h
Normal 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
|
@ -67,14 +67,12 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
for (int i = 0; i < SEGMENTS; i += 2)
|
||||
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
|
||||
SCALE_HEIGHT), Qt::black);
|
||||
|
||||
if (aa)
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
/*
|
||||
painter->setPen(Qt::red);
|
||||
painter->drawRect(boundingRect());
|
||||
*/
|
||||
if (aa)
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
}
|
||||
|
||||
QString ScaleItem::units() const
|
||||
|
22
src/settings.h
Normal file
22
src/settings.h
Normal 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
|
40
src/trackinfo.cpp
Normal file
40
src/trackinfo.cpp
Normal 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
24
src/trackinfo.h
Normal 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
|
@ -36,11 +36,14 @@ TrackView::TrackView(QWidget *parent)
|
||||
_map = 0;
|
||||
_maxPath = 0;
|
||||
_maxDistance = 0;
|
||||
|
||||
_plot = false;
|
||||
}
|
||||
|
||||
TrackView::~TrackView()
|
||||
{
|
||||
delete _scene;
|
||||
if (_mapScale->scene() != _scene)
|
||||
delete _mapScale;
|
||||
}
|
||||
|
||||
void TrackView::addTrack(const QVector<QPointF> &track)
|
||||
@ -294,7 +297,8 @@ void TrackView::setMap(Map *map)
|
||||
{
|
||||
_map = map;
|
||||
if (_map)
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(redraw()));
|
||||
connect(_map, SIGNAL(loaded()), this, SLOT(redraw()),
|
||||
Qt::UniqueConnection);
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
@ -308,6 +312,13 @@ void TrackView::redraw()
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void TrackView::rescale()
|
||||
{
|
||||
_zoom = qMin(scale2zoom(trackScale()), scale2zoom(waypointScale()));
|
||||
rescale(mapScale(_zoom));
|
||||
_mapScale->setZoom(_zoom);
|
||||
}
|
||||
|
||||
void TrackView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (_paths.isEmpty() && _locations.isEmpty())
|
||||
@ -335,48 +346,38 @@ void TrackView::wheelEvent(QWheelEvent *event)
|
||||
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)
|
||||
{
|
||||
QRectF orig, adj;
|
||||
QRect orig, adj;
|
||||
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()) {
|
||||
ratio = target.width()/target.height();
|
||||
diff = qAbs((orig.height() * ratio) - orig.width());
|
||||
adj = orig.adjusted(-diff/2, 0, diff/2, 0);
|
||||
} else {
|
||||
orig = viewport()->rect();
|
||||
|
||||
if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
|
||||
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);
|
||||
} 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()
|
||||
+ QPoint(-_mapScale->boundingRect().width(),
|
||||
-_mapScale->boundingRect().height()));
|
||||
setUpdatesEnabled(false);
|
||||
_plot = true;
|
||||
|
||||
setTrackLineWidth(0);
|
||||
_scene->render(painter, target, adj);
|
||||
setTrackLineWidth(TRACK_WIDTH * _scale);
|
||||
}
|
||||
QPointF pos = _mapScale->pos();
|
||||
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height())))));
|
||||
|
||||
enum QPrinter::Orientation TrackView::orientation() const
|
||||
{
|
||||
return (sceneRect().width() > sceneRect().height())
|
||||
? QPrinter::Landscape : QPrinter::Portrait;
|
||||
render(painter, target, adj);
|
||||
|
||||
_mapScale->setPos(pos);
|
||||
|
||||
_plot = false;
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
void TrackView::clearPOI()
|
||||
@ -432,18 +433,17 @@ void TrackView::movePositionMarker(qreal val)
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
painter->setWorldMatrixEnabled(false);
|
||||
|
||||
QRectF rr(rect.topLeft() * _scale, rect.size());
|
||||
QPoint tile = mercator2tile(QPointF(rr.topLeft().x(), -rr.topLeft().y()),
|
||||
_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;
|
||||
for (int i = 0; i <= rr.size().width() / TILE_SIZE + 1; i++) {
|
||||
@ -452,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++) {
|
||||
Tile &t = tiles[i];
|
||||
QPoint tp(tl.x() + (t.xy().rx() - tile.rx()) * TILE_SIZE,
|
||||
tl.y() + (t.xy().ry() - tile.ry()) * TILE_SIZE);
|
||||
QPoint tp(tl.x() + (t.xy().x() - tile.x()) * TILE_SIZE,
|
||||
tl.y() + (t.xy().y() - tile.y()) * TILE_SIZE);
|
||||
painter->drawPixmap(tp, t.pixmap());
|
||||
}
|
||||
}
|
||||
@ -467,6 +467,8 @@ void TrackView::resizeEvent(QResizeEvent *e)
|
||||
if (_paths.isEmpty() && _locations.isEmpty())
|
||||
return;
|
||||
|
||||
rescale();
|
||||
|
||||
QRectF br = trackBoundingRect() | waypointBoundingRect();
|
||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||
|
||||
@ -487,9 +489,10 @@ void TrackView::resizeEvent(QResizeEvent *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())));
|
||||
if (_mapScale->pos() != scenePos)
|
||||
if (_mapScale->pos() != scenePos && !_plot)
|
||||
_mapScale->setPos(scenePos);
|
||||
|
||||
QGraphicsView::paintEvent(e);
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <QVector>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QPrinter>
|
||||
#include "units.h"
|
||||
#include "palette.h"
|
||||
#include "waypoint.h"
|
||||
@ -35,7 +34,6 @@ public:
|
||||
void setUnits(enum Units units);
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target);
|
||||
enum QPrinter::Orientation orientation() const;
|
||||
|
||||
int trackCount() const {return _paths.count();}
|
||||
int waypointCount() const {return _locations.count();}
|
||||
@ -55,9 +53,7 @@ private:
|
||||
qreal waypointScale() const;
|
||||
qreal mapScale(int zoom) const;
|
||||
void rescale(qreal scale);
|
||||
|
||||
void showMarkers(bool show);
|
||||
void setTrackLineWidth(qreal width);
|
||||
void rescale();
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
@ -80,6 +76,8 @@ private:
|
||||
|
||||
qreal _scale;
|
||||
int _zoom;
|
||||
|
||||
bool _plot;
|
||||
};
|
||||
|
||||
#endif // TRACKVIEW_H
|
||||
|
@ -12,13 +12,14 @@ enum Units {
|
||||
#define MS2KMH 3.600000000000 // m/s -> km/h
|
||||
#define MS2MIH 2.236936290000 // m/s -> mi/h
|
||||
#define FT2MI 0.000189393939 // ft -> mi
|
||||
#define MM2IN 0.039370100000 // mm -> in
|
||||
|
||||
#define KMINM 1000 // 1 km in m
|
||||
#define MIINFT 5280 // 1 mi in ft
|
||||
#define MIINM 1609.344 // 1mi in m
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define UNIT_SPACE " "
|
||||
#define UNIT_SPACE QString(" ")
|
||||
#else // Q_OS_WIN32
|
||||
#define UNIT_SPACE QString::fromUtf8("\xE2\x80\x89")
|
||||
#endif // Q_OS_WIN32
|
||||
|
Reference in New Issue
Block a user