diff --git a/gpxsee.qrc b/gpxsee.qrc index 33194bcc..928d15e9 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -2,8 +2,8 @@ icons/dialog-close.png icons/document-open.png - icons/document-save-as.png - icons/document-save.png + icons/document-print.png + icons/document-export.png icons/flag.png icons/gpxsee.png icons/application-exit.png diff --git a/icons/document-export.png b/icons/document-export.png new file mode 100644 index 00000000..71fb3a90 Binary files /dev/null and b/icons/document-export.png differ diff --git a/icons/document-print.png b/icons/document-print.png new file mode 100644 index 00000000..8eb1c674 Binary files /dev/null and b/icons/document-print.png differ diff --git a/icons/document-save-as.png b/icons/document-save-as.png deleted file mode 100644 index 0ecb79e8..00000000 Binary files a/icons/document-save-as.png and /dev/null differ diff --git a/icons/document-save.png b/icons/document-save.png deleted file mode 100644 index a81e70d4..00000000 Binary files a/icons/document-save.png and /dev/null differ diff --git a/lang/gpxsee_cs.ts b/lang/gpxsee_cs.ts index 9c6220f0..2c70cd79 100644 --- a/lang/gpxsee_cs.ts +++ b/lang/gpxsee_cs.ts @@ -59,375 +59,380 @@ GUI - + GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at 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 - + Open file Otevřít soubor - - Save as - Uložit jako - - - + Open POI file Otevřít POI soubor - + Open Otevřít - + Quit Ukončit - - - + + + Keyboard controls Ovládací klávesy - - Save - Uložit - - - + Close Zavřít - + Reload Znovu načíst - + Show Zobrazit - - + + File Soubor - - - + + + Data sources Zdroje dat - + + Print + Tisknout + + + + Export + Exportovat + + + + Export as + Exportovat jako + + + Load POI file Nahrát POI soubor - + Close POI files Zavřit POI soubory - + Show POIs Zobrazit POI - + Show map Zobrazit mapu - + Clear tile cache Vymazat mezipaměť dlaždic - - - + + + Next map Následující mapa - + Show graphs Zobrazovat grafy - + Show toolbars Zobrazovat nástrojové lišty - + Metric Metrické - + Imperial Imperiální - + Fullscreen mode Celoobrazovkový režim - + Next Následující - + Previous Předchozí - + Last Poslední - + First První - + Map Mapa - + POI POI - + POI files POI soubory - + Settings Nastavení - + Units Jednotky - + Help Nápověda - + Previous map Předchozí mapa - + No GPX files loaded Nejsou načteny žádné GPX soubory - + Elevation Výška - + Speed Rychlost - + Heart rate Tep - + Next file Následující soubor - + Version Verze - + Previous file Předchozí soubor - + First file První soubor - + Last file Poslední soubor - + Append modifier Modifikátor nahradit/přidat - + Map (tiles) source URLs are read on program startup from the following file: URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru: - + 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: 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: - + To make GPXSee load a POI file automatically on startup, add the file to the following directory: POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře: - + GPX files (*.gpx);;All files (*) soubory GPX (*.gpx);;všechny soubory (*) - - + + Line: %1 Řádka: %1 - + GPX files (*.gpx);;CSV files (*.csv);;All files (*) soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*) - - + + mi mi - - - - - + + + + + ft ft - - + + Maximum Maximum - - + + Minimum Minimum - - + + About GPXSee O aplikaci GPXSee - + Navigation Navigace - + Map sources Mapové zdroje - + POIs POI body - - + + Distance Vzdálenost - - + + Time Čas - - + + Ascent Stoupání - - - - - + + + + + m m - - + + Descent Klesání - + %1 tracks Počet tras: %1 - - + + km km - - + + Error Chyba - + Error loading GPX file: %1 Soubor GPX nelze otevřít: %1 - + Error loading POI file: %1 Soubor POI nelze otevřít: diff --git a/src/gui.cpp b/src/gui.cpp index 1f822776..11bce180 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -202,18 +203,21 @@ void GUI::createActions() _openFileAction->setShortcut(OPEN_SHORTCUT); connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); addAction(_openFileAction); - _saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)), - tr("Save"), this); - _saveFileAction->setShortcut(SAVE_SHORTCUT); - _saveFileAction->setActionGroup(_fileActionGroup); - connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile())); - addAction(_saveFileAction); - _saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)), - tr("Save as"), this); - _saveAsAction->setShortcut(SAVE_AS_SHORTCUT); - _saveAsAction->setActionGroup(_fileActionGroup); - connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); - addAction(_saveAsAction); + _printFileAction = new QAction(QIcon(QPixmap(PRINT_FILE_ICON)), + tr("Print"), this); + _printFileAction->setActionGroup(_fileActionGroup); + connect(_printFileAction, SIGNAL(triggered()), this, SLOT(printFile())); + addAction(_printFileAction); + _exportFileAction = new QAction(QIcon(QPixmap(EXPORT_FILE_ICON)), + tr("Export"), this); + _exportFileAction->setShortcut(EXPORT_SHORTCUT); + _exportFileAction->setActionGroup(_fileActionGroup); + connect(_exportFileAction, SIGNAL(triggered()), this, SLOT(exportFile())); + 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)), tr("Close"), this); _closeFileAction->setShortcut(CLOSE_SHORTCUT); @@ -321,8 +325,9 @@ void GUI::createMenus() _fileMenu = menuBar()->addMenu(tr("File")); _fileMenu->addAction(_openFileAction); _fileMenu->addSeparator(); - _fileMenu->addAction(_saveFileAction); - _fileMenu->addAction(_saveAsAction); + _fileMenu->addAction(_printFileAction); + _fileMenu->addAction(_exportFileAction); + _fileMenu->addAction(_exportAsAction); _fileMenu->addSeparator(); _fileMenu->addAction(_reloadFileAction); _fileMenu->addSeparator(); @@ -375,9 +380,10 @@ void GUI::createToolBars() _fileToolBar = addToolBar(tr("File")); _fileToolBar->addAction(_openFileAction); - _fileToolBar->addAction(_saveFileAction); _fileToolBar->addAction(_reloadFileAction); _fileToolBar->addAction(_closeFileAction); + _fileToolBar->addAction(_exportFileAction); + _fileToolBar->addAction(_printFileAction); _showToolBar = addToolBar(tr("Show")); _showToolBar->addAction(_showPOIAction); @@ -629,26 +635,35 @@ void GUI::closePOIFiles() _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(), "*.pdf"); if (!fileName.isEmpty()) { - saveFile(fileName); - _saveFileName = fileName; + exportFile(fileName); + _exportFileName = fileName; } } -void GUI::saveFile() +void GUI::exportFile() { - if (_saveFileName.isEmpty()) - emit saveAs(); + if (_exportFileName.isEmpty()) + emit exportAs(); else - saveFile(_saveFileName); + exportFile(_exportFileName); } -void GUI::saveFile(const QString &fileName) +void GUI::exportFile(const QString &fileName) { QPrinter printer(QPrinter::HighResolution); printer.setPageSize(QPrinter::A4); @@ -656,9 +671,15 @@ void GUI::saveFile(const QString &fileName) printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); - QPainter p(&printer); + plot(&printer); +} + +void GUI::plot(QPrinter *printer) +{ + QPainter p(printer); TrackInfo info; + if (_imperialUnitsAction->isChecked()) { info.insert(tr("Distance"), QString::number(_distance * M2MI, 'f', 1) + UNIT_SPACE + tr("mi")); @@ -685,11 +706,11 @@ void GUI::saveFile(const QString &fileName) 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)); - _elevationGraph->plot(&p, QRectF(0, 0.80 * printer.height(), - printer.width(), printer.height() * 0.20)); - info.plot(&p, QRectF(0, 0, printer.width(), 200)); + _elevationGraph->plot(&p, QRectF(0, 0.80 * printer->height(), + printer->width(), printer->height() * 0.20)); + info.plot(&p, QRectF(0, 0, printer->width(), 200)); } void GUI::reloadFile() diff --git a/src/gui.h b/src/gui.h index d9ddbfde..af8ed76f 100644 --- a/src/gui.h +++ b/src/gui.h @@ -13,6 +13,7 @@ class QActionGroup; class QAction; class QLabel; class QSignalMapper; +class QPrinter; class FileBrowser; class GraphView; class ElevationGraph; @@ -35,8 +36,9 @@ private slots: void about(); void keys(); void dataSources(); - void saveFile(); - void saveAs(); + void printFile(); + void exportFile(); + void exportAs(); void openFile(); void closeAll(); void reloadFile(); @@ -71,6 +73,7 @@ private: void loadMaps(); void loadPOIs(); void closeFiles(); + void plot(QPrinter *printer); QAction *createPOIFileAction(int index); void createPOIFilesActions(); @@ -84,7 +87,7 @@ private: bool openPOIFile(const QString &fileName); bool loadFile(const QString &fileName); - void saveFile(const QString &fileName); + void exportFile(const QString &fileName); void updateStatusBarInfo(); void updateWindowTitle(); void updateNavigationActions(); @@ -118,8 +121,9 @@ private: QAction *_dataSourcesAction; QAction *_aboutAction; QAction *_aboutQtAction; - QAction *_saveFileAction; - QAction *_saveAsAction; + QAction *_printFileAction; + QAction *_exportFileAction; + QAction *_exportAsAction; QAction *_openFileAction; QAction *_closeFileAction; QAction *_reloadFileAction; @@ -159,7 +163,7 @@ private: FileBrowser *_browser; QList _files; - QString _saveFileName; + QString _exportFileName; Map *_currentMap; qreal _distance; diff --git a/src/icons.h b/src/icons.h index 4b6bcf93..0cf2ae06 100644 --- a/src/icons.h +++ b/src/icons.h @@ -3,8 +3,8 @@ #define APP_ICON ":/icons/gpxsee.png" #define OPEN_FILE_ICON ":/icons/document-open.png" -#define SAVE_FILE_ICON ":/icons/document-save.png" -#define SAVE_AS_ICON ":/icons/document-save-as.png" +#define EXPORT_FILE_ICON ":/icons/document-export.png" +#define PRINT_FILE_ICON ":/icons/document-print.png" #define CLOSE_FILE_ICON ":/icons/dialog-close.png" #define SHOW_POI_ICON ":/icons/flag.png" #define SHOW_MAP_ICON ":/icons/applications-internet.png" diff --git a/src/keys.h b/src/keys.h index 90ced003..42b81c60 100644 --- a/src/keys.h +++ b/src/keys.h @@ -12,10 +12,9 @@ #define QUIT_SHORTCUT QKeySequence::Quit #define OPEN_SHORTCUT QKeySequence::Open -#define SAVE_SHORTCUT QKeySequence::Save -#define SAVE_AS_SHORTCUT QKeySequence::SaveAs #define CLOSE_SHORTCUT QKeySequence::Close #define RELOAD_SHORTCUT QKeySequence::Refresh +#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E) #define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P) #define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M) #define NEXT_MAP_SHORTCUT QKeySequence::Forward