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

User interface improvements, this time for real

This commit is contained in:
Martin Tůma 2015-10-06 00:48:43 +02:00
parent eba700e5e7
commit 79bbfd6245
5 changed files with 21 additions and 1 deletions

View File

@ -34,3 +34,4 @@ SOURCES += src/main.cpp \
src/markeritem.cpp src/markeritem.cpp
RESOURCES += gpxsee.qrc RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts TRANSLATIONS = lang/gpxsee_cs.ts
macx:ICON = icons/gpxsee.icns

View File

@ -6,6 +6,7 @@
<file>icons/document-save.png</file> <file>icons/document-save.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>
</qresource> </qresource>
<qresource> <qresource>

View File

@ -58,7 +58,8 @@ void GUI::createActions()
// General actions // General actions
_exitAction = new QAction(tr("Exit"), this); _exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
_exitAction->setShortcut(QKeySequence::Quit);
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)), _aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
@ -70,17 +71,21 @@ void GUI::createActions()
// File related actions // File related actions
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)), _openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
tr("Open"), this); tr("Open"), this);
_openFileAction->setShortcut(QKeySequence::Open);
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)), _saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)),
tr("Save"), this); tr("Save"), this);
_saveFileAction->setShortcut(QKeySequence::Save);
_saveFileAction->setActionGroup(_fileActionGroup); _saveFileAction->setActionGroup(_fileActionGroup);
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile())); connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)), _saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)),
tr("Save as"), this); tr("Save as"), this);
_saveAsAction->setShortcut(QKeySequence::SaveAs);
_saveAsAction->setActionGroup(_fileActionGroup); _saveAsAction->setActionGroup(_fileActionGroup);
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
tr("Close"), this); tr("Close"), this);
_closeFileAction->setShortcut(QKeySequence::Close);
_closeFileAction->setActionGroup(_fileActionGroup); _closeFileAction->setActionGroup(_fileActionGroup);
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeFile())); connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeFile()));
@ -98,9 +103,12 @@ void GUI::createMenus()
{ {
_fileMenu = menuBar()->addMenu(tr("File")); _fileMenu = menuBar()->addMenu(tr("File"));
_fileMenu->addAction(_openFileAction); _fileMenu->addAction(_openFileAction);
_fileMenu->addSeparator();
_fileMenu->addAction(_saveFileAction); _fileMenu->addAction(_saveFileAction);
_fileMenu->addAction(_saveAsAction); _fileMenu->addAction(_saveAsAction);
_fileMenu->addSeparator();
_fileMenu->addAction(_closeFileAction); _fileMenu->addAction(_closeFileAction);
_fileMenu->addSeparator();
_fileMenu->addAction(_exitAction); _fileMenu->addAction(_exitAction);
_poiMenu = menuBar()->addMenu(tr("POI")); _poiMenu = menuBar()->addMenu(tr("POI"));
@ -118,9 +126,15 @@ void GUI::createToolBars()
_fileToolBar->addAction(_openFileAction); _fileToolBar->addAction(_openFileAction);
_fileToolBar->addAction(_saveFileAction); _fileToolBar->addAction(_saveFileAction);
_fileToolBar->addAction(_closeFileAction); _fileToolBar->addAction(_closeFileAction);
#ifdef __APPLE__
_fileToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // __APPLE__
_poiToolBar = addToolBar(tr("POI")); _poiToolBar = addToolBar(tr("POI"));
_poiToolBar->addAction(_showPOIAction); _poiToolBar->addAction(_showPOIAction);
#ifdef __APPLE__
_poiToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif // __APPLE__
} }
void GUI::createTrackView() void GUI::createTrackView()

View File

@ -7,5 +7,6 @@
#define SAVE_AS_ICON ":/icons/document-save-as.png" #define SAVE_AS_ICON ":/icons/document-save-as.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 QUIT_ICON ":/icons/application-exit.png"
#endif /* ICONS_H */ #endif /* ICONS_H */

View File

@ -13,6 +13,9 @@ int main(int argc, char *argv[])
QTranslator translator; QTranslator translator;
translator.load(QString(":/lang/gpxsee_") + locale); translator.load(QString(":/lang/gpxsee_") + locale);
app.installTranslator(&translator); app.installTranslator(&translator);
#ifdef __APPLE__
app.setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // __APPLE__
GUI gui; GUI gui;
gui.setWindowIcon(QIcon(QPixmap(APP_ICON))); gui.setWindowIcon(QIcon(QPixmap(APP_ICON)));