1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 09:05:14 +01:00

Now using proper menu entries location on OS X

+ proper qt stuff localization
This commit is contained in:
Martin Tůma 2017-05-31 23:37:02 +02:00
parent 9e798e626c
commit 8d5f72de64
2 changed files with 13 additions and 4 deletions

View File

@ -3,6 +3,7 @@
#include <QLocale> #include <QLocale>
#include <QFileOpenEvent> #include <QFileOpenEvent>
#include <QNetworkProxyFactory> #include <QNetworkProxyFactory>
#include <QLibraryInfo>
#include "opengl.h" #include "opengl.h"
#include "gui.h" #include "gui.h"
#include "onlinemap.h" #include "onlinemap.h"
@ -13,11 +14,16 @@
App::App(int &argc, char **argv) : QApplication(argc, argv), App::App(int &argc, char **argv) : QApplication(argc, argv),
_argc(argc), _argv(argv) _argc(argc), _argv(argv)
{ {
QTranslator *translator = new QTranslator(this); QTranslator *gpxsee = new QTranslator(this);
QString locale = QLocale::system().name(); QString locale = QLocale::system().name();
translator->load(QString(":/lang/gpxsee_") + locale); gpxsee->load(QString(":/lang/gpxsee_") + locale);
installTranslator(translator); installTranslator(gpxsee);
QTranslator *qt = new QTranslator(this);
qt->load(QLocale::system(), "qt", "_",
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
installTranslator(qt);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
setAttribute(Qt::AA_DontShowIconsInMenus); setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC #endif // Q_OS_MAC

View File

@ -295,6 +295,7 @@ void GUI::createActions()
// General actions // General actions
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this); _exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
_exitAction->setShortcut(QUIT_SHORTCUT); _exitAction->setShortcut(QUIT_SHORTCUT);
_exitAction->setMenuRole(QAction::QuitRole);
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
addAction(_exitAction); addAction(_exitAction);
@ -305,6 +306,7 @@ void GUI::createActions()
connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys())); connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys()));
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)), _aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
tr("About GPXSee"), this); tr("About GPXSee"), this);
_aboutAction->setMenuRole(QAction::AboutRole);
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about())); connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
// File actions // File actions
@ -477,6 +479,7 @@ void GUI::createActions()
SLOT(showFullscreen(bool))); SLOT(showFullscreen(bool)));
addAction(_fullscreenAction); addAction(_fullscreenAction);
_openOptionsAction = new QAction(tr("Options..."), this); _openOptionsAction = new QAction(tr("Options..."), this);
_openOptionsAction->setMenuRole(QAction::PreferencesRole);
connect(_openOptionsAction, SIGNAL(triggered()), this, connect(_openOptionsAction, SIGNAL(triggered()), this,
SLOT(openOptions())); SLOT(openOptions()));