From 89a50de58ec17d1257ca4635af11489b37e0107c Mon Sep 17 00:00:00 2001 From: con Date: Tue, 2 Jun 2009 16:49:29 +0200 Subject: [PATCH] Add missing visualizer of reg exp search option in find tool bar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer --- src/plugins/find/find.qrc | 8 +--- src/plugins/find/findtoolbar.cpp | 41 +++++++++++++------- src/plugins/find/findtoolbar.h | 4 ++ src/plugins/find/images/casesensitively.png | Bin 182 -> 153 bytes src/plugins/find/images/wholewords.png | Bin 210 -> 146 bytes src/plugins/find/images/wordandcase.png | Bin 158 -> 198 bytes 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/plugins/find/find.qrc b/src/plugins/find/find.qrc index db9017c2366..8466feef246 100644 --- a/src/plugins/find/find.qrc +++ b/src/plugins/find/find.qrc @@ -1,13 +1,7 @@ - images/all.png images/casesensitively.png - images/empty.png - images/expand.png - images/next.png - images/previous.png - images/replace_all.png images/wholewords.png - images/wordandcase.png + images/regexp.png diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index cedfbbaf9a5..313d229ceb8 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -68,7 +68,10 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_findNextAction(0), m_findPreviousAction(0), m_replaceNextAction(0), - m_widget(new QWidget) + m_widget(new QWidget), + m_casesensitiveIcon(":/find/images/casesensitively.png"), + m_regexpIcon(":/find/images/regexp.png"), + m_wholewordsIcon(":/find/images/wholewords.png") { //setup ui m_ui.setupUi(m_widget); @@ -215,6 +218,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen lineEditMenu->addAction(m_wholeWordAction); m_regularExpressionAction = new QAction(tr("Use Regular Expressions"), this); + m_regularExpressionAction->setIcon(QIcon(":/find/images/regexp.png")); m_regularExpressionAction->setCheckable(true); m_regularExpressionAction->setChecked(false); cmd = am->registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); @@ -435,21 +439,30 @@ void FindToolBar::findFlagsChanged() void FindToolBar::updateIcons() { - bool casesensitive = m_findFlags & QTextDocument::FindCaseSensitively; - bool wholewords = m_findFlags & QTextDocument::FindWholeWords; + bool casesensitive = m_findFlags & IFindSupport::FindCaseSensitively; + bool wholewords = m_findFlags & IFindSupport::FindWholeWords; + bool regexp = m_findFlags & IFindSupport::FindRegularExpression; + QPixmap pixmap(17, 17); + QPainter painter(&pixmap); + painter.eraseRect(0, 0, 17, 17); + int x = 16; - if (casesensitive && wholewords) { - QPixmap image = QPixmap(":/find/images/wordandcase.png"); - m_ui.findEdit->setPixmap(image); - } else if (casesensitive) { - QPixmap image = QPixmap(":/find/images/casesensitively.png"); - m_ui.findEdit->setPixmap(image); - } else if (wholewords) { - QPixmap image = QPixmap(":/find/images/wholewords.png"); - m_ui.findEdit->setPixmap(image); - } else { - m_ui.findEdit->setPixmap(QPixmap(Core::Constants::ICON_MAGNIFIER)); + if (casesensitive) { + painter.drawPixmap(x-10, 0, m_casesensitiveIcon); + x -= 6; } + if (wholewords) { + painter.drawPixmap(x-10, 0, m_wholewordsIcon); + x -= 6; + } + if (regexp) { + painter.drawPixmap(x-10, 0, m_regexpIcon); + } + if (!casesensitive && !wholewords && !regexp) { + QPixmap mag(Core::Constants::ICON_MAGNIFIER); + painter.drawPixmap(0, (pixmap.height() - mag.height()) / 2, mag); + } + m_ui.findEdit->setPixmap(pixmap); } void FindToolBar::updateFlagMenus() diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/find/findtoolbar.h index 0e5d86bc900..11e6d1a717e 100644 --- a/src/plugins/find/findtoolbar.h +++ b/src/plugins/find/findtoolbar.h @@ -114,6 +114,10 @@ private: QAction *m_regularExpressionAction; QWidget *m_widget; IFindSupport::FindFlags m_findFlags; + + QPixmap m_casesensitiveIcon; + QPixmap m_regexpIcon; + QPixmap m_wholewordsIcon; }; } // namespace Internal diff --git a/src/plugins/find/images/casesensitively.png b/src/plugins/find/images/casesensitively.png index 93038c0523c51da7b04ea8de4bc91e8bcef52d06..029b41faa4da49c90f294d7bcb5930fd3105242f 100644 GIT binary patch delta 124 zcmdnSIFoULN@;?pi(`m|U~<9&)fvYOKH76kPG#TZmSVOm(dPxzl24HzG7qF1+tnsm zrkp*IQ_?F^-I&CDA=brczTkYml>O<3PacPMC-QAdOEKH!)OEN4B-wI^-BR{hjYRLF dgn$Bu=shwww6y-TGcYhPc)I$ztaD0e0swUEGGzb& delta 154 zcmbQqxQ%gwO1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_p)*PZ!6K zid#v4{{OdUR&8LNex&4>XTfCS|IZB{nJ_+KDzWKJd{kdklXB*WgQCJI?i9&}H~BSf zfp1v5coUX*TOF7!#%3dXK~Lb~XQqyRT^Wr&)~>w_0tpQI!l&z+LZ4>TGB7YOc)I$z JtaD0e0swA%JLv!b diff --git a/src/plugins/find/images/wholewords.png b/src/plugins/find/images/wholewords.png index 0187023ada3c42321bdde22f1981e22946ba370d..0ffcecd963ceb70b16f9b2ed558cb649eba62d4d 100644 GIT binary patch delta 117 zcmcb_IEitBN?xR=i(`m|U~<9&$&5FD`jgD8RbUfq}u()z4*}Q$iB};t(me delta 182 zcmbQlc!_a>O1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_p)_PZ!6K zid$QPPIDbF;0S(c{@&t7-fjQ%3V}7VQ(dJ5e4-z(=4sFp@c*%AV&T`vf4vo&*^=%@ z=yq|4Dn=fgbbu%7+WPf}iofpue${ka;QML1VV5;CSkp>ke&|2?XR|NT_{f$!_Dpss o%#2hGex38a79saY`2d67^Gx4$navj%7#J8lUHx3vIVCg!00j+BCIA2c diff --git a/src/plugins/find/images/wordandcase.png b/src/plugins/find/images/wordandcase.png index 3a34cbea83b5289c0c735b57b0a8620b8b93d62f..34c0ac319088ea57b7cbebab2974bacfa6057d77 100644 GIT binary patch delta 170 zcmbQoc#Ls^N`0@Vi(`m}=-NO-t_B019M|xAt-iiTFEsvLxw^3E(7~-NzDJ!rFFnzl zZqj1!zkQA8Pm_DUY#$okzfifEq4&5zq34Atg|}%>f2K8^uk6wZP%29~rz_2H>K}{R zid(Bvz8Wjd73?&+mQjdp(3-hp|2F~U2`{#(IwX5Mzq3Vh chuRJXHWkO73-yYk3=9kmp00i_>zopr0B!nBRsaA1 delta 129 zcmX@cIFE6HN>!?-i(`n!#J!UOxegd`IG4V;cWLtNe!mSfPqpQ|cfT#vxx}S5rQKh@`xyQ2