forked from qt-creator/qt-creator
Core: Inline finddialog.ui
Translations are left alone for now. Change-Id: I8e88c33abcd8c79f158d8bdac030c68df16d462b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -64,7 +64,6 @@ add_qtc_plugin(Core
|
||||
find/basetextfind.cpp find/basetextfind.h
|
||||
find/currentdocumentfind.cpp find/currentdocumentfind.h
|
||||
find/find.qrc
|
||||
find/finddialog.ui
|
||||
find/findplugin.cpp find/findplugin.h
|
||||
find/findtoolbar.cpp find/findtoolbar.h
|
||||
find/findtoolwindow.cpp find/findtoolwindow.h
|
||||
|
@@ -294,7 +294,6 @@ Project {
|
||||
"currentdocumentfind.cpp",
|
||||
"currentdocumentfind.h",
|
||||
"find.qrc",
|
||||
"finddialog.ui",
|
||||
"findplugin.cpp",
|
||||
"findplugin.h",
|
||||
"findtoolbar.cpp",
|
||||
|
@@ -1,217 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Core::Internal::FindDialog</class>
|
||||
<widget class="QWidget" name="Core::Internal::FindDialog">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="searchButton">
|
||||
<property name="text">
|
||||
<string>&Search</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="replaceButton">
|
||||
<property name="text">
|
||||
<string>Search && &Replace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="searchLabel">
|
||||
<property name="text">
|
||||
<string>Search f&or:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>searchTerm</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="filterList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="optionsWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="matchCase">
|
||||
<property name="text">
|
||||
<string>&Case sensitive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="wholeWords">
|
||||
<property name="text">
|
||||
<string>Whole words o&nly</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="regExp">
|
||||
<property name="text">
|
||||
<string>Use re&gular expressions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sco&pe:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>filterList</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Utils::FancyLineEdit" name="searchTerm"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QWidget" name="configWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>10</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>680</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::FancyLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/fancylineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>filterList</tabstop>
|
||||
<tabstop>searchTerm</tabstop>
|
||||
<tabstop>matchCase</tabstop>
|
||||
<tabstop>wholeWords</tabstop>
|
||||
<tabstop>regExp</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -2,22 +2,33 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "findtoolwindow.h"
|
||||
|
||||
#include "ifindfilter.h"
|
||||
#include "findplugin.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QStringListModel>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QCompleter>
|
||||
#include <QCoreApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
#include <QScrollArea>
|
||||
#include <QSettings>
|
||||
#include <QStringListModel>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core::Internal {
|
||||
|
||||
static FindToolWindow *m_instance = nullptr;
|
||||
|
||||
@@ -45,35 +56,96 @@ FindToolWindow::FindToolWindow(QWidget *parent)
|
||||
m_configWidget(nullptr)
|
||||
{
|
||||
m_instance = this;
|
||||
m_ui.setupUi(this);
|
||||
m_ui.searchTerm->setFiltering(true);
|
||||
m_ui.searchTerm->setPlaceholderText(QString());
|
||||
setFocusProxy(m_ui.searchTerm);
|
||||
|
||||
connect(m_ui.searchButton, &QAbstractButton::clicked, this, &FindToolWindow::search);
|
||||
connect(m_ui.replaceButton, &QAbstractButton::clicked, this, &FindToolWindow::replace);
|
||||
connect(m_ui.matchCase, &QAbstractButton::toggled, Find::instance(), &Find::setCaseSensitive);
|
||||
connect(m_ui.wholeWords, &QAbstractButton::toggled, Find::instance(), &Find::setWholeWord);
|
||||
connect(m_ui.regExp, &QAbstractButton::toggled, Find::instance(), &Find::setRegularExpression);
|
||||
connect(m_ui.filterList, &QComboBox::activated,
|
||||
m_searchButton = new QPushButton(this);
|
||||
m_searchButton->setText(QCoreApplication::translate("Core::Internal::FindDialog", "&Search", nullptr));
|
||||
m_searchButton->setDefault(true);
|
||||
|
||||
m_replaceButton = new QPushButton(this);
|
||||
m_replaceButton->setText(QCoreApplication::translate("Core::Internal::FindDialog", "Search && &Replace", nullptr));
|
||||
|
||||
m_searchTerm = new FancyLineEdit(this);
|
||||
m_searchTerm->setFiltering(true);
|
||||
|
||||
m_searchLabel = new QLabel(this);
|
||||
m_searchLabel->setText(QCoreApplication::translate("Core::Internal::FindDialog", "Search f&or:", nullptr));
|
||||
m_searchLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
m_searchLabel->setBuddy(m_searchTerm);
|
||||
|
||||
m_filterList = new QComboBox;
|
||||
m_filterList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_filterList->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
|
||||
m_optionsWidget = new QWidget(this);
|
||||
|
||||
m_matchCase = new QCheckBox(m_optionsWidget);
|
||||
m_matchCase->setText(QCoreApplication::translate("Core::Internal::FindDialog", "&Case sensitive", nullptr));
|
||||
|
||||
m_wholeWords = new QCheckBox(m_optionsWidget);
|
||||
m_wholeWords->setText(QCoreApplication::translate("Core::Internal::FindDialog", "Whole words o&nly", nullptr));
|
||||
|
||||
m_regExp = new QCheckBox(m_optionsWidget);
|
||||
m_regExp->setText(QCoreApplication::translate("Core::Internal::FindDialog", "Use re&gular expressions", nullptr));
|
||||
|
||||
auto label = new QLabel(this);
|
||||
label->setText(QCoreApplication::translate("Core::Internal::FindDialog", "Sco&pe:", nullptr));
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
label->setMinimumSize(QSize(80, 0));
|
||||
label->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
label->setBuddy(m_filterList);
|
||||
|
||||
m_uiConfigWidget = new QWidget(this);
|
||||
QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
sizePolicy2.setHorizontalStretch(0);
|
||||
sizePolicy2.setVerticalStretch(10);
|
||||
m_uiConfigWidget->setSizePolicy(sizePolicy2);
|
||||
m_uiConfigWidget->setMinimumSize(QSize(680, 0));
|
||||
|
||||
setFocusProxy(m_searchTerm);
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
Row {
|
||||
m_matchCase,
|
||||
m_wholeWords,
|
||||
m_regExp,
|
||||
st,
|
||||
}.attachTo(m_optionsWidget, WithoutMargins);
|
||||
|
||||
Grid {
|
||||
label, m_filterList, br,
|
||||
m_searchLabel, m_searchTerm, br,
|
||||
empty, m_optionsWidget, br,
|
||||
Span(2, m_uiConfigWidget), br,
|
||||
Span(2, Row { st, m_searchButton, m_replaceButton }), br,
|
||||
}.attachTo(this);
|
||||
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
connect(m_searchButton, &QAbstractButton::clicked, this, &FindToolWindow::search);
|
||||
connect(m_replaceButton, &QAbstractButton::clicked, this, &FindToolWindow::replace);
|
||||
connect(m_matchCase, &QAbstractButton::toggled, Find::instance(), &Find::setCaseSensitive);
|
||||
connect(m_wholeWords, &QAbstractButton::toggled, Find::instance(), &Find::setWholeWord);
|
||||
connect(m_regExp, &QAbstractButton::toggled, Find::instance(), &Find::setRegularExpression);
|
||||
connect(m_filterList, &QComboBox::activated,
|
||||
this, QOverload<int>::of(&FindToolWindow::setCurrentFilter));
|
||||
|
||||
m_findCompleter->setModel(Find::findCompletionModel());
|
||||
m_ui.searchTerm->setSpecialCompleter(m_findCompleter);
|
||||
m_ui.searchTerm->installEventFilter(this);
|
||||
m_searchTerm->setSpecialCompleter(m_findCompleter);
|
||||
m_searchTerm->installEventFilter(this);
|
||||
connect(m_findCompleter, QOverload<const QModelIndex &>::of(&QCompleter::activated),
|
||||
this, &FindToolWindow::findCompleterActivated);
|
||||
|
||||
m_ui.searchTerm->setValidationFunction(validateRegExp);
|
||||
m_searchTerm->setValidationFunction(validateRegExp);
|
||||
connect(Find::instance(), &Find::findFlagsChanged,
|
||||
m_ui.searchTerm, &Utils::FancyLineEdit::validate);
|
||||
connect(m_ui.searchTerm, &Utils::FancyLineEdit::validChanged,
|
||||
m_searchTerm, &Utils::FancyLineEdit::validate);
|
||||
connect(m_searchTerm, &Utils::FancyLineEdit::validChanged,
|
||||
this, &FindToolWindow::updateButtonStates);
|
||||
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
m_ui.configWidget->setLayout(layout);
|
||||
m_uiConfigWidget->setLayout(layout);
|
||||
updateButtonStates();
|
||||
|
||||
connect(Find::instance(), &Find::findFlagsChanged, this, &FindToolWindow::updateFindFlags);
|
||||
@@ -96,7 +168,7 @@ bool FindToolWindow::event(QEvent *event)
|
||||
if ((ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
|
||||
&& (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::KeypadModifier)) {
|
||||
ke->accept();
|
||||
if (m_ui.searchButton->isEnabled())
|
||||
if (m_searchButton->isEnabled())
|
||||
search();
|
||||
return true;
|
||||
}
|
||||
@@ -106,10 +178,10 @@ bool FindToolWindow::event(QEvent *event)
|
||||
|
||||
bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) {
|
||||
if (obj == m_searchTerm && event->type() == QEvent::KeyPress) {
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Down) {
|
||||
if (m_ui.searchTerm->text().isEmpty())
|
||||
if (m_searchTerm->text().isEmpty())
|
||||
m_findCompleter->setCompletionPrefix(QString());
|
||||
m_findCompleter->complete();
|
||||
}
|
||||
@@ -121,34 +193,34 @@ void FindToolWindow::updateButtonStates()
|
||||
{
|
||||
bool filterEnabled = m_currentFilter && m_currentFilter->isEnabled();
|
||||
bool enabled = filterEnabled && (!m_currentFilter->showSearchTermInput()
|
||||
|| m_ui.searchTerm->isValid()) && m_currentFilter->isValid();
|
||||
m_ui.searchButton->setEnabled(enabled);
|
||||
m_ui.replaceButton->setEnabled(m_currentFilter
|
||||
|| m_searchTerm->isValid()) && m_currentFilter->isValid();
|
||||
m_searchButton->setEnabled(enabled);
|
||||
m_replaceButton->setEnabled(m_currentFilter
|
||||
&& m_currentFilter->isReplaceSupported() && enabled);
|
||||
if (m_configWidget)
|
||||
m_configWidget->setEnabled(filterEnabled);
|
||||
|
||||
if (m_currentFilter) {
|
||||
m_ui.searchTerm->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_ui.searchLabel->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_ui.optionsWidget->setVisible(m_currentFilter->supportedFindFlags()
|
||||
m_searchTerm->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_searchLabel->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_optionsWidget->setVisible(m_currentFilter->supportedFindFlags()
|
||||
& (FindCaseSensitively | FindWholeWords | FindRegularExpression));
|
||||
}
|
||||
|
||||
m_ui.matchCase->setEnabled(filterEnabled
|
||||
m_matchCase->setEnabled(filterEnabled
|
||||
&& (m_currentFilter->supportedFindFlags() & FindCaseSensitively));
|
||||
m_ui.wholeWords->setEnabled(filterEnabled
|
||||
m_wholeWords->setEnabled(filterEnabled
|
||||
&& (m_currentFilter->supportedFindFlags() & FindWholeWords));
|
||||
m_ui.regExp->setEnabled(filterEnabled
|
||||
m_regExp->setEnabled(filterEnabled
|
||||
&& (m_currentFilter->supportedFindFlags() & FindRegularExpression));
|
||||
m_ui.searchTerm->setEnabled(filterEnabled);
|
||||
m_searchTerm->setEnabled(filterEnabled);
|
||||
}
|
||||
|
||||
void FindToolWindow::updateFindFlags()
|
||||
{
|
||||
m_ui.matchCase->setChecked(Find::hasFindFlag(FindCaseSensitively));
|
||||
m_ui.wholeWords->setChecked(Find::hasFindFlag(FindWholeWords));
|
||||
m_ui.regExp->setChecked(Find::hasFindFlag(FindRegularExpression));
|
||||
m_matchCase->setChecked(Find::hasFindFlag(FindCaseSensitively));
|
||||
m_wholeWords->setChecked(Find::hasFindFlag(FindWholeWords));
|
||||
m_regExp->setChecked(Find::hasFindFlag(FindRegularExpression));
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +231,7 @@ void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters)
|
||||
for (IFindFilter *filter : qAsConst(m_filters))
|
||||
filter->disconnect(this);
|
||||
m_filters = filters;
|
||||
m_ui.filterList->clear();
|
||||
m_filterList->clear();
|
||||
QStringList names;
|
||||
for (IFindFilter *filter : filters) {
|
||||
names << filter->displayName();
|
||||
@@ -167,7 +239,7 @@ void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters)
|
||||
connect(filter, &IFindFilter::displayNameChanged,
|
||||
this, [this, filter]() { updateFindFilterName(filter); });
|
||||
}
|
||||
m_ui.filterList->addItems(names);
|
||||
m_filterList->addItems(names);
|
||||
if (m_filters.size() > 0)
|
||||
setCurrentFilter(0);
|
||||
}
|
||||
@@ -181,12 +253,12 @@ void FindToolWindow::updateFindFilterName(IFindFilter *filter)
|
||||
{
|
||||
int index = m_filters.indexOf(filter);
|
||||
if (QTC_GUARD(index >= 0))
|
||||
m_ui.filterList->setItemText(index, filter->displayName());
|
||||
m_filterList->setItemText(index, filter->displayName());
|
||||
}
|
||||
|
||||
void FindToolWindow::setFindText(const QString &text)
|
||||
{
|
||||
m_ui.searchTerm->setText(text);
|
||||
m_searchTerm->setText(text);
|
||||
}
|
||||
|
||||
void FindToolWindow::setCurrentFilter(IFindFilter *filter)
|
||||
@@ -197,13 +269,13 @@ void FindToolWindow::setCurrentFilter(IFindFilter *filter)
|
||||
if (index >= 0)
|
||||
setCurrentFilter(index);
|
||||
updateFindFlags();
|
||||
m_ui.searchTerm->setFocus();
|
||||
m_ui.searchTerm->selectAll();
|
||||
m_searchTerm->setFocus();
|
||||
m_searchTerm->selectAll();
|
||||
}
|
||||
|
||||
void FindToolWindow::setCurrentFilter(int index)
|
||||
{
|
||||
m_ui.filterList->setCurrentIndex(index);
|
||||
m_filterList->setCurrentIndex(index);
|
||||
for (int i = 0; i < m_configWidgets.size(); ++i) {
|
||||
QWidget *configWidget = m_configWidgets.at(i);
|
||||
if (i == index) {
|
||||
@@ -221,13 +293,13 @@ void FindToolWindow::setCurrentFilter(int index)
|
||||
this, &FindToolWindow::updateButtonStates);
|
||||
updateButtonStates();
|
||||
if (m_configWidget)
|
||||
m_ui.configWidget->layout()->addWidget(m_configWidget);
|
||||
m_uiConfigWidget->layout()->addWidget(m_configWidget);
|
||||
} else {
|
||||
if (configWidget)
|
||||
configWidget->setParent(nullptr);
|
||||
}
|
||||
}
|
||||
QWidget *w = m_ui.configWidget;
|
||||
QWidget *w = m_uiConfigWidget;
|
||||
while (w) {
|
||||
auto sa = qobject_cast<QScrollArea *>(w);
|
||||
if (sa) {
|
||||
@@ -236,7 +308,7 @@ void FindToolWindow::setCurrentFilter(int index)
|
||||
}
|
||||
w = w->parentWidget();
|
||||
}
|
||||
for (w = m_configWidget ? m_configWidget : m_ui.configWidget; w; w = w->parentWidget()) {
|
||||
for (w = m_configWidget ? m_configWidget : m_uiConfigWidget; w; w = w->parentWidget()) {
|
||||
if (w->layout())
|
||||
w->layout()->activate();
|
||||
}
|
||||
@@ -246,9 +318,9 @@ void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
|
||||
{
|
||||
QTC_ASSERT(filter, return);
|
||||
*filter = nullptr;
|
||||
Find::updateFindCompletion(m_ui.searchTerm->text(), Find::findFlags());
|
||||
int index = m_ui.filterList->currentIndex();
|
||||
QString searchTerm = m_ui.searchTerm->text();
|
||||
Find::updateFindCompletion(m_searchTerm->text(), Find::findFlags());
|
||||
int index = m_filterList->currentIndex();
|
||||
QString searchTerm = m_searchTerm->text();
|
||||
if (index >= 0)
|
||||
*filter = m_filters.at(index);
|
||||
if (term)
|
||||
@@ -310,3 +382,5 @@ void FindToolWindow::findCompleterActivated(const QModelIndex &index)
|
||||
Find::setRegularExpression(findFlags.testFlag(FindRegularExpression));
|
||||
Find::setPreserveCase(findFlags.testFlag(FindPreserveCase));
|
||||
}
|
||||
|
||||
} // Core::Internal
|
||||
|
@@ -3,17 +3,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_finddialog.h"
|
||||
#include "findplugin.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QWidget>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QCompleter)
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QCompleter;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IFindFilter;
|
||||
namespace Core { class IFindFilter; }
|
||||
namespace Utils { class FancyLineEdit; }
|
||||
|
||||
namespace Internal {
|
||||
namespace Core::Internal {
|
||||
|
||||
class FindToolWindow : public QWidget
|
||||
{
|
||||
@@ -47,13 +51,22 @@ private:
|
||||
|
||||
void acceptAndGetParameters(QString *term, IFindFilter **filter);
|
||||
|
||||
Ui::FindDialog m_ui;
|
||||
QList<IFindFilter *> m_filters;
|
||||
QCompleter *m_findCompleter;
|
||||
QWidgetList m_configWidgets;
|
||||
IFindFilter *m_currentFilter;
|
||||
QWidget *m_configWidget;
|
||||
|
||||
QWidget *m_uiConfigWidget;
|
||||
QPushButton *m_searchButton;
|
||||
QPushButton *m_replaceButton;
|
||||
QLabel *m_searchLabel;
|
||||
QComboBox *m_filterList;
|
||||
QWidget *m_optionsWidget;
|
||||
QCheckBox *m_matchCase;
|
||||
QCheckBox *m_wholeWords;
|
||||
QCheckBox *m_regExp;
|
||||
Utils::FancyLineEdit *m_searchTerm;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
} // Core::Internal
|
||||
|
Reference in New Issue
Block a user