From 89a50de58ec17d1257ca4635af11489b37e0107c Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> 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 <thorbjorn.lindeijer@nokia.com> --- src/plugins/find/find.qrc | 8 +--- src/plugins/find/findtoolbar.cpp | 43 +++++++++++++------- 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, 33 insertions(+), 22 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 @@ <RCC> <qresource prefix="/find" > - <file>images/all.png</file> <file>images/casesensitively.png</file> - <file>images/empty.png</file> - <file>images/expand.png</file> - <file>images/next.png</file> - <file>images/previous.png</file> - <file>images/replace_all.png</file> <file>images/wholewords.png</file> - <file>images/wordandcase.png</file> + <file>images/regexp.png</file> </qresource> </RCC> 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; - - 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)); + 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) { + 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-QAd1L|<<I@|z~Y&pbkDf_HOqIXe3 aKmkMa9+?|jT7TLZfWXt$&t;ucLK6UV>@sBl delta 154 zcmV;L0A>G~0k#2<B!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o00013 zNkl<Zc-mt8|NlP&C4dE&#B|0<aFa9t=P}|m0ptR7JdI)Ee|&so%)~$;Aj%758G!6> ze1=i%1&R$|q)R%$n-&H<9ndZi(ena`k1ZT1js=Rn01#jRFB8jtf>q^ceE<Le07*qo IM6N<$f^K^|=>Px# 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 zcmV-*0E++80g?fbByL$rL_t(I5o2JW8EEYMk771DA1cX&qKFI*3tl}qY{jbwE{U!g zoexz=u@@*d0PbSyGtm8v&L1>kKsXR_I2{&d_zeJQt}ka~AYcg0FjN{{6FMJN^#Jk! XYeyM&oKNPF00000NkvXXu0mjf;t(me delta 182 zcmV;n07?In0n!1GB!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0001V zNkl<Zc-pj5%L>3S2vg}d?>N|Q+fQeB5UiVJMH&!HTjQ$?fGQAA_`H#E_2d0ZAcF>C z-&ie*2o)h&#*)AcTGp?x!gKYz_tiDFQSX*5R?{hH1!i<y_%GuAJib{o#I)Q$0zSw# kG9@tj&P&!<9^xaw050cgO|EH!&;S4c07*qoM6N<$f&~puCIA2c 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 zcmV;b09F5<0mcE4B!7)bL_t(26|GS*3V<*SY(-apDvplg=qUcw)uD32!L<ZU#X?Ea z<Sv&qgg;NWtV#Ja-ugY^GT+d7vjC095OGP+S|IIa<@siU&v}Y0P$G6@&Mg}N%Kii< zsM@Mz^)n)!5s5O^Vsl|ypuTp*{O*MT=w8^9T&giU1Bk!&5F?Q2wk1GgNax(N8Mr36 Y00tyMjL?4}6#xJL07*qoM6N<$f^GUuRsaA1 delta 129 zcmV-{0Dk|*0iFSnBzk2@L_t(2k-d^p3cxT3Lv`%l(v#bdPOzEEhHURg+Y*VSM155E ziv2=JR7mh1#rI)eWc|_cdsa4)z_J(SI~TT@_lo@oT+_`WC+CH?K4{omJ1W(;dpa@m jlehvRyY=@>GXIGQHn~X39MsPa00000NkvXXu0mjf67D_i -- GitLab