forked from qt-creator/qt-creator
Mark canceled searches as such.
Task-number: QTCREATORBUG-6820 Change-Id: Ic14c0ea6f26e4a05c642012b87578f30c817fef7 Reviewed-by: Robert Löhning <robert.loehning@nokia.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -275,7 +275,7 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search)
|
|||||||
{
|
{
|
||||||
CppFindReferencesParameters parameters = search->userData().value<CppFindReferencesParameters>();
|
CppFindReferencesParameters parameters = search->userData().value<CppFindReferencesParameters>();
|
||||||
if (!(parameters.symbol && parameters.symbol->identifier())) {
|
if (!(parameters.symbol && parameters.symbol->identifier())) {
|
||||||
search->finishSearch();
|
search->finishSearch(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
|
connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
|
||||||
@@ -313,7 +313,7 @@ void CppFindReferences::searchAgain()
|
|||||||
Snapshot snapshot = CppModelManagerInterface::instance()->snapshot();
|
Snapshot snapshot = CppModelManagerInterface::instance()->snapshot();
|
||||||
search->restart();
|
search->restart();
|
||||||
if (!findSymbol(¶meters, snapshot)) {
|
if (!findSymbol(¶meters, snapshot)) {
|
||||||
search->finishSearch();
|
search->finishSearch(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
search->setUserData(qVariantFromValue(parameters));
|
search->setUserData(qVariantFromValue(parameters));
|
||||||
@@ -498,7 +498,7 @@ void CppFindReferences::searchFinished()
|
|||||||
QFutureWatcher<Usage> *watcher = static_cast<QFutureWatcher<Usage> *>(sender());
|
QFutureWatcher<Usage> *watcher = static_cast<QFutureWatcher<Usage> *>(sender());
|
||||||
Find::SearchResult *search = m_watchers.value(watcher);
|
Find::SearchResult *search = m_watchers.value(watcher);
|
||||||
if (search)
|
if (search)
|
||||||
search->finishSearch();
|
search->finishSearch(watcher->isCanceled());
|
||||||
m_watchers.remove(watcher);
|
m_watchers.remove(watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ void SymbolsFindFilter::finish()
|
|||||||
static_cast<QFutureWatcher<Find::SearchResultItem> *>(sender());
|
static_cast<QFutureWatcher<Find::SearchResultItem> *>(sender());
|
||||||
Find::SearchResult *search = m_watchers.value(watcher);
|
Find::SearchResult *search = m_watchers.value(watcher);
|
||||||
if (search)
|
if (search)
|
||||||
search->finishSearch();
|
search->finishSearch(watcher->isCanceled());
|
||||||
m_watchers.remove(watcher);
|
m_watchers.remove(watcher);
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,23 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
|||||||
QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
|
QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
|
||||||
topLayout->setMargin(2);
|
topLayout->setMargin(2);
|
||||||
topWidget->setLayout(topLayout);
|
topWidget->setLayout(topLayout);
|
||||||
|
layout->addWidget(topWidget);
|
||||||
|
|
||||||
|
m_messageWidget = new QFrame;
|
||||||
|
pal.setColor(QPalette::Window, QColor(255, 255, 225));
|
||||||
|
pal.setColor(QPalette::WindowText, Qt::red);
|
||||||
|
m_messageWidget->setPalette(pal);
|
||||||
|
m_messageWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||||
|
m_messageWidget->setLineWidth(1);
|
||||||
|
m_messageWidget->setAutoFillBackground(true);
|
||||||
|
QHBoxLayout *messageLayout = new QHBoxLayout(m_messageWidget);
|
||||||
|
messageLayout->setMargin(2);
|
||||||
|
m_messageWidget->setLayout(messageLayout);
|
||||||
|
QLabel *messageLabel = new QLabel(tr("Search was canceled."));
|
||||||
|
messageLabel->setPalette(pal);
|
||||||
|
messageLayout->addWidget(messageLabel);
|
||||||
|
layout->addWidget(m_messageWidget);
|
||||||
|
m_messageWidget->setVisible(false);
|
||||||
|
|
||||||
m_searchResultTreeView = new Internal::SearchResultTreeView(this);
|
m_searchResultTreeView = new Internal::SearchResultTreeView(this);
|
||||||
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
||||||
@@ -104,11 +121,9 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
|||||||
agg->add(m_searchResultTreeView);
|
agg->add(m_searchResultTreeView);
|
||||||
agg->add(new TreeViewFind(m_searchResultTreeView,
|
agg->add(new TreeViewFind(m_searchResultTreeView,
|
||||||
ItemDataRoles::ResultLineRole));
|
ItemDataRoles::ResultLineRole));
|
||||||
|
|
||||||
layout->addWidget(topWidget);
|
|
||||||
layout->addWidget(m_searchResultTreeView);
|
layout->addWidget(m_searchResultTreeView);
|
||||||
|
|
||||||
m_infoBarDisplay.setTarget(layout, 1);
|
m_infoBarDisplay.setTarget(layout, 2);
|
||||||
m_infoBarDisplay.setInfoBar(&m_infoBar);
|
m_infoBarDisplay.setInfoBar(&m_infoBar);
|
||||||
|
|
||||||
m_descriptionContainer = new QWidget(topWidget);
|
m_descriptionContainer = new QWidget(topWidget);
|
||||||
@@ -332,6 +347,7 @@ void SearchResultWidget::restart()
|
|||||||
m_count = 0;
|
m_count = 0;
|
||||||
m_cancelButton->setVisible(true);
|
m_cancelButton->setVisible(true);
|
||||||
m_searchAgainButton->setVisible(false);
|
m_searchAgainButton->setVisible(false);
|
||||||
|
m_messageWidget->setVisible(false);
|
||||||
updateMatchesFoundLabel();
|
updateMatchesFoundLabel();
|
||||||
emit restarted();
|
emit restarted();
|
||||||
}
|
}
|
||||||
@@ -347,11 +363,12 @@ void SearchResultWidget::setSearchAgainEnabled(bool enabled)
|
|||||||
m_searchAgainButton->setEnabled(enabled);
|
m_searchAgainButton->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWidget::finishSearch()
|
void SearchResultWidget::finishSearch(bool canceled)
|
||||||
{
|
{
|
||||||
m_replaceTextEdit->setEnabled(m_count > 0);
|
m_replaceTextEdit->setEnabled(m_count > 0);
|
||||||
m_replaceButton->setEnabled(m_count > 0);
|
m_replaceButton->setEnabled(m_count > 0);
|
||||||
m_cancelButton->setVisible(false);
|
m_cancelButton->setVisible(false);
|
||||||
|
m_messageWidget->setVisible(canceled);
|
||||||
m_searchAgainButton->setVisible(m_searchAgainSupported);
|
m_searchAgainButton->setVisible(m_searchAgainSupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/infobar.h>
|
#include <coreplugin/infobar.h>
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
@@ -89,7 +90,7 @@ public:
|
|||||||
void setSearchAgainEnabled(bool enabled);
|
void setSearchAgainEnabled(bool enabled);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void finishSearch();
|
void finishSearch(bool canceled);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activated(const Find::SearchResultItem &item);
|
void activated(const Find::SearchResultItem &item);
|
||||||
@@ -117,6 +118,7 @@ private:
|
|||||||
SearchResultTreeView *m_searchResultTreeView;
|
SearchResultTreeView *m_searchResultTreeView;
|
||||||
int m_count;
|
int m_count;
|
||||||
QString m_dontAskAgainGroup;
|
QString m_dontAskAgainGroup;
|
||||||
|
QFrame *m_messageWidget;
|
||||||
Core::InfoBar m_infoBar;
|
Core::InfoBar m_infoBar;
|
||||||
Core::InfoBarDisplay m_infoBarDisplay;
|
Core::InfoBarDisplay m_infoBarDisplay;
|
||||||
bool m_isShowingReplaceUI;
|
bool m_isShowingReplaceUI;
|
||||||
|
|||||||
@@ -669,9 +669,9 @@ void SearchResult::addResults(const QList<SearchResultItem> &items, AddMode mode
|
|||||||
\brief Notifies the search result window that the current search
|
\brief Notifies the search result window that the current search
|
||||||
has finished, and the UI should reflect that.
|
has finished, and the UI should reflect that.
|
||||||
*/
|
*/
|
||||||
void SearchResult::finishSearch()
|
void SearchResult::finishSearch(bool canceled)
|
||||||
{
|
{
|
||||||
m_widget->finishSearch();
|
m_widget->finishSearch(canceled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public slots:
|
|||||||
void addResult(const QString &fileName, int lineNumber, const QString &lineText,
|
void addResult(const QString &fileName, int lineNumber, const QString &lineText,
|
||||||
int searchTermStart, int searchTermLength, const QVariant &userData = QVariant());
|
int searchTermStart, int searchTermLength, const QVariant &userData = QVariant());
|
||||||
void addResults(const QList<SearchResultItem> &items, AddMode mode);
|
void addResults(const QList<SearchResultItem> &items, AddMode mode);
|
||||||
void finishSearch();
|
void finishSearch(bool canceled);
|
||||||
void setTextToReplace(const QString &textToReplace);
|
void setTextToReplace(const QString &textToReplace);
|
||||||
void restart();
|
void restart();
|
||||||
void setSearchAgainEnabled(bool enabled);
|
void setSearchAgainEnabled(bool enabled);
|
||||||
|
|||||||
@@ -958,7 +958,7 @@ void FindReferences::displayResults(int first, int last)
|
|||||||
void FindReferences::searchFinished()
|
void FindReferences::searchFinished()
|
||||||
{
|
{
|
||||||
if (m_currentSearch)
|
if (m_currentSearch)
|
||||||
m_currentSearch->finishSearch();
|
m_currentSearch->finishSearch(m_watcher.isCanceled());
|
||||||
m_currentSearch = 0;
|
m_currentSearch = 0;
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ void BaseFileFind::searchFinished()
|
|||||||
static_cast<QFutureWatcher<FileSearchResultList> *>(sender());
|
static_cast<QFutureWatcher<FileSearchResultList> *>(sender());
|
||||||
SearchResult *search = m_watchers.value(watcher);
|
SearchResult *search = m_watchers.value(watcher);
|
||||||
if (search)
|
if (search)
|
||||||
search->finishSearch();
|
search->finishSearch(watcher->isCanceled());
|
||||||
m_watchers.remove(watcher);
|
m_watchers.remove(watcher);
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user