TextEditor: Move BookmarkFilter class definition to .cpp

Change-Id: I6da2710afde7af153353e184de72df2325dc4644
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2024-01-26 14:09:54 +01:00
parent 994e83b839
commit fca5c4fe96
3 changed files with 25 additions and 21 deletions

View File

@@ -7,6 +7,8 @@
#include "bookmarkmanager.h" #include "bookmarkmanager.h"
#include "texteditortr.h" #include "texteditortr.h"
#include <coreplugin/locator/ilocatorfilter.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
using namespace Core; using namespace Core;
@@ -14,15 +16,23 @@ using namespace Utils;
namespace TextEditor::Internal { namespace TextEditor::Internal {
BookmarkFilter::BookmarkFilter() class BookmarkFilter final : public ILocatorFilter
{ {
setId("Bookmarks"); public:
setDisplayName(Tr::tr("Bookmarks")); BookmarkFilter()
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.")); setId("Bookmarks");
setPriority(Medium); setDisplayName(Tr::tr("Bookmarks"));
setDefaultShortcutString("b"); 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() LocatorMatcherTasks BookmarkFilter::matchers()
{ {
@@ -114,4 +124,9 @@ LocatorFilterEntries BookmarkFilter::match(const QString &input) const
return entries; return entries;
} }
void setupBookmarkFilter()
{
static BookmarkFilter theBookmarkFilter;
}
} // TextEditor::Internal } // TextEditor::Internal

View File

@@ -3,18 +3,8 @@
#pragma once #pragma once
#include <coreplugin/locator/ilocatorfilter.h>
namespace TextEditor::Internal { namespace TextEditor::Internal {
class BookmarkFilter : public Core::ILocatorFilter void setupBookmarkFilter();
{
public:
BookmarkFilter();
private:
Core::LocatorMatcherTasks matchers() final;
Core::LocatorFilterEntries match(const QString &input) const;
};
} // TextEditor::Internal } // TextEditor::Internal

View File

@@ -67,8 +67,6 @@ const char kCurrentDocumentWordUnderCursor[] = "CurrentDocument:WordUnderCursor"
class TextEditorPluginPrivate : public QObject class TextEditorPluginPrivate : public QObject
{ {
public: public:
BookmarkFilter m_bookmarkFilter;
TextEditorSettings settings; TextEditorSettings settings;
FindInFiles findInFilesFilter; FindInFiles findInFilesFilter;
@@ -121,6 +119,7 @@ void TextEditorPlugin::initialize()
setupBookmarkManager(this); setupBookmarkManager(this);
setupBookmarkView(); setupBookmarkView();
setupBookmarkFilter();
d = new TextEditorPluginPrivate; d = new TextEditorPluginPrivate;