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

Added basic PDF export settings

This commit is contained in:
Martin Tůma 2016-05-24 03:01:22 +02:00
parent b8e404b789
commit 82cbbbb52a
8 changed files with 394 additions and 138 deletions

View File

@ -40,7 +40,9 @@ HEADERS += src/config.h \
src/cpuarch.h \ src/cpuarch.h \
src/settings.h \ src/settings.h \
src/app.h \ src/app.h \
src/trackinfo.h src/trackinfo.h \
src/exportdialog.h \
src/fileselectwidget.h
SOURCES += src/main.cpp \ SOURCES += src/main.cpp \
src/gui.cpp \ src/gui.cpp \
src/gpx.cpp \ src/gpx.cpp \
@ -68,7 +70,9 @@ SOURCES += src/main.cpp \
src/heartrategraph.cpp \ src/heartrategraph.cpp \
src/range.cpp \ src/range.cpp \
src/app.cpp \ src/app.cpp \
src/trackinfo.cpp src/trackinfo.cpp \
src/exportdialog.cpp \
src/fileselectwidget.cpp
RESOURCES += gpxsee.qrc RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts TRANSLATIONS = lang/gpxsee_cs.ts
macx { macx {

View File

@ -56,20 +56,108 @@
<translation>Maximum</translation> <translation>Maximum</translation>
</message> </message>
</context> </context>
<context>
<name>ExportDialog</name>
<message>
<location filename="../src/exportdialog.cpp" line="21"/>
<source>Export to PDF</source>
<translation>Exportovat do PDF</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="24"/>
<source>PDF files (*.pdf);;All files (*)</source>
<translation>soubory PDF (*.pdf);;všechny soubory</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="43"/>
<source>Portrait</source>
<translation>Na výšku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="44"/>
<source>Landscape</source>
<translation>Na šířku</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="48"/>
<source>Export settings</source>
<translation>Nastavení exportu</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="50"/>
<source>Page size:</source>
<translation>Velikost stránky:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="51"/>
<source>Orientation</source>
<translation>Orientace</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="52"/>
<source>Output file:</source>
<translation>Výstupní soubor:</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="55"/>
<source>Export</source>
<translation>Exportovat</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="59"/>
<source>Cancel</source>
<translation>Zrušit</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="77"/>
<location filename="../src/exportdialog.cpp" line="84"/>
<location filename="../src/exportdialog.cpp" line="91"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="77"/>
<source>No output file selected.</source>
<translation>Nebyl zvolen žádný výstupní soubor.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="85"/>
<source>The output file is a directory.</source>
<translation>Výstupní soubor je adresář.</translation>
</message>
<message>
<location filename="../src/exportdialog.cpp" line="92"/>
<source>The output file is not writable.</source>
<translation>Výstupní soubor není zapisovatelný.</translation>
</message>
</context>
<context>
<name>FileSelectWidget</name>
<message>
<location filename="../src/fileselectwidget.cpp" line="10"/>
<source>Browse...</source>
<translation>Procházet...</translation>
</message>
<message>
<location filename="../src/fileselectwidget.cpp" line="22"/>
<source>Select file</source>
<translation>Vybrat soubor</translation>
</message>
</context>
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="458"/> <location filename="../src/gui.cpp" line="453"/>
<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="522"/> <location filename="../src/gui.cpp" line="517"/>
<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="599"/> <location filename="../src/gui.cpp" line="594"/>
<source>Open POI file</source> <source>Open POI file</source>
<translation>Otevřít POI soubor</translation> <translation>Otevřít POI soubor</translation>
</message> </message>
@ -85,36 +173,36 @@
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="190"/> <location filename="../src/gui.cpp" line="190"/>
<location filename="../src/gui.cpp" line="474"/> <location filename="../src/gui.cpp" line="469"/>
<location filename="../src/gui.cpp" line="475"/> <location filename="../src/gui.cpp" line="470"/>
<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="218"/> <location filename="../src/gui.cpp" line="214"/>
<source>Close</source> <source>Close</source>
<translation>Zavřít</translation> <translation>Zavřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="224"/> <location filename="../src/gui.cpp" line="220"/>
<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="381"/> <location filename="../src/gui.cpp" line="376"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="321"/> <location filename="../src/gui.cpp" line="317"/>
<location filename="../src/gui.cpp" line="375"/> <location filename="../src/gui.cpp" line="370"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="188"/> <location filename="../src/gui.cpp" line="188"/>
<location filename="../src/gui.cpp" line="497"/> <location filename="../src/gui.cpp" line="492"/>
<location filename="../src/gui.cpp" line="498"/> <location filename="../src/gui.cpp" line="493"/>
<source>Data sources</source> <source>Data sources</source>
<translation>Zdroje dat</translation> <translation>Zdroje dat</translation>
</message> </message>
@ -124,293 +212,291 @@
<translation>Tisknout</translation> <translation>Tisknout</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="208"/>
<source>Export</source> <source>Export</source>
<translation>Exportovat</translation> <translation type="vanished">Exportovat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="214"/>
<source>Export as</source> <source>Export as</source>
<translation>Exportovat jako</translation> <translation type="vanished">Exportovat jako</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="232"/> <location filename="../src/gui.cpp" line="228"/>
<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="235"/> <location filename="../src/gui.cpp" line="231"/>
<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="238"/> <location filename="../src/gui.cpp" line="234"/>
<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="246"/> <location filename="../src/gui.cpp" line="242"/>
<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="252"/> <location filename="../src/gui.cpp" line="248"/>
<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="257"/>
<location filename="../src/gui.cpp" line="261"/> <location filename="../src/gui.cpp" line="261"/>
<location filename="../src/gui.cpp" line="265"/> <location filename="../src/gui.cpp" line="479"/>
<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="272"/> <location filename="../src/gui.cpp" line="268"/>
<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="278"/> <location filename="../src/gui.cpp" line="274"/>
<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="284"/> <location filename="../src/gui.cpp" line="280"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="289"/> <location filename="../src/gui.cpp" line="285"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="295"/> <location filename="../src/gui.cpp" line="291"/>
<source>Fullscreen mode</source> <source>Fullscreen mode</source>
<translation>Celoobrazovkový režim</translation> <translation>Celoobrazovkový režim</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="303"/> <location filename="../src/gui.cpp" line="299"/>
<source>Next</source> <source>Next</source>
<translation>Následující</translation> <translation>Následující</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="306"/> <location filename="../src/gui.cpp" line="302"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="310"/> <location filename="../src/gui.cpp" line="306"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="313"/> <location filename="../src/gui.cpp" line="309"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="336"/> <location filename="../src/gui.cpp" line="331"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="343"/> <location filename="../src/gui.cpp" line="338"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="344"/> <location filename="../src/gui.cpp" line="339"/>
<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="352"/> <location filename="../src/gui.cpp" line="347"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="353"/> <location filename="../src/gui.cpp" line="348"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="362"/> <location filename="../src/gui.cpp" line="357"/>
<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="486"/> <location filename="../src/gui.cpp" line="481"/>
<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="654"/> <location filename="../src/gui.cpp" line="208"/>
<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="690"/> <location filename="../src/gui.cpp" line="667"/>
<location filename="../src/gui.cpp" line="693"/> <location filename="../src/gui.cpp" line="670"/>
<source>Date</source> <source>Date</source>
<translation>Datum</translation> <translation>Datum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="866"/> <location filename="../src/gui.cpp" line="841"/>
<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="420"/> <location filename="../src/gui.cpp" line="415"/>
<source>Elevation</source> <source>Elevation</source>
<translation>Výška</translation> <translation>Výška</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="421"/> <location filename="../src/gui.cpp" line="416"/>
<source>Speed</source> <source>Speed</source>
<translation>Rychlost</translation> <translation>Rychlost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="422"/> <location filename="../src/gui.cpp" line="417"/>
<source>Heart rate</source> <source>Heart rate</source>
<translation>Tep</translation> <translation>Tep</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="477"/> <location filename="../src/gui.cpp" line="472"/>
<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="454"/> <location filename="../src/gui.cpp" line="449"/>
<source>Version </source> <source>Version </source>
<translation>Verze </translation> <translation>Verze </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="478"/> <location filename="../src/gui.cpp" line="473"/>
<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="480"/> <location filename="../src/gui.cpp" line="475"/>
<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="481"/> <location filename="../src/gui.cpp" line="476"/>
<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="482"/> <location filename="../src/gui.cpp" line="477"/>
<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="501"/> <location filename="../src/gui.cpp" line="496"/>
<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="504"/> <location filename="../src/gui.cpp" line="499"/>
<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="512"/> <location filename="../src/gui.cpp" line="507"/>
<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="523"/> <location filename="../src/gui.cpp" line="518"/>
<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="590"/> <location filename="../src/gui.cpp" line="585"/>
<location filename="../src/gui.cpp" line="616"/> <location filename="../src/gui.cpp" line="611"/>
<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="600"/> <location filename="../src/gui.cpp" line="595"/>
<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="701"/> <location filename="../src/gui.cpp" line="678"/>
<location filename="../src/gui.cpp" line="881"/> <location filename="../src/gui.cpp" line="856"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="878"/> <location filename="../src/gui.cpp" line="853"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="193"/> <location filename="../src/gui.cpp" line="193"/>
<location filename="../src/gui.cpp" line="452"/> <location filename="../src/gui.cpp" line="447"/>
<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="380"/>
<source>Navigation</source> <source>Navigation</source>
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="500"/> <location filename="../src/gui.cpp" line="495"/>
<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="511"/> <location filename="../src/gui.cpp" line="506"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="700"/> <location filename="../src/gui.cpp" line="677"/>
<location filename="../src/gui.cpp" line="703"/> <location filename="../src/gui.cpp" line="680"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="708"/> <location filename="../src/gui.cpp" line="685"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="885"/> <location filename="../src/gui.cpp" line="860"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="873"/> <location filename="../src/gui.cpp" line="848"/>
<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="704"/> <location filename="../src/gui.cpp" line="681"/>
<location filename="../src/gui.cpp" line="888"/> <location filename="../src/gui.cpp" line="863"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="592"/> <location filename="../src/gui.cpp" line="587"/>
<location filename="../src/gui.cpp" line="617"/> <location filename="../src/gui.cpp" line="612"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="587"/> <location filename="../src/gui.cpp" line="582"/>
<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="613"/> <location filename="../src/gui.cpp" line="608"/>
<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:

115
src/exportdialog.cpp Normal file
View File

@ -0,0 +1,115 @@
#include <QPrinter>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QGroupBox>
#include <QComboBox>
#include <QPushButton>
#include <QFileInfo>
#include <QDir>
#include <QMessageBox>
#include <QLocale>
#include "fileselectwidget.h"
#include "exportdialog.h"
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
: QDialog(parent), _printer(printer)
{
int index;
setWindowTitle(tr("Export to PDF"));
_fileSelect = new FileSelectWidget();
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
_fileSelect->setFile(QString("%1/export.pdf").arg(QDir::currentPath()));
_paperSize = new QComboBox();
_paperSize->addItem("A0", QPrinter::A0);
_paperSize->addItem("A1", QPrinter::A1);
_paperSize->addItem("A2", QPrinter::A2);
_paperSize->addItem("A3", QPrinter::A3);
_paperSize->addItem("A4", QPrinter::A4);
_paperSize->addItem("A5", QPrinter::A5);
_paperSize->addItem("A6", QPrinter::A6);
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
_paperSize->addItem("Legal", QPrinter::Legal);
_paperSize->addItem("Letter", QPrinter::Letter);
index = (QLocale::system().measurementSystem() == QLocale::ImperialSystem)
? 9 /* Letter */ : 4 /* A4 */;
_paperSize->setCurrentIndex(index);
_orientation = new QComboBox();
_orientation->addItem(tr("Portrait"), QPrinter::Portrait);
_orientation->addItem(tr("Landscape"), QPrinter::Landscape);
index = _printer->orientation() == QPrinter::Portrait ? 0 : 1;
_orientation->setCurrentIndex(index);
QGroupBox *contentBox = new QGroupBox(tr("Export settings"));
QFormLayout *contentLayout = new QFormLayout;
contentLayout->addRow(tr("Page size:"), _paperSize);
contentLayout->addRow(tr("Orientation"), _orientation);
contentLayout->addRow(tr("Output file:"), _fileSelect);
contentBox->setLayout(contentLayout);
QPushButton *exportButton = new QPushButton(tr("Export"));
exportButton->setAutoDefault(true);
exportButton->setDefault(true);
connect(exportButton, SIGNAL(clicked()), this, SLOT(accept()));
QPushButton *cancelButton = new QPushButton(tr("Cancel"));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch();
buttonsLayout->addWidget(exportButton);
buttonsLayout->addWidget(cancelButton);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(contentBox);
layout->addLayout(buttonsLayout);
setLayout(layout);
}
bool ExportDialog::checkFile()
{
if (_fileSelect->file().isNull()) {
QMessageBox::warning(this, tr("Error"), tr("No output file selected."));
return false;
}
QFileInfo fi(_fileSelect->file());
if (fi.isDir()) {
QMessageBox::warning(this, tr("Error"),
tr("The output file is a directory."));
return false;
}
QFileInfo di(fi.path());
if (!di.isWritable()) {
QMessageBox::warning(this, tr("Error"),
tr("The output file is not writable."));
return false;
}
return true;
}
void ExportDialog::accept()
{
if (!checkFile())
return;
QPrinter::Orientation orientation = static_cast<QPrinter::Orientation>
(_orientation->itemData(_orientation->currentIndex()).toInt());
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);
QDialog::accept();
}

30
src/exportdialog.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef EXPORTDIALOG_H
#define EXPORTDIALOG_H
#include <QDialog>
class QPrinter;
class QComboBox;
class FileSelectWidget;
class ExportDialog : public QDialog
{
Q_OBJECT
public:
ExportDialog(QPrinter *printer, QWidget *parent = 0);
public slots:
void accept();
private:
bool checkFile();
QPrinter *_printer;
FileSelectWidget *_fileSelect;
QComboBox *_paperSize;
QComboBox *_orientation;
};
#endif // EXPORTDIALOG_H

27
src/fileselectwidget.cpp Normal file
View File

@ -0,0 +1,27 @@
#include <QPushButton>
#include <QFileDialog>
#include <QHBoxLayout>
#include "fileselectwidget.h"
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
{
_edit = new QLineEdit();
_button = new QPushButton(tr("Browse..."));
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));
QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin(0);
layout->addWidget(_edit);
layout->addWidget(_button);
setLayout(layout);
}
void FileSelectWidget::browse()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Select file"),
QDir::currentPath(), _filter);
if (!fileName.isEmpty())
_edit->setText(fileName);
}

