1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Use new GUI icons that fit the recent platform styles.

Switched to a new flat color icon set on Windows/Mac and platform provided
icon themes (e.g. Breeze) on Linux with a fallback to the Papirus theme. All
the GUI icons are now SVG.
This commit is contained in:
2023-10-27 20:32:13 +02:00
parent 6c50402423
commit 043a27dfae
112 changed files with 1257 additions and 293 deletions

View File

@ -70,6 +70,8 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
loadPCSs();
Waypoint::loadSymbolIcons(ProgramPaths::symbolsDir());
QIcon::setFallbackThemeName(APP_NAME);
_gui = new GUI();
#ifdef Q_OS_ANDROID

View File

@ -187,7 +187,8 @@ void GUI::createActions()
// General actions
#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
_exitAction = new QAction(QIcon(QUIT_ICON), tr("Quit"), this);
_exitAction = new QAction(QIcon::fromTheme(QUIT_NAME, QIcon(QUIT_ICON)),
tr("Quit"), this);
_exitAction->setShortcut(QUIT_SHORTCUT);
_exitAction->setMenuRole(QAction::QuitRole);
connect(_exitAction, &QAction::triggered, this, &GUI::close);
@ -208,45 +209,47 @@ void GUI::createActions()
connect(_aboutAction, &QAction::triggered, this, &GUI::about);
// File actions
_openFileAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Open..."), this);
_openFileAction = new QAction(QIcon::fromTheme(OPEN_FILE_NAME,
QIcon(OPEN_FILE_ICON)), tr("Open..."), this);
_openFileAction->setMenuRole(QAction::NoRole);
_openFileAction->setShortcut(OPEN_SHORTCUT);
connect(_openFileAction, &QAction::triggered, this,
QOverload<>::of(&GUI::openFile));
addAction(_openFileAction);
_openDirAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Open directory..."),
this);
_openDirAction = new QAction(QIcon::fromTheme(OPEN_DIR_NAME,
QIcon(OPEN_DIR_ICON)), tr("Open directory..."), this);
_openDirAction->setMenuRole(QAction::NoRole);
connect(_openDirAction, &QAction::triggered, this,
QOverload<>::of(&GUI::openDir));
_printFileAction = new QAction(QIcon(PRINT_FILE_ICON), tr("Print..."),
this);
_printFileAction = new QAction(QIcon::fromTheme(PRINT_FILE_NAME,
QIcon(PRINT_FILE_ICON)), tr("Print..."), this);
_printFileAction->setMenuRole(QAction::NoRole);
_printFileAction->setActionGroup(_fileActionGroup);
connect(_printFileAction, &QAction::triggered, this, &GUI::printFile);
addAction(_printFileAction);
_exportPDFFileAction = new QAction(QIcon(EXPORT_FILE_ICON),
tr("Export to PDF..."), this);
_exportPDFFileAction = new QAction(QIcon::fromTheme(EXPORT_FILE_NAME,
QIcon(EXPORT_FILE_ICON)), tr("Export to PDF..."), this);
_exportPDFFileAction->setMenuRole(QAction::NoRole);
_exportPDFFileAction->setShortcut(PDF_EXPORT_SHORTCUT);
_exportPDFFileAction->setActionGroup(_fileActionGroup);
connect(_exportPDFFileAction, &QAction::triggered, this, &GUI::exportPDFFile);
addAction(_exportPDFFileAction);
_exportPNGFileAction = new QAction(QIcon(EXPORT_FILE_ICON),
tr("Export to PNG..."), this);
_exportPNGFileAction = new QAction(QIcon::fromTheme(EXPORT_FILE_NAME,
QIcon(EXPORT_FILE_ICON)), tr("Export to PNG..."), this);
_exportPNGFileAction->setMenuRole(QAction::NoRole);
_exportPNGFileAction->setShortcut(PNG_EXPORT_SHORTCUT);
_exportPNGFileAction->setActionGroup(_fileActionGroup);
connect(_exportPNGFileAction, &QAction::triggered, this, &GUI::exportPNGFile);
addAction(_exportPNGFileAction);
_closeFileAction = new QAction(QIcon(CLOSE_FILE_ICON), tr("Close"), this);
_closeFileAction = new QAction(QIcon::fromTheme(CLOSE_FILE_NAME,
QIcon(CLOSE_FILE_ICON)), tr("Close"), this);
_closeFileAction->setMenuRole(QAction::NoRole);
_closeFileAction->setShortcut(CLOSE_SHORTCUT);
_closeFileAction->setActionGroup(_fileActionGroup);
connect(_closeFileAction, &QAction::triggered, this, &GUI::closeAll);
addAction(_closeFileAction);
_reloadFileAction = new QAction(QIcon(RELOAD_FILE_ICON), tr("Reload"),
this);
_reloadFileAction = new QAction(QIcon::fromTheme(RELOAD_FILE_NAME,
QIcon(RELOAD_FILE_ICON)), tr("Reload"), this);
_reloadFileAction->setMenuRole(QAction::NoRole);
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
_reloadFileAction->setActionGroup(_fileActionGroup);
@ -264,8 +267,8 @@ void GUI::createActions()
_poisActionGroup->setExclusive(false);
connect(_poisActionGroup, &QActionGroup::triggered, this,
&GUI::poiFileChecked);
_openPOIAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load POI file..."),
this);
_openPOIAction = new QAction(QIcon::fromTheme(OPEN_FILE_NAME,
QIcon(OPEN_FILE_ICON)), tr("Load POI file..."), this);
_openPOIAction->setMenuRole(QAction::NoRole);
connect(_openPOIAction, &QAction::triggered, this,
QOverload<>::of(&GUI::openPOIFile));
@ -294,7 +297,8 @@ void GUI::createActions()
_showPOILabelsAction->setCheckable(true);
connect(_showPOILabelsAction, &QAction::triggered, _mapView,
&MapView::showPOILabels);
_showPOIAction = new QAction(QIcon(SHOW_POI_ICON), tr("Show POIs"), this);
_showPOIAction = new QAction(QIcon::fromTheme(SHOW_POI_NAME,
QIcon(SHOW_POI_ICON)), tr("Show POIs"), this);
_showPOIAction->setMenuRole(QAction::NoRole);
_showPOIAction->setCheckable(true);
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
@ -305,8 +309,8 @@ void GUI::createActions()
_mapsActionGroup = new QActionGroup(this);
_mapsActionGroup->setExclusive(true);
connect(_mapsActionGroup, &QActionGroup::triggered, this, &GUI::mapChanged);
_showMapAction = new QAction(QIcon(SHOW_MAP_ICON), tr("Show map"),
this);
_showMapAction = new QAction(QIcon::fromTheme(SHOW_MAP_NAME,
QIcon(SHOW_MAP_ICON)), tr("Show map"), this);
_showMapAction->setEnabled(false);
_showMapAction->setMenuRole(QAction::NoRole);
_showMapAction->setCheckable(true);
@ -314,13 +318,13 @@ void GUI::createActions()
connect(_showMapAction, &QAction::triggered, _mapView,
&MapView::showMap);
addAction(_showMapAction);
_loadMapAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Load map..."),
this);
_loadMapAction = new QAction(QIcon::fromTheme(OPEN_FILE_NAME,
QIcon(OPEN_FILE_ICON)), tr("Load map..."), this);
_loadMapAction->setMenuRole(QAction::NoRole);
connect(_loadMapAction, &QAction::triggered, this,
QOverload<>::of(&GUI::loadMap));
_loadMapDirAction = new QAction(QIcon(OPEN_FILE_ICON),
tr("Load map directory..."), this);
_loadMapDirAction = new QAction(QIcon::fromTheme(OPEN_DIR_NAME,
QIcon(OPEN_DIR_ICON)), tr("Load map directory..."), this);
_loadMapDirAction->setMenuRole(QAction::NoRole);
connect(_loadMapDirAction, &QAction::triggered, this, &GUI::loadMapDir);
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
@ -345,8 +349,8 @@ void GUI::createActions()
&MapView::showCursorCoordinates);
// Position
_showPositionAction = new QAction(QIcon(SHOW_POS_ICON),
tr("Show position"), this);
_showPositionAction = new QAction(QIcon::fromTheme(SHOW_POS_NAME,
QIcon(SHOW_POS_ICON)), tr("Show position"), this);
_showPositionAction->setMenuRole(QAction::NoRole);
_showPositionAction->setCheckable(true);
_showPositionAction->setEnabled(false);
@ -444,8 +448,8 @@ void GUI::createActions()
connect(_showDEMTilesAction, &QAction::triggered, this, &GUI::showDEMTiles);
// Graph actions
_showGraphsAction = new QAction(QIcon(SHOW_GRAPHS_ICON), tr("Show graphs"),
this);
_showGraphsAction = new QAction(QIcon::fromTheme(SHOW_GRAPHS_NAME,
QIcon(SHOW_GRAPHS_ICON)), tr("Show graphs"), this);
_showGraphsAction->setMenuRole(QAction::NoRole);
_showGraphsAction->setCheckable(true);
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
@ -543,8 +547,8 @@ void GUI::createActions()
_dmsAction->setActionGroup(ag);
connect(_dmsAction, &QAction::triggered, this, &GUI::setDMS);
#ifndef Q_OS_ANDROID
_fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
tr("Fullscreen mode"), this);
_fullscreenAction = new QAction(QIcon::fromTheme(FULLSCREEN_NAME,
QIcon(FULLSCREEN_ICON)), tr("Fullscreen mode"), this);
_fullscreenAction->setMenuRole(QAction::NoRole);
_fullscreenAction->setCheckable(true);
_fullscreenAction->setShortcut(FULLSCREEN_SHORTCUT);
@ -557,19 +561,23 @@ void GUI::createActions()
// Navigation actions
#ifndef Q_OS_ANDROID
_nextAction = new QAction(QIcon(NEXT_FILE_ICON), tr("Next"), this);
_nextAction = new QAction(QIcon::fromTheme(NEXT_FILE_NAME,
QIcon(NEXT_FILE_ICON)), tr("Next"), this);
_nextAction->setActionGroup(_navigationActionGroup);
_nextAction->setMenuRole(QAction::NoRole);
connect(_nextAction, &QAction::triggered, this, &GUI::next);
_prevAction = new QAction(QIcon(PREV_FILE_ICON), tr("Previous"), this);
_prevAction = new QAction(QIcon::fromTheme(PREV_FILE_NAME,
QIcon(PREV_FILE_ICON)), tr("Previous"), this);
_prevAction->setMenuRole(QAction::NoRole);
_prevAction->setActionGroup(_navigationActionGroup);
connect(_prevAction, &QAction::triggered, this, &GUI::prev);
_lastAction = new QAction(QIcon(LAST_FILE_ICON), tr("Last"), this);
_lastAction = new QAction(QIcon::fromTheme(LAST_FILE_NAME,
QIcon(LAST_FILE_ICON)), tr("Last"), this);
_lastAction->setMenuRole(QAction::NoRole);
_lastAction->setActionGroup(_navigationActionGroup);
connect(_lastAction, &QAction::triggered, this, &GUI::last);
_firstAction = new QAction(QIcon(FIRST_FILE_ICON), tr("First"), this);
_firstAction = new QAction(QIcon::fromTheme(FIRST_FILE_NAME,
QIcon(FIRST_FILE_ICON)), tr("First"), this);
_firstAction->setMenuRole(QAction::NoRole);
_firstAction->setActionGroup(_navigationActionGroup);
connect(_firstAction, &QAction::triggered, this, &GUI::first);

