Commit 0d6cbab6 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau

Merge branch '5.4'

parents 58838e02 0b4ad384
Pipeline #7406 passed with stage
in 56 minutes and 53 seconds
......@@ -476,6 +476,10 @@ void VariableCollection::updateAutoUpdate(IDebugSession* session)
VariableCollection::~ VariableCollection()
{
for (auto* view : qAsConst(m_textHintProvidedViews)) {
auto* iface = qobject_cast<KTextEditor::TextHintInterface*>(view);
iface->unregisterTextHintProvider(&m_textHintProvider);
}
}
void VariableCollection::textDocumentCreated(IDocument* doc)
......@@ -499,7 +503,18 @@ void VariableCollection::viewCreated(KTextEditor::Document* doc,
if( !iface )
return;
if (m_textHintProvidedViews.contains(view)) {
return;
}
connect(view, &View::destroyed, this, &VariableCollection::viewDestroyed);
iface->registerTextHintProvider(&m_textHintProvider);
m_textHintProvidedViews.append(view);
}
void VariableCollection::viewDestroyed(QObject* obj)
{
m_textHintProvidedViews.removeOne(static_cast<KTextEditor::View*>(obj));
}
Locals* VariableCollection::locals(const QString &name) const
......
......@@ -238,6 +238,7 @@ private Q_SLOTS:
void textDocumentCreated( KDevelop::IDocument*);
void viewCreated(KTextEditor::Document*, KTextEditor::View*);
void viewDestroyed(QObject* obj);
private:
VariablesRoot* m_universe;
......@@ -246,6 +247,8 @@ private:
friend class VariableProvider;
VariableProvider m_textHintProvider;
QVector<KTextEditor::View*> m_textHintProvidedViews;
};
}
......
......@@ -325,10 +325,20 @@ ContextBrowserPlugin::ContextBrowserPlugin(QObject* parent, const QVariantList&)
//Needed global action for the context-menu extensions
m_findUses = new QAction(i18n("Find Uses"), this);
connect(m_findUses, &QAction::triggered, this, &ContextBrowserPlugin::findUses);
const auto documents = core()->documentController()->openDocuments();
for (KDevelop::IDocument* document : documents) {
textDocumentCreated(document);
}
}
ContextBrowserPlugin::~ContextBrowserPlugin()
{
for (auto* view : qAsConst(m_textHintProvidedViews)) {
auto* iface = qobject_cast<KTextEditor::TextHintInterface*>(view);
iface->unregisterTextHintProvider(&m_textHintProvider);
}
///TODO: QObject inheritance should suffice?
delete m_nextMenu;
delete m_previousMenu;
......@@ -976,6 +986,7 @@ void ContextBrowserPlugin::viewDestroyed(QObject* obj)
{
m_highlightedRanges.remove(static_cast<KTextEditor::View*>(obj));
m_updateViews.remove(static_cast<View*>(obj));
m_textHintProvidedViews.removeOne(static_cast<KTextEditor::View*>(obj));
}
void ContextBrowserPlugin::selectionChanged(View* view)
......@@ -1024,8 +1035,12 @@ void ContextBrowserPlugin::viewCreated(KTextEditor::Document*, View* v)
if (!iface)
return;
if (m_textHintProvidedViews.contains(v)) {
return;
}
iface->setTextHintDelay(highlightingTimeout);
iface->registerTextHintProvider(&m_textHintProvider);
m_textHintProvidedViews.append(v);
}
void ContextBrowserPlugin::registerToolView(ContextBrowserView* view)
......
......@@ -228,6 +228,8 @@ private:
//Holds a list of all active context browser tool views
QList<ContextBrowserView*> m_views;
QVector<KTextEditor::View*> m_textHintProvidedViews;
//Used to override the next declaration that will be highlighted
KDevelop::IndexedDeclaration m_useDeclaration;
KDevelop::IndexedDeclaration m_lastHighlightedDeclaration;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment