1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Added printing support

"Save" is now "Export"
This commit is contained in:
Martin Tůma 2016-05-15 22:38:15 +02:00
parent 36937d8f2d
commit 511deada2e
10 changed files with 172 additions and 143 deletions

View File

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

BIN
icons/document-export.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
icons/document-print.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

View File

@ -59,375 +59,380 @@
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="450"/> <location filename="../src/gui.cpp" line="457"/>
<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="514"/> <location filename="../src/gui.cpp" line="521"/>
<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="211"/> <location filename="../src/gui.cpp" line="593"/>
<source>Save as</source>
<translation>Uložit jako</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="586"/>
<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="200"/> <location filename="../src/gui.cpp" line="202"/>
<source>Open</source> <source>Open</source>
<translation>Otevřít</translation> <translation>Otevřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="184"/> <location filename="../src/gui.cpp" line="186"/>
<source>Quit</source> <source>Quit</source>
<translation>Ukončit</translation> <translation>Ukončit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="192"/> <location filename="../src/gui.cpp" line="194"/>
<location filename="../src/gui.cpp" line="466"/> <location filename="../src/gui.cpp" line="473"/>
<location filename="../src/gui.cpp" line="467"/> <location filename="../src/gui.cpp" line="474"/>
<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="205"/> <location filename="../src/gui.cpp" line="222"/>
<source>Save</source>
<translation>Uložit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="217"/>
<source>Close</source> <source>Close</source>
<translation>Zavřít</translation> <translation>Zavřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="223"/> <location filename="../src/gui.cpp" line="228"/>
<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="387"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="320"/> <location filename="../src/gui.cpp" line="325"/>
<location filename="../src/gui.cpp" line="369"/> <location filename="../src/gui.cpp" line="381"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="190"/> <location filename="../src/gui.cpp" line="192"/>
<location filename="../src/gui.cpp" line="489"/> <location filename="../src/gui.cpp" line="496"/>
<location filename="../src/gui.cpp" line="490"/> <location filename="../src/gui.cpp" line="497"/>
<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="231"/> <location filename="../src/gui.cpp" line="207"/>
<source>Print</source>
<translation>Tisknout</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="212"/>
<source>Export</source>
<translation>Exportovat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="217"/>
<source>Export as</source>
<translation>Exportovat jako</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="236"/>
<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="234"/> <location filename="../src/gui.cpp" line="239"/>
<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="237"/> <location filename="../src/gui.cpp" line="242"/>
<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="245"/> <location filename="../src/gui.cpp" line="250"/>
<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="251"/> <location filename="../src/gui.cpp" line="256"/>
<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="260"/> <location filename="../src/gui.cpp" line="265"/>
<location filename="../src/gui.cpp" line="264"/> <location filename="../src/gui.cpp" line="269"/>
<location filename="../src/gui.cpp" line="476"/> <location filename="../src/gui.cpp" line="483"/>
<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="271"/> <location filename="../src/gui.cpp" line="276"/>
<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="277"/> <location filename="../src/gui.cpp" line="282"/>
<source>Show toolbars</source> <source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation> <translation>Zobrazovat nástrojové lišty</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="283"/> <location filename="../src/gui.cpp" line="288"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="288"/> <location filename="../src/gui.cpp" line="293"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="294"/> <location filename="../src/gui.cpp" line="299"/>
<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="302"/> <location filename="../src/gui.cpp" line="307"/>
<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="305"/> <location filename="../src/gui.cpp" line="310"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="309"/> <location filename="../src/gui.cpp" line="314"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="312"/> <location filename="../src/gui.cpp" line="317"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="334"/> <location filename="../src/gui.cpp" line="340"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="341"/> <location filename="../src/gui.cpp" line="347"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="342"/> <location filename="../src/gui.cpp" line="348"/>
<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="350"/> <location filename="../src/gui.cpp" line="356"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="351"/> <location filename="../src/gui.cpp" line="357"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="360"/> <location filename="../src/gui.cpp" line="366"/>
<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="478"/> <location filename="../src/gui.cpp" line="485"/>
<source>Previous map</source> <source>Previous map</source>
<translation>Předchozí mapa</translation> <translation>Předchozí mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="822"/> <location filename="../src/gui.cpp" line="844"/>
<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="931"/> <location filename="../src/gui.cpp" line="426"/>
<source>Elevation</source> <source>Elevation</source>
<translation>Výška</translation> <translation>Výška</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="932"/> <location filename="../src/gui.cpp" line="427"/>
<source>Speed</source> <source>Speed</source>
<translation>Rychlost</translation> <translation>Rychlost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="933"/> <location filename="../src/gui.cpp" line="428"/>
<source>Heart rate</source> <source>Heart rate</source>
<translation>Tep</translation> <translation>Tep</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="469"/> <location filename="../src/gui.cpp" line="476"/>
<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="446"/> <location filename="../src/gui.cpp" line="453"/>
<source>Version </source> <source>Version </source>
<translation>Verze </translation> <translation>Verze </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="470"/> <location filename="../src/gui.cpp" line="477"/>
<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="472"/> <location filename="../src/gui.cpp" line="479"/>
<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="473"/> <location filename="../src/gui.cpp" line="480"/>
<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="474"/> <location filename="../src/gui.cpp" line="481"/>
<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="493"/> <location filename="../src/gui.cpp" line="500"/>
<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="496"/> <location filename="../src/gui.cpp" line="503"/>
<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="504"/> <location filename="../src/gui.cpp" line="511"/>
<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="515"/> <location filename="../src/gui.cpp" line="522"/>
<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="577"/> <location filename="../src/gui.cpp" line="584"/>
<location filename="../src/gui.cpp" line="603"/> <location filename="../src/gui.cpp" line="610"/>
<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="587"/> <location filename="../src/gui.cpp" line="594"/>
<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="662"/> <location filename="../src/gui.cpp" line="684"/>
<location filename="../src/gui.cpp" line="837"/> <location filename="../src/gui.cpp" line="859"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="665"/> <location filename="../src/gui.cpp" line="687"/>
<location filename="../src/gui.cpp" line="667"/> <location filename="../src/gui.cpp" line="689"/>
<location filename="../src/gui.cpp" line="669"/> <location filename="../src/gui.cpp" line="691"/>
<location filename="../src/gui.cpp" line="671"/> <location filename="../src/gui.cpp" line="693"/>
<location filename="../src/gui.cpp" line="834"/> <location filename="../src/gui.cpp" line="856"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="668"/> <location filename="../src/gui.cpp" line="690"/>
<location filename="../src/gui.cpp" line="680"/> <location filename="../src/gui.cpp" line="702"/>
<source>Maximum</source> <source>Maximum</source>
<translation>Maximum</translation> <translation>Maximum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="670"/> <location filename="../src/gui.cpp" line="692"/>
<location filename="../src/gui.cpp" line="682"/> <location filename="../src/gui.cpp" line="704"/>
<source>Minimum</source> <source>Minimum</source>
<translation>Minimum</translation> <translation>Minimum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="195"/> <location filename="../src/gui.cpp" line="197"/>
<location filename="../src/gui.cpp" line="444"/> <location filename="../src/gui.cpp" line="451"/>
<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="385"/> <location filename="../src/gui.cpp" line="391"/>
<source>Navigation</source> <source>Navigation</source>
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="492"/> <location filename="../src/gui.cpp" line="499"/>
<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="503"/> <location filename="../src/gui.cpp" line="510"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="661"/> <location filename="../src/gui.cpp" line="683"/>
<location filename="../src/gui.cpp" line="673"/> <location filename="../src/gui.cpp" line="695"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="663"/> <location filename="../src/gui.cpp" line="685"/>
<location filename="../src/gui.cpp" line="675"/> <location filename="../src/gui.cpp" line="697"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="664"/> <location filename="../src/gui.cpp" line="686"/>
<location filename="../src/gui.cpp" line="676"/> <location filename="../src/gui.cpp" line="698"/>
<source>Ascent</source> <source>Ascent</source>
<translation>Stoupání</translation> <translation>Stoupání</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="677"/> <location filename="../src/gui.cpp" line="699"/>
<location filename="../src/gui.cpp" line="679"/> <location filename="../src/gui.cpp" line="701"/>
<location filename="../src/gui.cpp" line="681"/> <location filename="../src/gui.cpp" line="703"/>
<location filename="../src/gui.cpp" line="683"/> <location filename="../src/gui.cpp" line="705"/>
<location filename="../src/gui.cpp" line="841"/> <location filename="../src/gui.cpp" line="863"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="666"/> <location filename="../src/gui.cpp" line="688"/>
<location filename="../src/gui.cpp" line="678"/> <location filename="../src/gui.cpp" line="700"/>
<source>Descent</source> <source>Descent</source>
<translation>Klesání</translation> <translation>Klesání</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="829"/> <location filename="../src/gui.cpp" line="851"/>
<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="674"/> <location filename="../src/gui.cpp" line="696"/>
<location filename="../src/gui.cpp" line="844"/> <location filename="../src/gui.cpp" line="866"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="579"/> <location filename="../src/gui.cpp" line="586"/>
<location filename="../src/gui.cpp" line="604"/> <location filename="../src/gui.cpp" line="611"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="574"/> <location filename="../src/gui.cpp" line="581"/>
<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="600"/> <location filename="../src/gui.cpp" line="607"/>
<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:

