From ea8a5d084c4ffb4aa6b17ceb5d0aeb783841ede2 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 23 Aug 2015 20:30:50 -0400 Subject: [PATCH] Tweaking of new label dialog. --- glabels/NewLabelDialog.cpp | 92 +++--- glabels/NewLabelDialog.h | 21 +- glabels/TemplatePicker.cpp | 11 +- glabels/icons.qrc | 4 + glabels/icons/16x16/actions/edit-clear.png | Bin 0 -> 292 bytes glabels/icons/16x16/actions/edit-find.png | Bin 0 -> 416 bytes glabels/icons/24x24/actions/edit-clear.png | Bin 0 -> 449 bytes glabels/icons/24x24/actions/edit-find.png | Bin 0 -> 569 bytes glabels/ui/NewLabelDialog.ui | 313 ++++++++++++++++----- 9 files changed, 323 insertions(+), 118 deletions(-) create mode 100644 glabels/icons/16x16/actions/edit-clear.png create mode 100644 glabels/icons/16x16/actions/edit-find.png create mode 100644 glabels/icons/24x24/actions/edit-clear.png create mode 100644 glabels/icons/24x24/actions/edit-find.png diff --git a/glabels/NewLabelDialog.cpp b/glabels/NewLabelDialog.cpp index ce305a3..82185fe 100644 --- a/glabels/NewLabelDialog.cpp +++ b/glabels/NewLabelDialog.cpp @@ -32,41 +32,29 @@ namespace glabels /// /// Constructor /// - NewLabelDialog::NewLabelDialog( QWidget *parent = 0 ) + NewLabelDialog::NewLabelDialog( QWidget *parent ) + : QDialog(parent), mCanceled(false) { setupUi( this ); // TODO: Set default based on locale and/or saved preferences // Perhaps move to checkboxes - pageSizeIsoRadio->setChecked( true ); + pageSizeIsoCheck->setChecked( false ); + pageSizeUsCheck->setChecked( true ); + pageSizeOtherCheck->setChecked( true ); QList tmplates = libglabels::Db::templates(); templatePicker->setTemplates( tmplates ); templatePicker->applyFilter( searchEntry->text(), - pageSizeIsoRadio->isChecked(), - pageSizeUsRadio->isChecked(), - pageSizeOtherRadio->isChecked() ); + pageSizeIsoCheck->isChecked(), + pageSizeUsCheck->isChecked(), + pageSizeOtherCheck->isChecked() ); similarBrowser->setAttribute(Qt::WA_TranslucentBackground); similarBrowser->viewport()->setAutoFillBackground(false); selectionStackedWidget->setCurrentIndex( 0 ); - - connect( searchEntry, SIGNAL(textChanged(const QString &)), - this, SLOT(searchEntryTextChanged(const QString &)) ); - - connect( pageSizeIsoRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) ); - connect( pageSizeUsRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) ); - connect( pageSizeOtherRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) ); - - connect( templatePicker, SIGNAL(itemSelectionChanged()), this, SLOT(templatePickerSelectionChanged()) ); - - connect( orientationNormalRadio, SIGNAL(toggled(bool)), this, SLOT(orientationRadioToggled(bool)) ); - connect( orientationRotatedRadio, SIGNAL(toggled(bool)), this, SLOT(orientationRadioToggled(bool)) ); - - connect( cancelButton, SIGNAL(clicked()), this, SLOT(close()) ); - connect( createButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()) ); } /// @@ -74,7 +62,14 @@ namespace glabels /// const libglabels::Template* NewLabelDialog::tmplate() const { - return templatePicker->selectedTemplate(); + if ( !mCanceled ) + { + return templatePicker->selectedTemplate(); + } + else + { + return 0; + } } @@ -90,34 +85,40 @@ namespace glabels /// /// Search Entry Text Changed Slot /// - void NewLabelDialog::searchEntryTextChanged( const QString &text ) + void NewLabelDialog::onSearchEntryTextChanged() { - templatePicker->applyFilter( text, - pageSizeIsoRadio->isChecked(), - pageSizeUsRadio->isChecked(), - pageSizeOtherRadio->isChecked() ); + templatePicker->applyFilter( searchEntry->text(), + pageSizeIsoCheck->isChecked(), + pageSizeUsCheck->isChecked(), + pageSizeOtherCheck->isChecked() ); + } + + + /// + /// Search Entry Text Changed Slot + /// + void NewLabelDialog::onSearchClearButtonClicked() + { + searchEntry->setText( "" ); } /// - /// Page Size Radio Toggled Slot + /// Page Size Check Toggled Slot /// - void NewLabelDialog::pageSizeRadioToggled( bool checked ) + void NewLabelDialog::onPageSizeCheckToggled() { - if ( checked ) - { - templatePicker->applyFilter( searchEntry->text(), - pageSizeIsoRadio->isChecked(), - pageSizeUsRadio->isChecked(), - pageSizeOtherRadio->isChecked() ); - } + templatePicker->applyFilter( searchEntry->text(), + pageSizeIsoCheck->isChecked(), + pageSizeUsCheck->isChecked(), + pageSizeOtherCheck->isChecked() ); } /// /// Template Picker Selection Changed Slot /// - void NewLabelDialog::templatePickerSelectionChanged() + void NewLabelDialog::onTemplatePickerSelectionChanged() { orientationNormalRadio->setChecked( true ); @@ -197,21 +198,28 @@ namespace glabels /// /// Orientation Radio Button Toggled Slot /// - void NewLabelDialog::orientationRadioToggled( bool checked ) + void NewLabelDialog::onOrientationRadioToggled() { - if ( checked ) - { - simplePreview->setRotate( orientationRotatedRadio->isChecked() ); - } + simplePreview->setRotate( orientationRotatedRadio->isChecked() ); } /// /// Create Button Clicked Slot /// - void NewLabelDialog::createButtonClicked() + void NewLabelDialog::onCreateButtonClicked() { close(); } + + /// + /// Cancel Button Clicked Slot + /// + void NewLabelDialog::onCancelButtonClicked() + { + mCanceled = true; + close(); + } + } diff --git a/glabels/NewLabelDialog.h b/glabels/NewLabelDialog.h index d894213..8bf3d78 100644 --- a/glabels/NewLabelDialog.h +++ b/glabels/NewLabelDialog.h @@ -39,7 +39,7 @@ namespace glabels // Life Cycle ///////////////////////////////// public: - NewLabelDialog( QWidget *parent ); + NewLabelDialog( QWidget *parent = 0 ); ///////////////////////////////// @@ -53,11 +53,20 @@ namespace glabels // Slots ///////////////////////////////// private slots: - void searchEntryTextChanged( const QString &text ); - void pageSizeRadioToggled( bool checked ); - void templatePickerSelectionChanged(); - void orientationRadioToggled( bool checked ); - void createButtonClicked(); + void onSearchEntryTextChanged(); + void onSearchClearButtonClicked(); + void onPageSizeCheckToggled(); + void onTemplatePickerSelectionChanged(); + void onOrientationRadioToggled(); + void onCreateButtonClicked(); + void onCancelButtonClicked(); + + + ///////////////////////////////// + // Private data + ///////////////////////////////// + private: + bool mCanceled; }; diff --git a/glabels/TemplatePicker.cpp b/glabels/TemplatePicker.cpp index 1734e7d..6c9a2d2 100644 --- a/glabels/TemplatePicker.cpp +++ b/glabels/TemplatePicker.cpp @@ -64,13 +64,14 @@ namespace glabels { TemplatePickerItem *tItem = dynamic_cast(item); - if ( tItem->tmplate()->name().contains( searchString, Qt::CaseInsensitive ) && - (isoMask == tItem->tmplate()->isSizeIso()) && - (usMask == tItem->tmplate()->isSizeUs()) && - (otherMask == tItem->tmplate()->isSizeOther()) ) + bool sizeMask = + (isoMask && tItem->tmplate()->isSizeIso()) || + (usMask && tItem->tmplate()->isSizeUs()) || + (otherMask && tItem->tmplate()->isSizeOther()); + + if ( tItem->tmplate()->name().contains( searchString, Qt::CaseInsensitive ) && sizeMask ) { item->setHidden( false ); - } else { diff --git a/glabels/icons.qrc b/glabels/icons.qrc index 8e4b4be..2702f15 100644 --- a/glabels/icons.qrc +++ b/glabels/icons.qrc @@ -2,6 +2,8 @@ + icons/16x16/actions/edit-clear.png + icons/16x16/actions/edit-find.png icons/16x16/actions/glabels-align-bottom.png icons/16x16/actions/glabels-align-hcenter.png icons/16x16/actions/glabels-align-left.png @@ -28,6 +30,8 @@ icons/16x16/actions/glabels-rotate-right.png icons/16x16/actions/glabels-text.png icons/16x16/apps/glabels.png + icons/24x24/actions/edit-clear.png + icons/24x24/actions/edit-find.png icons/24x24/actions/glabels-align-text-center.png icons/24x24/actions/glabels-align-text-left.png icons/24x24/actions/glabels-align-text-right.png diff --git a/glabels/icons/16x16/actions/edit-clear.png b/glabels/icons/16x16/actions/edit-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..b88491c8a6ae460415aec7ee276cbce0e6c46c6c GIT binary patch literal 292 zcmV+<0o(qGP)6opsCA3G7TP&@6lveZftQL*+VEc6j9ECmsJYb(V{8@Cf{D{EVc{~AKRWiA8) zLs)k4Kp>f%^9}djnXiuu_y#adlhf(M?RLYZ&9C9}`Ao0ZBOZ^VmI8qQwOWncZl^)C z@a1x$P$)<+nM~4XG|1=k@*NI`S*=zmc>(BjI%00O+uZMW9L;7kg25oERLUu7qwQ{4 z7O_~2bUMxR`9!U`d(!Q81+HL9+V02WQ4FnCOEUn>=X3er@Aq|pQ@_vWqgX6z%>tNA zCIT3ZMmoSTl}aUntk-MYdORNFaygmE;c)N}RMHp~0{ z1~5Di&~mvXkw{3udHjAqnM_8#%V=M(mz3xUF${z0bjn~bU^pDI-|uDTX0s`fa=EOJ zQwM1>R4*!(ia_f1I!b@OCkj%nR*6QVT(4LDb=hp&mNMnAeL_D6)|(Xs54myx0000< KMNUMnLSTXn=ed&r literal 0 HcmV?d00001 diff --git a/glabels/icons/24x24/actions/edit-clear.png b/glabels/icons/24x24/actions/edit-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..b85fa29c662a65d0b6324516cdb1307847e07165 GIT binary patch literal 449 zcmV;y0Y3hTP)4d}KAYF>0Kvh*H5yK~w326Cl<@0$^ zgz)Kf8VJsc!iBfnZF!iifWc?8ndi;PWD>bt4v9p<^I9g8K{lHe3q)|LR;vZd^Z7)v zSaf>fa2U(w5|qc|!51+2d_L#?+-9>07G2j-sZ_99t-x}>-~9zLaH?oDisSJJzu2~o zMx((MU^pB~ZCWG}!Dh2@&DOFk)M_>X)PX6x7!uMX+yW$ zE&O5_21=#U>rL+UdR#%hUIz<(YZ}XbzX!|pdX+n-{eE9~Of^kIwOVz0u~-bd-R|Wv z^+*PTf$#j&=``Z;xT_xug`9pWm3r^0SS%L*epPrRqtWOi0+(bw9tVOK3I(CSCAr;h rIG@kbb-7$Xe?a>DCm)#v|APDhzExq*XBpJ800000NkvXXu0mjfCp^yh literal 0 HcmV?d00001 diff --git a/glabels/icons/24x24/actions/edit-find.png b/glabels/icons/24x24/actions/edit-find.png new file mode 100644 index 0000000000000000000000000000000000000000..ae9787f72761e559778a834007b154378fa32ec0 GIT binary patch literal 569 zcmV-90>=G`P)~2 zEIBzjLPA1FNJvXdOHxu&TU%RRUS42eU}IxrX=!O{YHDk1Yiw+6dU|?$dwYC*e13j@ zfq{X8gM);GgoTBLhK7cSh=_}ei;RqnkB^U&larN|m6@5DoSdAUot>hhqNb*%sHmu_ zs;aZIv$V9dxw*Nzy1Ki&yTQT1#KgqK#l_9d&Ct-$(b3V?*4EwK-QM2b;Naln%+;>gww2>+A0B?(gsK@bK{T^z`@l_xSku`uh6&`}_a@|3AD7(*OVf19VbOQvkuj zUHySg0002&Nkl1_JUDC#lG+VFfti#8OwNn zW%Aw3X6FX~B$}4_`TA~WZKK)!Mxsd(fb4w77tzxkgYws&Xp)0Me0dQ~!o-8R4`yNE zQ~SNn!J-9i!}N!wXI}CQJ!K3uU{43n6*yD_%Wz}h1R@Ko&^B-k4GY`QG_Vdw77{4D zrxWFQjNzWx-z`GvP5bp`U`gGAw<9nWpPxnJz?NHG^lB7axa-S(34m<59zxw0?Hp99 ztw+@u*tB9UN&-ox=7~E|gRrH+FH(gSADrx$yFNHcr~TO%NkA!k`SqYL00000NkvXX Hu0mjf$<_|c literal 0 HcmV?d00001 diff --git a/glabels/ui/NewLabelDialog.ui b/glabels/ui/NewLabelDialog.ui index c7fad4f..8e74ac2 100644 --- a/glabels/ui/NewLabelDialog.ui +++ b/glabels/ui/NewLabelDialog.ui @@ -21,13 +21,45 @@ - - - - 0 - 0 - + + + Search + + + + + + 0 + 0 + + + + Search + + + + + + + + + + + :/icons/16x16/actions/edit-clear.png:/icons/16x16/actions/edit-clear.png + + + + 16 + 16 + + + + true + + + + @@ -61,65 +93,44 @@ false - - - - 10 - 20 - 121 - 21 - - - - - 50 - false - - - - ISO sizes - - - - - - 10 - 40 - 111 - 21 - - - - - 50 - false - - - - US sizes - - - - - - 10 - 60 - 111 - 21 - - - - - 50 - false - - - - Other - - + + + + + ISO sizes + + + + + + + US sizes + + + + + + + Other + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -445,6 +456,178 @@
SimplePreview.h
- - + + + + + + searchEntry + textChanged(QString) + NewLabelDialog + onSearchEntryTextChanged() + + + 69 + 48 + + + 2 + 53 + + + + + searchClearButton + clicked() + NewLabelDialog + onSearchClearButtonClicked() + + + 177 + 52 + + + 190 + 7 + + + + + pageSizeIsoCheck + toggled(bool) + NewLabelDialog + onPageSizeCheckToggled() + + + 78 + 116 + + + 3 + 110 + + + + + pageSizeUsCheck + toggled(bool) + NewLabelDialog + onPageSizeCheckToggled() + + + 52 + 145 + + + 8 + 144 + + + + + pageSizeOtherCheck + toggled(bool) + NewLabelDialog + onPageSizeCheckToggled() + + + 37 + 170 + + + 10 + 188 + + + + + templatePicker + itemSelectionChanged() + NewLabelDialog + onTemplatePickerSelectionChanged() + + + 232 + 550 + + + 244 + 697 + + + + + orientationRotatedRadio + toggled(bool) + NewLabelDialog + onOrientationRadioToggled() + + + 901 + 637 + + + 982 + 617 + + + + + orientationNormalRadio + toggled(bool) + NewLabelDialog + onOrientationRadioToggled() + + + 807 + 644 + + + 982 + 592 + + + + + createButton + clicked() + NewLabelDialog + onCreateButtonClicked() + + + 951 + 699 + + + 985 + 671 + + + + + cancelButton + clicked() + NewLabelDialog + onCancelButtonClicked() + + + 837 + 692 + + + 767 + 704 + + + + + + onSearchClearButtonClicked() + onPageSizeCheckToggled() + onTemplatePickerSelectionChanged() + onOrientationRadioToggled() + onCreateButtonClicked() + onSearchEntryTextChanged() + onCancelButtonClicked() +