forked from qt-creator/qt-creator
TextEditor: Simplify setup of line number filter
Change-Id: Ida977fc959f3fe6052151ba8e2461a64699d0a41 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -108,7 +108,7 @@ add_qtc_plugin(TextEditor
|
||||
texteditoractionhandler.cpp texteditoractionhandler.h
|
||||
texteditorconstants.cpp texteditorconstants.h
|
||||
texteditoroverlay.cpp texteditoroverlay.h
|
||||
texteditorplugin.cpp texteditorplugin.h
|
||||
texteditorplugin.cpp
|
||||
texteditorsettings.cpp texteditorsettings.h
|
||||
textindenter.cpp textindenter.h
|
||||
textmark.cpp textmark.h
|
||||
|
@@ -12,7 +12,10 @@ using namespace Utils;
|
||||
|
||||
namespace TextEditor::Internal {
|
||||
|
||||
LineNumberFilter::LineNumberFilter()
|
||||
class LineNumberFilter final : public Core::ILocatorFilter
|
||||
{
|
||||
public:
|
||||
LineNumberFilter()
|
||||
{
|
||||
setId("Line in current document");
|
||||
setDisplayName(Tr::tr("Line in Current Document"));
|
||||
@@ -23,7 +26,8 @@ LineNumberFilter::LineNumberFilter()
|
||||
setDefaultIncludedByDefault(true);
|
||||
}
|
||||
|
||||
LocatorMatcherTasks LineNumberFilter::matchers()
|
||||
private:
|
||||
LocatorMatcherTasks matchers() final
|
||||
{
|
||||
using namespace Tasking;
|
||||
|
||||
@@ -65,5 +69,17 @@ LocatorMatcherTasks LineNumberFilter::matchers()
|
||||
};
|
||||
return {{Sync(onSetup), storage}};
|
||||
}
|
||||
};
|
||||
|
||||
ILocatorFilter *lineNumberFilter()
|
||||
{
|
||||
static LineNumberFilter theLineNumberFilter;
|
||||
return &theLineNumberFilter;
|
||||
}
|
||||
|
||||
void setupLineNumberFilter()
|
||||
{
|
||||
(void) lineNumberFilter(); // Instantiate it.
|
||||
}
|
||||
|
||||
} // namespace TextEditor::Internal
|
||||
|
@@ -7,13 +7,8 @@
|
||||
|
||||
namespace TextEditor::Internal {
|
||||
|
||||
class LineNumberFilter : public Core::ILocatorFilter
|
||||
{
|
||||
public:
|
||||
LineNumberFilter();
|
||||
Core::ILocatorFilter *lineNumberFilter();
|
||||
|
||||
private:
|
||||
Core::LocatorMatcherTasks matchers() final;
|
||||
};
|
||||
void setupLineNumberFilter();
|
||||
|
||||
} // namespace TextEditor::Internal
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "texteditor.h"
|
||||
#include "texteditoractionhandler.h"
|
||||
#include "texteditorconstants.h"
|
||||
#include "texteditorplugin.h"
|
||||
#include "texteditorsettings.h"
|
||||
#include "textindenter.h"
|
||||
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "snippetprovider.h"
|
||||
|
||||
#include <texteditor/texteditorplugin.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace TextEditor;
|
||||
|
@@ -145,7 +145,6 @@ QtcPlugin {
|
||||
"texteditoroverlay.cpp",
|
||||
"texteditoroverlay.h",
|
||||
"texteditorplugin.cpp",
|
||||
"texteditorplugin.h",
|
||||
"texteditorsettings.cpp",
|
||||
"texteditorsettings.h",
|
||||
"textindenter.cpp",
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "displaysettings.h"
|
||||
#include "fontsettings.h"
|
||||
#include "linenumberfilter.h"
|
||||
#include "texteditorplugin.h"
|
||||
#include "texteditortr.h"
|
||||
#include "texteditorsettings.h"
|
||||
|
||||
|
@@ -1,8 +1,6 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "texteditorplugin.h"
|
||||
|
||||
#include "bookmarkfilter.h"
|
||||
#include "bookmarkmanager.h"
|
||||
#include "findincurrentfile.h"
|
||||
@@ -103,7 +101,6 @@ public:
|
||||
FilePath m_marginActionFileName;
|
||||
|
||||
TextEditorSettings settings;
|
||||
LineNumberFilter lineNumberFilter; // Goto line functionality for quick open
|
||||
|
||||
FindInFiles findInFilesFilter;
|
||||
FindInCurrentFile findInCurrentFileFilter;
|
||||
@@ -303,6 +300,7 @@ void TextEditorPlugin::initialize()
|
||||
|
||||
setupTextMarkRegistry(this);
|
||||
setupOutlineFactory();
|
||||
setupLineNumberFilter(); // Goto line functionality for quick open
|
||||
|
||||
d = new TextEditorPluginPrivate;
|
||||
|
||||
@@ -449,11 +447,6 @@ void TextEditorPlugin::extensionsInitialized()
|
||||
});
|
||||
}
|
||||
|
||||
LineNumberFilter *lineNumberFilter()
|
||||
{
|
||||
return &m_instance->d->lineNumberFilter;
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
||||
{
|
||||
HighlighterHelper::handleShutdown();
|
||||
|
@@ -1,13 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace TextEditor::Internal {
|
||||
|
||||
class LineNumberFilter;
|
||||
LineNumberFilter *lineNumberFilter();
|
||||
|
||||
} // TextEditor::Internal
|
@@ -6,7 +6,6 @@
|
||||
#include "fontsettings.h"
|
||||
#include "textdocument.h"
|
||||
#include "texteditor.h"
|
||||
#include "texteditorplugin.h"
|
||||
#include "texteditortr.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
Reference in New Issue
Block a user