30
src/fileselectwidget.h Normal file
View File

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

View File

@ -33,6 +33,7 @@
#include "trackinfo.h" #include "trackinfo.h"
#include "filebrowser.h" #include "filebrowser.h"
#include "cpuarch.h" #include "cpuarch.h"
#include "exportdialog.h"
#include "gui.h" #include "gui.h"
@ -204,15 +205,11 @@ void GUI::createActions()
connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile())); connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile()));
addAction(_printFileAction); addAction(_printFileAction);
_exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)), _exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)),
tr("Export"), this); tr("Export to PDF"), this);
_exportFileAction->setShortcut(EXPORT_SHORTCUT); _exportFileAction->setShortcut(EXPORT_SHORTCUT);
_exportFileAction->setActionGroup(_fileActionGroup); _exportFileAction->setActionGroup(_fileActionGroup);
connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile())); connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile()));
addAction(_exportFileAction); addAction(_exportFileAction);
_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);
@ -322,7 +319,6 @@ void GUI::createMenus()
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_printFileAction); _fileMenu->addAction(_printFileAction);
_fileMenu->addAction(_exportFileAction); _fileMenu->addAction(_exportFileAction);
_fileMenu->addAction(_exportAsAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
_fileMenu->addAction(_reloadFileAction); _fileMenu->addAction(_reloadFileAction);
_fileMenu->addSeparator(); _fileMenu->addSeparator();
@ -642,39 +638,19 @@ void GUI::closePOIFiles()
void GUI::printFile() void GUI::printFile()
{ {
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this); QPrintDialog dialog(&printer, this);
if (printDialog.exec() == QDialog::Accepted) if (dialog.exec() == QDialog::Accepted)
plot(&printer); plot(&printer);
} }
void GUI::exportAs()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to PDF"),
QString(), "*.pdf");
if (!fileName.isEmpty()) {
exportFile(fileName);
_exportFileName = fileName;
}
}
void GUI::exportFile() void GUI::exportFile()
{
if (_exportFileName.isEmpty())
emit exportAs();
else
exportFile(_exportFileName);
}
void GUI::exportFile(const QString &fileName)
{ {
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
printer.setPageSize(QPrinter::A4);
printer.setOrientation(_track->orientation()); printer.setOrientation(_track->orientation());
printer.setOutputFormat(QPrinter::PdfFormat); ExportDialog dialog(&printer, this);
printer.setOutputFileName(fileName);
if (dialog.exec() == QDialog::Accepted)
plot(&printer); plot(&printer);
} }
@ -682,6 +658,8 @@ void GUI::plot(QPrinter *printer)
{ {
QPainter p(printer); QPainter p(printer);
TrackInfo info; TrackInfo info;
qreal ih, gh, mh;
if (_dateRange.first.isValid()) { if (_dateRange.first.isValid()) {
if (_dateRange.first == _dateRange.second) { if (_dateRange.first == _dateRange.second) {
@ -707,37 +685,26 @@ void GUI::plot(QPrinter *printer)
info.insert(tr("Time"), timeSpan(_time)); info.insert(tr("Time"), timeSpan(_time));
qreal ratio = p.paintEngine()->paintDevice()->logicalDpiX() / SCREEN_DPI;
qreal ih = info.contentSize().height() * ratio;
qreal mh = ih / 2;
#define GRR(printer) \
(((printer)->width() > (printer)->height()) \
? 0.15 * ((qreal)((printer)->width()) / (qreal)((printer)->height())) \
: 0.15)
#define TRR(printer) \
(1.0 - GRR(printer))
if (info.isEmpty()) { if (info.isEmpty()) {
if (_trackGraphs->isVisible()) ih = 0;
_track->plot(&p, QRectF(0, 0, printer->width(), mh = 0;
(TRR(printer) * printer->height())));
else
_track->plot(&p, QRectF(0, 0, printer->width(), printer->height()));
} else { } else {
qreal r = p.paintEngine()->paintDevice()->logicalDpiX() / SCREEN_DPI;
ih = info.contentSize().height() * r;
mh = ih / 2;
info.plot(&p, QRectF(0, 0, printer->width(), ih)); info.plot(&p, QRectF(0, 0, printer->width(), ih));
if (_trackGraphs->isVisible())
_track->plot(&p, QRectF(0, ih + mh, printer->width(),
(TRR(printer) * printer->height()) - (ih + 2*mh)));
else
_track->plot(&p, QRectF(0, ih + mh, printer->width(),
printer->height() - (ih + mh)));
} }
if (_trackGraphs->isVisible()) { if (_trackGraphs->isVisible()) {
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
gh = (printer->width() > printer->height())
? 0.15 * r * (printer->height() - ih - 2*mh)
: 0.15 * (printer->height() - ih - 2*mh);
GraphView *gv = static_cast<GraphView*>(_trackGraphs->currentWidget()); GraphView *gv = static_cast<GraphView*>(_trackGraphs->currentWidget());
gv->plot(&p, QRectF(0, TRR(printer) * printer->height(), gv->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
printer->width(), printer->height() * GRR(printer))); } else
} gh = 0;
_track->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
- (ih + 2*mh + gh)));
} }
void GUI::reloadFile() void GUI::reloadFile()

View File

@ -39,7 +39,6 @@ private slots:
void dataSources(); void dataSources();
void printFile(); void printFile();
void exportFile(); void exportFile();
void exportAs();
void openFile(); void openFile();
void closeAll(); void closeAll();
void reloadFile(); void reloadFile();
@ -125,7 +124,6 @@ private:
QAction *_aboutQtAction; QAction *_aboutQtAction;
QAction *_printFileAction; QAction *_printFileAction;
QAction *_exportFileAction; QAction *_exportFileAction;
QAction *_exportAsAction;
QAction *_openFileAction; QAction *_openFileAction;
QAction *_closeFileAction; QAction *_closeFileAction;
QAction *_reloadFileAction; QAction *_reloadFileAction;
@ -165,7 +163,6 @@ private:
FileBrowser *_browser; FileBrowser *_browser;
QList<QString> _files; QList<QString> _files;
QString _exportFileName;
Map *_currentMap; Map *_currentMap;
int _trackCount; int _trackCount;