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

Compare commits

..

26 Commits
3.2 ... 3.5

Author SHA1 Message Date
f61488fcfa Version++ 2016-12-20 08:39:40 +01:00
b68ca92add OpenGL code cleanup 2016-12-20 00:11:30 +01:00
0448ae5eea Added basic print/export formating options 2016-12-16 02:30:58 +01:00
2bc112c7b4 Fixed broken latitude handling 2016-12-13 18:54:58 +01:00
ccd92edb8d More code cleanup 2016-12-10 11:52:18 +01:00
0cbf79870b Code cleanup 2016-12-10 11:50:53 +01:00
7e8530555d Unified AA samples count for QGLFormat and QSurfaceFormat. 2016-12-10 11:45:16 +01:00
2fd16e5e31 Version++ 2016-12-10 01:20:17 +01:00
a5033c8b19 Fixed QOpenGLWidget usage (wrong minimal QT version) 2016-12-10 01:18:31 +01:00
b0c6176ddd Fixed switched default values 2016-12-08 00:28:44 +01:00
6edd7a8c61 Code cleanup 2016-12-07 22:01:45 +01:00
8a299be65b Translations 2016-12-07 22:01:33 +01:00
cde4c65c53 GUI polishing 2016-12-07 21:38:36 +01:00
b24136a580 Use OpenGL also for graph views when selected 2016-12-07 02:02:39 +01:00
da1b2bb90a Use a reasonable number of samples per pixel 2016-12-07 00:54:14 +01:00
30e198cf46 Cache the graph grid 2016-12-07 00:44:32 +01:00
0f2deca4fa Fixed broken graph width setting 2016-12-07 00:03:36 +01:00
1055c4fd98 Added missing OpenGL related libs to Windows package.
Version++.
2016-12-06 22:05:26 +01:00
18c501b610 Removed path item caching (made obsolete by OpenGL rendering) 2016-12-06 21:28:45 +01:00
71310116e3 Cosmetics 2016-12-06 21:03:19 +01:00
34e48199b2 Fixed options/settings handling isses. 2016-12-06 21:02:44 +01:00
4cf027df58 Fixed widget rendering issues 2016-12-06 21:01:06 +01:00
a9668ca86e Added options dialogue 2016-12-06 01:48:26 +01:00
181f60ed40 README update 2016-11-23 19:54:46 +01:00
307405d661 Improved track date handling 2016-11-23 18:45:06 +01:00
1242423ca8 Fixed possible invalid memory access 2016-11-23 18:44:22 +01:00
46 changed files with 1614 additions and 378 deletions

View File

@ -1,15 +1,16 @@
# GPXSee
GPXSee is a Qt-based application for visualizing and analyzing GPX, TCX, FIT,
IGC and KML files.
GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX,
KML, FIT, IGC and NMEA files.
## Features
* User-definable map sources.
* Elevation, speed, heart rate, cadence, power and temperature graphs.
* Support for multiple tracks in one view.
* Support for POI files.
* Print/export to PDF.
* Full-screen mode
* Full-screen mode.
* Native GUI for Windows, Mac OS X and Linux.
* Opens GPX, TCX, FIT, KML, IGC and Garmin CSV files.
* Opens GPX, TCX, FIT, KML, IGC, NMEA and Garmin CSV files.
![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux.png)

View File

