From cd89706d74f8666c88a9e5b6a44881dcfb208f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 2 Feb 2017 20:06:17 +0100 Subject: [PATCH] Do not use hardcoded control keys info --- src/gui.cpp | 55 +++++++++++++++++++++++++---------------------------- src/keys.h | 12 ++++++------ 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 068517b4..4a7b1cb7 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -545,15 +545,13 @@ void GUI::about() QMessageBox msgBox(this); msgBox.setWindowTitle(tr("About GPXSee")); - msgBox.setText(QString("

") + QString(APP_NAME) + QString("

") - + QString("

") + tr("Version ") + APP_VERSION + QString(" (") - + CPU_ARCH + QString(", Qt ") + QString(QT_VERSION_STR) - + QString(")

")); - msgBox.setInformativeText(QString("
") + msgBox.setText("

" + QString(APP_NAME) + "

" + tr("Version ") + + APP_VERSION + " (" + CPU_ARCH + ", Qt " + QT_VERSION_STR + ")

"); + msgBox.setInformativeText("
" + tr("GPXSee is distributed under the terms of the GNU General Public " "License version 3. For more info about GPXSee visit the project " - "homepage at ") + QString("" APP_HOMEPAGE - ".
")); + "homepage at ") + "" + APP_HOMEPAGE + + ".
"); QIcon icon = msgBox.windowIcon(); QSize size = icon.actualSize(QSize(64, 64)); @@ -567,20 +565,20 @@ void GUI::keys() QMessageBox msgBox(this); msgBox.setWindowTitle(tr("Keyboard controls")); - msgBox.setText(QString("

") + tr("Keyboard controls") + QString("

")); + msgBox.setText("

" + tr("Keyboard controls") + "

"); msgBox.setInformativeText( - QString("
" - "" - "
") + tr("Next file") - + QString("SPACE
") + tr("Previous file") - + QString("BACKSPACE
") - + tr("First file") + QString("HOME
") - + tr("Last file") + QString("END
") - + tr("Append modifier") + QString("SHIFT
") - + tr("Next map") + QString("") - + _nextMapAction->shortcut().toString() + QString("
") - + tr("Previous map") + QString("") - + _prevMapAction->shortcut().toString() + QString("
")); + "
" + tr("Next file") + + "" + QKeySequence(NEXT_KEY).toString() + + "
" + tr("Previous file") + + "" + QKeySequence(PREV_KEY).toString() + + "
" + tr("First file") + "" + + QKeySequence(FIRST_KEY).toString() + "
" + + tr("Last file") + "" + QKeySequence(LAST_KEY).toString() + + "
" + tr("Append modifier") + + "SHIFT
" + + tr("Next map") + "" + NEXT_MAP_SHORTCUT.toString() + + "
" + tr("Previous map") + "" + + PREV_MAP_SHORTCUT.toString() + "
"); msgBox.exec(); } @@ -590,23 +588,23 @@ void GUI::dataSources() QMessageBox msgBox(this); msgBox.setWindowTitle(tr("Data sources")); - msgBox.setText(QString("

") + tr("Data sources") + QString("

")); + msgBox.setText("

" + tr("Data sources") + "

"); msgBox.setInformativeText( - QString("

") + tr("Map sources") + QString("

") + "

" + tr("Map sources") + "

" + tr("Map (tiles) source URLs are read on program startup from the " "following file:") - + QString("

") + USER_MAP_FILE + QString("

") + + "

" + USER_MAP_FILE + "

" + tr("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:") - + QString("

Map1 http://tile.server.com/map/$z/$x/$y.png" - "
Map2 http://mapserver.org/map/$z-$x-$y

") + + "

Map1 http://tile.server.com/map/$z/$x/$y.png" + "
Map2 http://mapserver.org/map/$z-$x-$y

" - + QString("

") + tr("POIs") + QString("

") + + "

" + tr("POIs") + "

" + tr("To make GPXSee load a POI file automatically on startup, add " "the file to the following directory:") - + QString("

") + USER_POI_DIR + QString("

") + + "

" + USER_POI_DIR + "

" ); msgBox.exec(); @@ -1088,8 +1086,7 @@ void GUI::updateStatusBarInfo() void GUI::updateWindowTitle() { if (_files.count() == 1) - setWindowTitle(QFileInfo(_files.at(0)).fileName() - + QString(" - " APP_NAME)); + setWindowTitle(QFileInfo(_files.at(0)).fileName() + " - " + APP_NAME); else setWindowTitle(APP_NAME); } diff --git a/src/keys.h b/src/keys.h index 99b4503e..76d20dec 100644 --- a/src/keys.h +++ b/src/keys.h @@ -10,15 +10,15 @@ #define LAST_KEY Qt::Key_End #define MODIFIER Qt::ShiftModifier -#define QUIT_SHORTCUT QKeySequence::Quit -#define OPEN_SHORTCUT QKeySequence::Open -#define CLOSE_SHORTCUT QKeySequence::Close -#define RELOAD_SHORTCUT QKeySequence::Refresh +#define QUIT_SHORTCUT QKeySequence(QKeySequence::Quit) +#define OPEN_SHORTCUT QKeySequence(QKeySequence::Open) +#define CLOSE_SHORTCUT QKeySequence(QKeySequence::Close) +#define RELOAD_SHORTCUT QKeySequence(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 -#define PREV_MAP_SHORTCUT QKeySequence::Back +#define NEXT_MAP_SHORTCUT QKeySequence(QKeySequence::Forward) +#define PREV_MAP_SHORTCUT QKeySequence(QKeySequence::Back) #define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G) #define DISTANCE_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_D) #define TIME_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_T)