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