@ -1,10 +1,12 @@
TARGET = GPXSee
VERSION = 3.2
VERSION = 3.5
QT += core \
gui \
network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
lessThan(QT_VERSION, 5.4): QT += opengl
macx: QT += opengl
HEADERS += src/config.h \
src/icons.h \
src/gui.h \
@ -70,7 +72,11 @@ HEADERS += src/config.h \
src/cadencegraph.h \
src/powergraph.h \
src/igcparser.h \
src/nmeaparser.h
src/nmeaparser.h \
src/optionsdialog.h \
src/colorbox.h \
src/stylecombobox.h \
src/opengl.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/poi.cpp \
@ -121,7 +127,10 @@ SOURCES += src/main.cpp \
src/powergraph.cpp \
src/igcparser.cpp \
src/path.cpp \
src/nmeaparser.cpp
src/nmeaparser.cpp \
src/optionsdialog.cpp \
src/colorbox.cpp \
src/stylecombobox.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts
macx {

View File

@ -15,6 +15,10 @@
<file>icons/arrow-right-double.png</file>
<file>icons/view-fullscreen.png</file>
<file>icons/office-chart-line-stacked.png</file>
<file>icons/preferences-desktop-display.png</file>
<file>icons/flag_48.png</file>
<file>icons/system-run.png</file>
<file>icons/document-print-preview.png</file>
<file>lang/gpxsee_cs.qm</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icons/flag_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icons/system-run.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -67,89 +67,89 @@
<context>
<name>ExportDialog</name>
<message>
<location filename="../src/exportdialog.cpp" line="122"/>
<location filename="../src/exportdialog.cpp" line="120"/>
<source>Export to PDF</source>
<translation>Exportovat do PDF</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="29"/>
<location filename="../src/exportdialog.cpp" line="25"/>
<source>PDF files (*.pdf);;All files (*)</source>
<translation>Soubory PDF (*.pdf);;Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="42"/>
<location filename="../src/exportdialog.cpp" line="38"/>
<source>Portrait</source>
<translation>Na výšku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="43"/>
<location filename="../src/exportdialog.cpp" line="39"/>
<source>Landscape</source>
<translation>Na šířku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="85"/>
<location filename="../src/exportdialog.cpp" line="83"/>
<source>Page size:</source>
<translation>Velikost stránky:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="86"/>
<location filename="../src/exportdialog.cpp" line="84"/>
<source>Orientation:</source>
<translation>Orientace:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="82"/>
<location filename="../src/exportdialog.cpp" line="80"/>
<source>Page Setup</source>
<translation>Nastavení stránky</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="55"/>
<location filename="../src/exportdialog.cpp" line="52"/>
<source>in</source>
<translation>in</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="55"/>
<location filename="../src/exportdialog.cpp" line="52"/>
<source>mm</source>
<translation>mm</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="87"/>
<location filename="../src/exportdialog.cpp" line="85"/>
<source>Margins:</source>
<translation>Okraje:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="93"/>
<location filename="../src/exportdialog.cpp" line="91"/>
<source>File:</source>
<translation>Soubor:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="100"/>
<location filename="../src/exportdialog.cpp" line="98"/>
<source>Output file</source>
<translation>Výstupní soubor</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="107"/>
<location filename="../src/exportdialog.cpp" line="105"/>
<source>Export</source>
<translation>Exportovat</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="129"/>
<location filename="../src/exportdialog.cpp" line="139"/>
<location filename="../src/exportdialog.cpp" line="144"/>
<location filename="../src/exportdialog.cpp" line="127"/>
<location filename="../src/exportdialog.cpp" line="137"/>
<location filename="../src/exportdialog.cpp" line="142"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="129"/>
<location filename="../src/exportdialog.cpp" line="127"/>
<source>No output file selected.</source>
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="139"/>
<location filename="../src/exportdialog.cpp" line="137"/>
<source>%1 is a directory.</source>
<translation>%1 je adresář.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="144"/>
<location filename="../src/exportdialog.cpp" line="142"/>
<source>%1 is not writable.</source>
<translation>%1 nelze zapsat.</translation>
</message>
@ -190,285 +190,290 @@
<context>
<name>GUI</name>
<message>
<location filename="../src/gui.cpp" line="552"/>
<location filename="../src/gui.cpp" line="545"/>
<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="616"/>
<location filename="../src/gui.cpp" line="609"/>
<source>Open file</source>
<translation>Otevřít soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="697"/>
<location filename="../src/gui.cpp" line="698"/>
<source>Open POI file</source>
<translation>Otevřít POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="227"/>
<location filename="../src/gui.cpp" line="216"/>
<source>Open</source>
<translation>Otevřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="211"/>
<location filename="../src/gui.cpp" line="200"/>
<source>Quit</source>
<translation>Ukončit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="219"/>
<location filename="../src/gui.cpp" line="568"/>
<location filename="../src/gui.cpp" line="569"/>
<location filename="../src/gui.cpp" line="208"/>
<location filename="../src/gui.cpp" line="561"/>
<location filename="../src/gui.cpp" line="562"/>
<source>Keyboard controls</source>
<translation>Ovládací klávesy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="243"/>
<location filename="../src/gui.cpp" line="232"/>
<source>Close</source>
<translation>Zavřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="249"/>
<location filename="../src/gui.cpp" line="238"/>
<source>Reload</source>
<translation>Znovu načíst</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="478"/>
<location filename="../src/gui.cpp" line="471"/>
<source>Show</source>
<translation>Zobrazit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="400"/>
<location filename="../src/gui.cpp" line="472"/>
<location filename="../src/gui.cpp" line="392"/>
<location filename="../src/gui.cpp" line="465"/>
<source>File</source>
<translation>Soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="112"/>
<location filename="../src/gui.cpp" line="102"/>
<source>FIT files (*.fit)</source>
<translation>Soubory FIT (*.fit)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="113"/>
<location filename="../src/gui.cpp" line="103"/>
<source>IGC files (*.igc)</source>
<translation>Soubory IGC (*.igc)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="114"/>
<location filename="../src/gui.cpp" line="104"/>
<source>NMEA files (*.nmea)</source>
<translation>Soubory NMEA (*.nmea)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="217"/>
<location filename="../src/gui.cpp" line="591"/>
<location filename="../src/gui.cpp" line="592"/>
<location filename="../src/gui.cpp" line="206"/>
<location filename="../src/gui.cpp" line="584"/>
<location filename="../src/gui.cpp" line="585"/>
<source>Data sources</source>
<translation>Zdroje dat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="257"/>
<location filename="../src/gui.cpp" line="246"/>
<source>Load POI file</source>
<translation>Nahrát POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="260"/>
<location filename="../src/gui.cpp" line="249"/>
<source>Close POI files</source>
<translation>Zavřit POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="262"/>
<location filename="../src/gui.cpp" line="251"/>
<source>Overlap POIs</source>
<translation>Překrývat POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="266"/>
<location filename="../src/gui.cpp" line="255"/>
<source>Show POI labels</source>
<translation>Zobrazovat názvy POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="271"/>
<location filename="../src/gui.cpp" line="260"/>
<source>Show POIs</source>
<translation>Zobrazit POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="280"/>
<location filename="../src/gui.cpp" line="269"/>
<source>Show map</source>
<translation>Zobrazit mapu</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="286"/>
<location filename="../src/gui.cpp" line="275"/>
<source>Clear tile cache</source>
<translation>Vymazat mezipaměť dlaždic</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="295"/>
<location filename="../src/gui.cpp" line="299"/>
<location filename="../src/gui.cpp" line="578"/>
<location filename="../src/gui.cpp" line="284"/>
<location filename="../src/gui.cpp" line="288"/>
<location filename="../src/gui.cpp" line="571"/>
<source>Next map</source>
<translation>Následující mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="306"/>
<location filename="../src/gui.cpp" line="295"/>
<source>Show tracks</source>
<translation>Zobrazit cesty</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="310"/>
<location filename="../src/gui.cpp" line="299"/>
<source>Show routes</source>
<translation>Zobrazit trasy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="314"/>
<location filename="../src/gui.cpp" line="303"/>
<source>Show waypoints</source>
<translation>Zobrazit navigační body</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="318"/>
<location filename="../src/gui.cpp" line="307"/>
<source>Waypoint labels</source>
<translation>Názvy navigačních bodů</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="329"/>
<location filename="../src/gui.cpp" line="318"/>
<source>Show graphs</source>
<translation>Zobrazovat grafy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="351"/>
<location filename="../src/gui.cpp" line="340"/>
<source>Show grid</source>
<translation>Zobrazit mřížku</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="357"/>
<location filename="../src/gui.cpp" line="346"/>
<source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="363"/>
<location filename="../src/gui.cpp" line="352"/>
<source>Metric</source>
<translation>Metrické</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="368"/>
<location filename="../src/gui.cpp" line="357"/>
<source>Imperial</source>
<translation>Imperiální</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="374"/>
<location filename="../src/gui.cpp" line="363"/>
<source>Fullscreen mode</source>
<translation>Celoobrazovkový režim</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="382"/>
<location filename="../src/gui.cpp" line="369"/>
<source>Options...</source>
<translation>Nastavení...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="374"/>
<source>Next</source>
<translation>Následující</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="385"/>
<location filename="../src/gui.cpp" line="377"/>
<source>Previous</source>
<translation>Předchozí</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="389"/>
<location filename="../src/gui.cpp" line="381"/>
<source>Last</source>
<translation>Poslední</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="392"/>
<location filename="../src/gui.cpp" line="384"/>
<source>First</source>
<translation>První</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="414"/>
<location filename="../src/gui.cpp" line="406"/>
<source>Map</source>
<translation>Mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="421"/>
<location filename="../src/gui.cpp" line="413"/>
<source>Graph</source>
<translation>Graf</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="429"/>
<location filename="../src/gui.cpp" line="421"/>
<source>POI</source>
<translation>POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="430"/>
<location filename="../src/gui.cpp" line="422"/>
<source>POI files</source>
<translation>POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="441"/>
<location filename="../src/gui.cpp" line="433"/>
<source>Data</source>
<translation>Data</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="442"/>
<location filename="../src/gui.cpp" line="434"/>
<source>Display</source>
<translation>Zobrazit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="450"/>
<location filename="../src/gui.cpp" line="442"/>
<source>Settings</source>
<translation>Nastavení</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="451"/>
<location filename="../src/gui.cpp" line="443"/>
<source>Units</source>
<translation>Jednotky</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="459"/>
<location filename="../src/gui.cpp" line="452"/>
<source>Help</source>
<translation>Nápověda</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="580"/>
<location filename="../src/gui.cpp" line="573"/>
<source>Previous map</source>
<translation>Předchozí mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="113"/>
<location filename="../src/gui.cpp" line="103"/>
<source>GPX files (*.gpx)</source>
<translation>Soubory GPX (*.gpx)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="115"/>
<location filename="../src/gui.cpp" line="105"/>
<source>TCX files (*.tcx)</source>
<translation>Soubory TCX (*.tcx)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="114"/>
<location filename="../src/gui.cpp" line="104"/>
<source>KML files (*.kml)</source>
<translation>Soubory KML (*.kml)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="112"/>
<location filename="../src/gui.cpp" line="102"/>
<source>CSV files (*.csv)</source>
<translation>Soubory CSV (*.csv)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="115"/>
<location filename="../src/gui.cpp" line="105"/>
<source>All files (*)</source>
<translation>Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="783"/>
<location filename="../src/gui.cpp" line="786"/>
<location filename="../src/gui.cpp" line="837"/>
<location filename="../src/gui.cpp" line="840"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="795"/>
<location filename="../src/gui.cpp" line="829"/>
<source>Routes</source>
<translation>Trasy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="983"/>
<location filename="../src/gui.cpp" line="1053"/>
<source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation>
</message>
<message numerus="yes">
<location filename="../src/gui.cpp" line="987"/>
<location filename="../src/gui.cpp" line="1057"/>
<source>%n files</source>
<translation>
<numerusform>%n soubor</numerusform>
@ -477,126 +482,131 @@
</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="571"/>
<location filename="../src/gui.cpp" line="564"/>
<source>Next file</source>
<translation>Následující soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="548"/>
<location filename="../src/gui.cpp" line="541"/>
<source>Version </source>
<translation>Verze </translation>
</message>
<message>
<location filename="../src/gui.cpp" line="232"/>
<location filename="../src/gui.cpp" line="221"/>
<source>Print...</source>
<translation>Tisknout...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="237"/>
<location filename="../src/gui.cpp" line="226"/>
<source>Export to PDF...</source>
<translation>Exportovat do PDF...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="797"/>
<location filename="../src/gui.cpp" line="831"/>
<source>Waypoints</source>
<translation>Navigační body</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="572"/>
<location filename="../src/gui.cpp" line="565"/>
<source>Previous file</source>
<translation>Předchozí soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="111"/>
<location filename="../src/gui.cpp" line="101"/>
<source>Supported files (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)</source>
<translation>Podporované soubory (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="322"/>
<location filename="../src/gui.cpp" line="311"/>
<source>Route waypoints</source>
<translation>Body tras</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="574"/>
<location filename="../src/gui.cpp" line="567"/>
<source>First file</source>
<translation>První soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="575"/>
<location filename="../src/gui.cpp" line="568"/>
<source>Last file</source>
<translation>Poslední soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="576"/>
<location filename="../src/gui.cpp" line="569"/>
<source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="595"/>
<location filename="../src/gui.cpp" line="588"/>
<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="598"/>
<location filename="../src/gui.cpp" line="591"/>
<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="606"/>
<location filename="../src/gui.cpp" line="599"/>
<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="686"/>
<location filename="../src/gui.cpp" line="687"/>
<source>Error loading data file:</source>
<translation>Datový soubor nelze načíst:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="689"/>
<location filename="../src/gui.cpp" line="714"/>
<location filename="../src/gui.cpp" line="690"/>
<location filename="../src/gui.cpp" line="715"/>
<source>Line: %1</source>
<translation>Řádka: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="711"/>
<location filename="../src/gui.cpp" line="712"/>
<source>Error loading POI file:</source>
<translation>Soubor POI nelze načíst:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="793"/>
<location filename="../src/gui.cpp" line="823"/>
<source>Name</source>
<translation>Název</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="827"/>
<source>Tracks</source>
<translation>Cesty</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="222"/>
<location filename="../src/gui.cpp" line="546"/>
<location filename="../src/gui.cpp" line="211"/>
<location filename="../src/gui.cpp" line="539"/>
<source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="483"/>
<location filename="../src/gui.cpp" line="476"/>
<source>Navigation</source>
<translation>Navigace</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="594"/>
<location filename="../src/gui.cpp" line="587"/>
<source>Map sources</source>
<translation>Mapové zdroje</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="605"/>
<location filename="../src/gui.cpp" line="598"/>
<source>POIs</source>
<translation>POI body</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="337"/>
<location filename="../src/gui.cpp" line="800"/>
<location filename="../src/gui.cpp" line="326"/>
<location filename="../src/gui.cpp" line="847"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="344"/>
<location filename="../src/gui.cpp" line="802"/>
<location filename="../src/gui.cpp" line="333"/>
<location filename="../src/gui.cpp" line="849"/>
<source>Time</source>
<translation>Čas</translation>
</message>
@ -604,48 +614,48 @@
<context>
<name>GraphView</name>
<message>
<location filename="../src/graphview.cpp" line="102"/>
<location filename="../src/graphview.cpp" line="112"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="105"/>
<location filename="../src/graphview.cpp" line="115"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="110"/>
<location filename="../src/graphview.cpp" line="120"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="113"/>
<location filename="../src/graphview.cpp" line="123"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="119"/>
<location filename="../src/graphview.cpp" line="129"/>
<source>s</source>
<translation>s</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="122"/>
<location filename="../src/graphview.cpp" line="132"/>
<source>min</source>
<translation>min</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="125"/>
<location filename="../src/graphview.cpp" line="135"/>
<source>h</source>
<translation>h</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="54"/>
<location filename="../src/graphview.cpp" line="151"/>
<location filename="../src/graphview.cpp" line="64"/>
<location filename="../src/graphview.cpp" line="161"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="153"/>
<location filename="../src/graphview.cpp" line="163"/>
<source>Time</source>
<translation>Čas</translation>
</message>
@ -674,6 +684,158 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../src/optionsdialog.cpp" line="34"/>
<source>Base color:</source>
<translation>Základní barva:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="35"/>
<source>Palette shift:</source>
<translation>Posun palety:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="47"/>
<source>Track width:</source>
<translation>Šířka cest:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="48"/>
<source>Track style:</source>
<translation>Styl cest:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="50"/>
<source>Tracks</source>
<translation>Cesty</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="60"/>
<source>Route width:</source>
<translation>Šířka tras:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="61"/>
<source>Route style:</source>
<translation>Styl tras:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="63"/>
<source>Routes</source>
<translation>Trasy</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="67"/>
<location filename="../src/optionsdialog.cpp" line="99"/>
<source>Use anti-aliasing</source>
<translation>Vyhlazovat hrany</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="97"/>
<source>Line width:</source>
<translation>Šířka čar:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="113"/>
<source>Colors</source>
<translation>Barvy</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="114"/>
<source>Paths</source>
<translation>Trasy</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="115"/>
<location filename="../src/optionsdialog.cpp" line="180"/>
<source>Graphs</source>
<translation>Grafy</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="127"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="130"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="134"/>
<source>POI radius:</source>
<translation>POI radius:</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="140"/>
<location filename="../src/optionsdialog.cpp" line="225"/>
<source>POI</source>
<translation>POI</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="147"/>
<source>Name</source>
<translation>Název</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="149"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="151"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="153"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="155"/>
<source>Item count (&gt;1)</source>
<translation>Počet objektů (&gt;1)</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="169"/>
<source>Separate graph page</source>
<translation>Samostatná stránka s grafy</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="179"/>
<source>Header</source>
<translation>Záhlaví</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="187"/>
<source>Use OpenGL</source>
<translation>Používat OpenGL</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="207"/>
<location filename="../src/optionsdialog.cpp" line="228"/>
<source>System</source>
<translation>Systém</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="223"/>
<source>Appearance</source>
<translation>Vzhled</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="226"/>
<source>Print &amp; Export</source>
<translation>Tisk a export</translation>
</message>
<message>
<location filename="../src/optionsdialog.cpp" line="255"/>
<source>Options</source>
<translation>Nastavení</translation>
</message>
</context>
<context>
<name>PowerGraph</name>
<message>

View File

@ -4,7 +4,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "3.2"
!define VERSION "3.5"
; The file to write
OutFile "GPXSee-${VERSION}.exe"
@ -130,6 +130,8 @@ Section "QT libs" SEC_QT
File "Qt5PrintSupport.dll"
File "Qt5Network.dll"
File "libGLESv2.dll"
File "libEGL.dll"
File "D3DCompiler_47.dll"
File /r "platforms"
File /r "imageformats"
File /r "printsupport"

View File

@ -4,7 +4,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "3.2"
!define VERSION "3.5"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"
@ -138,6 +138,8 @@ Section "QT libs" SEC_QT
File "Qt5PrintSupport.dll"
File "Qt5Network.dll"
File "libGLESv2.dll"
File "libEGL.dll"
File "D3DCompiler_47.dll"
File /r "platforms"
File /r "imageformats"
File /r "printsupport"

View File

@ -3,6 +3,8 @@
#include <QLocale>
#include <QFileOpenEvent>
#include <QNetworkProxyFactory>
#include <QPixmapCache>
#include "opengl.h"
#include "gui.h"
#include "app.h"
@ -20,6 +22,8 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
#endif // Q_OS_MAC
QNetworkProxyFactory::setUseSystemConfiguration(true);
QPixmapCache::setCacheLimit(65536);
OPENGL_SET_SAMPLES(4);
_gui = new GUI();
}

68
src/colorbox.cpp Normal file
View File

@ -0,0 +1,68 @@
#include <QStylePainter>
#include <QStyleOptionComboBox>
#include <QMouseEvent>
#include <QColorDialog>
#include <QComboBox>
#include "colorbox.h"
ColorBox::ColorBox(QWidget *parent) : QWidget(parent)
{
_color = Qt::red;
setSizePolicy(QSizePolicy::QSizePolicy::Minimum, QSizePolicy::Fixed);
}
QSize ColorBox::sizeHint() const
{
static QSize size;
if (size.isValid())
return size;
QComboBox cb;
size = cb.sizeHint();
return size;
}
void ColorBox::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QStylePainter painter(this);
QStyleOptionComboBox option;
option.initFrom(this);
#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
painter.setBrush(_color);
painter.drawPrimitive(QStyle::PE_Frame, option);
#else // Q_OS_MAC || Q_OS_WIN32
// Fallback for some broken QT4 styles that do not draw the background
painter.setBrush(_color);
painter.setPen(Qt::NoPen);
painter.drawRect(event->rect().adjusted(2, 2, -2, -2));
// If works (QT5 and most QT4 styles) overpaints the previous rectangle
option.palette.setBrush(QPalette::Base, _color);
painter.drawPrimitive(QStyle::PE_PanelLineEdit, option);
painter.drawPrimitive(QStyle::PE_FrameLineEdit, option);
#endif // Q_OS_MAC || Q_OS_WIN32
}
void ColorBox::mousePressEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton)
return;
QColor color = QColorDialog::getColor(_color, this, QString(),
QColorDialog::ShowAlphaChannel);
if (color.isValid()) {
_color = color;
update();
emit colorChanged(_color);
}
}
void ColorBox::setColor(const QColor &color)
{
_color = color;
update();
}

