Reorganize icon data as an embedded icon theme (#226)

This commit is contained in:
Jaye Evins
2025-08-25 23:44:40 -04:00
committed by GitHub
parent de85d47765
commit ffd634075f
132 changed files with 305 additions and 834 deletions
+45 -45
View File
@@ -22,7 +22,6 @@
#include "File.h"
#include "Help.h"
#include "Icons.h"
#include "LabelEditor.h"
#include "MergeView.h"
#include "ObjectEditor.h"
@@ -66,7 +65,7 @@ namespace glabels
///
MainWindow::MainWindow() : mModel(nullptr), mUndoRedoModel(nullptr)
{
setWindowIcon( Icons::Glabels() );
setWindowIcon( QIcon::fromTheme( "glabels" ) );
createActions();
createMenus();
@@ -99,7 +98,7 @@ namespace glabels
// Add "Welcome" page
mPages->addWidget( welcomePage );
mWelcomeButton = new QToolButton( this );
mWelcomeButton->setIcon( Icons::Glabels() );
mWelcomeButton->setIcon( QIcon::fromTheme( "glabels" ) );
mWelcomeButton->setText( tr("Welcome") );
mWelcomeButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mWelcomeButton->setCheckable( true );
@@ -111,7 +110,7 @@ namespace glabels
// Add "Editor" page
mPages->addWidget( editorPage );
mEditorButton = new QToolButton( this );
mEditorButton->setIcon( Icons::Edit() );
mEditorButton->setIcon( QIcon::fromTheme( "glabels-edit" ) );
mEditorButton->setText( tr("Edit") );
mEditorButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mEditorButton->setCheckable( true );
@@ -123,7 +122,7 @@ namespace glabels
// Add "Properties" page
mPages->addWidget( propertiesPage );
mPropertiesButton = new QToolButton( this );
mPropertiesButton->setIcon( Icons::Properties() );
mPropertiesButton->setIcon( QIcon::fromTheme( "glabels-properties" ) );
mPropertiesButton->setText( tr("Properties") );
mPropertiesButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mPropertiesButton->setCheckable( true );
@@ -135,7 +134,7 @@ namespace glabels
// Add "Merge" page
mPages->addWidget( mergePage );
mMergeButton = new QToolButton( this );
mMergeButton->setIcon( Icons::Merge() );
mMergeButton->setIcon( QIcon::fromTheme( "glabels-merge" ) );
mMergeButton->setText( tr("Merge") );
mMergeButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mMergeButton->setCheckable( true );
@@ -147,7 +146,7 @@ namespace glabels
// Add "Variables" page
mPages->addWidget( variablesPage );
mVariablesButton = new QToolButton( this );
mVariablesButton->setIcon( Icons::Variables() );
mVariablesButton->setIcon( QIcon::fromTheme( "glabels-variables" ) );
mVariablesButton->setText( tr("Variables") );
mVariablesButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mVariablesButton->setCheckable( true );
@@ -159,7 +158,7 @@ namespace glabels
// Add "Print" page
mPages->addWidget( printPage );
mPrintButton = new QToolButton( this );
mPrintButton->setIcon( Icons::FilePrint() );
mPrintButton->setIcon( QIcon::fromTheme( "glabels-print" ) );
mPrintButton->setText( tr("Print") );
mPrintButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
mPrintButton->setCheckable( true );
@@ -295,13 +294,13 @@ namespace glabels
{
/* File actions */
fileNewAction = new QAction( tr("&New..."), this );
fileNewAction->setIcon( Icons::FileNew() );
fileNewAction->setIcon( QIcon::fromTheme( "glabels-file-new" ) );
fileNewAction->setShortcut( QKeySequence::New );
fileNewAction->setStatusTip( tr("Create a new gLabels project") );
connect( fileNewAction, SIGNAL(triggered()), this, SLOT(fileNew()) );
fileOpenAction = new QAction( tr("&Open..."), this );
fileOpenAction->setIcon( Icons::FileOpen() );
fileOpenAction->setIcon( QIcon::fromTheme( "glabels-file-open" ) );
fileOpenAction->setShortcut( QKeySequence::Open );
fileOpenAction->setStatusTip( tr("Open an existing gLabels project") );
connect( fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen()) );
@@ -309,19 +308,20 @@ namespace glabels
for ( int i = 0; i < model::Settings::maxRecentFiles(); i++ )
{
auto* action = new QAction( this );
action->setIcon( QIcon::fromTheme( "glabels" ) );
action->setVisible( false );
fileRecentActionList.append( action );
connect( action, SIGNAL(triggered()), this, SLOT(fileOpenRecent()) );
}
fileSaveAction = new QAction( tr("&Save"), this );
fileSaveAction->setIcon( Icons::FileSave() );
fileSaveAction->setIcon( QIcon::fromTheme( "glabels-file-save" ) );
fileSaveAction->setShortcut( QKeySequence::Save );
fileSaveAction->setStatusTip( tr("Save current gLabels project") );
connect( fileSaveAction, SIGNAL(triggered()), this, SLOT(fileSave()) );
fileSaveAsAction = new QAction( tr("Save &As..."), this );
fileSaveAsAction->setIcon( Icons::FileSaveAs() );
fileSaveAsAction->setIcon( QIcon::fromTheme( "glabels-file-save-as" ) );
fileSaveAsAction->setShortcut( QKeySequence::SaveAs );
fileSaveAsAction->setStatusTip( tr("Save current gLabels project to a different name") );
connect( fileSaveAsAction, SIGNAL(triggered()), this, SLOT(fileSaveAs()) );
@@ -382,19 +382,19 @@ namespace glabels
connect( editRedoAction, SIGNAL(triggered()), this, SLOT(editRedo()) );
editCutAction = new QAction( tr("Cut"), this );
editCutAction->setIcon( Icons::EditCut() );
editCutAction->setIcon( QIcon::fromTheme( "glabels-edit-cut" ) );
editCutAction->setShortcut( QKeySequence::Cut );
editCutAction->setStatusTip( tr("Cut the selection") );
connect( editCutAction, SIGNAL(triggered()), this, SLOT(editCut()) );
editCopyAction = new QAction( tr("&Copy"), this );
editCopyAction->setIcon( Icons::EditCopy() );
editCopyAction->setIcon( QIcon::fromTheme( "glabels-edit-copy" ) );
editCopyAction->setShortcut( QKeySequence::Copy );
editCopyAction->setStatusTip( tr("Copy the selection") );
connect( editCopyAction, SIGNAL(triggered()), this, SLOT(editCopy()) );
editPasteAction = new QAction( tr("&Paste"), this );
editPasteAction->setIcon( Icons::EditPaste() );
editPasteAction->setIcon( QIcon::fromTheme( "glabels-edit-paste" ) );
editPasteAction->setShortcut( QKeySequence::Paste );
editPasteAction->setStatusTip( tr("Paste the clipboard") );
connect( editPasteAction, SIGNAL(triggered()), this, SLOT(editPaste()) );
@@ -446,136 +446,136 @@ namespace glabels
connect( viewMarkupAction, SIGNAL(toggled(bool)), this, SLOT(viewMarkup(bool)) );
viewZoomInAction = new QAction( tr("Zoom &In"), this );
viewZoomInAction->setIcon( Icons::ZoomIn() );
viewZoomInAction->setIcon( QIcon::fromTheme( "glabels-zoom-in" ) );
viewZoomInAction->setShortcut( QKeySequence::ZoomIn );
viewZoomInAction->setStatusTip( tr("Increase magnification") );
connect( viewZoomInAction, SIGNAL(triggered()), this, SLOT(viewZoomIn()) );
viewZoomOutAction = new QAction( tr("Zoom &Out"), this );
viewZoomOutAction->setIcon( Icons::ZoomOut() );
viewZoomOutAction->setIcon( QIcon::fromTheme( "glabels-zoom-out" ) );
viewZoomOutAction->setShortcut( QKeySequence::ZoomOut );
viewZoomOutAction->setStatusTip( tr("Decrease magnification") );
connect( viewZoomOutAction, SIGNAL(triggered()), this, SLOT(viewZoomOut()) );
viewZoom1To1Action = new QAction( tr("Zoom &1 to 1"), this );
viewZoom1To1Action->setIcon( Icons::ZoomOriginal() );
viewZoom1To1Action->setIcon( QIcon::fromTheme( "glabels-zoom-one-to-one" ) );
viewZoom1To1Action->setStatusTip( tr("Restore scale to 100%") );
connect( viewZoom1To1Action, SIGNAL(triggered()), this, SLOT(viewZoom1To1()) );
viewZoomToFitAction = new QAction( tr("Zoom to &Fit"), this );
viewZoomToFitAction->setIcon( Icons::ZoomBestFit() );
viewZoomToFitAction->setIcon( QIcon::fromTheme( "glabels-zoom-to-fit" ) );
viewZoomToFitAction->setStatusTip( tr("Set scale to fit window") );
connect( viewZoomToFitAction, SIGNAL(triggered()), this, SLOT(viewZoomToFit()) );
/* Object actions */
objectsArrowModeAction = new QAction( tr("Select Mode"), this );
objectsArrowModeAction->setIcon( Icons::Arrow() );
objectsArrowModeAction->setIcon( QIcon::fromTheme( "glabels-arrow" ) );
objectsArrowModeAction->setStatusTip( tr("Select, move and modify objects") );
connect( objectsArrowModeAction, SIGNAL(triggered()), this, SLOT(objectsArrowMode()) );
objectsCreateTextAction = new QAction( tr("Text"), this );
objectsCreateTextAction->setIcon( Icons::Text() );
objectsCreateTextAction->setIcon( QIcon::fromTheme( "glabels-text" ) );
objectsCreateTextAction->setStatusTip( tr("Create text object") );
connect( objectsCreateTextAction, SIGNAL(triggered()), this, SLOT(objectsCreateText()) );
objectsCreateBoxAction = new QAction( tr("Box"), this );
objectsCreateBoxAction->setIcon( Icons::Box() );
objectsCreateBoxAction->setIcon( QIcon::fromTheme( "glabels-box" ) );
objectsCreateBoxAction->setStatusTip( tr("Create box object") );
connect( objectsCreateBoxAction, SIGNAL(triggered()), this, SLOT(objectsCreateBox()) );
objectsCreateLineAction = new QAction( tr("Line"), this );
objectsCreateLineAction->setIcon( Icons::Line() );
objectsCreateLineAction->setIcon( QIcon::fromTheme( "glabels-line" ) );
objectsCreateLineAction->setStatusTip( tr("Create line object") );
connect( objectsCreateLineAction, SIGNAL(triggered()), this, SLOT(objectsCreateLine()) );
objectsCreateEllipseAction = new QAction( tr("Ellipse"), this );
objectsCreateEllipseAction->setIcon( Icons::Ellipse() );
objectsCreateEllipseAction->setIcon( QIcon::fromTheme( "glabels-ellipse" ) );
objectsCreateEllipseAction->setStatusTip( tr("Create ellipse/circle object") );
connect( objectsCreateEllipseAction, SIGNAL(triggered()), this, SLOT(objectsCreateEllipse()) );
objectsCreateImageAction = new QAction( tr("Image"), this );
objectsCreateImageAction->setIcon( Icons::Image() );
objectsCreateImageAction->setIcon( QIcon::fromTheme( "glabels-image" ) );
objectsCreateImageAction->setStatusTip( tr("Create image object") );
connect( objectsCreateImageAction, SIGNAL(triggered()), this, SLOT(objectsCreateImage()) );
objectsCreateBarcodeAction = new QAction( tr("Barcode"), this );
objectsCreateBarcodeAction->setIcon( Icons::Barcode() );
objectsCreateBarcodeAction->setIcon( QIcon::fromTheme( "glabels-barcode" ) );
objectsCreateBarcodeAction->setStatusTip( tr("Create barcode object") );
connect( objectsCreateBarcodeAction, SIGNAL(triggered()), this, SLOT(objectsCreateBarcode()) );
objectsOrderRaiseAction = new QAction( tr("Bring To Front"), this );
objectsOrderRaiseAction->setIcon( Icons::OrderTop() );
objectsOrderRaiseAction->setIcon( QIcon::fromTheme( "glabels-order-top" ) );
objectsOrderRaiseAction->setStatusTip( tr("Raise selection to top") );
connect( objectsOrderRaiseAction, SIGNAL(triggered()), this, SLOT(objectsOrderRaise()) );
objectsOrderLowerAction = new QAction( tr("Send To Back"), this );
objectsOrderLowerAction->setIcon( Icons::OrderBottom() );
objectsOrderLowerAction->setIcon( QIcon::fromTheme( "glabels-order-bottom" ) );
objectsOrderLowerAction->setStatusTip( tr("Lower selection to bottom") );
connect( objectsOrderLowerAction, SIGNAL(triggered()), this, SLOT(objectsOrderLower()) );
objectsXformRotateLeftAction = new QAction( tr("Rotate Left"), this );
objectsXformRotateLeftAction->setIcon( Icons::RotateLeft() );
objectsXformRotateLeftAction->setIcon( QIcon::fromTheme( "glabels-rotate-left" ) );
objectsXformRotateLeftAction->setStatusTip( tr("Rotate object(s) 90 degrees counter-clockwise") );
connect( objectsXformRotateLeftAction, SIGNAL(triggered()), this, SLOT(objectsXformRotateLeft()) );
objectsXformRotateRightAction = new QAction( tr("Rotate Right"), this );
objectsXformRotateRightAction->setIcon( Icons::RotateRight() );
objectsXformRotateRightAction->setIcon( QIcon::fromTheme( "glabels-rotate-right" ) );
objectsXformRotateRightAction->setStatusTip( tr("Rotate object(s) 90 degrees clockwise") );
connect( objectsXformRotateRightAction, SIGNAL(triggered()), this, SLOT(objectsXformRotateRight()) );
objectsXformFlipHorizAction = new QAction( tr("Flip Horizontally"), this );
objectsXformFlipHorizAction->setIcon( Icons::FlipHoriz() );
objectsXformFlipHorizAction->setIcon( QIcon::fromTheme( "glabels-flip-horiz" ) );
objectsXformFlipHorizAction->setStatusTip( tr("Flip object(s) horizontally") );
connect( objectsXformFlipHorizAction, SIGNAL(triggered()), this, SLOT(objectsXformFlipHoriz()) );
objectsXformFlipVertAction = new QAction( tr("Flip Vertically"), this );
objectsXformFlipVertAction->setIcon( Icons::FlipVert() );
objectsXformFlipVertAction->setIcon( QIcon::fromTheme( "glabels-flip-vert" ) );
objectsXformFlipVertAction->setStatusTip( tr("Flip object(s) vertically") );
connect( objectsXformFlipVertAction, SIGNAL(triggered()), this, SLOT(objectsXformFlipVert()) );
objectsAlignLeftAction = new QAction( tr("Align Left"), this );
objectsAlignLeftAction->setIcon( Icons::AlignLeft() );
objectsAlignLeftAction->setIcon( QIcon::fromTheme( "glabels-align-left" ) );
objectsAlignLeftAction->setStatusTip( tr("Align objects to left edges") );
connect( objectsAlignLeftAction, SIGNAL(triggered()), this, SLOT(objectsAlignLeft()) );
objectsAlignHCenterAction = new QAction( tr("Align Center"), this );
objectsAlignHCenterAction->setIcon( Icons::AlignHCenter() );
objectsAlignHCenterAction->setIcon( QIcon::fromTheme( "glabels-align-center" ) );
objectsAlignHCenterAction->setStatusTip( tr("Align objects to horizontal centers") );
connect( objectsAlignHCenterAction, SIGNAL(triggered()), this, SLOT(objectsAlignHCenter()) );
objectsAlignRightAction = new QAction( tr("Align Right"), this );
objectsAlignRightAction->setIcon( Icons::AlignRight() );
objectsAlignRightAction->setIcon( QIcon::fromTheme( "glabels-align-right" ) );
objectsAlignRightAction->setStatusTip( tr("Align objects to right edges") );
connect( objectsAlignRightAction, SIGNAL(triggered()), this, SLOT(objectsAlignRight()) );
objectsAlignTopAction = new QAction( tr("Align Top"), this );
objectsAlignTopAction->setIcon( Icons::AlignTop() );
objectsAlignTopAction->setIcon( QIcon::fromTheme( "glabels-align-top" ) );
objectsAlignTopAction->setStatusTip( tr("Align objects to top edges") );
connect( objectsAlignTopAction, SIGNAL(triggered()), this, SLOT(objectsAlignTop()) );
objectsAlignVCenterAction = new QAction( tr("Align Middle"), this );
objectsAlignVCenterAction->setIcon( Icons::AlignVCenter() );
objectsAlignVCenterAction->setIcon( QIcon::fromTheme( "glabels-align-vcenter" ) );
objectsAlignVCenterAction->setStatusTip( tr("Align objects to vertical centers") );
connect( objectsAlignVCenterAction, SIGNAL(triggered()), this, SLOT(objectsAlignVCenter()) );
objectsAlignBottomAction = new QAction( tr("Align Bottom"), this );
objectsAlignBottomAction->setIcon( Icons::AlignBottom() );
objectsAlignBottomAction->setIcon( QIcon::fromTheme( "glabels-align-bottom" ) );
objectsAlignBottomAction->setStatusTip( tr("Align objects to bottom edges") );
connect( objectsAlignBottomAction, SIGNAL(triggered()), this, SLOT(objectsAlignBottom()) );
objectsCenterHorizAction = new QAction( tr("Center Horizontally"), this );
objectsCenterHorizAction->setIcon( Icons::CenterHoriz() );
objectsCenterHorizAction->setIcon( QIcon::fromTheme( "glabels-center-horiz" ) );
objectsCenterHorizAction->setStatusTip( tr("Horizontally center objects in label") );
connect( objectsCenterHorizAction, SIGNAL(triggered()), this, SLOT(objectsCenterHoriz()) );
objectsCenterVertAction = new QAction( tr("Center Vertically"), this );
objectsCenterVertAction->setIcon( Icons::CenterVert() );
objectsCenterVertAction->setIcon( QIcon::fromTheme( "glabels-center-vert" ) );
objectsCenterVertAction->setStatusTip( tr("Vertically center objects in label") );
connect( objectsCenterVertAction, SIGNAL(triggered()), this, SLOT(objectsCenterVert()) );
objectsCenterAction = new QAction( tr("Center Both"), this );
objectsCenterAction->setIcon( Icons::Center() );
objectsCenterAction->setIcon( QIcon::fromTheme( "glabels-center" ) );
objectsCenterAction->setStatusTip( tr("Center objects in label") );
connect( objectsCenterAction, SIGNAL(triggered()), this, SLOT(objectsCenter()) );
@@ -599,17 +599,17 @@ namespace glabels
/* Context menu version of edit actions */
contextCutAction = new QAction( tr("Cut"), this );
contextCutAction->setIcon( Icons::EditCut() );
contextCutAction->setIcon( QIcon::fromTheme( "glabels-edit-cut" ) );
contextCutAction->setStatusTip( tr("Cut the selection") );
connect( contextCutAction, SIGNAL(triggered()), this, SLOT(editCut()) );
contextCopyAction = new QAction( tr("&Copy"), this );
contextCopyAction->setIcon( Icons::EditCopy() );
contextCopyAction->setIcon( QIcon::fromTheme( "glabels-edit-copy" ) );
contextCopyAction->setStatusTip( tr("Copy the selection") );
connect( contextCopyAction, SIGNAL(triggered()), this, SLOT(editCopy()) );
contextPasteAction = new QAction( tr("&Paste"), this );
contextPasteAction->setIcon( Icons::EditPaste() );
contextPasteAction->setIcon( QIcon::fromTheme( "glabels-edit-paste" ) );
contextPasteAction->setStatusTip( tr("Paste the clipboard") );
connect( contextPasteAction, SIGNAL(triggered()), this, SLOT(editContextPaste()) );
@@ -628,7 +628,7 @@ namespace glabels
fileMenu = menuBar()->addMenu( tr("&File") );
fileMenu->addAction( fileNewAction );
fileMenu->addAction( fileOpenAction );
fileRecentMenu = fileMenu->addMenu( Icons::FileRecent(), tr("Open Recent") );
fileRecentMenu = fileMenu->addMenu( QIcon::fromTheme( "glabels-file-recent" ), tr("Open Recent") );
for ( auto* action : fileRecentActionList )
{
fileRecentMenu->addAction( action );