View File

@ -1,36 +1,71 @@
#ifndef ICONS_H
#define ICONS_H
#define APP_ICON ":/gpxsee.png"
#include "common/config.h"
#define APP_ICON ":/gpxsee.svg"
// Toolbar/menu icons
#define OPEN_FILE_ICON ":/document-open.png"
#define EXPORT_FILE_ICON ":/document-export.png"
#define PRINT_FILE_ICON ":/document-print.png"
#define CLOSE_FILE_ICON ":/dialog-close.png"
#define SHOW_POI_ICON ":/flag.png"
#define SHOW_MAP_ICON ":/applications-internet.png"
#define SHOW_GRAPHS_ICON ":/office-chart-line.png"
#define QUIT_ICON ":/application-exit.png"
#define RELOAD_FILE_ICON ":/view-refresh.png"
#define NEXT_FILE_ICON ":/arrow-right.png"
#define PREV_FILE_ICON ":/arrow-left.png"
#define LAST_FILE_ICON ":/arrow-right-double.png"
#define FIRST_FILE_ICON ":/arrow-left-double.png"
#define FULLSCREEN_ICON ":/view-fullscreen.png"
#define SHOW_POS_ICON ":/transform-move.png"
#define OPEN_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/document-open.svg"
#define OPEN_DIR_ICON ":/icons/" APP_NAME "/actions/22x22/document-open-folder.svg"
#define EXPORT_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/document-export.svg"
#define PRINT_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/document-print.svg"
#define CLOSE_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/document-close.svg"
#define SHOW_POI_ICON ":/icons/" APP_NAME "/actions/22x22/flag.svg"
#define SHOW_MAP_ICON ":/icons/" APP_NAME "/actions/22x22/map-globe.svg"
#define SHOW_GRAPHS_ICON ":/icons/" APP_NAME "/actions/22x22/office-chart-area-stacked.svg"
#define QUIT_ICON ":/icons/" APP_NAME "/actions/22x22/application-exit.svg"
#define RELOAD_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/view-refresh.svg"
#define NEXT_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/go-next.svg"
#define PREV_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/go-previous.svg"
#define LAST_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/go-last.svg"
#define FIRST_FILE_ICON ":/icons/" APP_NAME "/actions/22x22/go-first.svg"
#define FULLSCREEN_ICON ":/icons/" APP_NAME "/actions/22x22/view-fullscreen.svg"
#define SHOW_POS_ICON ":/icons/" APP_NAME "/actions/22x22/transform-move.svg"
// Widgets
#define SHOW_PWD_ICON ":/icons/" APP_NAME "/actions/22x22/show-hidden.svg"
#define HIDE_PWD_ICON ":/icons/" APP_NAME "/actions/22x22/hint.svg"
// Options dialog icons
#define APPEARANCE_ICON ":/format-stroke-color.png"
#define POI_ICON ":/flag_32.png"
#define SYSTEM_ICON ":/preferences-system.png"
#define PRINT_EXPORT_ICON ":/document-print_32.png"
#define DATA_ICON ":/view-filter.png"
#define MAPS_ICON ":/applications-internet_32.png"
#define DEM_ICON ":/view-grid.png"
#define POSITION_ICON ":/transform-move_32.png"
#define APPEARANCE_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_appearance.svg"
#define POI_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_poi.svg"
#define SYSTEM_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_system.svg"
#define PRINT_EXPORT_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_print+export.svg"
#define DATA_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_data.svg"
#define MAPS_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_maps.svg"
#define DEM_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_dem.svg"
#define POSITION_ICON ":/icons/" APP_NAME "/preferences/48x48/gpxsee_position.svg"
#define SHOW_PWD_ICON ":/document-encrypt.png"
#define HIDE_PWD_ICON ":/document-decrypt.png"
// Desktop theme names
#define OPEN_FILE_NAME "document-open"
#define OPEN_DIR_NAME "document-open-folder"
#define EXPORT_FILE_NAME "document-export"
#define PRINT_FILE_NAME "document-print"
#define CLOSE_FILE_NAME "document-close"
#define SHOW_POI_NAME "flag"
#define SHOW_MAP_NAME "map-globe"
#define SHOW_GRAPHS_NAME "office-chart-area-stacked"
#define QUIT_NAME "application-exit"
#define RELOAD_FILE_NAME "view-refresh"
#define NEXT_FILE_NAME "go-next"
#define PREV_FILE_NAME "go-previous"
#define LAST_FILE_NAME "go-last"
#define FIRST_FILE_NAME "go-first"
#define FULLSCREEN_NAME "view-fullscreen"
#define SHOW_POS_NAME "transform-move"
#define SHOW_PWD_NAME "show-hidden"
#define HIDE_PWD_NAME "hint"
#define APPEARANCE_NAME "gpxsee_appearance"
#define POI_NAME "gpxsee_poi"
#define SYSTEM_NAME "gpxsee_system"
#define PRINT_EXPORT_NAME "gpxsee_print+export"
#define DATA_NAME "gpxsee_data"
#define MAPS_NAME "gpxsee_maps"
#define DEM_NAME "gpxsee_dem"
#define POSITION_NAME "gpxsee_position"
#endif /* ICONS_H */