29
src/colorbox.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef COLORBOX_H
#define COLORBOX_H
#include <QWidget>
class ColorBox : public QWidget
{
Q_OBJECT
public:
ColorBox(QWidget *parent = 0);
const QColor &color() const {return _color;}
void setColor(const QColor &color);
QSize sizeHint() const;
signals:
void colorChanged(const QColor &color);
protected:
void mousePressEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
private:
QColor _color;
};
#endif // COLORBOX_H

View File

@ -2,6 +2,10 @@
#include "wgs84.h"
#include "coordinates.h"
#define MIN_LAT deg2rad(-90.0)
#define MAX_LAT deg2rad(90.0)
#define MIN_LON deg2rad(-180.0)
#define MAX_LON deg2rad(180.0)
qreal Coordinates::distanceTo(const Coordinates &c) const
{
@ -35,3 +39,31 @@ QDebug operator<<(QDebug dbg, const Coordinates &coordinates)
return dbg.maybeSpace();
}
QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
{
qreal radDist = distance / WGS84_RADIUS;
qreal minLat = deg2rad(_lat) - radDist;
qreal maxLat = deg2rad(_lat) + radDist;
qreal minLon, maxLon;
if (minLat > MIN_LAT && maxLat < MAX_LAT) {
qreal deltaLon = asin(sin(radDist) / cos(_lat));
minLon = deg2rad(_lon) - deltaLon;
if (minLon < MIN_LON)
minLon += 2.0 * M_PI;
maxLon = deg2rad(_lon) + deltaLon;
if (maxLon > MAX_LON)
maxLon -= 2.0 * M_PI;
} else {
// a pole is within the distance
minLat = qMax(minLat, MIN_LAT);
maxLat = qMin(maxLat, MAX_LAT);
minLon = MIN_LON;
maxLon = MAX_LON;
}
return QPair<Coordinates, Coordinates>(Coordinates(rad2deg(minLon),
rad2deg(minLat)), Coordinates(rad2deg(maxLon), rad2deg(maxLat)));
}

View File

@ -26,6 +26,7 @@ public:
&& _lat <= 90.0) ? true : false;}
qreal distanceTo(const Coordinates &c) const;
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;
QPointF toMercator() const;
static Coordinates fromMercator(const QPointF &m);

View File

