2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "searchresultwindow.h"
|
2011-09-06 13:03:15 +02:00
|
|
|
#include "searchresultwidget.h"
|
2012-10-18 08:02:25 +02:00
|
|
|
#include "searchresultcolor.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-21 18:09:37 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2010-06-29 13:34:43 +02:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
|
#include <coreplugin/icontext.h>
|
2009-10-05 16:01:50 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2014-07-14 16:19:40 +02:00
|
|
|
#include <utils/styledbar.h>
|
2009-01-21 18:09:37 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QAction>
|
|
|
|
|
#include <QComboBox>
|
2014-07-14 16:19:40 +02:00
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QFont>
|
|
|
|
|
#include <QLabel>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QScrollArea>
|
2014-07-14 16:19:40 +02:00
|
|
|
#include <QSettings>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStackedWidget>
|
2014-07-14 16:19:40 +02:00
|
|
|
#include <QToolButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-24 10:43:01 +01:00
|
|
|
static const char SETTINGSKEYSECTIONNAME[] = "SearchResults";
|
|
|
|
|
static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults";
|
2012-02-07 12:25:28 +01:00
|
|
|
static const int MAX_SEARCH_HISTORY = 12;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
namespace Core {
|
2009-09-29 16:59:19 +02:00
|
|
|
|
2010-06-29 13:16:54 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-12-06 16:57:09 +01:00
|
|
|
class InternalScrollArea : public QScrollArea
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit InternalScrollArea(QWidget *parent)
|
|
|
|
|
: QScrollArea(parent)
|
|
|
|
|
{
|
|
|
|
|
setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
|
|
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSize sizeHint() const
|
|
|
|
|
{
|
|
|
|
|
if (widget())
|
|
|
|
|
return widget()->size();
|
|
|
|
|
return QScrollArea::sizeHint();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SearchResultWindowPrivate : public QObject
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
SearchResultWindowPrivate(SearchResultWindow *window);
|
|
|
|
|
bool isSearchVisible() const;
|
|
|
|
|
int visibleSearchIndex() const;
|
2012-05-25 16:45:18 +02:00
|
|
|
void setCurrentIndex(int index, bool focus);
|
2010-06-29 13:16:54 +02:00
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
FindPlugin *m_plugin;
|
2011-09-09 16:10:57 +02:00
|
|
|
SearchResultWindow *q;
|
|
|
|
|
QList<Internal::SearchResultWidget *> m_searchResultWidgets;
|
2010-06-29 13:34:43 +02:00
|
|
|
QToolButton *m_expandCollapseButton;
|
|
|
|
|
QAction *m_expandCollapseAction;
|
2010-06-29 13:16:54 +02:00
|
|
|
static const bool m_initiallyExpand = false;
|
2011-09-09 16:10:57 +02:00
|
|
|
QWidget *m_spacer;
|
2014-07-14 16:19:40 +02:00
|
|
|
QLabel *m_historyLabel;
|
|
|
|
|
QWidget *m_spacer2;
|
2011-09-09 16:10:57 +02:00
|
|
|
QComboBox *m_recentSearchesBox;
|
2011-09-09 08:46:51 +02:00
|
|
|
QStackedWidget *m_widget;
|
2011-09-09 16:10:57 +02:00
|
|
|
QList<SearchResult *> m_searchResults;
|
|
|
|
|
int m_currentIndex;
|
2011-11-01 11:46:22 +01:00
|
|
|
QFont m_font;
|
2012-10-18 08:02:25 +02:00
|
|
|
SearchResultColor m_color;
|
2011-09-09 16:10:57 +02:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void setCurrentIndex(int index);
|
2012-02-07 15:44:12 +01:00
|
|
|
void moveWidgetToTop();
|
2012-05-25 16:45:18 +02:00
|
|
|
void popupRequested(bool focus);
|
2010-06-29 13:16:54 +02:00
|
|
|
};
|
|
|
|
|
|
2011-09-09 16:10:57 +02:00
|
|
|
SearchResultWindowPrivate::SearchResultWindowPrivate(SearchResultWindow *window)
|
|
|
|
|
: q(window)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SearchResultWindowPrivate::isSearchVisible() const
|
|
|
|
|
{
|
|
|
|
|
return m_currentIndex > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SearchResultWindowPrivate::visibleSearchIndex() const
|
2010-06-29 13:16:54 +02:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
return m_currentIndex - 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-25 16:45:18 +02:00
|
|
|
void SearchResultWindowPrivate::setCurrentIndex(int index, bool focus)
|
2011-09-09 16:10:57 +02:00
|
|
|
{
|
|
|
|
|
if (isSearchVisible())
|
|
|
|
|
m_searchResultWidgets.at(visibleSearchIndex())->notifyVisibilityChanged(false);
|
|
|
|
|
m_currentIndex = index;
|
|
|
|
|
m_widget->setCurrentIndex(index);
|
|
|
|
|
m_recentSearchesBox->setCurrentIndex(index);
|
|
|
|
|
if (!isSearchVisible()) {
|
2012-05-25 16:45:18 +02:00
|
|
|
if (focus)
|
|
|
|
|
m_widget->currentWidget()->setFocus();
|
2011-09-09 16:10:57 +02:00
|
|
|
m_expandCollapseButton->setEnabled(false);
|
|
|
|
|
} else {
|
2012-05-25 16:45:18 +02:00
|
|
|
if (focus)
|
|
|
|
|
m_searchResultWidgets.at(visibleSearchIndex())->setFocusInternally();
|
2011-09-09 16:10:57 +02:00
|
|
|
m_searchResultWidgets.at(visibleSearchIndex())->notifyVisibilityChanged(true);
|
|
|
|
|
m_expandCollapseButton->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
q->navigateStateChanged();
|
2010-06-29 13:16:54 +02:00
|
|
|
}
|
2012-02-07 15:44:12 +01:00
|
|
|
|
2012-05-25 16:45:18 +02:00
|
|
|
void SearchResultWindowPrivate::setCurrentIndex(int index)
|
|
|
|
|
{
|
|
|
|
|
setCurrentIndex(index, true/*focus*/);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-07 15:44:12 +01:00
|
|
|
void SearchResultWindowPrivate::moveWidgetToTop()
|
|
|
|
|
{
|
|
|
|
|
SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
|
|
|
|
|
QTC_ASSERT(widget, return);
|
|
|
|
|
int index = m_searchResultWidgets.indexOf(widget);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return; // nothing to do
|
|
|
|
|
int internalIndex = index + 1/*account for "new search" entry*/;
|
|
|
|
|
QString searchEntry = m_recentSearchesBox->itemText(internalIndex);
|
|
|
|
|
|
|
|
|
|
m_searchResultWidgets.removeAt(index);
|
|
|
|
|
m_widget->removeWidget(widget);
|
|
|
|
|
m_recentSearchesBox->removeItem(internalIndex);
|
|
|
|
|
SearchResult *result = m_searchResults.takeAt(index);
|
|
|
|
|
|
|
|
|
|
m_searchResultWidgets.prepend(widget);
|
|
|
|
|
m_widget->insertWidget(1, widget);
|
|
|
|
|
m_recentSearchesBox->insertItem(1, searchEntry);
|
|
|
|
|
m_searchResults.prepend(result);
|
|
|
|
|
|
|
|
|
|
// adapt the current index
|
|
|
|
|
if (index == visibleSearchIndex()) {
|
|
|
|
|
// was visible, so we switch
|
|
|
|
|
// this is the default case
|
|
|
|
|
m_currentIndex = 1;
|
|
|
|
|
m_widget->setCurrentIndex(1);
|
|
|
|
|
m_recentSearchesBox->setCurrentIndex(1);
|
|
|
|
|
} else if (visibleSearchIndex() < index) {
|
|
|
|
|
// academical case where the widget moved before the current widget
|
|
|
|
|
// only our internal book keeping needed
|
|
|
|
|
++m_currentIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-05-25 16:45:18 +02:00
|
|
|
|
|
|
|
|
void SearchResultWindowPrivate::popupRequested(bool focus)
|
|
|
|
|
{
|
|
|
|
|
SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
|
|
|
|
|
QTC_ASSERT(widget, return);
|
|
|
|
|
int internalIndex = m_searchResultWidgets.indexOf(widget) + 1/*account for "new search" entry*/;
|
|
|
|
|
setCurrentIndex(internalIndex, focus);
|
2012-09-13 15:50:06 +02:00
|
|
|
q->popup(focus ? Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus
|
|
|
|
|
: Core::IOutputPane::NoModeSwitch);
|
2012-05-25 16:45:18 +02:00
|
|
|
}
|
2010-03-24 10:43:01 +01:00
|
|
|
}
|
2009-09-29 16:40:52 +02:00
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
using namespace Core::Internal;
|
2010-06-29 13:16:54 +02:00
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
2014-01-13 16:17:34 +01:00
|
|
|
\enum Core::SearchResultWindow::SearchMode
|
2013-09-09 10:46:07 +02:00
|
|
|
This enum type specifies whether a search should show the replace UI or not:
|
2010-07-12 12:05:31 +02:00
|
|
|
|
|
|
|
|
\value SearchOnly
|
2013-09-09 10:46:07 +02:00
|
|
|
The search does not support replace.
|
2010-07-12 12:05:31 +02:00
|
|
|
\value SearchAndReplace
|
|
|
|
|
The search supports replace, so show the UI for it.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-01-13 16:17:34 +01:00
|
|
|
\class Core::SearchResult
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The SearchResult class reports user interaction, such as the
|
|
|
|
|
activation of a search result item.
|
2010-07-12 12:05:31 +02:00
|
|
|
|
|
|
|
|
Whenever a new search is initiated via startNewSearch, an instance of this
|
|
|
|
|
class is returned to provide the initiator with the hooks for handling user
|
|
|
|
|
interaction.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-01-13 16:17:34 +01:00
|
|
|
\fn void SearchResult::activated(const Core::SearchResultItem &item)
|
2013-09-09 10:46:07 +02:00
|
|
|
Indicates that the user activated the search result \a item by
|
|
|
|
|
double-clicking it, for example.
|
2010-07-12 12:05:31 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-01-13 16:17:34 +01:00
|
|
|
\fn void SearchResult::replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &checkedItems, bool preserveCase)
|
2013-09-09 10:46:07 +02:00
|
|
|
Indicates that the user initiated a text replace by selecting
|
|
|
|
|
\gui {Replace All}, for example.
|
2010-07-12 12:05:31 +02:00
|
|
|
|
|
|
|
|
The signal reports the text to use for replacement in \a replaceText,
|
|
|
|
|
and the list of search result items that were selected by the user
|
|
|
|
|
in \a checkedItems.
|
|
|
|
|
The handler of this signal should apply the replace only on the selected
|
|
|
|
|
items.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-01-13 16:17:34 +01:00
|
|
|
\class Core::SearchResultWindow
|
2010-07-12 12:05:31 +02:00
|
|
|
\brief The SearchResultWindow class is the implementation of a commonly
|
|
|
|
|
shared \gui{Search Results} output pane. Use it to show search results
|
|
|
|
|
to a user.
|
|
|
|
|
|
|
|
|
|
Whenever you want to show the user a list of search results, or want
|
|
|
|
|
to present UI for a global search and replace, use the single instance
|
|
|
|
|
of this class.
|
|
|
|
|
|
|
|
|
|
Except for being an implementation of a output pane, the
|
2013-10-07 13:34:40 +02:00
|
|
|
SearchResultWindow has a few functions and one enum that allows other
|
2010-07-12 12:05:31 +02:00
|
|
|
plugins to show their search results and hook into the user actions for
|
|
|
|
|
selecting an entry and performing a global replace.
|
|
|
|
|
|
|
|
|
|
Whenever you start a search, call startNewSearch(SearchMode) to initialize
|
2013-09-09 10:46:07 +02:00
|
|
|
the \gui {Search Results} output pane. The parameter determines if the GUI for
|
2010-07-12 12:05:31 +02:00
|
|
|
replacing should be shown.
|
2013-10-07 13:34:40 +02:00
|
|
|
The function returns a SearchResult object that is your
|
2010-07-12 12:05:31 +02:00
|
|
|
hook into the signals from user interaction for this search.
|
|
|
|
|
When you produce search results, call addResults or addResult to add them
|
2013-09-09 10:46:07 +02:00
|
|
|
to the \gui {Search Results} output pane.
|
|
|
|
|
After the search has finished call finishSearch to inform the
|
|
|
|
|
\gui {Search Results} output pane about it.
|
2010-07-12 12:05:31 +02:00
|
|
|
|
2011-09-06 13:03:15 +02:00
|
|
|
You will get activated signals via your SearchResult instance when
|
2010-07-12 12:05:31 +02:00
|
|
|
the user selects a search result item, and, if you started the search
|
|
|
|
|
with the SearchAndReplace option, the replaceButtonClicked signal
|
|
|
|
|
when the user requests a replace.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QString SearchResultWindow::displayName() const
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
|
|
|
|
|
2010-07-12 12:46:50 +02:00
|
|
|
SearchResultWindow *SearchResultWindow::m_instance = 0;
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-09 08:46:51 +02:00
|
|
|
SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel)
|
2011-09-09 16:10:57 +02:00
|
|
|
: d(new SearchResultWindowPrivate(this))
|
2010-03-24 10:43:01 +01:00
|
|
|
{
|
2010-07-12 12:46:50 +02:00
|
|
|
m_instance = this;
|
2014-01-13 16:17:34 +01:00
|
|
|
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_spacer = new QWidget;
|
|
|
|
|
d->m_spacer->setMinimumWidth(30);
|
2014-07-14 16:19:40 +02:00
|
|
|
d->m_historyLabel = new QLabel(tr("History:"));
|
|
|
|
|
d->m_spacer2 = new QWidget;
|
|
|
|
|
d->m_spacer2->setMinimumWidth(5);
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_recentSearchesBox = new QComboBox;
|
2014-07-14 16:19:40 +02:00
|
|
|
d->m_recentSearchesBox->setProperty("drawleftborder", true);
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_recentSearchesBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
|
|
|
d->m_recentSearchesBox->addItem(tr("New Search"));
|
|
|
|
|
connect(d->m_recentSearchesBox, SIGNAL(activated(int)), d, SLOT(setCurrentIndex(int)));
|
|
|
|
|
|
2011-09-09 08:46:51 +02:00
|
|
|
d->m_widget = new QStackedWidget;
|
2010-06-16 11:56:30 +02:00
|
|
|
d->m_widget->setWindowTitle(displayName());
|
2010-03-24 10:43:01 +01:00
|
|
|
|
2011-12-06 16:57:09 +01:00
|
|
|
InternalScrollArea *newSearchArea = new InternalScrollArea(d->m_widget);
|
2011-11-24 11:38:35 +01:00
|
|
|
newSearchArea->setWidget(newSearchPanel);
|
2011-11-25 15:25:40 +01:00
|
|
|
newSearchArea->setFocusProxy(newSearchPanel);
|
2011-11-24 11:38:35 +01:00
|
|
|
d->m_widget->addWidget(newSearchArea);
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_currentIndex = 0;
|
2011-05-06 16:06:25 +02:00
|
|
|
|
2010-06-29 13:34:43 +02:00
|
|
|
d->m_expandCollapseButton = new QToolButton(d->m_widget);
|
|
|
|
|
d->m_expandCollapseButton->setAutoRaise(true);
|
|
|
|
|
|
|
|
|
|
d->m_expandCollapseAction = new QAction(tr("Expand All"), this);
|
|
|
|
|
d->m_expandCollapseAction->setCheckable(true);
|
|
|
|
|
d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png")));
|
2012-05-24 13:49:06 +02:00
|
|
|
Core::Command *cmd = Core::ActionManager::registerAction(
|
2010-09-10 14:13:19 +02:00
|
|
|
d->m_expandCollapseAction, "Find.ExpandAll",
|
2010-06-29 13:34:43 +02:00
|
|
|
Core::Context(Core::Constants::C_GLOBAL));
|
2011-01-14 12:20:08 +01:00
|
|
|
cmd->setAttribute(Core::Command::CA_UpdateText);
|
2010-06-29 13:34:43 +02:00
|
|
|
d->m_expandCollapseButton->setDefaultAction(cmd->action());
|
2010-03-24 10:43:01 +01:00
|
|
|
|
2010-06-29 13:34:43 +02:00
|
|
|
connect(d->m_expandCollapseAction, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool)));
|
2008-12-02 12:01:29 +01:00
|
|
|
readSettings();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
SearchResultWindow::~SearchResultWindow()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
qDeleteAll(d->m_searchResults);
|
2010-03-24 10:43:01 +01:00
|
|
|
delete d->m_widget;
|
|
|
|
|
d->m_widget = 0;
|
|
|
|
|
delete d;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Returns the single shared instance of the \gui {Search Results} output pane.
|
2010-07-12 12:05:31 +02:00
|
|
|
*/
|
2010-07-12 12:46:50 +02:00
|
|
|
SearchResultWindow *SearchResultWindow::instance()
|
|
|
|
|
{
|
|
|
|
|
return m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-08-09 11:08:01 +02:00
|
|
|
void SearchResultWindow::visibilityChanged(bool visible)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
if (d->isSearchVisible())
|
|
|
|
|
d->m_searchResultWidgets.at(d->visibleSearchIndex())->notifyVisibilityChanged(visible);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
QWidget *SearchResultWindow::outputWidget(QWidget *)
|
|
|
|
|
{
|
2010-03-24 10:43:01 +01:00
|
|
|
return d->m_widget;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-07 16:59:48 +02:00
|
|
|
QList<QWidget*> SearchResultWindow::toolBarWidgets() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2014-07-14 16:19:40 +02:00
|
|
|
return QList<QWidget*>() << d->m_expandCollapseButton << d->m_spacer
|
|
|
|
|
<< d->m_historyLabel << d->m_spacer2 << d->m_recentSearchesBox;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Tells the \gui {Search Results} output pane to start a new search.
|
2010-07-12 12:05:31 +02:00
|
|
|
|
2013-09-09 10:46:07 +02:00
|
|
|
The \a label should be a string that shortly describes the type of the
|
|
|
|
|
search, that is, the search filter and possibly the most relevant search
|
|
|
|
|
option, followed by a colon ':'. For example: \c {Project 'myproject':}
|
|
|
|
|
The \a searchTerm is shown after the colon.
|
2011-09-09 16:10:57 +02:00
|
|
|
The \a toolTip should elaborate on the search parameters, like file patterns that are searched and
|
|
|
|
|
find flags.
|
2011-05-06 16:06:25 +02:00
|
|
|
If \a cfgGroup is not empty, it will be used for storing the "do not ask again"
|
|
|
|
|
setting of a "this change cannot be undone" warning (which is implicitly requested
|
|
|
|
|
by passing a non-empty group).
|
2010-07-12 12:05:31 +02:00
|
|
|
Returns a SearchResult object that is used for signaling user interaction
|
|
|
|
|
with the results of this search.
|
2011-09-09 16:10:57 +02:00
|
|
|
The search result window owns the returned SearchResult
|
|
|
|
|
and might delete it any time, even while the search is running
|
2013-09-09 10:46:07 +02:00
|
|
|
(for example, when the user clears the \gui {Search Results} pane, or when
|
|
|
|
|
the user opens so many other searches
|
2011-09-09 16:10:57 +02:00
|
|
|
that this search falls out of the history).
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
*/
|
2011-09-09 16:10:57 +02:00
|
|
|
SearchResult *SearchResultWindow::startNewSearch(const QString &label,
|
|
|
|
|
const QString &toolTip,
|
|
|
|
|
const QString &searchTerm,
|
|
|
|
|
SearchMode searchOrSearchAndReplace,
|
2014-03-11 16:06:33 -03:00
|
|
|
PreserveCaseMode preserveCaseMode,
|
2011-09-09 16:10:57 +02:00
|
|
|
const QString &cfgGroup)
|
2009-10-05 16:01:50 +02:00
|
|
|
{
|
2012-02-07 12:25:28 +01:00
|
|
|
if (d->m_searchResults.size() >= MAX_SEARCH_HISTORY) {
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_searchResultWidgets.last()->notifyVisibilityChanged(false);
|
2012-05-25 16:45:18 +02:00
|
|
|
// widget first, because that might send interesting signals to SearchResult
|
2011-09-09 16:10:57 +02:00
|
|
|
delete d->m_searchResultWidgets.takeLast();
|
2012-05-25 16:45:18 +02:00
|
|
|
delete d->m_searchResults.takeLast();
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_recentSearchesBox->removeItem(d->m_recentSearchesBox->count()-1);
|
2011-09-15 09:57:18 +02:00
|
|
|
if (d->m_currentIndex >= d->m_recentSearchesBox->count()) {
|
|
|
|
|
// temporarily set the index to the last existing
|
|
|
|
|
d->m_currentIndex = d->m_recentSearchesBox->count() - 1;
|
|
|
|
|
}
|
2011-09-09 16:10:57 +02:00
|
|
|
}
|
|
|
|
|
Internal::SearchResultWidget *widget = new Internal::SearchResultWidget;
|
|
|
|
|
d->m_searchResultWidgets.prepend(widget);
|
|
|
|
|
d->m_widget->insertWidget(1, widget);
|
|
|
|
|
connect(widget, SIGNAL(navigateStateChanged()), this, SLOT(navigateStateChanged()));
|
2012-02-07 15:44:12 +01:00
|
|
|
connect(widget, SIGNAL(restarted()), d, SLOT(moveWidgetToTop()));
|
2012-05-25 16:45:18 +02:00
|
|
|
connect(widget, SIGNAL(requestPopup(bool)), d, SLOT(popupRequested(bool)));
|
2012-10-18 08:02:25 +02:00
|
|
|
widget->setTextEditorFont(d->m_font, d->m_color);
|
2014-03-11 16:06:33 -03:00
|
|
|
widget->setSupportPreserveCase(preserveCaseMode == PreserveCaseEnabled);
|
2011-09-09 16:10:57 +02:00
|
|
|
widget->setShowReplaceUI(searchOrSearchAndReplace != SearchOnly);
|
2011-09-20 12:18:55 +02:00
|
|
|
widget->setAutoExpandResults(d->m_expandCollapseAction->isChecked());
|
2011-09-09 16:10:57 +02:00
|
|
|
widget->setInfo(label, toolTip, searchTerm);
|
|
|
|
|
if (searchOrSearchAndReplace == SearchAndReplace)
|
|
|
|
|
widget->setDontAskAgainGroup(cfgGroup);
|
|
|
|
|
SearchResult *result = new SearchResult(widget);
|
|
|
|
|
d->m_searchResults.prepend(result);
|
|
|
|
|
d->m_recentSearchesBox->insertItem(1, tr("%1 %2").arg(label, searchTerm));
|
|
|
|
|
if (d->m_currentIndex > 0)
|
|
|
|
|
++d->m_currentIndex; // so setCurrentIndex still knows about the right "currentIndex" and its widget
|
|
|
|
|
d->setCurrentIndex(1);
|
|
|
|
|
return result;
|
2009-10-05 16:01:50 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Clears the current contents of the \gui {Search Results} output pane.
|
2010-07-12 12:05:31 +02:00
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
void SearchResultWindow::clearContents()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
for (int i = d->m_recentSearchesBox->count() - 1; i > 0 /* don't want i==0 */; --i)
|
|
|
|
|
d->m_recentSearchesBox->removeItem(i);
|
|
|
|
|
foreach (Internal::SearchResultWidget *widget, d->m_searchResultWidgets)
|
|
|
|
|
widget->notifyVisibilityChanged(false);
|
|
|
|
|
qDeleteAll(d->m_searchResultWidgets);
|
|
|
|
|
d->m_searchResultWidgets.clear();
|
|
|
|
|
qDeleteAll(d->m_searchResults);
|
|
|
|
|
d->m_searchResults.clear();
|
|
|
|
|
|
|
|
|
|
d->m_currentIndex = 0;
|
|
|
|
|
d->m_widget->currentWidget()->setFocus();
|
|
|
|
|
d->m_expandCollapseButton->setEnabled(false);
|
2009-04-30 12:50:52 +02:00
|
|
|
navigateStateChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-27 13:47:06 +02:00
|
|
|
bool SearchResultWindow::hasFocus() const
|
2009-04-08 14:32:31 +02:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
return d->m_widget->focusWidget() && d->m_widget->focusWidget()->hasFocus();
|
2009-04-08 14:32:31 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-27 13:47:06 +02:00
|
|
|
bool SearchResultWindow::canFocus() const
|
2009-04-08 14:32:31 +02:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
if (d->isSearchVisible())
|
|
|
|
|
return d->m_searchResultWidgets.at(d->visibleSearchIndex())->canFocusInternally();
|
|
|
|
|
return true;
|
2009-04-08 14:32:31 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-08 14:32:31 +02:00
|
|
|
void SearchResultWindow::setFocus()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
if (!d->isSearchVisible())
|
2011-09-09 08:46:51 +02:00
|
|
|
d->m_widget->currentWidget()->setFocus();
|
|
|
|
|
else
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_searchResultWidgets.at(d->visibleSearchIndex())->setFocusInternally();
|
2009-04-08 14:32:31 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2012-10-18 08:02:25 +02:00
|
|
|
void SearchResultWindow::setTextEditorFont(const QFont &font,
|
|
|
|
|
const QColor &textForegroundColor,
|
|
|
|
|
const QColor &textBackgroundColor,
|
|
|
|
|
const QColor &highlightForegroundColor,
|
|
|
|
|
const QColor &highlightBackgroundColor)
|
2009-04-08 14:32:31 +02:00
|
|
|
{
|
2011-11-01 11:46:22 +01:00
|
|
|
d->m_font = font;
|
2012-10-18 08:02:25 +02:00
|
|
|
Internal::SearchResultColor color;
|
|
|
|
|
color.textBackground = textBackgroundColor;
|
|
|
|
|
color.textForeground = textForegroundColor;
|
|
|
|
|
color.highlightBackground = highlightBackgroundColor.isValid()
|
|
|
|
|
? highlightBackgroundColor
|
|
|
|
|
: textBackgroundColor;
|
|
|
|
|
color.highlightForeground = highlightForegroundColor.isValid()
|
|
|
|
|
? highlightForegroundColor
|
|
|
|
|
: textForegroundColor;
|
|
|
|
|
d->m_color = color;
|
2011-09-09 16:10:57 +02:00
|
|
|
foreach (Internal::SearchResultWidget *widget, d->m_searchResultWidgets)
|
2012-10-18 08:02:25 +02:00
|
|
|
widget->setTextEditorFont(font, color);
|
2011-05-06 16:06:25 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-09 08:46:51 +02:00
|
|
|
void SearchResultWindow::openNewSearchPanel()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
d->setCurrentIndex(0);
|
2012-09-13 15:50:06 +02:00
|
|
|
popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus | IOutputPane::EnsureSizeHint);
|
2011-09-09 08:46:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
void SearchResultWindow::handleExpandCollapseToolButton(bool checked)
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
if (!d->isSearchVisible())
|
|
|
|
|
return;
|
|
|
|
|
d->m_searchResultWidgets.at(d->visibleSearchIndex())->setAutoExpandResults(checked);
|
2011-01-14 12:20:08 +01:00
|
|
|
if (checked) {
|
|
|
|
|
d->m_expandCollapseAction->setText(tr("Collapse All"));
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_searchResultWidgets.at(d->visibleSearchIndex())->expandAll();
|
2011-01-14 12:20:08 +01:00
|
|
|
} else {
|
|
|
|
|
d->m_expandCollapseAction->setText(tr("Expand All"));
|
2011-09-09 16:10:57 +02:00
|
|
|
d->m_searchResultWidgets.at(d->visibleSearchIndex())->collapseAll();
|
2011-01-14 12:20:08 +01:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-07 16:59:48 +02:00
|
|
|
void SearchResultWindow::readSettings()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
QSettings *s = Core::ICore::settings();
|
2013-05-28 15:17:20 +02:00
|
|
|
s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
|
|
|
|
|
d->m_expandCollapseAction->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool());
|
|
|
|
|
s->endGroup();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-07 16:59:48 +02:00
|
|
|
void SearchResultWindow::writeSettings()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
QSettings *s = Core::ICore::settings();
|
2013-05-28 15:17:20 +02:00
|
|
|
s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
|
|
|
|
|
s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseAction->isChecked());
|
|
|
|
|
s->endGroup();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
int SearchResultWindow::priorityInStatusBar() const
|
|
|
|
|
{
|
|
|
|
|
return 80;
|
|
|
|
|
}
|
2009-04-30 12:50:52 +02:00
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-27 13:47:06 +02:00
|
|
|
bool SearchResultWindow::canNext() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
if (d->isSearchVisible())
|
|
|
|
|
return d->m_searchResultWidgets.at(d->visibleSearchIndex())->count() > 0;
|
|
|
|
|
return false;
|
2009-04-30 12:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-27 13:47:06 +02:00
|
|
|
bool SearchResultWindow::canPrevious() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
return canNext();
|
2009-04-30 12:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-30 12:50:52 +02:00
|
|
|
void SearchResultWindow::goToNext()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
int index = d->m_widget->currentIndex();
|
|
|
|
|
if (index != 0)
|
|
|
|
|
d->m_searchResultWidgets.at(index-1)->goToNext();
|
2009-04-30 12:50:52 +02:00
|
|
|
}
|
2010-07-12 12:05:31 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2009-04-30 12:50:52 +02:00
|
|
|
void SearchResultWindow::goToPrev()
|
|
|
|
|
{
|
2011-09-09 16:10:57 +02:00
|
|
|
int index = d->m_widget->currentIndex();
|
|
|
|
|
if (index != 0)
|
|
|
|
|
d->m_searchResultWidgets.at(index-1)->goToPrevious();
|
2009-04-30 12:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:05:31 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
2011-09-27 13:47:06 +02:00
|
|
|
bool SearchResultWindow::canNavigate() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2010-03-24 10:43:01 +01:00
|
|
|
|
2011-09-06 13:03:15 +02:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
|
|
|
|
SearchResult::SearchResult(SearchResultWidget *widget)
|
|
|
|
|
: m_widget(widget)
|
|
|
|
|
{
|
2014-01-13 16:17:34 +01:00
|
|
|
connect(widget, SIGNAL(activated(Core::SearchResultItem)),
|
|
|
|
|
this, SIGNAL(activated(Core::SearchResultItem)));
|
|
|
|
|
connect(widget, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)),
|
|
|
|
|
this, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)));
|
2011-09-09 08:46:51 +02:00
|
|
|
connect(widget, SIGNAL(cancelled()),
|
|
|
|
|
this, SIGNAL(cancelled()));
|
2012-05-25 16:45:18 +02:00
|
|
|
connect(widget, SIGNAL(paused(bool)),
|
|
|
|
|
this, SIGNAL(paused(bool)));
|
2011-09-06 13:03:15 +02:00
|
|
|
connect(widget, SIGNAL(visibilityChanged(bool)),
|
|
|
|
|
this, SIGNAL(visibilityChanged(bool)));
|
2011-12-13 10:50:57 +01:00
|
|
|
connect(widget, SIGNAL(searchAgainRequested()),
|
|
|
|
|
this, SIGNAL(searchAgainRequested()));
|
2011-09-06 13:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-02 11:51:31 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Attaches some random \a data to this search, that you can use later.
|
2011-09-02 11:51:31 +02:00
|
|
|
|
|
|
|
|
\sa userData()
|
|
|
|
|
*/
|
|
|
|
|
void SearchResult::setUserData(const QVariant &data)
|
|
|
|
|
{
|
|
|
|
|
m_userData = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Returns the data that was attached to this search by calling
|
|
|
|
|
setUserData().
|
2011-09-02 11:51:31 +02:00
|
|
|
|
|
|
|
|
\sa setUserData()
|
|
|
|
|
*/
|
|
|
|
|
QVariant SearchResult::userData() const
|
|
|
|
|
{
|
|
|
|
|
return m_userData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Returns the text that should replace the text in search results.
|
2011-09-02 11:51:31 +02:00
|
|
|
*/
|
|
|
|
|
QString SearchResult::textToReplace() const
|
|
|
|
|
{
|
2011-09-06 13:03:15 +02:00
|
|
|
return m_widget->textToReplace();
|
2011-09-02 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 15:16:49 +01:00
|
|
|
int SearchResult::count() const
|
|
|
|
|
{
|
|
|
|
|
return m_widget->count();
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-13 10:50:57 +01:00
|
|
|
void SearchResult::setSearchAgainSupported(bool supported)
|
|
|
|
|
{
|
|
|
|
|
m_widget->setSearchAgainSupported(supported);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-02 11:51:31 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Adds a single result line to the \gui {Search Results} output pane.
|
2011-09-02 11:51:31 +02:00
|
|
|
|
2013-09-09 10:46:07 +02:00
|
|
|
\a fileName, \a lineNumber, and \a lineText are shown on the result line.
|
2011-09-02 11:51:31 +02:00
|
|
|
\a searchTermStart and \a searchTermLength specify the region that
|
2013-09-09 10:46:07 +02:00
|
|
|
should be visually marked (string position and length in \a lineText).
|
2011-09-02 11:51:31 +02:00
|
|
|
You can attach arbitrary \a userData to the search result, which can
|
2013-09-09 10:46:07 +02:00
|
|
|
be used, for example, when reacting to the signals of the search results
|
|
|
|
|
for your search.
|
2011-09-02 11:51:31 +02:00
|
|
|
|
|
|
|
|
\sa addResults()
|
|
|
|
|
*/
|
|
|
|
|
void SearchResult::addResult(const QString &fileName, int lineNumber, const QString &lineText,
|
|
|
|
|
int searchTermStart, int searchTermLength, const QVariant &userData)
|
|
|
|
|
{
|
2011-09-06 13:03:15 +02:00
|
|
|
m_widget->addResult(fileName, lineNumber, lineText,
|
|
|
|
|
searchTermStart, searchTermLength, userData);
|
2011-12-12 15:16:49 +01:00
|
|
|
emit countChanged(m_widget->count());
|
2011-09-02 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Adds the search result \a items to the \gui {Search Results} output pane.
|
2011-09-02 11:51:31 +02:00
|
|
|
|
|
|
|
|
\sa addResult()
|
|
|
|
|
*/
|
|
|
|
|
void SearchResult::addResults(const QList<SearchResultItem> &items, AddMode mode)
|
|
|
|
|
{
|
2011-09-06 13:03:15 +02:00
|
|
|
m_widget->addResults(items, mode);
|
2011-12-12 15:16:49 +01:00
|
|
|
emit countChanged(m_widget->count());
|
2011-09-02 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Notifies the \gui {Search Results} output pane that the current search
|
2011-09-02 11:51:31 +02:00
|
|
|
has finished, and the UI should reflect that.
|
|
|
|
|
*/
|
2012-05-16 15:59:16 +02:00
|
|
|
void SearchResult::finishSearch(bool canceled)
|
2011-09-02 11:51:31 +02:00
|
|
|
{
|
2012-05-16 15:59:16 +02:00
|
|
|
m_widget->finishSearch(canceled);
|
2011-09-02 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
Sets the value in the UI element that allows the user to type
|
2011-09-02 11:51:31 +02:00
|
|
|
the text that should replace text in search results to \a textToReplace.
|
|
|
|
|
*/
|
|
|
|
|
void SearchResult::setTextToReplace(const QString &textToReplace)
|
|
|
|
|
{
|
2011-09-06 13:03:15 +02:00
|
|
|
m_widget->setTextToReplace(textToReplace);
|
2011-09-02 11:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
2011-12-13 10:50:57 +01:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
* Removes all search results.
|
2011-12-13 10:50:57 +01:00
|
|
|
*/
|
2012-02-07 15:44:12 +01:00
|
|
|
void SearchResult::restart()
|
2011-12-13 10:50:57 +01:00
|
|
|
{
|
2012-02-07 15:44:12 +01:00
|
|
|
m_widget->restart();
|
2011-12-13 10:50:57 +01:00
|
|
|
}
|
|
|
|
|
|
2011-12-14 15:55:05 +01:00
|
|
|
void SearchResult::setSearchAgainEnabled(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
m_widget->setSearchAgainEnabled(enabled);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-25 16:45:18 +02:00
|
|
|
/*!
|
2013-09-09 10:46:07 +02:00
|
|
|
* Opens the \gui {Search Results} output pane with this search.
|
2012-05-25 16:45:18 +02:00
|
|
|
*/
|
|
|
|
|
void SearchResult::popup()
|
|
|
|
|
{
|
|
|
|
|
m_widget->sendRequestPopup();
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
} // namespace Core
|
2011-09-09 16:10:57 +02:00
|
|
|
|
|
|
|
|
#include "searchresultwindow.moc"
|