View File

@ -4,6 +4,7 @@
#include <QStatusBar> #include <QStatusBar>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QPrintDialog>
#include <QPrinter> #include <QPrinter>
#include <QPainter> #include <QPainter>
#include <QKeyEvent> #include <QKeyEvent>
@ -202,18 +203,21 @@ void GUI::createActions()
_openFileAction->setShortcut(OPEN_SHORTCUT); _openFileAction->setShortcut(OPEN_SHORTCUT);
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
addAction(_openFileAction); addAction(_openFileAction);
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)), _printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)),
tr("Save"), this); tr("Print"), this);
_saveFileAction->setShortcut(SAVE_SHORTCUT); _printFileAction->setActionGroup(_fileActionGroup);
_saveFileAction->setActionGroup(_fileActionGroup); connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile())); addAction(_printFileAction);
addAction(_saveFileAction); _exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)), tr("Export"), this);
tr("Save as"), this); _exportFileAction->setShortcut(EXPORT_SHORTCUT);
_saveAsAction->setShortcut(SAVE_AS_SHORTCUT); _exportFileAction->setActionGroup(_fileActionGroup);
_saveAsAction->setActionGroup(_fileActionGroup); connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); addAction(_exportFileAction);
addAction(_saveAsAction); _exportAsAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
tr("Export as"), this);
_exportAsAction->setActionGroup(_fileActionGroup);
connect(_exportAsAction, SIGNAL(triggered()), this, SLOT(exportAs()));
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
tr("Close"), this); tr("Close"), this);
_closeFileAction->setShortcut(CLOSE_SHORTCUT); _closeFileAction->setShortcut(CLOSE_SHORTCUT);
@ -321,8 +325,9 @@ void GUI::createMenus()
_fileMenu = menuBar()->addMenu(tr("File")); _fileMenu = menuBar()->addMenu(tr("File"));
_fileMenu->addAction(_openFileAction); _fileMenu->addAction(_openFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_saveFileAction); _fileMenu->addAction(_printFileAction);
_fileMenu->addAction(_saveAsAction); _fileMenu->addAction(_exportFileAction);
_fileMenu->addAction(_exportAsAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_reloadFileAction); _fileMenu->addAction(_reloadFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
@ -375,9 +380,10 @@ void GUI::createToolBars()
_fileToolBar = addToolBar(tr("File")); _fileToolBar = addToolBar(tr("File"));
_fileToolBar->addAction(_openFileAction); _fileToolBar->addAction(_openFileAction);
_fileToolBar->addAction(_saveFileAction);
_fileToolBar->addAction(_reloadFileAction); _fileToolBar->addAction(_reloadFileAction);
_fileToolBar->addAction(_closeFileAction); _fileToolBar->addAction(_closeFileAction);
_fileToolBar->addAction(_exportFileAction);
_fileToolBar->addAction(_printFileAction);
_showToolBar = addToolBar(tr("Show")); _showToolBar = addToolBar(tr("Show"));
_showToolBar->addAction(_showPOIAction); _showToolBar->addAction(_showPOIAction);
@ -629,26 +635,35 @@ void GUI::closePOIFiles()
_poi.clear(); _poi.clear();
} }
void GUI::saveAs() void GUI::printFile()
{
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);
if (printDialog.exec() == QDialog::Accepted)
plot(&printer);
}
void GUI::exportAs()
{ {
QString fileName = QFileDialog::getSaveFileName(this, "Export to PDF", QString fileName = QFileDialog::getSaveFileName(this, "Export to PDF",
QString(), "*.pdf"); QString(), "*.pdf");
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
saveFile(fileName); exportFile(fileName);
_saveFileName = fileName; _exportFileName = fileName;
} }
} }
void GUI::saveFile() void GUI::exportFile()
{ {
if (_saveFileName.isEmpty()) if (_exportFileName.isEmpty())
emit saveAs(); emit exportAs();
else else
saveFile(_saveFileName); exportFile(_exportFileName);
} }
void GUI::saveFile(const QString &fileName) void GUI::exportFile(const QString &fileName)
{ {
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
printer.setPageSize(QPrinter::A4); printer.setPageSize(QPrinter::A4);
@ -656,9 +671,15 @@ void GUI::saveFile(const QString &fileName)
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName); printer.setOutputFileName(fileName);
QPainter p(&printer); plot(&printer);
}
void GUI::plot(QPrinter *printer)
{
QPainter p(printer);
TrackInfo info; TrackInfo info;
if (_imperialUnitsAction->isChecked()) { if (_imperialUnitsAction->isChecked()) {
info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1) info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1)
+ UNIT_SPACE + tr("mi")); + UNIT_SPACE + tr("mi"));
@ -685,11 +706,11 @@ void GUI::saveFile(const QString &fileName)
0) + UNIT_SPACE + tr("m")); 0) + UNIT_SPACE + tr("m"));
} }
_track->plot(&p, QRectF(0, 300, printer.width(), (0.80 * printer.height()) _track->plot(&p, QRectF(0, 300, printer->width(), (0.80 * printer->height())
- 400)); - 400));
_elevationGraph->plot(&p, QRectF(0, 0.80 * printer.height(), _elevationGraph->plot(&p, QRectF(0, 0.80 * printer->height(),
printer.width(), printer.height() * 0.20)); printer->width(), printer->height() * 0.20));
info.plot(&p, QRectF(0, 0, printer.width(), 200)); info.plot(&p, QRectF(0, 0, printer->width(), 200));
} }
void GUI::reloadFile() void GUI::reloadFile()

