1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Yet another bunch of print/PDF export improvements

This commit is contained in:
Martin Tůma 2016-05-21 16:10:24 +02:00
parent eae8e23c6c
commit daf4ef894c
7 changed files with 159 additions and 158 deletions

View File

@ -59,385 +59,358 @@
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="455"/> <location filename="../src/gui.cpp" line="458"/>
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source> <source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation> <translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="519"/> <location filename="../src/gui.cpp" line="522"/>
<source>Open file</source> <source>Open file</source>
<translation>Otevřít soubor</translation> <translation>Otevřít soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="591"/> <location filename="../src/gui.cpp" line="599"/>
<source>Open POI file</source> <source>Open POI file</source>
<translation>Otevřít POI soubor</translation> <translation>Otevřít POI soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="195"/> <location filename="../src/gui.cpp" line="198"/>
<source>Open</source> <source>Open</source>
<translation>Otevřít</translation> <translation>Otevřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="179"/> <location filename="../src/gui.cpp" line="182"/>
<source>Quit</source> <source>Quit</source>
<translation>Ukončit</translation> <translation>Ukončit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="187"/> <location filename="../src/gui.cpp" line="190"/>
<location filename="../src/gui.cpp" line="471"/> <location filename="../src/gui.cpp" line="474"/>
<location filename="../src/gui.cpp" line="472"/> <location filename="../src/gui.cpp" line="475"/>
<source>Keyboard controls</source> <source>Keyboard controls</source>
<translation>Ovládací klávesy</translation> <translation>Ovládací klávesy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="215"/> <location filename="../src/gui.cpp" line="218"/>
<source>Close</source> <source>Close</source>
<translation>Zavřít</translation> <translation>Zavřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="221"/> <location filename="../src/gui.cpp" line="224"/>
<source>Reload</source> <source>Reload</source>
<translation>Znovu načíst</translation> <translation>Znovu načíst</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="378"/> <location filename="../src/gui.cpp" line="381"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="318"/> <location filename="../src/gui.cpp" line="321"/>
<location filename="../src/gui.cpp" line="372"/> <location filename="../src/gui.cpp" line="375"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="185"/> <location filename="../src/gui.cpp" line="188"/>
<location filename="../src/gui.cpp" line="494"/> <location filename="../src/gui.cpp" line="497"/>
<location filename="../src/gui.cpp" line="495"/> <location filename="../src/gui.cpp" line="498"/>
<source>Data sources</source> <source>Data sources</source>
<translation>Zdroje dat</translation> <translation>Zdroje dat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="200"/> <location filename="../src/gui.cpp" line="203"/>
<source>Print</source> <source>Print</source>
<translation>Tisknout</translation> <translation>Tisknout</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="205"/> <location filename="../src/gui.cpp" line="208"/>
<source>Export</source> <source>Export</source>
<translation>Exportovat</translation> <translation>Exportovat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="211"/> <location filename="../src/gui.cpp" line="214"/>
<source>Export as</source> <source>Export as</source>
<translation>Exportovat jako</translation> <translation>Exportovat jako</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="229"/> <location filename="../src/gui.cpp" line="232"/>
<source>Load POI file</source> <source>Load POI file</source>
<translation>Nahrát POI soubor</translation> <translation>Nahrát POI soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="232"/> <location filename="../src/gui.cpp" line="235"/>
<source>Close POI files</source> <source>Close POI files</source>
<translation>Zavřit POI soubory</translation> <translation>Zavřit POI soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="235"/> <location filename="../src/gui.cpp" line="238"/>
<source>Show POIs</source> <source>Show POIs</source>
<translation>Zobrazit POI</translation> <translation>Zobrazit POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="243"/> <location filename="../src/gui.cpp" line="246"/>
<source>Show map</source> <source>Show map</source>
<translation>Zobrazit mapu</translation> <translation>Zobrazit mapu</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="249"/> <location filename="../src/gui.cpp" line="252"/>
<source>Clear tile cache</source> <source>Clear tile cache</source>
<translation>Vymazat mezipaměť dlaždic</translation> <translation>Vymazat mezipaměť dlaždic</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="258"/> <location filename="../src/gui.cpp" line="261"/>
<location filename="../src/gui.cpp" line="262"/> <location filename="../src/gui.cpp" line="265"/>
<location filename="../src/gui.cpp" line="481"/> <location filename="../src/gui.cpp" line="484"/>
<source>Next map</source> <source>Next map</source>
<translation>Následující mapa</translation> <translation>Následující mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="269"/> <location filename="../src/gui.cpp" line="272"/>
<source>Show graphs</source> <source>Show graphs</source>
<translation>Zobrazovat grafy</translation> <translation>Zobrazovat grafy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="275"/> <location filename="../src/gui.cpp" line="278"/>
<source>Show toolbars</source> <source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation> <translation>Zobrazovat nástrojové lišty</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="281"/> <location filename="../src/gui.cpp" line="284"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="286"/> <location filename="../src/gui.cpp" line="289"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="292"/> <location filename="../src/gui.cpp" line="295"/>
<source>Fullscreen mode</source> <source>Fullscreen mode</source>
<translation>Celoobrazovkový režim</translation> <translation>Celoobrazovkový režim</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="300"/> <location filename="../src/gui.cpp" line="303"/>
<source>Next</source> <source>Next</source>
<translation>Následující</translation> <translation>Následující</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="303"/> <location filename="../src/gui.cpp" line="306"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="307"/> <location filename="../src/gui.cpp" line="310"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="310"/> <location filename="../src/gui.cpp" line="313"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="333"/> <location filename="../src/gui.cpp" line="336"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="340"/> <location filename="../src/gui.cpp" line="343"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="341"/> <location filename="../src/gui.cpp" line="344"/>
<source>POI files</source> <source>POI files</source>
<translation>POI soubory</translation> <translation>POI soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="349"/> <location filename="../src/gui.cpp" line="352"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="350"/> <location filename="../src/gui.cpp" line="353"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="359"/> <location filename="../src/gui.cpp" line="362"/>
<source>Help</source> <source>Help</source>
<translation>Nápověda</translation> <translation>Nápověda</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="483"/> <location filename="../src/gui.cpp" line="486"/>
<source>Previous map</source> <source>Previous map</source>
<translation>Předchozí mapa</translation> <translation>Předchozí mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="646"/> <location filename="../src/gui.cpp" line="654"/>
<source>Export to PDF</source> <source>Export to PDF</source>
<translation>Exportovat do PDF</translation> <translation>Exportovat do PDF</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="842"/> <location filename="../src/gui.cpp" line="690"/>
<location filename="../src/gui.cpp" line="693"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="866"/>
<source>No GPX files loaded</source> <source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation> <translation>Nejsou načteny žádné GPX soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="417"/> <location filename="../src/gui.cpp" line="420"/>
<source>Elevation</source> <source>Elevation</source>
<translation>Výška</translation> <translation>Výška</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="418"/> <location filename="../src/gui.cpp" line="421"/>
<source>Speed</source> <source>Speed</source>
<translation>Rychlost</translation> <translation>Rychlost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="419"/> <location filename="../src/gui.cpp" line="422"/>
<source>Heart rate</source> <source>Heart rate</source>
<translation>Tep</translation> <translation>Tep</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="474"/> <location filename="../src/gui.cpp" line="477"/>
<source>Next file</source> <source>Next file</source>
<translation>Následující soubor</translation> <translation>Následující soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="451"/> <location filename="../src/gui.cpp" line="454"/>
<source>Version </source> <source>Version </source>
<translation>Verze </translation> <translation>Verze </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="475"/> <location filename="../src/gui.cpp" line="478"/>
<source>Previous file</source> <source>Previous file</source>
<translation>Předchozí soubor</translation> <translation>Předchozí soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="477"/> <location filename="../src/gui.cpp" line="480"/>
<source>First file</source> <source>First file</source>
<translation>První soubor</translation> <translation>První soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="478"/> <location filename="../src/gui.cpp" line="481"/>
<source>Last file</source> <source>Last file</source>
<translation>Poslední soubor</translation> <translation>Poslední soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="479"/> <location filename="../src/gui.cpp" line="482"/>
<source>Append modifier</source> <source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation> <translation>Modifikátor nahradit/přidat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="498"/> <location filename="../src/gui.cpp" line="501"/>
<source>Map (tiles) source URLs are read on program startup from the following file:</source> <source>Map (tiles) source URLs are read on program startup from the following file:</source>
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation> <translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="501"/> <location filename="../src/gui.cpp" line="504"/>
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source> <source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation> <translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="509"/> <location filename="../src/gui.cpp" line="512"/>
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source> <source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation> <translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="520"/> <location filename="../src/gui.cpp" line="523"/>
<source>GPX files (*.gpx);;All files (*)</source> <source>GPX files (*.gpx);;All files (*)</source>
<translation>soubory GPX (*.gpx);;všechny soubory (*)</translation> <translation>soubory GPX (*.gpx);;všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="582"/> <location filename="../src/gui.cpp" line="590"/>
<location filename="../src/gui.cpp" line="608"/> <location filename="../src/gui.cpp" line="616"/>
<source>Line: %1</source> <source>Line: %1</source>
<translation>Řádka: %1</translation> <translation>Řádka: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="592"/> <location filename="../src/gui.cpp" line="600"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source> <source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation> <translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="682"/> <location filename="../src/gui.cpp" line="701"/>
<location filename="../src/gui.cpp" line="857"/> <location filename="../src/gui.cpp" line="881"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="685"/> <location filename="../src/gui.cpp" line="878"/>
<location filename="../src/gui.cpp" line="687"/>
<location filename="../src/gui.cpp" line="689"/>
<location filename="../src/gui.cpp" line="691"/>
<location filename="../src/gui.cpp" line="854"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="688"/> <location filename="../src/gui.cpp" line="193"/>
<location filename="../src/gui.cpp" line="700"/> <location filename="../src/gui.cpp" line="452"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="690"/>
<location filename="../src/gui.cpp" line="702"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="190"/>
<location filename="../src/gui.cpp" line="449"/>
<source>About GPXSee</source> <source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation> <translation>O aplikaci GPXSee</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="382"/> <location filename="../src/gui.cpp" line="385"/>
<source>Navigation</source> <source>Navigation</source>
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="497"/> <location filename="../src/gui.cpp" line="500"/>
<source>Map sources</source> <source>Map sources</source>
<translation>Mapové zdroje</translation> <translation>Mapové zdroje</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="508"/> <location filename="../src/gui.cpp" line="511"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="681"/> <location filename="../src/gui.cpp" line="700"/>
<location filename="../src/gui.cpp" line="693"/> <location filename="../src/gui.cpp" line="703"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="683"/> <location filename="../src/gui.cpp" line="708"/>
<location filename="../src/gui.cpp" line="695"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="684"/> <location filename="../src/gui.cpp" line="885"/>
<location filename="../src/gui.cpp" line="696"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="697"/>
<location filename="../src/gui.cpp" line="699"/>
<location filename="../src/gui.cpp" line="701"/>
<location filename="../src/gui.cpp" line="703"/>
<location filename="../src/gui.cpp" line="861"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="686"/> <location filename="../src/gui.cpp" line="873"/>
<location filename="../src/gui.cpp" line="698"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="849"/>
<source>%1 tracks</source> <source>%1 tracks</source>
<translation>Počet tras: %1</translation> <translation>Počet tras: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="694"/> <location filename="../src/gui.cpp" line="704"/>
<location filename="../src/gui.cpp" line="864"/> <location filename="../src/gui.cpp" line="888"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="584"/> <location filename="../src/gui.cpp" line="592"/>
<location filename="../src/gui.cpp" line="609"/> <location filename="../src/gui.cpp" line="617"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="579"/> <location filename="../src/gui.cpp" line="587"/>
<source>Error loading GPX file: <source>Error loading GPX file:
%1</source> %1</source>
<translation>Soubor GPX nelze otevřít: <translation>Soubor GPX nelze otevřít:
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="605"/> <location filename="../src/gui.cpp" line="613"/>
<source>Error loading POI file: <source>Error loading POI file:
%1</source> %1</source>
<translation>Soubor POI nelze otevřít: <translation>Soubor POI nelze otevřít:
@ -495,22 +468,22 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../src/scaleitem.cpp" line="83"/> <location filename="../src/scaleitem.cpp" line="81"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/scaleitem.cpp" line="83"/> <location filename="../src/scaleitem.cpp" line="81"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/scaleitem.cpp" line="85"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/scaleitem.cpp" line="85"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>

