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 "texteditortr.h"
#include <coreplugin/locator/ilocatorfilter.h>
#include <utils/algorithm.h>
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

View File

@@ -3,18 +3,8 @@
#pragma once
#include <coreplugin/locator/ilocatorfilter.h>
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

View File

@@ -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;