View File

@ -13,6 +13,7 @@ class QActionGroup;
class QAction; class QAction;
class QLabel; class QLabel;
class QSignalMapper; class QSignalMapper;
class QPrinter;
class FileBrowser; class FileBrowser;
class GraphView; class GraphView;
class ElevationGraph; class ElevationGraph;
@ -35,8 +36,9 @@ private slots:
void about(); void about();
void keys(); void keys();
void dataSources(); void dataSources();
void saveFile(); void printFile();
void saveAs(); void exportFile();
void exportAs();
void openFile(); void openFile();
void closeAll(); void closeAll();
void reloadFile(); void reloadFile();
@ -71,6 +73,7 @@ private:
void loadMaps(); void loadMaps();
void loadPOIs(); void loadPOIs();
void closeFiles(); void closeFiles();
void plot(QPrinter *printer);
QAction *createPOIFileAction(int index); QAction *createPOIFileAction(int index);
void createPOIFilesActions(); void createPOIFilesActions();
@ -84,7 +87,7 @@ private:
bool openPOIFile(const QString &fileName); bool openPOIFile(const QString &fileName);
bool loadFile(const QString &fileName); bool loadFile(const QString &fileName);
void saveFile(const QString &fileName); void exportFile(const QString &fileName);
void updateStatusBarInfo(); void updateStatusBarInfo();
void updateWindowTitle(); void updateWindowTitle();
void updateNavigationActions(); void updateNavigationActions();
@ -118,8 +121,9 @@ private:
QAction *_dataSourcesAction; QAction *_dataSourcesAction;
QAction *_aboutAction; QAction *_aboutAction;
QAction *_aboutQtAction; QAction *_aboutQtAction;
QAction *_saveFileAction; QAction *_printFileAction;
QAction *_saveAsAction; QAction *_exportFileAction;
QAction *_exportAsAction;
QAction *_openFileAction; QAction *_openFileAction;
QAction *_closeFileAction; QAction *_closeFileAction;
QAction *_reloadFileAction; QAction *_reloadFileAction;
@ -159,7 +163,7 @@ private:
FileBrowser *_browser; FileBrowser *_browser;
QList<QString> _files; QList<QString> _files;
QString _saveFileName; QString _exportFileName;
Map *_currentMap; Map *_currentMap;
qreal _distance; qreal _distance;

View File

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

View File

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