View File

@ -1,7 +1,6 @@
#include <QGraphicsView> #include <QGraphicsView>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QEvent> #include <QEvent>
#include <QGraphicsSimpleTextItem>
#include "config.h" #include "config.h"
#include "axisitem.h" #include "axisitem.h"
#include "slideritem.h" #include "slideritem.h"
@ -244,10 +243,9 @@ void GraphView::plot(QPainter *painter, const QRectF &target)
setUpdatesEnabled(false); setUpdatesEnabled(false);
redraw(canvas); redraw(canvas);
_slider->hide(); if (_slider->pos().x() == _slider->area().left())
_scene->removeItem(_info); _slider->hide();
_scene->render(painter, target, _scene->itemsBoundingRect()); _scene->render(painter, target, _scene->itemsBoundingRect());
_scene->addItem(_info);
_slider->show(); _slider->show();
redraw(); redraw();
setUpdatesEnabled(true); setUpdatesEnabled(true);

View File

@ -33,6 +33,10 @@
#include "gui.h" #include "gui.h"
#define PLOT_INFO_HEIGHT 200
#define PLOT_MARGIN 100
#define PLOT_GRAPH_RATIO 0.2
static QString timeSpan(qreal time) static QString timeSpan(qreal time)
{ {
unsigned h, m, s; unsigned h, m, s;
@ -45,7 +49,6 @@ static QString timeSpan(qreal time)
.arg(s, 2, 10, QChar('0')); .arg(s, 2, 10, QChar('0'));
} }
GUI::GUI(QWidget *parent) : QMainWindow(parent) GUI::GUI(QWidget *parent) : QMainWindow(parent)
{ {
loadMaps(); loadMaps();
@ -569,6 +572,11 @@ bool GUI::loadFile(const QString &fileName)
for (int i = 0; i < gpx.trackCount(); i++) { for (int i = 0; i < gpx.trackCount(); i++) {
_distance += gpx.track(i).distance(); _distance += gpx.track(i).distance();
_time += gpx.track(i).time(); _time += gpx.track(i).time();
const QDate &date = gpx.track(i).date().date();
if (_dateRange.first.isNull() || _dateRange.first > date)
_dateRange.first = date;
if (_dateRange.second.isNull() || _dateRange.second < date)
_dateRange.second = date;
} }
_trackCount += gpx.trackCount(); _trackCount += gpx.trackCount();
@ -674,45 +682,53 @@ void GUI::exportFile(const QString &fileName)
void GUI::plot(QPrinter *printer) void GUI::plot(QPrinter *printer)
{ {
QPainter p(printer); QPainter p(printer);
TrackInfo info; TrackInfo info;
if (_imperialUnitsAction->isChecked()) { if (_dateRange.first.isValid()) {
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1) if (_dateRange.first == _dateRange.second) {
+ UNIT_SPACE + tr("mi")); QString format = QLocale::system().dateFormat(QLocale::LongFormat);
info.insert(tr("Time"), timeSpan(_time)); info.insert(tr("Date"), _dateRange.first.toString(format));
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent() } else {
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft")); QString format = QLocale::system().dateFormat(QLocale::ShortFormat);
info.insert(tr("Descent"), QString::number(_elevationGraph->descent() info.insert(tr("Date"), QString("%1 - %2")
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft")); .arg(_dateRange.first.toString(format),
info.insert(tr("Maximum"), QString::number(_elevationGraph->max() _dateRange.second.toString(format)));
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft")); }
info.insert(tr("Minimum"), QString::number(_elevationGraph->min()
* M2FT, 'f', 0) + UNIT_SPACE + tr("ft"));
} else {
info.insert(tr("Distance"), QString::number(_distance * M2KM, 'f', 1)
+ UNIT_SPACE + tr("km"));
info.insert(tr("Time"), timeSpan(_time));
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent(),
'f', 0) + UNIT_SPACE + tr("m"));
info.insert(tr("Descent"), QString::number(_elevationGraph->descent(),
'f', 0) + UNIT_SPACE + tr("m"));
info.insert(tr("Maximum"), QString::number(_elevationGraph->max(), 'f',
0) + UNIT_SPACE + tr("m"));
info.insert(tr("Minimum"), QString::number(_elevationGraph->min(), 'f',
0) + UNIT_SPACE + tr("m"));
} }
if (_distance > 0) {
if (_imperialUnitsAction->isChecked()) {
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f',
1) + UNIT_SPACE + tr("mi"));
} else {
info.insert(tr("Distance"), QString::number(_distance * M2KM, 'f',
1) + UNIT_SPACE + tr("km"));
}
}
if (_time > 0)
info.insert(tr("Time"), timeSpan(_time));
if (_elevationGraph->count()) {
_track->plot(&p, QRectF(0, 300, printer->width(), if (info.isEmpty()) {
(0.80 * printer->height()) - 400)); if (_trackGraphs->isVisible())
_elevationGraph->plot(&p, QRectF(0, 0.80 * printer->height(), _track->plot(&p, QRectF(0, 0, printer->width(),
printer->width(), printer->height() * 0.20)); ((1.0 - PLOT_GRAPH_RATIO) * printer->height())));
info.plot(&p, QRectF(0, 0, printer->width(), 200)); else
_track->plot(&p, QRectF(0, 0, printer->width(), printer->height()));
} else { } else {
_track->plot(&p, QRectF(0, 300, printer->width(), info.plot(&p, QRectF(0, 0, printer->width(), PLOT_INFO_HEIGHT));
printer->height() - 300)); if (_trackGraphs->isVisible())
info.plot(&p, QRectF(0, 0, printer->width(), 200)); _track->plot(&p, QRectF(0, PLOT_INFO_HEIGHT + PLOT_MARGIN,
printer->width(), ((1.0 - PLOT_GRAPH_RATIO) * printer->height())
- (PLOT_INFO_HEIGHT + 2*PLOT_MARGIN)));
else
_track->plot(&p, QRectF(0, PLOT_INFO_HEIGHT + PLOT_MARGIN,
printer->width(), printer->height()
- (PLOT_INFO_HEIGHT + PLOT_MARGIN)));
}
if (_trackGraphs->isVisible()) {
GraphView *gv = static_cast<GraphView*>(_trackGraphs->currentWidget());
gv->plot(&p, QRectF(0, (1.0 - PLOT_GRAPH_RATIO) * printer->height(),
printer->width(), printer->height() * PLOT_GRAPH_RATIO));
} }
} }
@ -720,6 +736,7 @@ void GUI::reloadFile()
{ {
_distance = 0; _distance = 0;
_time = 0; _time = 0;
_dateRange = DateRange(QDate(), QDate());
_trackCount = 0; _trackCount = 0;
_elevationGraph->clear(); _elevationGraph->clear();
@ -748,6 +765,7 @@ void GUI::closeFiles()
{ {
_distance = 0; _distance = 0;
_time = 0; _time = 0;
_dateRange = DateRange(QDate(), QDate());
_trackCount = 0; _trackCount = 0;
_sliderPos = 0; _sliderPos = 0;
@ -1127,7 +1145,9 @@ void GUI::readSettings()
settings.endGroup(); settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP); settings.beginGroup(SETTINGS_SETTINGS_GROUP);
if (settings.value(UNITS_SETTING, Metric).toInt() == Imperial) { Units u = QLocale::system().measurementSystem() == QLocale::ImperialSystem
? Imperial : Metric;
if (settings.value(UNITS_SETTING, u).toInt() == Imperial) {
setImperialUnits(); setImperialUnits();
_imperialUnitsAction->setChecked(true); _imperialUnitsAction->setChecked(true);
} else } else

View File

@ -4,6 +4,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QString> #include <QString>
#include <QList> #include <QList>
#include <QDate>
#include "poi.h" #include "poi.h"
class QMenu; class QMenu;
@ -69,6 +70,7 @@ private slots:
private: private:
typedef QPair<GraphView *, QString> GraphTab; typedef QPair<GraphView *, QString> GraphTab;
typedef QPair<QDate, QDate> DateRange;
void loadMaps(); void loadMaps();
void loadPOIs(); void loadPOIs();
@ -166,9 +168,10 @@ private:
QString _exportFileName; QString _exportFileName;
Map *_currentMap; Map *_currentMap;
int _trackCount;
qreal _distance; qreal _distance;
qreal _time; qreal _time;
int _trackCount; DateRange _dateRange;
qreal _sliderPos; qreal _sliderPos;

View File

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

View File

@ -16,3 +16,8 @@ void TrackInfo::plot(QPainter *painter, const QRectF &target)
{ {
render(painter, target); render(painter, target);
} }
bool TrackInfo::isEmpty()
{
return _info->isEmpty();
}

View File

@ -14,6 +14,7 @@ public:
void insert(const QString &key, const QString &value); void insert(const QString &key, const QString &value);
void plot(QPainter *painter, const QRectF &target); void plot(QPainter *painter, const QRectF &target);
bool isEmpty();
private: private:
InfoItem *_info; InfoItem *_info;