From 7112ca1c56f3ca9b458bcc3561a69b3193d7d69e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 5 Mar 2018 11:38:11 +0100 Subject: [PATCH] Add "New Search" tool button to search results pane Task-number: QTCREATORBUG-17870 Change-Id: If939e71cb74b5a0b6811e435b02e86c5053bd067 Reviewed-by: Alessandro Portale --- .../utils/images/iconoverlay_add_small.png | Bin 0 -> 99 bytes .../utils/images/iconoverlay_add_small@2x.png | Bin 0 -> 102 bytes src/libs/utils/utils.qrc | 2 ++ src/libs/utils/utilsicons.cpp | 3 +++ src/libs/utils/utilsicons.h | 1 + .../coreplugin/find/searchresultwindow.cpp | 11 ++++++++++- src/tools/icons/qtcreatoricons.svg | 17 +++++++++++++++++ 7 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/libs/utils/images/iconoverlay_add_small.png create mode 100644 src/libs/utils/images/iconoverlay_add_small@2x.png diff --git a/src/libs/utils/images/iconoverlay_add_small.png b/src/libs/utils/images/iconoverlay_add_small.png new file mode 100644 index 0000000000000000000000000000000000000000..1a628682b145df0f016bc28d82d803014efd961c GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRdMrH;E236Z!B?bltwg8_HR|W=#|Ns9ly*d9b z0|SGEr;B3!XQ){ourx+L*7(8A5T-G@yGywo` CPaH}B literal 0 HcmV?d00001 diff --git a/src/libs/utils/images/iconoverlay_add_small@2x.png b/src/libs/utils/images/iconoverlay_add_small@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1a80ee0911aeddb6d439bb99f8fa213d02194030 GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;IMrH;E2G1=owlgp=um$*pxH2#>{Qv)d>CO3f z85kI(JzX3_IHHq(@U!rQDA+wv{%2s2EbycBfDapkVNKc9aF2D17(fQN`njxgN@xNA D^;8__ literal 0 HcmV?d00001 diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc index d0bb9891da2..859883bd706 100644 --- a/src/libs/utils/utils.qrc +++ b/src/libs/utils/utils.qrc @@ -157,6 +157,8 @@ images/collapse@2x.png images/expand.png images/expand@2x.png + images/iconoverlay_add_small.png + images/iconoverlay_add_small@2x.png images/iconoverlay_add.png images/iconoverlay_add@2x.png images/iconoverlay_add_background.png diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index 65dc1c1c6e0..3fde63e7630 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -82,6 +82,9 @@ const Icon BOOKMARK_TEXTEDITOR({ {QLatin1String(":/utils/images/bookmark.png"), Theme::Bookmarks_TextMarkColor}}, Icon::Tint); const Icon SNAPSHOT_TOOLBAR({ {QLatin1String(":/utils/images/snapshot.png"), Theme::IconsBaseColor}}); +const Icon NEWSEARCH_TOOLBAR({ + {QLatin1String(":/utils/images/zoom.png"), Theme::IconsBaseColor}, + {QLatin1String(":/utils/images/iconoverlay_add_small.png"), Theme::IconsRunColor}}); const Icon NEWFILE({ {QLatin1String(":/utils/images/filenew.png"), Theme::PanelTextColorMid}}, Icon::Tint); diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index 1879382c792..36748cfa92b 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -55,6 +55,7 @@ QTCREATOR_UTILS_EXPORT extern const Icon BOOKMARK; QTCREATOR_UTILS_EXPORT extern const Icon BOOKMARK_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon BOOKMARK_TEXTEDITOR; QTCREATOR_UTILS_EXPORT extern const Icon SNAPSHOT_TOOLBAR; +QTCREATOR_UTILS_EXPORT extern const Icon NEWSEARCH_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon NEWFILE; QTCREATOR_UTILS_EXPORT extern const Icon OPENFILE; diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index ce3d0e2a086..5de04e87d29 100644 --- a/src/plugins/coreplugin/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -26,6 +26,7 @@ #include "searchresultwindow.h" #include "searchresultwidget.h" #include "searchresultcolor.h" +#include "textfindconstants.h" #include #include @@ -90,6 +91,7 @@ namespace Internal { SearchResultWindow *q; QList m_searchResultWidgets; QToolButton *m_expandCollapseButton; + QToolButton *m_newSearchButton; QAction *m_expandCollapseAction; static const bool m_initiallyExpand = false; QWidget *m_spacer; @@ -141,6 +143,13 @@ namespace Internal { cmd->setAttribute(Command::CA_UpdateText); m_expandCollapseButton->setDefaultAction(cmd->action()); + QAction *newSearchAction = new QAction(tr("New Search"), this); + newSearchAction->setIcon(Utils::Icons::NEWSEARCH_TOOLBAR.icon()); + cmd = ActionManager::command(Constants::ADVANCED_FIND); + m_newSearchButton = Command::toolButtonWithAppendedShortcut(newSearchAction, cmd); + if (QTC_GUARD(cmd && cmd->action())) + connect(m_newSearchButton, &QToolButton::triggered, cmd->action(), &QAction::trigger); + connect(m_expandCollapseAction, &QAction::toggled, this, &SearchResultWindowPrivate::handleExpandCollapseToolButton); @@ -340,7 +349,7 @@ QWidget *SearchResultWindow::outputWidget(QWidget *) */ QList SearchResultWindow::toolBarWidgets() const { - return {d->m_expandCollapseButton, d->m_spacer, + return {d->m_expandCollapseButton, d->m_newSearchButton, d->m_spacer, d->m_historyLabel, d->m_spacer2, d->m_recentSearchesBox}; } diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 32639a51b02..d344fe4b247 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -8168,6 +8168,23 @@ cy="578" r="5" /> + + + +