Add missing visualizer of reg exp search option in find tool bar.

Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
This commit is contained in:
con
2009-06-02 16:49:29 +02:00
parent d8cca2b79d
commit 89a50de58e
6 changed files with 32 additions and 21 deletions

View File

@@ -1,13 +1,7 @@
<RCC> <RCC>
<qresource prefix="/find" > <qresource prefix="/find" >
<file>images/all.png</file>
<file>images/casesensitively.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/wholewords.png</file>
<file>images/wordandcase.png</file> <file>images/regexp.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -68,7 +68,10 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_findNextAction(0), m_findNextAction(0),
m_findPreviousAction(0), m_findPreviousAction(0),
m_replaceNextAction(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 //setup ui
m_ui.setupUi(m_widget); m_ui.setupUi(m_widget);
@@ -215,6 +218,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
lineEditMenu->addAction(m_wholeWordAction); lineEditMenu->addAction(m_wholeWordAction);
m_regularExpressionAction = new QAction(tr("Use Regular Expressions"), this); m_regularExpressionAction = new QAction(tr("Use Regular Expressions"), this);
m_regularExpressionAction->setIcon(QIcon(":/find/images/regexp.png"));
m_regularExpressionAction->setCheckable(true); m_regularExpressionAction->setCheckable(true);
m_regularExpressionAction->setChecked(false); m_regularExpressionAction->setChecked(false);
cmd = am->registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); cmd = am->registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext);
@@ -435,21 +439,30 @@ void FindToolBar::findFlagsChanged()
void FindToolBar::updateIcons() void FindToolBar::updateIcons()
{ {
bool casesensitive = m_findFlags & QTextDocument::FindCaseSensitively; bool casesensitive = m_findFlags & IFindSupport::FindCaseSensitively;
bool wholewords = m_findFlags & QTextDocument::FindWholeWords; 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) { if (casesensitive) {
QPixmap image = QPixmap(":/find/images/wordandcase.png"); painter.drawPixmap(x-10, 0, m_casesensitiveIcon);
m_ui.findEdit->setPixmap(image); x -= 6;
} 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 (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() void FindToolBar::updateFlagMenus()

View File

@@ -114,6 +114,10 @@ private:
QAction *m_regularExpressionAction; QAction *m_regularExpressionAction;
QWidget *m_widget; QWidget *m_widget;
IFindSupport::FindFlags m_findFlags; IFindSupport::FindFlags m_findFlags;
QPixmap m_casesensitiveIcon;
QPixmap m_regexpIcon;
QPixmap m_wholewordsIcon;
}; };
} // namespace Internal } // namespace Internal

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 198 B