From 3d9f49543cb43bc232369c4c6e07b6bbb9674e96 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Thu, 24 Oct 2013 22:49:35 -0400 Subject: [PATCH] Added more action/menu framework. Added most action icons to icons resources. --- app/Icons.h | 266 ++++++++++++++++++ app/MainWindow.cpp | 148 ++++++++++ app/MainWindow.h | 27 ++ app/icons.qrc | 4 - .../24x24/actions/glabels-hchain-broken.png | Bin 325 -> 0 bytes app/icons/24x24/actions/glabels-hchain.png | Bin 302 -> 0 bytes .../24x24/actions/glabels-vchain-broken.png | Bin 333 -> 0 bytes app/icons/24x24/actions/glabels-vchain.png | Bin 326 -> 0 bytes 8 files changed, 441 insertions(+), 4 deletions(-) delete mode 100644 app/icons/24x24/actions/glabels-hchain-broken.png delete mode 100644 app/icons/24x24/actions/glabels-hchain.png delete mode 100644 app/icons/24x24/actions/glabels-vchain-broken.png delete mode 100644 app/icons/24x24/actions/glabels-vchain.png diff --git a/app/Icons.h b/app/Icons.h index a14d0fe..588eec5 100644 --- a/app/Icons.h +++ b/app/Icons.h @@ -40,6 +40,272 @@ namespace gLabels } }; + class Barcode : public QIcon + { + public: + Barcode() + { + addFile( ":icons/16x16/actions/glabels-barcode.png" ); + addFile( ":icons/24x24/actions/glabels-barcode.png" ); + } + }; + + class Box : public QIcon + { + public: + Box() + { + addFile( ":icons/16x16/actions/glabels-box.png" ); + addFile( ":icons/24x24/actions/glabels-box.png" ); + } + }; + + class Ellipse : public QIcon + { + public: + Ellipse() + { + addFile( ":icons/16x16/actions/glabels-ellipse.png" ); + addFile( ":icons/24x24/actions/glabels-ellipse.png" ); + } + }; + + class Image : public QIcon + { + public: + Image() + { + addFile( ":icons/16x16/actions/glabels-image.png" ); + addFile( ":icons/24x24/actions/glabels-image.png" ); + } + }; + + class Line : public QIcon + { + public: + Line() + { + addFile( ":icons/16x16/actions/glabels-line.png" ); + addFile( ":icons/24x24/actions/glabels-line.png" ); + } + }; + + class Text : public QIcon + { + public: + Text() + { + addFile( ":icons/16x16/actions/glabels-text.png" ); + addFile( ":icons/24x24/actions/glabels-text.png" ); + } + }; + + class Merge : public QIcon + { + public: + Merge() + { + addFile( ":icons/16x16/actions/glabels-merge.png" ); + addFile( ":icons/24x24/actions/glabels-merge.png" ); + } + }; + + class ObjectProperties : public QIcon + { + public: + ObjectProperties() + { + addFile( ":icons/16x16/actions/glabels-object-properties.png" ); + addFile( ":icons/24x24/actions/glabels-object-properties.png" ); + } + }; + + class AlignLeft : public QIcon + { + public: + AlignLeft() + { + addFile( ":icons/16x16/actions/glabels-align-left.png" ); + } + }; + + class AlignHCenter : public QIcon + { + public: + AlignHCenter() + { + addFile( ":icons/16x16/actions/glabels-align-hcenter.png" ); + } + }; + + class AlignRight : public QIcon + { + public: + AlignRight() + { + addFile( ":icons/16x16/actions/glabels-align-right.png" ); + } + }; + + class AlignBottom : public QIcon + { + public: + AlignBottom() + { + addFile( ":icons/16x16/actions/glabels-align-bottom.png" ); + } + }; + + class AlignVCenter : public QIcon + { + public: + AlignVCenter() + { + addFile( ":icons/16x16/actions/glabels-align-vcenter.png" ); + } + }; + + class AlignTop : public QIcon + { + public: + AlignTop() + { + addFile( ":icons/16x16/actions/glabels-align-top.png" ); + } + }; + + class CenterHoriz : public QIcon + { + public: + CenterHoriz() + { + addFile( ":icons/16x16/actions/glabels-center-horiz.png" ); + } + }; + + class CenterVert : public QIcon + { + public: + CenterVert() + { + addFile( ":icons/16x16/actions/glabels-center-vert.png" ); + } + }; + + class FlipHoriz : public QIcon + { + public: + FlipHoriz() + { + addFile( ":icons/16x16/actions/glabels-flip-horiz.png" ); + } + }; + + class FlipVert : public QIcon + { + public: + FlipVert() + { + addFile( ":icons/16x16/actions/glabels-flip-vert.png" ); + } + }; + + class RotateLeft : public QIcon + { + public: + RotateLeft() + { + addFile( ":icons/16x16/actions/glabels-rotate-left.png" ); + } + }; + + class RotateRight : public QIcon + { + public: + RotateRight() + { + addFile( ":icons/16x16/actions/glabels-rotate-right.png" ); + } + }; + + class OrderBottom : public QIcon + { + public: + OrderBottom() + { + addFile( ":icons/16x16/actions/glabels-order-bottom.png" ); + } + }; + + class OrderTop : public QIcon + { + public: + OrderTop() + { + addFile( ":icons/16x16/actions/glabels-order-top.png" ); + } + }; + + class AlignTextBottom : public QIcon + { + public: + AlignTextBottom() + { + addFile( ":icons/24x24/actions/glabels-align-text-bottom.png" ); + } + }; + + class AlignTextMiddle : public QIcon + { + public: + AlignTextMiddle() + { + addFile( ":icons/24x24/actions/glabels-align-text-middle.png" ); + } + }; + + class AlignTextTop : public QIcon + { + public: + AlignTextTop() + { + addFile( ":icons/24x24/actions/glabels-align-text-top.png" ); + } + }; + + class BucketFill : public QIcon + { + public: + BucketFill() + { + addFile( ":icons/16x16/actions/glabels-bucket-fill.png" ); + addFile( ":icons/24x24/actions/glabels-bucket-fill.png" ); + } + }; + + class Pencil : public QIcon + { + public: + Pencil() + { + addFile( ":icons/16x16/actions/glabels-pencil.png" ); + addFile( ":icons/24x24/actions/glabels-pencil.png" ); + } + }; + + class Glabels : public QIcon + { + public: + Glabels() + { + addFile( ":icons/16x16/apps/glabels.png" ); + addFile( ":icons/24x24/apps/glabels.png" ); + addFile( ":icons/32x32/apps/glabels.png" ); + addFile( ":icons/48x48/apps/glabels.png" ); + addFile( ":icons/scalable/apps/glabels.svg" ); + } + }; + } } diff --git a/app/MainWindow.cpp b/app/MainWindow.cpp index 9e73eaa..83f4a2a 100644 --- a/app/MainWindow.cpp +++ b/app/MainWindow.cpp @@ -208,6 +208,66 @@ namespace gLabels 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->setStatusTip( tr("Create text object") ); + connect( objectsCreateTextAction, SIGNAL(triggered()), this, SLOT(objectsCreateText()) ); + + objectsCreateBoxAction = new QAction( tr("Box"), this ); + objectsCreateBoxAction->setIcon( Icons::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->setStatusTip( tr("Create line object") ); + connect( objectsCreateLineAction, SIGNAL(triggered()), this, SLOT(objectsCreateLine()) ); + + objectsCreateEllipseAction = new QAction( tr("Ellipse"), this ); + objectsCreateEllipseAction->setIcon( Icons::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->setStatusTip( tr("Create image object") ); + connect( objectsCreateImageAction, SIGNAL(triggered()), this, SLOT(objectsCreateImage()) ); + + objectsCreateBarcodeAction = new QAction( tr("Barcode"), this ); + objectsCreateBarcodeAction->setIcon( Icons::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->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->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->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->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->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->setStatusTip( tr("Flip object(s) vertically") ); + connect( objectsXformFlipVertAction, SIGNAL(triggered()), this, SLOT(objectsXformFlipVert()) ); + /* Help actions */ helpAboutAction = new QAction( tr("&About..."), this ); @@ -261,6 +321,21 @@ namespace gLabels objectsMenu = menuBar()->addMenu( tr("&Objects") ); objectsMenu->addAction( objectsArrowModeAction ); + objectsCreateMenu = objectsMenu->addMenu( tr("&Create") ); + objectsCreateMenu->addAction( objectsCreateTextAction ); + objectsCreateMenu->addAction( objectsCreateBoxAction ); + objectsCreateMenu->addAction( objectsCreateLineAction ); + objectsCreateMenu->addAction( objectsCreateEllipseAction ); + objectsCreateMenu->addAction( objectsCreateImageAction ); + objectsCreateMenu->addAction( objectsCreateBarcodeAction ); + objectsOrderMenu = objectsMenu->addMenu( tr("&Order") ); + objectsOrderMenu->addAction( objectsOrderRaiseAction ); + objectsOrderMenu->addAction( objectsOrderLowerAction ); + objectsXformMenu = objectsMenu->addMenu( tr("&Rotate/Flip") ); + objectsXformMenu->addAction( objectsXformRotateLeftAction ); + objectsXformMenu->addAction( objectsXformRotateRightAction ); + objectsXformMenu->addAction( objectsXformFlipHorizAction ); + objectsXformMenu->addAction( objectsXformFlipVertAction ); helpMenu = menuBar()->addMenu( tr("&Help") ); helpMenu->addAction( helpAboutAction ); @@ -429,6 +504,78 @@ namespace gLabels } + void MainWindow::objectsCreateText() + { + std::cout << "ACTION: objects->Create->Text" << std::endl; + } + + + void MainWindow::objectsCreateBox() + { + std::cout << "ACTION: objects->Create->Box" << std::endl; + } + + + void MainWindow::objectsCreateLine() + { + std::cout << "ACTION: objects->Create->Line" << std::endl; + } + + + void MainWindow::objectsCreateEllipse() + { + std::cout << "ACTION: objects->Create->Ellipse" << std::endl; + } + + + void MainWindow::objectsCreateImage() + { + std::cout << "ACTION: objects->Create->Image" << std::endl; + } + + + void MainWindow::objectsCreateBarcode() + { + std::cout << "ACTION: objects->Create->Barcode" << std::endl; + } + + + void MainWindow::objectsOrderRaise() + { + std::cout << "ACTION: objects->Order->Bring to front" << std::endl; + } + + + void MainWindow::objectsOrderLower() + { + std::cout << "ACTION: objects->Order->Send to back" << std::endl; + } + + + void MainWindow::objectsXformRotateLeft() + { + std::cout << "ACTION: objects->Rotate/Flip->Rotate Left" << std::endl; + } + + + void MainWindow::objectsXformRotateRight() + { + std::cout << "ACTION: objects->Rotate/Flip->Rotate Right" << std::endl; + } + + + void MainWindow::objectsXformFlipHoriz() + { + std::cout << "ACTION: objects->Rotate/Flip->Flip Horizontally" << std::endl; + } + + + void MainWindow::objectsXformFlipVert() + { + std::cout << "ACTION: objects->Rotate/Flip->Flip Vertically" << std::endl; + } + + void MainWindow::helpAbout() { QMessageBox aboutBox( QMessageBox::NoIcon, @@ -448,3 +595,4 @@ namespace gLabels } } + diff --git a/app/MainWindow.h b/app/MainWindow.h index c51e266..cae85fe 100644 --- a/app/MainWindow.h +++ b/app/MainWindow.h @@ -74,6 +74,18 @@ namespace gLabels void viewZoomToFit(); void objectsArrowMode(); + void objectsCreateText(); + void objectsCreateBox(); + void objectsCreateLine(); + void objectsCreateEllipse(); + void objectsCreateImage(); + void objectsCreateBarcode(); + void objectsOrderRaise(); + void objectsOrderLower(); + void objectsXformRotateLeft(); + void objectsXformRotateRight(); + void objectsXformFlipHoriz(); + void objectsXformFlipVert(); void helpAbout(); @@ -86,6 +98,9 @@ namespace gLabels QMenu *editMenu; QMenu *viewMenu; QMenu *objectsMenu; + QMenu *objectsCreateMenu; + QMenu *objectsOrderMenu; + QMenu *objectsXformMenu; QMenu *helpMenu; QAction *fileNewAction; @@ -118,6 +133,18 @@ namespace gLabels QAction *viewZoomToFitAction; QAction *objectsArrowModeAction; + QAction *objectsCreateTextAction; + QAction *objectsCreateBoxAction; + QAction *objectsCreateLineAction; + QAction *objectsCreateEllipseAction; + QAction *objectsCreateImageAction; + QAction *objectsCreateBarcodeAction; + QAction *objectsOrderRaiseAction; + QAction *objectsOrderLowerAction; + QAction *objectsXformRotateLeftAction; + QAction *objectsXformRotateRightAction; + QAction *objectsXformFlipHorizAction; + QAction *objectsXformFlipVertAction; QAction *helpAboutAction; diff --git a/app/icons.qrc b/app/icons.qrc index fbdc52d..5ce1660 100644 --- a/app/icons.qrc +++ b/app/icons.qrc @@ -36,16 +36,12 @@ icons/24x24/actions/glabels-box.png icons/24x24/actions/glabels-bucket-fill.png icons/24x24/actions/glabels-ellipse.png - icons/24x24/actions/glabels-hchain-broken.png - icons/24x24/actions/glabels-hchain.png icons/24x24/actions/glabels-image.png icons/24x24/actions/glabels-line.png icons/24x24/actions/glabels-merge.png icons/24x24/actions/glabels-object-properties.png icons/24x24/actions/glabels-pencil.png icons/24x24/actions/glabels-text.png - icons/24x24/actions/glabels-vchain-broken.png - icons/24x24/actions/glabels-vchain.png icons/24x24/apps/glabels.png icons/32x32/apps/glabels.png icons/48x48/apps/glabels.png diff --git a/app/icons/24x24/actions/glabels-hchain-broken.png b/app/icons/24x24/actions/glabels-hchain-broken.png deleted file mode 100644 index 2e961a3e7956e25846ebf90a491f10d6d10d8b33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^5|gW!U_%O``R3p^r= z85p>QK$!8;-MT+OLG}_)Usv{vJVFd+ymx>9`VJJj-rONmD{*#E^{fpT%>WRZ1zEk%Zeda1wAKyF;kqRciPBjxp2k2>nAmr3bd_O zU#Y|2=fQVu`6K7VGiL=o)fpRR-oNIk5-YP_kj2};_}S;kmgC`f!Dv^la9FEvF)_k49U!0j33(dr7rzr;aBr%zWq+) RzdO)(44$rjF6*2UngB2jgBSn+ diff --git a/app/icons/24x24/actions/glabels-hchain.png b/app/icons/24x24/actions/glabels-hchain.png deleted file mode 100644 index 5bc2eedcacf36ced3749e623c07dd9c813823b29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^5|gW!U_%O``R3p^r= z85p>QK$!8;-MT+OLG}_)Usv{vJVLBG`ul2|m4QOLJzX3_D&{07EHF%Pd1hd^@z3$4 zAMWqBPg&V&JYz=0KX(@wgD+pd8ttk0$mDwX-(Pl#uI}!KQZs>4-@kn`TCsAak%YAL z;uW^l-*lSSua|FYmH=tXzq{+Ly|6I1>yM+|)BjJbJ>Hblxn+wa}0^Cu~WJ9bwe zcq%C&Au-Rcw(DU~2kVM`?jH}fa*JoaZm#_N%;?Mv!`6dm&Ir9bwcKCcu;%YCVP(FA oeNOz1+qQ*?7|vR*G>e(xp+&>v+dL~)1HHlE>FVdQ&MBb@0N=rVZ2$lO diff --git a/app/icons/24x24/actions/glabels-vchain-broken.png b/app/icons/24x24/actions/glabels-vchain-broken.png deleted file mode 100644 index 8ef1363ce98d44add645aa5f74b3bd69f7342b66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^oIotW!3HEXq_67%DYhhUcNd2LAh=-f^2s121s;*b z3=G^tAk28_ZrvZCAbW|YuPggS9w7#E-T!^B>wrSHJY5_^D&}0B?8wz@AmF;+nNP8T z$MHqz5_OG7zIVhI-gDaijmc?`lj0<~1Fj1#?#{U4qWyN0Jd!)5sI0Xt|nBLS-V|8(!i7NoM_bRa-sjS(VHd&y^?nAPHYlpSdhD3S~ESo^ln7^YM*1FBCdXa#Fd0}QqR||&EWjOF4N($L32^2 zf1pT2@2O24r*G^$cS6Ll@A22!WxRh`X3op)?J}6XYFC1U$d+pyhXrD~ zJLmcI-e!-2K#?^e=e@q_q#lkeOM0$2@xiKH1`{{9ziw|m(U4hH;+3&>zo%16bcRHm zz>9yIy}5la3o}f3p3dNK`<_`)-L6TSHp*7b^a(GNvEIl0*O+@PYxUC(7U_d&BB_yw zqE82XxOD$Y3X8huqiilAIhL6}bJn`f@Q#f)>|@??tz!{K?Da^EKfm84