From fca5c4fe96680d3f00b45f6d5bf338094269a445 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 26 Jan 2024 14:09:54 +0100 Subject: [PATCH] TextEditor: Move BookmarkFilter class definition to .cpp Change-Id: I6da2710afde7af153353e184de72df2325dc4644 Reviewed-by: David Schulz --- src/plugins/texteditor/bookmarkfilter.cpp | 31 +++++++++++++++------ src/plugins/texteditor/bookmarkfilter.h | 12 +------- src/plugins/texteditor/texteditorplugin.cpp | 3 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/plugins/texteditor/bookmarkfilter.cpp b/src/plugins/texteditor/bookmarkfilter.cpp index a22b4d702d0..0938a0e81b8 100644 --- a/src/plugins/texteditor/bookmarkfilter.cpp +++ b/src/plugins/texteditor/bookmarkfilter.cpp @@ -7,6 +7,8 @@ #include "bookmarkmanager.h" #include "texteditortr.h" +#include + #include using namespace Core; @@ -14,15 +16,23 @@ using namespace Utils; namespace TextEditor::Internal { -BookmarkFilter::BookmarkFilter() +class BookmarkFilter final : public ILocatorFilter { - setId("Bookmarks"); - setDisplayName(Tr::tr("Bookmarks")); - setDescription(Tr::tr("Locates bookmarks. Filter by file name, by the text on the line of the " - "bookmark, or by the bookmark's note text.")); - setPriority(Medium); - setDefaultShortcutString("b"); -} +public: + BookmarkFilter() + { + setId("Bookmarks"); + setDisplayName(Tr::tr("Bookmarks")); + setDescription(Tr::tr("Locates bookmarks. Filter by file name, by the text on the line of the " + "bookmark, or by the bookmark's note text.")); + setPriority(Medium); + setDefaultShortcutString("b"); + } + +private: + LocatorMatcherTasks matchers() final; + LocatorFilterEntries match(const QString &input) const; +}; LocatorMatcherTasks BookmarkFilter::matchers() { @@ -114,4 +124,9 @@ LocatorFilterEntries BookmarkFilter::match(const QString &input) const return entries; } +void setupBookmarkFilter() +{ + static BookmarkFilter theBookmarkFilter; +} + } // TextEditor::Internal diff --git a/src/plugins/texteditor/bookmarkfilter.h b/src/plugins/texteditor/bookmarkfilter.h index d2a41ebdc74..c965b0e394e 100644 --- a/src/plugins/texteditor/bookmarkfilter.h +++ b/src/plugins/texteditor/bookmarkfilter.h @@ -3,18 +3,8 @@ #pragma once -#include - namespace TextEditor::Internal { -class BookmarkFilter : public Core::ILocatorFilter -{ -public: - BookmarkFilter(); - -private: - Core::LocatorMatcherTasks matchers() final; - Core::LocatorFilterEntries match(const QString &input) const; -}; +void setupBookmarkFilter(); } // TextEditor::Internal diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 083afbc73dd..a6ac1aa5b33 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -67,8 +67,6 @@ const char kCurrentDocumentWordUnderCursor[] = "CurrentDocument:WordUnderCursor" class TextEditorPluginPrivate : public QObject { public: - BookmarkFilter m_bookmarkFilter; - TextEditorSettings settings; FindInFiles findInFilesFilter; @@ -121,6 +119,7 @@ void TextEditorPlugin::initialize() setupBookmarkManager(this); setupBookmarkView(); + setupBookmarkFilter(); d = new TextEditorPluginPrivate;