@ -11,23 +11,19 @@
#include <QMessageBox>
#include <QTabWidget>
#include <QDoubleSpinBox>
#include <QLocale>
#include "fileselectwidget.h"
#include "units.h"
#include "exportdialog.h"
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
: QDialog(parent), _printer(printer)
ExportDialog::ExportDialog(Export *exp, QWidget *parent)
: QDialog(parent), _export(exp)
{
int index;
_units = (QLocale::system().measurementSystem()
== QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter;
_fileSelect = new FileSelectWidget();
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
_fileSelect->setFile(_printer->outputFileName());
_fileSelect->setFile(_export->fileName);
_paperSize = new QComboBox();
_paperSize->addItem("A3", QPrinter::A3);
@ -36,7 +32,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
_paperSize->addItem("Legal", QPrinter::Legal);
_paperSize->addItem("Letter", QPrinter::Letter);
if ((index = _paperSize->findData(_printer->paperSize())) >= 0)
if ((index = _paperSize->findData(_export->paperSize)) >= 0)
_paperSize->setCurrentIndex(index);
_portrait = new QRadioButton(tr("Portrait"));
@ -44,32 +40,34 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
QHBoxLayout *orientationLayout = new QHBoxLayout();
orientationLayout->addWidget(_portrait);
orientationLayout->addWidget(_landscape);
if (_printer->orientation() == QPrinter::Portrait)
if (_export->orientation == QPrinter::Portrait)
_portrait->setChecked(true);
else
_landscape->setChecked(true);
qreal top, bottom, left, right;
_printer->getPageMargins(&left, &top, &right, &bottom, _units);
QString us = _units == QPrinter::Inch ? tr("in") : tr("mm");
_topMargin = new QDoubleSpinBox();
_bottomMargin = new QDoubleSpinBox();
_leftMargin = new QDoubleSpinBox();
_rightMargin = new QDoubleSpinBox();
_topMargin->setValue(top);
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
_topMargin->setSuffix(UNIT_SPACE + us);
_bottomMargin->setValue(bottom);
_bottomMargin->setSuffix(UNIT_SPACE + us);
_leftMargin->setValue(left);
_leftMargin->setSuffix(UNIT_SPACE + us);
_rightMargin->setValue(right);
_rightMargin->setSuffix(UNIT_SPACE + us);
if (_units == QPrinter::Inch) {
if (_export->units == Imperial) {
_topMargin->setValue(_export->margins.top() * MM2IN);
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
_leftMargin->setValue(_export->margins.left() * MM2IN);
_rightMargin->setValue(_export->margins.right() * MM2IN);
_topMargin->setSingleStep(0.1);
_bottomMargin->setSingleStep(0.1);
_leftMargin->setSingleStep(0.1);
_rightMargin->setSingleStep(0.1);
} else {
_topMargin->setValue(_export->margins.top());
_bottomMargin->setValue(_export->margins.bottom());
_leftMargin->setValue(_export->margins.left());
_rightMargin->setValue(_export->margins.right());
}
QGridLayout *marginsLayout = new QGridLayout();
@ -164,12 +162,16 @@ void ExportDialog::accept()
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);
_export->fileName = _fileSelect->file();
_export->paperSize = paperSize;
_export->orientation = orientation;
if (_export->units == Imperial)
_export->margins = MarginsF(_leftMargin->value() / MM2IN,
_topMargin->value() / MM2IN, _rightMargin->value() / MM2IN,
_bottomMargin->value() / MM2IN);
else
_export->margins = MarginsF(_leftMargin->value(), _topMargin->value(),
_rightMargin->value(), _bottomMargin->value());
QDialog::accept();
}

View File

@ -3,18 +3,29 @@
#include <QDialog>
#include <QPrinter>
#include "margins.h"
#include "units.h"
class QComboBox;
class QRadioButton;
class FileSelectWidget;
class QDoubleSpinBox;
struct Export {
QString fileName;
QPrinter::PaperSize paperSize;
QPrinter::Orientation orientation;
MarginsF margins;
Units units;
};
class ExportDialog : public QDialog
{
Q_OBJECT
public:
ExportDialog(QPrinter *printer, QWidget *parent = 0);
ExportDialog(Export *exp, QWidget *parent = 0);
public slots:
void accept();
@ -22,9 +33,7 @@ public slots:
private:
bool checkFile();
QPrinter *_printer;
QPrinter::Unit _units;
Export *_export;
FileSelectWidget *_fileSelect;
QComboBox *_paperSize;

View File

@ -2,20 +2,20 @@
#include "graphitem.h"
#define GRAPH_WIDTH 1
#define HOVER_WIDTH 2
GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
: QGraphicsObject(parent)
{
_id = 0;
_width = 1;
_pen = QPen(Qt::black, GRAPH_WIDTH);
_pen = QPen(Qt::black, _width);
_type = Distance;
_graph = graph;
_sx = 1.0; _sy = 1.0;
setZValue(1.0);
updatePath();
updateBounds();
}
@ -51,6 +51,14 @@ void GraphItem::setColor(const QColor &color)
update();
}
void GraphItem::setWidth(int width)
{
prepareGeometryChange();
_width = width;
_pen.setWidth(width);
}
qreal GraphItem::yAtX(qreal x)
{
int low = 0;
@ -130,10 +138,10 @@ void GraphItem::emitSliderPositionChanged(qreal pos)
void GraphItem::selected(bool selected)
{
if (selected) {
_pen.setWidth(HOVER_WIDTH);
_pen.setWidth(_width + 1);
setZValue(zValue() + 1.0);
} else {
_pen.setWidth(GRAPH_WIDTH);
_pen.setWidth(_width);
setZValue(zValue() - 1.0);
}

View File

@ -24,6 +24,7 @@ public:
int id() const {return _id;}
void setId(int id) {_id = id;}
void setColor(const QColor &color);
void setWidth(int width);
qreal yAtX(qreal x);
qreal distanceAtTime(qreal time);
@ -41,6 +42,7 @@ private:
int _id;
QPen _pen;
int _width;
Graph _graph;
GraphType _type;

View File

@ -3,6 +3,8 @@
#include <QMouseEvent>
#include <QPaintEngine>
#include <QPaintDevice>
#include <QSysInfo>
#include "opengl.h"
#include "config.h"
#include "axisitem.h"
#include "slideritem.h"
@ -23,23 +25,27 @@ GraphView::GraphView(QWidget *parent)
_scene = new QGraphicsScene();
setScene(_scene);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setRenderHint(QPainter::Antialiasing, true);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_xAxis = new AxisItem(AxisItem::X);
_xAxis->setZValue(1.0);
_xAxis->setZValue(2.0);
_yAxis = new AxisItem(AxisItem::Y);
_yAxis->setZValue(1.0);
_yAxis->setZValue(2.0);
_slider = new SliderItem();
_slider->setZValue(2.0);
_slider->setZValue(3.0);
_sliderInfo = new SliderInfoItem(_slider);
_sliderInfo->setZValue(2.0);
_sliderInfo->setZValue(3.0);
_info = new InfoItem();
_grid = new GridItem();
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
SLOT(emitSliderPositionChanged(const QPointF&)));
_width = 1;
_xScale = 1;
_yScale = 1;
_yOffset = 0;
@ -169,7 +175,8 @@ void GraphView::loadGraph(const Graph &graph, PathItem *path, int id)
GraphItem *gi = new GraphItem(graph);
gi->setGraphType(_graphType);
gi->setId(id);
gi->setColor(_palette.color());
gi->setColor(_palette.nextColor());
gi->setWidth(_width);
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
SLOT(emitSliderPositionChanged(qreal)));
@ -431,3 +438,31 @@ void GraphView::clearInfo()
{
_info->clear();
}
void GraphView::setPalette(const Palette &palette)
{
_palette = palette;
_palette.reset();
for (int i = 0; i < _graphs.count(); i++)
_graphs.at(i)->setColor(_palette.nextColor());
}
void GraphView::setGraphWidth(int width)
{
_width = width;
for (int i = 0; i < _graphs.count(); i++)
_graphs.at(i)->setWidth(width);
}
void GraphView::useOpenGL(bool use)
{
if (use) {
#ifdef Q_OS_WIN32
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
#endif // Q_OS_WIN32
setViewport(new OPENGL_WIDGET);
} else
setViewport(new QWidget);
}

View File

@ -35,6 +35,9 @@ public:
void setUnits(Units units);
void showGrid(bool show);
void setPalette(const Palette &palette);
void setGraphWidth(int width);
const QString &yLabel() const {return _yLabel;}
const QString &yUnits() const {return _yUnits;}
qreal yScale() const {return _yScale;}
@ -52,6 +55,8 @@ public:
void plot(QPainter *painter, const QRectF &target);
void useOpenGL(bool use);
signals:
void sliderPositionChanged(qreal);
@ -60,7 +65,7 @@ protected:
void redraw(const QSizeF &size);
void addInfo(const QString &key, const QString &value);
void clearInfo();
void skipColor() {_palette.color();}
void skipColor() {_palette.nextColor();}
private slots:
void emitSliderPositionChanged(const QPointF &pos);
@ -99,6 +104,7 @@ private:
QSet<int> _hide;
QRectF _bounds;
Palette _palette;
int _width;
Units _units;
GraphType _graphType;

View File

@ -6,7 +6,9 @@
GridItem::GridItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{
#ifndef Q_OS_MAC
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
#endif // Q_OS_MAC
}
void GridItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,

View File

@ -21,7 +21,6 @@
#include <QLocale>
#include <QMimeData>
#include <QUrl>
#include <QPixmapCache>
#include "config.h"
#include "icons.h"
#include "keys.h"
@ -39,7 +38,6 @@
#include "trackinfo.h"
#include "filebrowser.h"
#include "cpuarch.h"
#include "exportdialog.h"
#include "graphtab.h"
#include "format.h"
#include "gui.h"
@ -72,6 +70,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
setWindowIcon(QIcon(QPixmap(APP_ICON)));
setWindowTitle(APP_NAME);
setUnifiedTitleAndToolBarOnMac(true);
setAcceptDrops(true);
_trackCount = 0;
_routeCount = 0;
@ -87,15 +86,6 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
updateStatusBarInfo();
readSettings();
_exportPaperSize = (QLocale::system().measurementSystem()
== QLocale::ImperialSystem) ? QPrinter::Letter : QPrinter::A4;
_exportOrientation = QPrinter::Portrait;
_exportFileName = QString("%1/export.pdf").arg(QDir::currentPath());
_exportMargins = MarginsF(5.0, 5.0, 5.0, 5.0);
setAcceptDrops(true);
QPixmapCache::setCacheLimit(65536);
}
GUI::~GUI()
@ -198,7 +188,6 @@ void GUI::createActions()
{
QActionGroup *ag;
// Action Groups
_fileActionGroup = new QActionGroup(this);
_fileActionGroup->setExclusive(false);
@ -377,6 +366,9 @@ void GUI::createActions()
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
SLOT(showFullscreen(bool)));
addAction(_fullscreenAction);
_openOptionsAction = new QAction(tr("Options..."), this);
connect(_openOptionsAction, SIGNAL(triggered()), this,
SLOT(openOptions()));
// Navigation actions
_nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this);
@ -453,8 +445,9 @@ void GUI::createMenus()
unitsMenu->addAction(_imperialUnitsAction);
settingsMenu->addSeparator();
settingsMenu->addAction(_showToolbarsAction);
settingsMenu->addSeparator();
settingsMenu->addAction(_fullscreenAction);
settingsMenu->addSeparator();
settingsMenu->addAction(_openOptionsAction);
QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
helpMenu->addAction(_dataSourcesAction);
@ -675,6 +668,14 @@ bool GUI::loadFile(const QString &fileName)
_waypointCount += data.waypoints().count();
if (_pathName.isNull()) {
if (data.tracks().count() == 1 && !data.routes().count())
_pathName = data.tracks().first()->name();
else if (data.routes().count() == 1 && !data.tracks().count())
_pathName = data.routes().first()->routeData().name();
} else
_pathName = QString();
return true;
} else {
updateNavigationActions();
@ -746,26 +747,67 @@ void GUI::printFile()
plot(&printer);
}
void GUI::openOptions()
{
Options options(_options);
OptionsDialog dialog(&options, this);
if (dialog.exec() != QDialog::Accepted)
return;
if (options.palette != _options.palette) {
_pathView->setPalette(options.palette);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->setPalette(options.palette);
}
if (options.trackWidth != _options.trackWidth)
_pathView->setTrackWidth(options.trackWidth);
if (options.routeWidth != _options.routeWidth)
_pathView->setRouteWidth(options.routeWidth);
if (options.trackStyle != _options.trackStyle)
_pathView->setTrackStyle(options.trackStyle);
if (options.routeStyle != _options.routeStyle)
_pathView->setRouteStyle(options.routeStyle);
if (options.pathAntiAliasing != _options.pathAntiAliasing)
_pathView->setRenderHint(QPainter::Antialiasing,
options.pathAntiAliasing);
if (options.graphWidth != _options.graphWidth)
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->setGraphWidth(options.graphWidth);
if (options.graphAntiAliasing != _options.graphAntiAliasing)
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
options.graphAntiAliasing);
if (options.poiRadius != _options.poiRadius)
_poi->setRadius(options.poiRadius);
if (options.useOpenGL != _options.useOpenGL) {
_pathView->useOpenGL(options.useOpenGL);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->useOpenGL(options.useOpenGL);
}
_options = options;
}
void GUI::exportFile()
{
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);
ExportDialog dialog(&_export, this);
if (dialog.exec() != QDialog::Accepted)
return;
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);
}
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setCreator(QString(APP_NAME) + QString(" ")
+ QString(APP_VERSION));
printer.setOrientation(_export.orientation);
printer.setOutputFileName(_export.fileName);
printer.setPaperSize(_export.paperSize);
printer.setPageMargins(_export.margins.left(), _export.margins.top(),
_export.margins.right(), _export.margins.bottom(), QPrinter::Millimeter);
plot(&printer);
}
void GUI::plot(QPrinter *printer)
@ -777,7 +819,19 @@ void GUI::plot(QPrinter *printer)
qreal d = distance();
qreal t = time();
if (_dateRange.first.isValid()) {
if (!_pathName.isNull() && _options.printName)
info.insert(tr("Name"), _pathName);
if (_options.printItemCount) {
if (_trackCount > 1)
info.insert(tr("Tracks"), QString::number(_trackCount));
if (_routeCount > 1)
info.insert(tr("Routes"), QString::number(_routeCount));
if (_waypointCount > 2)
info.insert(tr("Waypoints"), QString::number(_waypointCount));
}
if (_dateRange.first.isValid() && _options.printDate) {
if (_dateRange.first == _dateRange.second) {
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
info.insert(tr("Date"), _dateRange.first.toString(format));
@ -789,16 +843,9 @@ void GUI::plot(QPrinter *printer)
}
}
if (_trackCount > 1)
info.insert(tr("Tracks"), QString::number(_trackCount));
if (_routeCount > 1)
info.insert(tr("Routes"), QString::number(_routeCount));
if (_waypointCount > 2)
info.insert(tr("Waypoints"), QString::number(_waypointCount));
if (d > 0)
if (d > 0 && _options.printDistance)
info.insert(tr("Distance"), Format::distance(d, units));
if (t > 0)
if (t > 0 && _options.printTime)
info.insert(tr("Time"), Format::timeSpan(t));
@ -811,7 +858,7 @@ void GUI::plot(QPrinter *printer)
mh = ih / 2;
info.plot(&p, QRectF(0, 0, printer->width(), ih));
}
if (_graphTabWidget->isVisible()) {
if (_graphTabWidget->isVisible() && !_options.separateGraphPage) {
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
gh = (printer->width() > printer->height())
? 0.15 * r * (printer->height() - ih - 2*mh)
@ -823,6 +870,27 @@ void GUI::plot(QPrinter *printer)
gh = 0;
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
- (ih + 2*mh + gh)));
if (_graphTabWidget->isVisible() && _options.separateGraphPage) {
printer->newPage();
int cnt = 0;
for (int i = 0; i < _tabs.size(); i++)
if (_tabs.at(i)->count())
cnt++;
qreal sp = ratio * 20;
gh = qMin((printer->height() - ((cnt - 1) * sp))/(qreal)cnt,
0.20 * printer->height());
qreal y = 0;
for (int i = 0; i < _tabs.size(); i++) {
if (_tabs.at(i)->count()) {
_tabs.at(i)->plot(&p, QRectF(0, y, printer->width(), gh));
y += gh + sp;
}
}
}
}
void GUI::reloadFile()
@ -834,6 +902,7 @@ void GUI::reloadFile()
_routeDistance = 0;
_time = 0;
_dateRange = DateRange(QDate(), QDate());
_pathName = QString();
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->clear();
@ -867,6 +936,7 @@ void GUI::closeFiles()
_routeDistance = 0;
_time = 0;
_dateRange = DateRange(QDate(), QDate());
_pathName = QString();
_sliderPos = 0;
@ -1109,6 +1179,9 @@ void GUI::updatePathView()
void GUI::setUnits(Units units)
{
_export.units = units;
_options.units = units;
_pathView->setUnits(units);
for (int i = 0; i <_tabs.count(); i++)
_tabs.at(i)->setUnits(units);
@ -1229,57 +1302,131 @@ void GUI::dropEvent(QDropEvent *event)
void GUI::writeSettings()
{
QSettings settings(APP_NAME, APP_NAME);
settings.clear();
settings.beginGroup(WINDOW_SETTINGS_GROUP);
settings.setValue(WINDOW_SIZE_SETTING, size());
settings.setValue(WINDOW_POS_SETTING, pos());
if (size() != WINDOW_SIZE_DEFAULT)
settings.setValue(WINDOW_SIZE_SETTING, size());
if (pos() != WINDOW_POS_DEFAULT)
settings.setValue(WINDOW_POS_SETTING, pos());
settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
if ((_imperialUnitsAction->isChecked() ? Imperial : Metric) !=
UNITS_DEFAULT)
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
? Imperial : Metric);
settings.setValue(SHOW_TOOLBARS_SETTING, _showToolbarsAction->isChecked());
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
settings.setValue(SHOW_TOOLBARS_SETTING,
_showToolbarsAction->isChecked());
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (_currentMap)
settings.setValue(CURRENT_MAP_SETTING, _currentMap->name());
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
if (_showMapAction->isChecked() != SHOW_MAP_DEFAULT)
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
settings.endGroup();
settings.beginGroup(GRAPH_SETTINGS_GROUP);
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked()
? Time : Distance);
settings.setValue(SHOW_GRAPH_GRIDS_SETTING,
_showGraphGridAction->isChecked());
if (_showGraphsAction->isChecked() != SHOW_GRAPHS_DEFAULT)
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
if ((_timeGraphAction->isChecked() ? Time : Distance) != GRAPH_TYPE_DEFAULT)
settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked()
? Time : Distance);
if (_showGraphGridAction->isChecked() != SHOW_GRAPH_GRIDS_DEFAULT)
settings.setValue(SHOW_GRAPH_GRIDS_SETTING,
_showGraphGridAction->isChecked());
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked());
if (_showPOIAction->isChecked() != SHOW_POI_DEFAULT)
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
if (_overlapPOIAction->isChecked() != OVERLAP_POI_DEFAULT)
settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked());
settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX);
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
for (int i = 0, j = 0; i < _poiFilesActions.count(); i++) {
int j = 0;
for (int i = 0; i < _poiFilesActions.count(); i++) {
if (!_poiFilesActions.at(i)->isChecked()) {
if (j == 0)
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
settings.setArrayIndex(j++);
settings.setValue(DISABLED_POI_FILE_SETTING, _poi->files().at(i));
}
}
settings.endArray();
if (j != 0)
settings.endArray();
settings.endGroup();
settings.beginGroup(DATA_SETTINGS_GROUP);
settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked());
settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked());
settings.setValue(SHOW_WAYPOINTS_SETTING,
_showWaypointsAction->isChecked());
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
_showWaypointLabelsAction->isChecked());
settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING,
_showRouteWaypointsAction->isChecked());
if (_showTracksAction->isChecked() != SHOW_TRACKS_DEFAULT)
settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked());
if (_showRoutesAction->isChecked() != SHOW_ROUTES_DEFAULT)
settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked());
if (_showWaypointsAction->isChecked() != SHOW_WAYPOINTS_DEFAULT)
settings.setValue(SHOW_WAYPOINTS_SETTING,
_showWaypointsAction->isChecked());
if (_showWaypointLabelsAction->isChecked() != SHOW_WAYPOINT_LABELS_DEFAULT)
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
_showWaypointLabelsAction->isChecked());
if (_showRouteWaypointsAction->isChecked() != SHOW_ROUTE_WAYPOINTS_DEFAULT)
settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING,
_showRouteWaypointsAction->isChecked());
settings.endGroup();
settings.beginGroup(EXPORT_SETTINGS_GROUP);
if (_export.orientation != PAPER_ORIENTATION_DEFAULT)
settings.setValue(PAPER_ORIENTATION_SETTING, _export.orientation);
if (_export.paperSize != PAPER_SIZE_DEFAULT)
settings.setValue(PAPER_SIZE_SETTING, _export.paperSize);
if (_export.margins.left() != MARGIN_LEFT_DEFAULT)
settings.setValue(MARGIN_LEFT_SETTING, _export.margins.left());
if (_export.margins.top() != MARGIN_TOP_DEFAULT)
settings.setValue(MARGIN_TOP_SETTING, _export.margins.top());
if (_export.margins.right() != MARGIN_RIGHT_DEFAULT)
settings.setValue(MARGIN_RIGHT_SETTING, _export.margins.right());
if (_export.margins.bottom() != MARGIN_BOTTOM_DEFAULT)
settings.setValue(MARGIN_BOTTOM_SETTING, _export.margins.bottom());
if (_export.fileName != EXPORT_FILENAME_DEFAULT)
settings.setValue(EXPORT_FILENAME_SETTING, _export.fileName);
settings.endGroup();
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
if (_options.palette.color() != PALETTE_COLOR_DEFAULT)
settings.setValue(PALETTE_COLOR_SETTING, _options.palette.color());
if (_options.palette.shift() != PALETTE_SHIFT_DEFAULT)
settings.setValue(PALETTE_SHIFT_SETTING, _options.palette.shift());
if (_options.trackWidth != TRACK_WIDTH_DEFAULT)
settings.setValue(TRACK_WIDTH_SETTING, _options.trackWidth);
if (_options.routeWidth != ROUTE_WIDTH_DEFAULT)
settings.setValue(ROUTE_WIDTH_SETTING, _options.routeWidth);
if (_options.trackStyle != TRACK_STYLE_DEFAULT)
settings.setValue(TRACK_STYLE_SETTING, (int)_options.trackStyle);
if (_options.routeStyle != ROUTE_STYLE_DEFAULT)
settings.setValue(ROUTE_STYLE_SETTING, (int)_options.routeStyle);
if (_options.graphWidth != GRAPH_WIDTH_DEFAULT)
settings.setValue(GRAPH_WIDTH_SETTING, _options.graphWidth);
if (_options.pathAntiAliasing != PATH_AA_DEFAULT)
settings.setValue(PATH_AA_SETTING, _options.pathAntiAliasing);
if (_options.graphAntiAliasing != GRAPH_AA_DEFAULT)
settings.setValue(GRAPH_AA_SETTING, _options.graphAntiAliasing);
if (_options.poiRadius != POI_RADIUS_DEFAULT)
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
if (_options.printName != PRINT_NAME_DEFAULT)
settings.setValue(PRINT_NAME_SETTING, _options.printName);
if (_options.printDate != PRINT_DATE_DEFAULT)
settings.setValue(PRINT_DATE_SETTING, _options.printDate);
if (_options.printDistance != PRINT_DISTANCE_DEFAULT)
settings.setValue(PRINT_DISTANCE_SETTING, _options.printDistance);
if (_options.printTime != PRINT_TIME_DEFAULT)
settings.setValue(PRINT_TIME_SETTING, _options.printTime);
if (_options.printItemCount != PRINT_ITEM_COUNT_DEFAULT)
settings.setValue(PRINT_ITEM_COUNT_SETTING, _options.printItemCount);
if (_options.separateGraphPage != SEPARATE_GRAPH_PAGE_DEFAULT)
settings.setValue(SEPARATE_GRAPH_PAGE_SETTING,
_options.separateGraphPage);
settings.endGroup();
}
@ -1288,26 +1435,26 @@ 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());
resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize());
move(settings.value(WINDOW_POS_SETTING, WINDOW_POS_DEFAULT).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();
if (settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt() == Imperial) {
setUnits(Imperial);
_imperialUnitsAction->setChecked(true);
} else
} else {
setUnits(Metric);
_metricUnitsAction->setChecked(true);
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false)
}
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
showToolbars(false);
else
_showToolbarsAction->setChecked(true);
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (settings.value(SHOW_MAP_SETTING, true).toBool() == true)
if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool())
_showMapAction->setChecked(true);
if (_maps.count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
@ -1320,31 +1467,33 @@ void GUI::readSettings()
settings.endGroup();
settings.beginGroup(GRAPH_SETTINGS_GROUP);
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false)
if (!settings.value(SHOW_GRAPHS_SETTING, SHOW_GRAPHS_DEFAULT).toBool())
showGraphs(false);
else
_showGraphsAction->setChecked(true);
if (settings.value(GRAPH_TYPE_SETTING, Distance).toInt() == Time) {
if (settings.value(GRAPH_TYPE_SETTING, GRAPH_TYPE_DEFAULT).toInt()
== Time) {
setTimeGraph();
_timeGraphAction->setChecked(true);
} else
_distanceGraphAction->setChecked(true);
if (settings.value(SHOW_GRAPH_GRIDS_SETTING, true).toBool() == false)
if (!settings.value(SHOW_GRAPH_GRIDS_SETTING, SHOW_GRAPH_GRIDS_DEFAULT)
.toBool())
showGraphGrids(false);
else
_showGraphGridAction->setChecked(true);
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false)
if (!settings.value(OVERLAP_POI_SETTING, OVERLAP_POI_DEFAULT).toBool())
_pathView->setPOIOverlap(false);
else
_overlapPOIAction->setChecked(true);
if (settings.value(LABELS_POI_SETTING, true).toBool() == false)
if (!settings.value(LABELS_POI_SETTING, LABELS_POI_DEFAULT).toBool())
_pathView->showPOILabels(false);
else
_showPOILabelsAction->setChecked(true);
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
if (settings.value(SHOW_POI_SETTING, SHOW_POI_DEFAULT).toBool())
_showPOIAction->setChecked(true);
else
_pathView->showPOI(false);
@ -1364,31 +1513,110 @@ void GUI::readSettings()
settings.endGroup();
settings.beginGroup(DATA_SETTINGS_GROUP);
if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false) {
if (!settings.value(SHOW_TRACKS_SETTING, SHOW_TRACKS_DEFAULT).toBool()) {
_pathView->showTracks(false);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->showTracks(false);
} else
_showTracksAction->setChecked(true);
if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false) {
if (!settings.value(SHOW_ROUTES_SETTING, SHOW_ROUTES_DEFAULT).toBool()) {
_pathView->showRoutes(false);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->showRoutes(false);
} else
_showRoutesAction->setChecked(true);
if (settings.value(SHOW_WAYPOINTS_SETTING, true).toBool() == false)
if (!settings.value(SHOW_WAYPOINTS_SETTING, SHOW_WAYPOINTS_DEFAULT)
.toBool())
_pathView->showWaypoints(false);
else
_showWaypointsAction->setChecked(true);
if (settings.value(SHOW_WAYPOINT_LABELS_SETTING, true).toBool() == false)
if (!settings.value(SHOW_WAYPOINT_LABELS_SETTING,
SHOW_WAYPOINT_LABELS_DEFAULT).toBool())
_pathView->showWaypointLabels(false);
else
_showWaypointLabelsAction->setChecked(true);
if (settings.value(SHOW_ROUTE_WAYPOINTS_SETTING, true).toBool() == false)
if (!settings.value(SHOW_ROUTE_WAYPOINTS_SETTING,
SHOW_ROUTE_WAYPOINTS_SETTING).toBool())
_pathView->showRouteWaypoints(false);
else
_showRouteWaypointsAction->setChecked(true);
settings.endGroup();
settings.beginGroup(EXPORT_SETTINGS_GROUP);
_export.orientation = (QPrinter::Orientation) settings.value(
PAPER_ORIENTATION_SETTING, PAPER_ORIENTATION_DEFAULT).toInt();
_export.paperSize = (QPrinter::PaperSize) settings.value(PAPER_SIZE_SETTING,
PAPER_SIZE_DEFAULT).toInt();
qreal ml = settings.value(MARGIN_LEFT_SETTING, MARGIN_LEFT_DEFAULT)
.toReal();
qreal mt = settings.value(MARGIN_TOP_SETTING, MARGIN_TOP_DEFAULT).toReal();
qreal mr = settings.value(MARGIN_RIGHT_SETTING, MARGIN_RIGHT_DEFAULT)
.toReal();
qreal mb = settings.value(MARGIN_BOTTOM_SETTING, MARGIN_BOTTOM_DEFAULT)
.toReal();
_export.margins = MarginsF(ml, mt, mr, mb);
_export.fileName = settings.value(EXPORT_FILENAME_SETTING,
EXPORT_FILENAME_DEFAULT).toString();
settings.endGroup();
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
QColor pc = settings.value(PALETTE_COLOR_SETTING, PALETTE_COLOR_DEFAULT)
.value<QColor>();
qreal ps = settings.value(PALETTE_SHIFT_SETTING, PALETTE_SHIFT_DEFAULT)
.toDouble();
_options.palette = Palette(pc, ps);
_options.trackWidth = settings.value(TRACK_WIDTH_SETTING,
TRACK_WIDTH_DEFAULT).toInt();
_options.routeWidth = settings.value(ROUTE_WIDTH_SETTING,
ROUTE_WIDTH_DEFAULT).toInt();
_options.trackStyle = (Qt::PenStyle) settings.value(TRACK_STYLE_SETTING,
(int)TRACK_STYLE_DEFAULT).toInt();
_options.routeStyle = (Qt::PenStyle) settings.value(ROUTE_STYLE_SETTING,
(int)ROUTE_STYLE_DEFAULT).toInt();
_options.pathAntiAliasing = settings.value(PATH_AA_SETTING, PATH_AA_DEFAULT)
.toBool();
_options.graphWidth = settings.value(GRAPH_WIDTH_SETTING,
GRAPH_WIDTH_DEFAULT).toInt();
_options.graphAntiAliasing = settings.value(GRAPH_AA_SETTING,
GRAPH_AA_DEFAULT).toBool();
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
.toInt();
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
.toBool();
_options.printName = settings.value(PRINT_NAME_SETTING, PRINT_NAME_DEFAULT)
.toBool();
_options.printDate = settings.value(PRINT_DATE_SETTING, PRINT_DATE_DEFAULT)
.toBool();
_options.printDistance = settings.value(PRINT_DISTANCE_SETTING,
PRINT_DISTANCE_DEFAULT).toBool();
_options.printTime = settings.value(PRINT_TIME_SETTING, PRINT_TIME_DEFAULT)
.toBool();
_options.printItemCount = settings.value(PRINT_ITEM_COUNT_SETTING,
PRINT_ITEM_COUNT_DEFAULT).toBool();
_options.separateGraphPage = settings.value(SEPARATE_GRAPH_PAGE_SETTING,
SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
_pathView->setPalette(_options.palette);
_pathView->setTrackWidth(_options.trackWidth);
_pathView->setRouteWidth(_options.routeWidth);
_pathView->setTrackStyle(_options.trackStyle);
_pathView->setRouteStyle(_options.routeStyle);
_pathView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
if (_options.useOpenGL)
_pathView->useOpenGL(true);
for (int i = 0; i < _tabs.count(); i++) {
_tabs.at(i)->setPalette(_options.palette);
_tabs.at(i)->setGraphWidth(_options.graphWidth);
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
_options.graphAntiAliasing);
if (_options.useOpenGL)
_tabs.at(i)->useOpenGL(true);
}
_poi->setRadius(_options.poiRadius);
settings.endGroup();
}
int GUI::mapIndex(const QString &name)

