forked from qt-creator/qt-creator
TextEditor: Use new setup pattern for BookmarkView
Change-Id: I934f1bd6cb3889c4199176cf8d15beaee805f86c Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1010,19 +1010,29 @@ BookmarkManager &bookmarkManager()
|
||||
|
||||
// BookmarkViewFactory
|
||||
|
||||
BookmarkViewFactory::BookmarkViewFactory()
|
||||
class BookmarkViewFactory final : public INavigationWidgetFactory
|
||||
{
|
||||
public:
|
||||
BookmarkViewFactory()
|
||||
{
|
||||
setDisplayName(Tr::tr("Bookmarks"));
|
||||
setPriority(300);
|
||||
setId("Bookmarks");
|
||||
setActivationSequence(QKeySequence(useMacShortcuts ? Tr::tr("Alt+Meta+M") : Tr::tr("Alt+M")));
|
||||
}
|
||||
}
|
||||
|
||||
NavigationView BookmarkViewFactory::createWidget()
|
||||
{
|
||||
private:
|
||||
NavigationView createWidget() final
|
||||
{
|
||||
auto view = new BookmarkView;
|
||||
view->setActivationMode(Utils::DoubleClickActivation); // QUESTION: is this useful ?
|
||||
return {view, view->createToolBarWidgets()};
|
||||
}
|
||||
};
|
||||
|
||||
void setupBookmarkView()
|
||||
{
|
||||
static BookmarkViewFactory theBookmarkViewFactory;
|
||||
}
|
||||
|
||||
} // TextEditor::Internal
|
||||
|
@@ -116,14 +116,6 @@ private:
|
||||
BookmarkManager &bookmarkManager();
|
||||
|
||||
void setupBookmarkManager(QObject *guard);
|
||||
|
||||
class BookmarkViewFactory : public Core::INavigationWidgetFactory
|
||||
{
|
||||
public:
|
||||
BookmarkViewFactory();
|
||||
|
||||
private:
|
||||
Core::NavigationView createWidget() override;
|
||||
};
|
||||
void setupBookmarkView();
|
||||
|
||||
} // Bookmarks::Internal
|
||||
|
@@ -83,7 +83,6 @@ public:
|
||||
void createStandardContextMenu();
|
||||
|
||||
BookmarkFilter m_bookmarkFilter;
|
||||
BookmarkViewFactory m_bookmarkViewFactory;
|
||||
|
||||
TextEditorSettings settings;
|
||||
|
||||
@@ -136,24 +135,16 @@ void TextEditorPluginPrivate::requestContextMenu(TextEditorWidget *widget,
|
||||
bookmarkManager().requestContextMenu(widget->textDocument()->filePath(), lineNumber, menu);
|
||||
}
|
||||
|
||||
static class TextEditorPlugin *m_instance = nullptr;
|
||||
|
||||
class TextEditorPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "TextEditor.json")
|
||||
|
||||
public:
|
||||
TextEditorPlugin()
|
||||
{
|
||||
m_instance = this;
|
||||
}
|
||||
|
||||
~TextEditorPlugin() final
|
||||
{
|
||||
delete d;
|
||||
d = nullptr;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
ShutdownFlag aboutToShutdown() final;
|
||||
@@ -178,6 +169,7 @@ void TextEditorPlugin::initialize()
|
||||
setupLineNumberFilter(); // Goto line functionality for quick open
|
||||
|
||||
setupBookmarkManager(this);
|
||||
setupBookmarkView();
|
||||
|
||||
d = new TextEditorPluginPrivate;
|
||||
|
||||
|
Reference in New Issue
Block a user