forked from qt-creator/qt-creator
Add text search functionality to output window centrally
All output windows should be searchable with Edit > Find/Replace (Ctrl+F), no reason for every single instance setting that up individually. Add a find placeholder for the build system output in Projects mode, so the search functionality is available there as well. Change-Id: Idad6824bfb21e6ae9ab923191a7e83b43256e68b Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -27,9 +27,7 @@
|
||||
#include "outputwindow.h"
|
||||
#include "icontext.h"
|
||||
#include "coreconstants.h"
|
||||
#include "find/basetextfind.h"
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -45,14 +43,6 @@ MessageOutputWindow::MessageOutputWindow()
|
||||
{
|
||||
m_widget = new OutputWindow(Context(Constants::C_GENERAL_OUTPUT_PANE), zoomSettingsKey);
|
||||
m_widget->setReadOnly(true);
|
||||
// Let selected text be colored as if the text edit was editable,
|
||||
// otherwise the highlight for searching is too light
|
||||
QPalette p = m_widget->palette();
|
||||
QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
|
||||
p.setColor(QPalette::Highlight, activeHighlight);
|
||||
QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
|
||||
p.setColor(QPalette::HighlightedText, activeHighlightedText);
|
||||
m_widget->setPalette(p);
|
||||
|
||||
connect(this, &IOutputPane::zoomInRequested, m_widget, &Core::OutputWindow::zoomIn);
|
||||
connect(this, &IOutputPane::zoomOutRequested, m_widget, &Core::OutputWindow::zoomOut);
|
||||
@@ -60,10 +50,6 @@ MessageOutputWindow::MessageOutputWindow()
|
||||
connect(this, &IOutputPane::fontChanged, m_widget, &OutputWindow::setBaseFont);
|
||||
connect(this, &IOutputPane::wheelZoomEnabledChanged, m_widget, &OutputWindow::setWheelZoomEnabled);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(m_widget);
|
||||
agg->add(new BaseTextFind(m_widget));
|
||||
|
||||
setupFilterUi("MessageOutputPane.Filter");
|
||||
setFilteringEnabled(true);
|
||||
setupContext(Constants::C_GENERAL_OUTPUT_PANE, m_widget);
|
||||
|
@@ -26,11 +26,13 @@
|
||||
#include "outputwindow.h"
|
||||
|
||||
#include "actionmanager/actionmanager.h"
|
||||
#include "editormanager/editormanager.h"
|
||||
#include "coreconstants.h"
|
||||
#include "coreplugin.h"
|
||||
#include "editormanager/editormanager.h"
|
||||
#include "find/basetextfind.h"
|
||||
#include "icore.h"
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
#include <utils/outputformatter.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -176,6 +178,19 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
|
||||
float zoom = Core::ICore::settings()->value(d->settingsKey).toFloat();
|
||||
setFontZoom(zoom);
|
||||
}
|
||||
|
||||
// Let selected text be colored as if the text edit was editable,
|
||||
// otherwise the highlight for searching is too light
|
||||
QPalette p = palette();
|
||||
QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
|
||||
p.setColor(QPalette::Highlight, activeHighlight);
|
||||
QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
|
||||
p.setColor(QPalette::HighlightedText, activeHighlightedText);
|
||||
setPalette(p);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(this);
|
||||
agg->add(new BaseTextFind(this));
|
||||
}
|
||||
|
||||
OutputWindow::~OutputWindow()
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/find/basetextfind.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/outputwindow.h>
|
||||
#include <texteditor/behaviorsettings.h>
|
||||
@@ -447,9 +446,6 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
|
||||
connect(TextEditor::TextEditorSettings::instance(), &TextEditor::TextEditorSettings::behaviorSettingsChanged,
|
||||
ow, updateBehaviorSettings);
|
||||
|
||||
auto *agg = new Aggregation::Aggregate;
|
||||
agg->add(ow);
|
||||
agg->add(new Core::BaseTextFind(ow));
|
||||
m_runControlTabs.push_back(RunControlTab(rc, ow));
|
||||
m_tabWidget->addTab(ow, rc->displayName());
|
||||
qCDebug(appOutputLog) << "AppOutputPane::createNewOutputWindow: Adding tab for" << rc;
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include "taskhub.h"
|
||||
|
||||
#include <coreplugin/outputwindow.h>
|
||||
#include <coreplugin/find/basetextfind.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -93,15 +92,6 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
||||
parser->runPostPrintActions();
|
||||
});
|
||||
|
||||
// Let selected text be colored as if the text edit was editable,
|
||||
// otherwise the highlight for searching is too light
|
||||
QPalette p = m_outputWindow->palette();
|
||||
QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
|
||||
p.setColor(QPalette::Highlight, activeHighlight);
|
||||
QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
|
||||
p.setColor(QPalette::HighlightedText, activeHighlightedText);
|
||||
m_outputWindow->setPalette(p);
|
||||
|
||||
Utils::ProxyAction *cancelBuildProxyButton =
|
||||
Utils::ProxyAction::proxyActionWithIcon(cancelBuildAction,
|
||||
Utils::Icons::STOP_SMALL_TOOLBAR.icon());
|
||||
@@ -135,10 +125,6 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
||||
Core::ICore::showOptionsDialog(OPTIONS_PAGE_ID);
|
||||
});
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(m_outputWindow);
|
||||
agg->add(new Core::BaseTextFind(m_outputWindow));
|
||||
|
||||
qRegisterMetaType<QTextCharFormat>("QTextCharFormat");
|
||||
|
||||
m_handler = new ShowOutputTaskHandler(this);
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/coreicons.h>
|
||||
#include <coreplugin/find/optionspopup.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
@@ -111,6 +112,8 @@ BuildSystemOutputWindow::BuildSystemOutputWindow()
|
||||
: OutputWindow(Context(kBuildSystemOutputContext), "ProjectsMode.BuildSystemOutput.Zoom")
|
||||
, m_clear(new QAction)
|
||||
{
|
||||
setReadOnly(true);
|
||||
|
||||
Command *clearCommand = ActionManager::command(Core::Constants::OUTPUTPANE_CLEAR);
|
||||
m_clear->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
||||
m_clear->setText(clearCommand->action()->text());
|
||||
@@ -624,8 +627,10 @@ public:
|
||||
q->addDockWidget(Qt::LeftDockWidgetArea, selectorDock);
|
||||
|
||||
m_buildSystemOutput = new BuildSystemOutputWindow;
|
||||
m_buildSystemOutput->setReadOnly(true);
|
||||
auto output = new QWidget;
|
||||
// ProjectWindow sets background role to Base which is wrong for the output window,
|
||||
// especially the find tool bar (resulting in wrong label color)
|
||||
output->setBackgroundRole(QPalette::Window);
|
||||
output->setObjectName("BuildSystemOutput");
|
||||
output->setWindowTitle(ProjectWindow::tr("Build System Output"));
|
||||
auto outputLayout = new QVBoxLayout;
|
||||
@@ -634,6 +639,7 @@ public:
|
||||
outputLayout->setSpacing(0);
|
||||
outputLayout->addWidget(m_buildSystemOutput->toolBar());
|
||||
outputLayout->addWidget(m_buildSystemOutput);
|
||||
outputLayout->addWidget(new FindToolBarPlaceHolder(m_buildSystemOutput));
|
||||
auto outputDock = q->addDockForWidget(output, true);
|
||||
q->addDockWidget(Qt::RightDockWidgetArea, outputDock);
|
||||
}
|
||||
|
@@ -27,8 +27,6 @@
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
#include <coreplugin/find/basetextfind.h>
|
||||
#include <coreplugin/outputwindow.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -123,9 +121,6 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
|
||||
outputFormatter()->setBoldFontEnabled(false);
|
||||
m_parser = new VcsOutputLineParser;
|
||||
setLineParsers({m_parser});
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(this);
|
||||
agg->add(new Core::BaseTextFind(this));
|
||||
}
|
||||
|
||||
// Search back for beginning of word
|
||||
|
Reference in New Issue
Block a user