View File

@ -9,7 +9,8 @@
#include "units.h"
#include "graph.h"
#include "poi.h"
#include "margins.h"
#include "exportdialog.h"
#include "optionsdialog.h"
class QMenu;
class QToolBar;
@ -55,6 +56,7 @@ private slots:
void clearMapCache();
void nextMap();
void prevMap();
void openOptions();
void mapChanged(int);
void graphChanged(int);
@ -159,6 +161,7 @@ private:
QAction *_showWaypointsAction;
QAction *_showWaypointLabelsAction;
QAction *_showRouteWaypointsAction;
QAction *_openOptionsAction;
QList<QAction*> _mapActions;
QList<QAction*> _poiFilesActions;
@ -186,16 +189,15 @@ private:
qreal _routeDistance;
qreal _time;
DateRange _dateRange;
QString _pathName;
qreal _sliderPos;
int _frameStyle;
bool _showGraphs;
QString _exportFileName;
QPrinter::PaperSize _exportPaperSize;
QPrinter::Orientation _exportOrientation;
MarginsF _exportMargins;
Export _export;
Options _options;
};
#endif // GUI_H

View File

@ -1,20 +1,28 @@
#ifndef ICONS_H
#define ICONS_H
#define APP_ICON ":/icons/gpxsee.png"
#define OPEN_FILE_ICON ":/icons/document-open.png"
#define EXPORT_FILE_ICON ":/icons/document-export.png"
#define PRINT_FILE_ICON ":/icons/document-print.png"
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
#define SHOW_POI_ICON ":/icons/flag.png"
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line-stacked.png"
#define QUIT_ICON ":/icons/application-exit.png"
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
#define PREV_FILE_ICON ":/icons/arrow-left.png"
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
#define APP_ICON ":/icons/gpxsee.png"
// Toolbar/menu icons
#define OPEN_FILE_ICON ":/icons/document-open.png"
#define EXPORT_FILE_ICON ":/icons/document-export.png"
#define PRINT_FILE_ICON ":/icons/document-print.png"
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
#define SHOW_POI_ICON ":/icons/flag.png"
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line-stacked.png"
#define QUIT_ICON ":/icons/application-exit.png"
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
#define PREV_FILE_ICON ":/icons/arrow-left.png"
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
// Options dialog icons
#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png"
#define POI_ICON ":/icons/flag_48.png"
#define SYSTEM_ICON ":/icons/system-run.png"
#define PRINT_EXPORT_ICON ":/icons/document-print-preview.png"
#endif /* ICONS_H */