View File

@ -827,14 +827,22 @@ OptionsDialog::OptionsDialog(Options &options, Units units, QWidget *parent)
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), QString(), menu);
new QListWidgetItem(QIcon(SYSTEM_ICON), QString(), menu);
#else // Q_OS_ANDROID
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"), menu);
new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
new QListWidgetItem(QIcon(DEM_ICON), tr("DEM"), menu);
new QListWidgetItem(QIcon(POSITION_ICON), tr("Position"), menu);
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"), menu);
new QListWidgetItem(QIcon(SYSTEM_ICON), tr("System"), menu);
new QListWidgetItem(QIcon::fromTheme(APPEARANCE_NAME, QIcon(APPEARANCE_ICON)),
tr("Appearance"), menu);
new QListWidgetItem(QIcon::fromTheme(MAPS_NAME, QIcon(MAPS_ICON)),
tr("Maps"), menu);
new QListWidgetItem(QIcon::fromTheme(DATA_NAME, QIcon(DATA_ICON)),
tr("Data"), menu);
new QListWidgetItem(QIcon::fromTheme(POI_NAME, QIcon(POI_ICON)), tr("POI"),
menu);
new QListWidgetItem(QIcon::fromTheme(DEM_NAME, QIcon(DEM_ICON)), tr("DEM"),
menu);
new QListWidgetItem(QIcon::fromTheme(POSITION_NAME, QIcon(POSITION_ICON)),
tr("Position"), menu);
new QListWidgetItem(QIcon::fromTheme(PRINT_EXPORT_NAME,
QIcon(PRINT_EXPORT_ICON)), tr("Print & Export"), menu);
new QListWidgetItem(QIcon::fromTheme(SYSTEM_NAME, QIcon(SYSTEM_ICON)),
tr("System"), menu);
#endif // Q_OS_ANDROID
QHBoxLayout *contentLayout = new QHBoxLayout();

View File

@ -5,7 +5,8 @@
PasswordEdit::PasswordEdit(QWidget *parent) : QLineEdit(parent)
{
_show = false;
_action = addAction(QIcon(SHOW_PWD_ICON), QLineEdit::TrailingPosition);
_action = addAction(QIcon::fromTheme(SHOW_PWD_ICON),
QLineEdit::TrailingPosition);
connect(_action, &QAction::triggered, this, &PasswordEdit::showPassword);
setEchoMode(QLineEdit::Password);
}
@ -13,11 +14,11 @@ PasswordEdit::PasswordEdit(QWidget *parent) : QLineEdit(parent)
void PasswordEdit::showPassword()
{
if (_show) {
_action->setIcon(QIcon(SHOW_PWD_ICON));
_action->setIcon(QIcon::fromTheme(SHOW_PWD_ICON));
setEchoMode(QLineEdit::Password);
_show = false;
} else {
_action->setIcon(QIcon(HIDE_PWD_ICON));
_action->setIcon(QIcon::fromTheme(HIDE_PWD_ICON));
setEchoMode(QLineEdit::Normal);
_show = true;
}