View File

@ -110,7 +110,8 @@ bool IGCParser::readHRecord(const char *line, int len)
return false;
}
_date = QDate(2000 + y, m, d);
_date = QDate(y + 2000 < QDate::currentDate().year() ? 2000 + y : 1900 + y,
m, d);
if (!_date.isValid()) {
_errorString = "Invalid date";
return false;

View File

@ -7,7 +7,9 @@
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{
#ifndef Q_OS_MAC
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
#endif // Q_OS_MAC
}
void InfoItem::updateBoundingRect()

View File

@ -7,10 +7,10 @@ static bool validSentence(const char *line, int len)
{
const char *lp;
if (len < 10 || line[0] != '$')
if (len < 12 || line[0] != '$')
return false;
for (lp = line + len - 1; lp > line; lp--)
for (lp = line + len - 1; lp > line + 3; lp--)
if (!::isspace(*lp))
break;
if (*(lp-2) != '*' || !::isalnum(*(lp-1)) || !::isalnum(*(lp)))
@ -313,7 +313,7 @@ bool NMEAParser::readGGA(const char *line, int len)
return false;
break;
case 3:
if (!readNS(vp, lp - vp, lon))
if (!readNS(vp, lp - vp, lat))
return false;
break;
case 4:

26
src/opengl.h Normal file
View File

@ -0,0 +1,26 @@
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
#include <QGLWidget>
#include <QGLFormat>
#else
#include <QOpenGLWidget>
#include <QSurfaceFormat>
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
#define OPENGL_WIDGET QGLWidget
#else
#define OPENGL_WIDGET QOpenGLWidget
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
#define OPENGL_SET_SAMPLES(samples) \
{QGLFormat fmt; \
fmt.setSamples(samples); \
QGLFormat::setDefaultFormat(fmt);}
#else
#define OPENGL_SET_SAMPLES(samples) \
{QSurfaceFormat fmt; \
fmt.setSamples(samples);\
QSurfaceFormat::setDefaultFormat(fmt);}
#endif

284
src/optionsdialog.cpp Normal file
View File

@ -0,0 +1,284 @@
#include <QVBoxLayout>
#include <QFormLayout>
#include <QDialogButtonBox>
#include <QListWidget>
#include <QListWidgetItem>
#include <QStackedWidget>
#include <QTabWidget>
#include <QSpinBox>
#include <QGroupBox>
#include <QCheckBox>
#include <QComboBox>
#include <QSysInfo>
#include "config.h"
#include "icons.h"
#include "colorbox.h"
#include "stylecombobox.h"
#include "optionsdialog.h"
#define MENU_MARGIN 20
#define MENU_ICON_SIZE 32
QWidget *OptionsDialog::createAppearancePage()
{
_baseColor = new ColorBox();
_baseColor->setColor(_options->palette.color());
_colorOffset = new QDoubleSpinBox();
_colorOffset->setMinimum(0);
_colorOffset->setMaximum(1.0);
_colorOffset->setSingleStep(0.01);
_colorOffset->setValue(_options->palette.shift());
QFormLayout *paletteLayout = new QFormLayout();
paletteLayout->addRow(tr("Base color:"), _baseColor);
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
QWidget *colorTab = new QWidget();
colorTab->setLayout(paletteLayout);
_trackWidth = new QSpinBox();
_trackWidth->setValue(_options->trackWidth);
_trackWidth->setMinimum(1);
_trackStyle = new StyleComboBox();
_trackStyle->setValue(_options->trackStyle);
QFormLayout *trackLayout = new QFormLayout();
trackLayout->addRow(tr("Track width:"), _trackWidth);
trackLayout->addRow(tr("Track style:"), _trackStyle);
#ifndef Q_OS_MAC
QGroupBox *trackBox = new QGroupBox(tr("Tracks"));
trackBox->setLayout(trackLayout);
#endif
_routeWidth = new QSpinBox();
_routeWidth->setValue(_options->routeWidth);
_routeWidth->setMinimum(1);
_routeStyle = new StyleComboBox();
_routeStyle->setValue(_options->routeStyle);
QFormLayout *routeLayout = new QFormLayout();
routeLayout->addRow(tr("Route width:"), _routeWidth);
routeLayout->addRow(tr("Route style:"), _routeStyle);
#ifndef Q_OS_MAC
QGroupBox *routeBox = new QGroupBox(tr("Routes"));
routeBox->setLayout(routeLayout);
#endif // Q_OS_MAC
_pathAA = new QCheckBox(tr("Use anti-aliasing"));
_pathAA->setChecked(_options->pathAntiAliasing);
QFormLayout *pathAALayout = new QFormLayout();
pathAALayout->addWidget(_pathAA);
QWidget *pathTab = new QWidget();
QVBoxLayout *pathTabLayout = new QVBoxLayout();
#ifdef Q_OS_MAC
QFrame *l1 = new QFrame();
l1->setFrameShape(QFrame::HLine);
l1->setFrameShadow(QFrame::Sunken);
QFrame *l2 = new QFrame();
l2->setFrameShape(QFrame::HLine);
l2->setFrameShadow(QFrame::Sunken);
pathTabLayout->addLayout(trackLayout);
pathTabLayout->addWidget(l1);
pathTabLayout->addLayout(routeLayout);
pathTabLayout->addWidget(l2);
#else
pathTabLayout->addWidget(trackBox);
pathTabLayout->addWidget(routeBox);
#endif
pathTabLayout->addLayout(pathAALayout);
pathTab->setLayout(pathTabLayout);
_graphWidth = new QSpinBox();
_graphWidth->setValue(_options->graphWidth);
_graphWidth->setMinimum(1);
QFormLayout *graphLayout = new QFormLayout();
graphLayout->addRow(tr("Line width:"), _graphWidth);
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
_graphAA->setChecked(_options->graphAntiAliasing);
QFormLayout *graphAALayout = new QFormLayout();
graphAALayout->addWidget(_graphAA);
QWidget *graphTab = new QWidget();
QVBoxLayout *graphTabLayout = new QVBoxLayout();
graphTabLayout->addLayout(graphLayout);
graphTabLayout->addLayout(graphAALayout);
graphTabLayout->addStretch();
graphTab->setLayout(graphTabLayout);
QTabWidget *appearancePage = new QTabWidget();
appearancePage->addTab(colorTab, tr("Colors"));
appearancePage->addTab(pathTab, tr("Paths"));
appearancePage->addTab(graphTab, tr("Graphs"));
return appearancePage;
}
QWidget *OptionsDialog::createPOIPage()
{
_poiRadius = new QDoubleSpinBox();
_poiRadius->setSingleStep(1);
_poiRadius->setDecimals(1);
if (_options->units == Imperial) {
_poiRadius->setValue(_options->poiRadius / MIINM);
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
} else {
_poiRadius->setValue(_options->poiRadius / KMINM);
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
}
QFormLayout *poiLayout = new QFormLayout();
poiLayout->addRow(tr("POI radius:"), _poiRadius);
QWidget *poiTab = new QWidget();
poiTab->setLayout(poiLayout);
QTabWidget *poiPage = new QTabWidget();
poiPage->addTab(poiTab, tr("POI"));
return poiPage;
}
QWidget *OptionsDialog::createExportPage()
{
_name = new QCheckBox(tr("Name"));
_name->setChecked(_options->printName);
_date = new QCheckBox(tr("Date"));
_date->setChecked(_options->printDate);
_distance = new QCheckBox(tr("Distance"));
_distance->setChecked(_options->printDistance);
_time = new QCheckBox(tr("Time"));
_time->setChecked(_options->printTime);
_itemCount = new QCheckBox(tr("Item count (>1)"));
_itemCount->setChecked(_options->printItemCount);
QFormLayout *headerTabLayout = new QFormLayout();
headerTabLayout->addWidget(_name);
headerTabLayout->addWidget(_date);
headerTabLayout->addWidget(_distance);
headerTabLayout->addWidget(_time);
headerTabLayout->addItem(new QSpacerItem(10, 10));
headerTabLayout->addWidget(_itemCount);
QWidget *headerTab = new QWidget();
headerTab->setLayout(headerTabLayout);
_separateGraphPage = new QCheckBox(tr("Separate graph page"));
_separateGraphPage->setChecked(_options->separateGraphPage);
QFormLayout *graphTabLayout = new QFormLayout();
graphTabLayout->addWidget(_separateGraphPage);
QWidget *graphTab = new QWidget();
graphTab->setLayout(graphTabLayout);
QTabWidget *exportPage = new QTabWidget();
exportPage->addTab(headerTab, tr("Header"));
exportPage->addTab(graphTab, tr("Graphs"));
return exportPage;
}
QWidget *OptionsDialog::createSystemPage()
{
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
#ifdef Q_OS_WIN32
if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
_useOpenGL->setChecked(false);
_useOpenGL->setEnabled(false);
} else
#endif // Q_OS_WIN32
_useOpenGL->setChecked(_options->useOpenGL);
QFormLayout *systemLayout = new QFormLayout();
systemLayout->addWidget(_useOpenGL);
QWidget *systemTab = new QWidget();
systemTab->setLayout(systemLayout);
QTabWidget *systemPage = new QTabWidget();
systemPage->addTab(systemTab, tr("System"));
return systemPage;
}
OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
: QDialog(parent), _options(options)
{
QStackedWidget *pages = new QStackedWidget();
pages->addWidget(createAppearancePage());
pages->addWidget(createPOIPage());
pages->addWidget(createExportPage());
pages->addWidget(createSystemPage());
QListWidget *menu = new QListWidget();
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
menu);
new QListWidgetItem(QIcon(QPixmap(POI_ICON)), tr("POI"), menu);
new QListWidgetItem(QIcon(QPixmap(PRINT_EXPORT_ICON)), tr("Print & Export"),
menu);
new QListWidgetItem(QIcon(QPixmap(SYSTEM_ICON)), tr("System"), menu);
QHBoxLayout *contentLayout = new QHBoxLayout();
contentLayout->addWidget(menu);
contentLayout->addWidget(pages);
menu->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
menu->setMaximumWidth(menu->sizeHintForColumn(0) + 2 * menu->frameWidth()
+ MENU_MARGIN);
pages->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
pages->setMinimumWidth(2 * menu->size().width());
connect(menu, SIGNAL(currentRowChanged(int)), pages,
SLOT(setCurrentIndex(int)));
menu->item(0)->setSelected(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *layout = new QVBoxLayout;
layout->addLayout(contentLayout);
layout->addWidget(buttonBox);
setLayout(layout);
setWindowTitle(tr("Options"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
void OptionsDialog::accept()
{
_options->palette.setColor(_baseColor->color());
_options->palette.setShift(_colorOffset->value());
_options->trackWidth = _trackWidth->value();
_options->trackStyle = (Qt::PenStyle) _trackStyle->itemData(
_trackStyle->currentIndex()).toInt();
_options->routeWidth = _routeWidth->value();
_options->routeStyle = (Qt::PenStyle) _routeStyle->itemData(
_routeStyle->currentIndex()).toInt();
_options->pathAntiAliasing = _pathAA->isChecked();
_options->graphWidth = _graphWidth->value();
_options->graphAntiAliasing = _graphAA->isChecked();
if (_options->units == Imperial)
_options->poiRadius = _poiRadius->value() * MIINM;
else
_options->poiRadius = _poiRadius->value() * KMINM;
_options->useOpenGL = _useOpenGL->isChecked();
_options->printName = _name->isChecked();
_options->printDate = _date->isChecked();
_options->printDistance = _distance->isChecked();
_options->printTime = _time->isChecked();
_options->printItemCount = _itemCount->isChecked();
_options->separateGraphPage = _separateGraphPage->isChecked();
QDialog::accept();
}

77
src/optionsdialog.h Normal file
View File

@ -0,0 +1,77 @@
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
#include <QDialog>
#include "palette.h"
#include "units.h"
class ColorBox;
class StyleComboBox;
class QSpinBox;
class QDoubleSpinBox;
class QComboBox;
class QCheckBox;
struct Options {
// Appearance
Palette palette;
int trackWidth;
int routeWidth;
Qt::PenStyle trackStyle;
Qt::PenStyle routeStyle;
int graphWidth;
bool pathAntiAliasing;
bool graphAntiAliasing;
// POI
int poiRadius;
// System
bool useOpenGL;
// Print/Export
bool printName;
bool printDate;
bool printDistance;
bool printTime;
bool printItemCount;
bool separateGraphPage;
Units units;
};
class OptionsDialog : public QDialog
{
Q_OBJECT
public:
OptionsDialog(Options *options, QWidget *parent = 0);
public slots:
void accept();
private:
QWidget *createAppearancePage();
QWidget *createPOIPage();
QWidget *createSystemPage();
QWidget *createExportPage();
Options *_options;
ColorBox *_baseColor;
QDoubleSpinBox *_colorOffset;
QSpinBox *_trackWidth;
StyleComboBox *_trackStyle;
QSpinBox *_routeWidth;
StyleComboBox *_routeStyle;
QCheckBox *_pathAA;
QSpinBox *_graphWidth;
QCheckBox *_graphAA;
QDoubleSpinBox *_poiRadius;
QCheckBox *_useOpenGL;
QCheckBox *_name;
QCheckBox *_date;
QCheckBox *_distance;
QCheckBox *_time;
QCheckBox *_itemCount;
QCheckBox *_separateGraphPage;
};
#endif // OPTIONSDIALOG_H

View File

@ -1,62 +1,46 @@
#include "palette.h"
#define HUE_INIT 0.1f
#define HUE_INCREMENT 0.62f
#define SATURATION 0.99f
#define VALUE 0.99f
static unsigned hsv2rgb(float h, float s, float v)
Palette::Palette(const QColor &color, qreal shift)
{
unsigned hi;
float r = 0, g = 0, b = 0, p, q, t, f;
_h = 0; _s = 0; _v = 0; _a = 1.0;
hi = (unsigned)(h * 6.0f);
f = h * 6.0f - hi;
p = v * (1.0f - s);
q = v * (1.0f - f * s);
t = v * (1.0f - (1.0f - f) * s);
setColor(color);
setShift(shift);
switch (hi) {
case 0:
r = v; g = t; b = p;
break;
case 1:
r = q; g = v; b = p;
break;
case 2:
r = p; g = v; b = t;
break;
case 3:
r = p; g = q; b = v;
break;
case 4:
r = t; g = p; b = v;
break;
case 5:
r = v; g = p; b = q;
break;
}
return ((unsigned)(r * 256) << 16)
+ ((unsigned)(g * 256) << 8)
+ (unsigned)(b * 256);
_state = _h;
}
Palette::Palette()
void Palette::setColor(const QColor &color)
{
_hueState = HUE_INIT;
if (color.isValid())
color.getHsvF(&_h, &_s, &_v, &_a);
}
QColor Palette::color()
void Palette::setShift(qreal shift)
{
_hueState += HUE_INCREMENT;
_hueState -= (int) _hueState;
if (shift >= 0 && shift <= 1.0)
_shift = shift;
}
return QColor(hsv2rgb(_hueState, SATURATION, VALUE));
QColor Palette::nextColor()
{
QColor ret = QColor::fromHsvF(_state, _s, _v, _a);
_state += _shift;
_state -= (int) _state;
return ret;
}
void Palette::reset()
{
_hueState = HUE_INIT;
_state = _h;
}
QDebug operator<<(QDebug dbg, const Palette &palette)
{
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
<< ")";
return dbg.maybeSpace();
}

View File

@ -2,16 +2,32 @@
#define PALETTE_H
#include <QColor>
#include <QDebug>
class Palette
{
public:
Palette();
QColor color();
Palette(const QColor &color = Qt::blue, qreal shift = 0.62);
QColor color() const {return QColor::fromHsvF(_h, _s, _v, _a).toRgb();}
qreal shift() const {return _shift;}
void setColor(const QColor &color);
void setShift(qreal shift);
QColor nextColor();
void reset();
bool operator==(const Palette &other) const
{return (_h == other._h && _s == other._s && _v == other._v
&& _a == other._a && _shift == other._shift);}
bool operator!=(const Palette &other) const
{return !(*this == other);}
private:
float _hueState;
qreal _h, _s, _v, _a, _shift;
qreal _state;
};
QDebug operator<<(QDebug dbg, const Palette &palette);
#endif // PALLETE_H

View File

@ -6,25 +6,19 @@
#include "pathitem.h"
#define PATH_WIDTH 3
#define HOVER_WIDTH 4
void PathItem::updateShape()
{
QPainterPathStroker s;
s.setWidth(HOVER_WIDTH * 1.0/scale());
s.setWidth((_width + 1) * 1.0/scale());
_shape = s.createStroke(_path);
if (qMax(boundingRect().width(), boundingRect().height()) * scale() <= 768)
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
else
setCacheMode(QGraphicsItem::NoCache);
}
PathItem::PathItem(QGraphicsItem *parent) : QGraphicsObject(parent)
{
_width = 3;
QBrush brush(Qt::SolidPattern);
_pen = QPen(brush, PATH_WIDTH);
_pen = QPen(brush, _width);
_units = Metric;
@ -54,7 +48,7 @@ void PathItem::setScale(qreal scale)
{
prepareGeometryChange();
_pen.setWidthF(PATH_WIDTH * 1.0/scale);
_pen.setWidthF(_width * 1.0/scale);
QGraphicsItem::setScale(scale);
_marker->setScale(1.0/scale);
@ -67,6 +61,22 @@ void PathItem::setColor(const QColor &color)
update();
}
void PathItem::setWidth(int width)
{
prepareGeometryChange();
_width = width;
_pen.setWidthF(_width * 1.0/scale());
updateShape();
}
void PathItem::setStyle(Qt::PenStyle style)
{
_pen.setStyle(style);
update();
}
void PathItem::setUnits(enum Units units)
{
_units = units;
@ -120,7 +130,7 @@ void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
_pen.setWidthF(HOVER_WIDTH * 1.0/scale());
_pen.setWidthF((_width + 1) * 1.0/scale());
setZValue(zValue() + 1.0);
update();
@ -131,7 +141,7 @@ void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
_pen.setWidthF(PATH_WIDTH * 1.0/scale());
_pen.setWidthF(_width * 1.0/scale());
setZValue(zValue() - 1.0);
update();

View File

@ -24,6 +24,8 @@ public:
void setScale(qreal scale);
void setUnits(enum Units units);
void setColor(const QColor &color);
void setWidth(int width);
void setStyle(Qt::PenStyle style);
public slots:
void moveMarker(qreal distance);
@ -36,11 +38,7 @@ protected:
QVector<qreal> _distance;
QPainterPath _path;
QPainterPath _shape;
QPen _pen;
MarkerItem *_marker;
Units _units;
private:
@ -48,6 +46,10 @@ private:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
int _width;
QPen _pen;
QPainterPath _shape;
};
#endif // PATHITEM_H

View File

@ -1,6 +1,8 @@
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QWheelEvent>
#include <QSysInfo>
#include "opengl.h"
#include "rd.h"
#include "poi.h"
#include "data.h"
@ -90,7 +92,7 @@ PathView::PathView(QWidget *parent)
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHints(QPainter::Antialiasing);
setRenderHint(QPainter::Antialiasing, true);
setAcceptDrops(false);
_mapScale = new ScaleItem();
@ -110,6 +112,10 @@ PathView::PathView(QWidget *parent)
_showPOILabels = true;
_overlapPOIs = true;
_showRouteWaypoints = true;
_trackWidth = 3;
_routeWidth = 3;
_trackStyle = Qt::SolidLine;
_routeStyle = Qt::DashLine;
_plot = false;
}
@ -123,7 +129,7 @@ PathView::~PathView()
PathItem *PathView::addTrack(const Track &track)
{
if (track.isNull()) {
_palette.color();
_palette.nextColor();
return 0;
}
@ -132,7 +138,9 @@ PathItem *PathView::addTrack(const Track &track)
_tr |= ti->path().boundingRect();
_zoom = scale2zoom(contentsScale());
ti->setScale(1.0/mapScale(_zoom));
ti->setColor(_palette.color());
ti->setColor(_palette.nextColor());
ti->setWidth(_trackWidth);
ti->setStyle(_trackStyle);
ti->setVisible(_showTracks);
_scene->addItem(ti);
@ -145,7 +153,7 @@ PathItem *PathView::addTrack(const Track &track)
PathItem *PathView::addRoute(const Route &route)
{
if (route.isNull()) {
_palette.color();
_palette.nextColor();
return 0;
}
@ -154,7 +162,9 @@ PathItem *PathView::addRoute(const Route &route)
_rr |= ri->path().boundingRect();
_zoom = scale2zoom(contentsScale());
ri->setScale(1.0/mapScale(_zoom));
ri->setColor(_palette.color());
ri->setColor(_palette.nextColor());
ri->setWidth(_routeWidth);
ri->setStyle(_routeStyle);
ri->setVisible(_showRoutes);
ri->showWaypoints(_showRouteWaypoints);
ri->showWaypointLabels(_showWaypointLabels);
@ -297,6 +307,17 @@ void PathView::rescale(int zoom)
updatePOIVisibility();
}
void PathView::setPalette(const Palette &palette)
{
_palette = palette;
_palette.reset();
for (int i = 0; i < _tracks.count(); i++)
_tracks.at(i)->setColor(_palette.nextColor());
for (int i = 0; i < _routes.count(); i++)
_routes.at(i)->setColor(_palette.nextColor());
}
void PathView::setPOI(POI *poi)
{
if (_poi)
@ -585,6 +606,38 @@ void PathView::setPOIOverlap(bool overlap)
updatePOIVisibility();
}
void PathView::setTrackWidth(int width)
{
_trackWidth = width;
for (int i = 0; i < _tracks.count(); i++)
_tracks.at(i)->setWidth(width);
}
void PathView::setRouteWidth(int width)
{
_routeWidth = width;
for (int i = 0; i < _routes.count(); i++)
_routes.at(i)->setWidth(width);
}
void PathView::setTrackStyle(Qt::PenStyle style)
{
_trackStyle = style;
for (int i = 0; i < _tracks.count(); i++)
_tracks.at(i)->setStyle(style);
}
void PathView::setRouteStyle(Qt::PenStyle style)
{
_routeStyle = style;
for (int i = 0; i < _routes.count(); i++)
_routes.at(i)->setStyle(style);
}
void PathView::drawBackground(QPainter *painter, const QRectF &rect)
{
if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
@ -652,3 +705,14 @@ void PathView::paintEvent(QPaintEvent *event)
QGraphicsView::paintEvent(event);
}
void PathView::useOpenGL(bool use)
{
if (use) {
#ifdef Q_OS_WIN32
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
#endif // Q_OS_WIN32
setViewport(new OPENGL_WIDGET);
} else
setViewport(new QWidget);
}

View File

@ -30,6 +30,7 @@ public:
QList<PathItem*> loadData(const Data &data);
void setPalette(const Palette &palette);
void setPOI(POI *poi);
void setMap(Map *map);
void setUnits(enum Units units);
@ -42,6 +43,8 @@ public:
void clear();
void useOpenGL(bool use);
public slots:
void redraw();
@ -53,6 +56,10 @@ public slots:
void showRoutes(bool show);
void showWaypoints(bool show);
void showRouteWaypoints(bool show);
void setTrackWidth(int width);
void setRouteWidth(int width);
void setTrackStyle(Qt::PenStyle style);
void setRouteStyle(Qt::PenStyle style);
private slots:
void updatePOI();
@ -103,6 +110,10 @@ private:
bool _showPOILabels;
bool _overlapPOIs;
bool _showRouteWaypoints;
int _trackWidth;
int _routeWidth;
Qt::PenStyle _trackStyle;
Qt::PenStyle _routeStyle;
bool _plot;
};

View File

@ -10,7 +10,7 @@
POI::POI(QObject *parent) : QObject(parent)
{
_errorLine = 0;
_radius = 0.01;
_radius = 1000;
}
bool POI::loadFile(const QString &fileName)
@ -66,11 +66,15 @@ QVector<Waypoint> POI::points(const PathItem *path) const
const QPainterPath &pp = path->path();
for (int i = 0; i < pp.elementCount(); i++) {
Coordinates p = Coordinates::fromMercator(pp.elementAt(i));
min[0] = p.lon() - _radius;
min[1] = -p.lat() - _radius;
max[0] = p.lon() + _radius;
max[1] = -p.lat() + _radius;
const QPainterPath::Element &pe = pp.elementAt(i);
Coordinates p = Coordinates::fromMercator(QPointF(pe.x, -pe.y));
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
min[0] = br.first.lon();
min[1] = br.first.lat();
max[0] = br.second.lon();
max[1] = br.second.lat();
_tree.Search(min, max, cb, &set);
}
@ -92,10 +96,13 @@ QVector<Waypoint> POI::points(const QList<WaypointItem*> &list)
for (int i = 0; i < list.count(); i++) {
const Coordinates &p = list.at(i)->waypoint().coordinates();
min[0] = p.lon() - _radius;
min[1] = p.lat() - _radius;
max[0] = p.lon() + _radius;
max[1] = p.lat() + _radius;
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
min[0] = br.first.lon();
min[1] = br.first.lat();
max[0] = br.second.lon();
max[1] = br.second.lat();
_tree.Search(min, max, cb, &set);
}
@ -116,10 +123,13 @@ QVector<Waypoint> POI::points(const QList<Waypoint> &list) const
for (int i = 0; i < list.count(); i++) {
const Coordinates &p = list.at(i).coordinates();
min[0] = p.lon() - _radius;
min[1] = p.lat() - _radius;
max[0] = p.lon() + _radius;
max[1] = p.lat() + _radius;
QPair<Coordinates, Coordinates> br = p.boundingRect(_radius);
min[0] = br.first.lon();
min[1] = br.first.lat();
max[0] = br.second.lon();
max[1] = br.second.lat();
_tree.Search(min, max, cb, &set);
}
@ -168,7 +178,7 @@ void POI::clear()
emit pointsChanged();
}
void POI::setRadius(qreal radius)
void POI::setRadius(unsigned radius)
{
_radius = radius;

View File

@ -22,8 +22,8 @@ public:
const QString &errorString() const {return _errorString;}
int errorLine() const {return _errorLine;}
qreal radius() const {return _radius;}
void setRadius(qreal radius);
unsigned radius() const {return _radius;}
void setRadius(unsigned radius);
QVector<Waypoint> points(const PathItem *path) const;
QVector<Waypoint> points(const QList<WaypointItem*> &list) const;
@ -49,7 +49,7 @@ private:
QStringList _files;
QList<FileIndex> _indexes;
qreal _radius;
unsigned _radius;
QString _errorString;
int _errorLine;

View File

@ -52,8 +52,6 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
_marker->setPos(_path.elementAt(0));
_pen.setStyle(Qt::DotLine);
setToolTip(toolTip());
}

View File

@ -1,35 +1,108 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#define IMPERIAL_UNITS() \
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
#define WINDOW_SETTINGS_GROUP "Window"
#define WINDOW_SIZE_SETTING "size"
#define WINDOW_SIZE_DEFAULT QSize(600, 800)
#define WINDOW_POS_SETTING "pos"
#define WINDOW_POS_DEFAULT QPoint(10, 10)
#define SETTINGS_SETTINGS_GROUP "Settings"
#define UNITS_SETTING "units"
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
#define SHOW_TOOLBARS_SETTING "toolbar"
#define SHOW_TOOLBARS_DEFAULT true
#define GRAPH_SETTINGS_GROUP "Graph"
#define SHOW_GRAPHS_SETTING "show"
#define SHOW_GRAPHS_DEFAULT true
#define GRAPH_TYPE_SETTING "type"
#define GRAPH_TYPE_DEFAULT Distance
#define SHOW_GRAPH_GRIDS_SETTING "grid"
#define SHOW_GRAPH_GRIDS_DEFAULT true
#define MAP_SETTINGS_GROUP "Map"
#define CURRENT_MAP_SETTING "map"
#define SHOW_MAP_SETTING "show"
#define SHOW_MAP_DEFAULT true
#define POI_SETTINGS_GROUP "POI"
#define OVERLAP_POI_SETTING "overlap"
#define OVERLAP_POI_DEFAULT false
#define LABELS_POI_SETTING "labels"
#define LABELS_POI_DEFAULT true
#define SHOW_POI_SETTING "show"
#define SHOW_POI_DEFAULT false
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
#define DISABLED_POI_FILE_SETTING "file"
#define DATA_SETTINGS_GROUP "Data"
#define SHOW_TRACKS_SETTING "tracks"
#define SHOW_TRACKS_DEFAULT true
#define SHOW_ROUTES_SETTING "routes"
#define SHOW_ROUTES_DEFAULT true
#define SHOW_WAYPOINTS_SETTING "waypoints"
#define SHOW_WAYPOINTS_DEFAULT true
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
#define SHOW_ROUTE_WAYPOINTS_DEFAULT true
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
#define SHOW_WAYPOINT_LABELS_DEFAULT true
#define EXPORT_SETTINGS_GROUP "Export"
#define PAPER_ORIENTATION_SETTING "orientation"
#define PAPER_ORIENTATION_DEFAULT QPrinter::Portrait
#define PAPER_SIZE_SETTING "size"
#define PAPER_SIZE_DEFAULT (IMPERIAL_UNITS() ? QPrinter::Letter \
: QPrinter::A4)
#define MARGIN_LEFT_SETTING "marginLeft"
#define MARGIN_LEFT_DEFAULT 5 /* mm */
#define MARGIN_TOP_SETTING "marginTop"
#define MARGIN_TOP_DEFAULT 5 /* mm */
#define MARGIN_RIGHT_SETTING "marginRight"
#define MARGIN_RIGHT_DEFAULT 5 /* mm */
#define MARGIN_BOTTOM_SETTING "marginBottom"
#define MARGIN_BOTTOM_DEFAULT 5 /* mm */
#define EXPORT_FILENAME_SETTING "fileName"
#define EXPORT_FILENAME_DEFAULT QString("%1/export.pdf"). \
arg(QDir::currentPath())
#define OPTIONS_SETTINGS_GROUP "Options"
#define PALETTE_COLOR_SETTING "paletteColor"
#define PALETTE_COLOR_DEFAULT QColor(Qt::blue)
#define PALETTE_SHIFT_SETTING "paletteShift"
#define PALETTE_SHIFT_DEFAULT 0.62
#define TRACK_WIDTH_SETTING "trackWidth"
#define TRACK_WIDTH_DEFAULT 3
#define ROUTE_WIDTH_SETTING "routeWidth"
#define ROUTE_WIDTH_DEFAULT 3
#define TRACK_STYLE_SETTING "trackStyle"
#define TRACK_STYLE_DEFAULT Qt::SolidLine
#define ROUTE_STYLE_SETTING "routeStyle"
#define ROUTE_STYLE_DEFAULT Qt::DotLine
#define GRAPH_WIDTH_SETTING "graphWidth"
#define GRAPH_WIDTH_DEFAULT 1
#define PATH_AA_SETTING "pathAntiAliasing"
#define PATH_AA_DEFAULT true
#define GRAPH_AA_SETTING "graphAntiAliasing"
#define GRAPH_AA_DEFAULT false
#define POI_RADIUS_SETTING "poiRadius"
#define POI_RADIUS_DEFAULT (IMPERIAL_UNITS() ? MIINM : KMINM)
#define USE_OPENGL_SETTING "useOpenGL"
#define USE_OPENGL_DEFAULT false
#define PRINT_NAME_SETTING "printName"
#define PRINT_NAME_DEFAULT true
#define PRINT_DATE_SETTING "printDate"
#define PRINT_DATE_DEFAULT true
#define PRINT_DISTANCE_SETTING "printDistance"
#define PRINT_DISTANCE_DEFAULT true
#define PRINT_TIME_SETTING "printTime"
#define PRINT_TIME_DEFAULT true
#define PRINT_ITEM_COUNT_SETTING "printItemCount"
#define PRINT_ITEM_COUNT_DEFAULT true
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
#define SEPARATE_GRAPH_PAGE_DEFAULT false
#endif // SETTINGS_H

View File

@ -32,9 +32,11 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
font.setPixelSize(FONT_SIZE);
font.setFamily(FONT_FAMILY);
QFontMetrics fm(font);
painter->setFont(font);
painter->setFont(font);
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setPen(Qt::red);
if (_side == Right)
painter->drawText(SIZE, fm.height() - fm.descent(), _text);
else

44
src/stylecombobox.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <QPen>
#include <QPainter>
#include <QResizeEvent>
#include "stylecombobox.h"
#define MIN_LINE_LENGTH 60
#define LINE_WIDTH_RATIO 7
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
StyleComboBox::StyleComboBox(QWidget *parent) : QComboBox(parent)
{
Qt::PenStyle styles[] = {Qt::SolidLine, Qt::DashLine, Qt::DotLine,
Qt::DashDotLine, Qt::DashDotDotLine};
QSize is = iconSize();
setIconSize(QSize(MIN_LINE_LENGTH, is.height()));
is = iconSize();
for (size_t i = 0; i < ARRAY_SIZE(styles); i++) {
QPixmap pm(is);
pm.fill(Qt::transparent);
QBrush brush(Qt::black);
QPen pen(brush, is.height() / LINE_WIDTH_RATIO, styles[i]);
QPainter painter(&pm);
painter.setPen(pen);
painter.drawLine(0, is.height() / 2, is.width(), is.height() / 2);
addItem(QIcon(pm), QString(), QVariant((int)styles[i]));
}
}
void StyleComboBox::setValue(Qt::PenStyle value)
{
for (int i = 0; i < count(); i++) {
if ((Qt::PenStyle) itemData(i).toInt() == value) {
setCurrentIndex(i);
return;
}
}
}

16
src/stylecombobox.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef STYLECOMBOBOX_H
#define STYLECOMBOBOX_H
#include <QComboBox>
class StyleComboBox : public QComboBox
{
Q_OBJECT
public:
StyleComboBox(QWidget *parent = 0);
void setValue(Qt::PenStyle value);
};
#endif // STYLECOMBOBOX_H

View File

@ -16,14 +16,14 @@ enum Units {
#define H2S 0.000277777778 // h -> s
#define MIN2S 0.016666666667 // min -> s
#define KMINM 1000 // 1 km in m
#define MIINFT 5280 // 1 mi in ft
#define KMINM 1000.0 // 1 km in m
#define MIINFT 5280.0 // 1 mi in ft
#define MIINM 1609.344 // 1 mi in m
#define MININS 60 // 1 min in s
#define HINS 3600 // 1 hins
#define MININS 60.0 // 1 min in s
#define HINS 3600.0 // 1 hins
#define C2FS 1.8 // Celsius to Farenheit - scale
#define C2FO 32 // Celsius to Farenheit - offset
#define C2FS 1.8 // Celsius to Farenheit - scale
#define C2FO 32.0 // Celsius to Farenheit - offset
#ifdef Q_OS_WIN32
#define UNIT_SPACE QString(" ")

View File

@ -48,7 +48,7 @@ inline uint qHash(const Waypoint &key)
return ::qHash(key.name());
}
QDebug operator<<(QDebug dbg, const Waypoint &Waypoint);
QDebug operator<<(QDebug dbg, const Waypoint &waypoint);
Q_DECLARE_TYPEINFO(Waypoint, Q_MOVABLE_TYPE);