diff --git a/codecompletion/items/declaration.h b/codecompletion/items/declaration.h index 749bb36c..6018f454 100644 --- a/codecompletion/items/declaration.h +++ b/codecompletion/items/declaration.h @@ -1,57 +1,57 @@ /***************************************************************************** * Copyright (c) 2011-2016 Sven Brauch * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************** */ #ifndef PYTHONDECLARATIONCOMPLETIONITEM_H #define PYTHONDECLARATIONCOMPLETIONITEM_H #include #include #include #include "codecompletion/context.h" namespace Python { class PythonDeclarationCompletionItem : public KDevelop::NormalDeclarationCompletionItem { public: PythonDeclarationCompletionItem(KDevelop::DeclarationPointer decl = KDevelop::DeclarationPointer(), QExplicitlySharedDataPointer context = QExplicitlySharedDataPointer(), int inheritanceDepth = 0); QVariant data(const QModelIndex& index, int role, const KDevelop::CodeCompletionModel* model) const override; QString shortenedTypeString(const KDevelop::DeclarationPointer& decl, int desiredTypeLength) const override; void setTypeHint(PythonCodeCompletionContext::ItemTypeHint type); void addMatchQuality(int add); bool createsExpandingWidget() const override { return true; } QWidget* createExpandingWidget(const CodeCompletionModel* /*model*/) const override { - return new Python::NavigationWidget(m_declaration, {}, {}, {}, KDevelop::AbstractNavigationWidget::EmbeddableWidget); + return new Python::NavigationWidget(m_declaration, {}, KDevelop::AbstractNavigationWidget::EmbeddableWidget); } protected: PythonCodeCompletionContext::ItemTypeHint m_typeHint; int m_addMatchQuality; }; } // namespace Python #endif diff --git a/duchain/navigation/navigationwidget.cpp b/duchain/navigation/navigationwidget.cpp index e822ef5b..71407095 100644 --- a/duchain/navigation/navigationwidget.cpp +++ b/duchain/navigation/navigationwidget.cpp @@ -1,49 +1,49 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2012-2014 Sven Brauch * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "navigationwidget.h" #include "declarationnavigationcontext.h" #include "helpers.h" using namespace KDevelop; namespace Python { NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, - const QString& /* htmlPrefix */, const QString& /* htmlSuffix */, KDevelop::AbstractNavigationWidget::DisplayHints hints) + KDevelop::AbstractNavigationWidget::DisplayHints hints) : KDevelop::AbstractNavigationWidget() { setDisplayHints(hints); initBrowser(400); auto realDeclaration = DeclarationPointer(Helper::resolveAliasDeclaration(declaration.data())); auto context = new DeclarationNavigationContext(realDeclaration, topContext); setContext(NavigationContextPointer(context)); } NavigationWidget::NavigationWidget(const IncludeItem &/*includeItem*/, TopDUContextPointer /*topContext*/, - const QString &/*htmlPrefix*/, const QString &/*htmlSuffix*/, KDevelop::AbstractNavigationWidget::DisplayHints hints) + KDevelop::AbstractNavigationWidget::DisplayHints hints) : KDevelop::AbstractNavigationWidget() { setDisplayHints(hints); // not supported } } diff --git a/duchain/navigation/navigationwidget.h b/duchain/navigation/navigationwidget.h index 76eb4dfa..a3c37262 100644 --- a/duchain/navigation/navigationwidget.h +++ b/duchain/navigation/navigationwidget.h @@ -1,47 +1,45 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2012-2014 Sven Brauch * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PYTHON_NAVIGATIONWIDGET_H #define PYTHON_NAVIGATIONWIDGET_H #include #include #include "pythonduchainexport.h" namespace Python { class KDEVPYTHONDUCHAIN_EXPORT NavigationWidget : public KDevelop::AbstractNavigationWidget { Q_OBJECT public: NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, - const QString& htmlPrefix = QString(), const QString& htmlSuffix = QString(), KDevelop::AbstractNavigationWidget::DisplayHints hints = KDevelop::AbstractNavigationWidget::NoHints); NavigationWidget(const KDevelop::IncludeItem& includeItem, KDevelop::TopDUContextPointer topContext, - const QString& htmlPrefix = QString(), const QString& htmlSuffix = QString(), KDevelop::AbstractNavigationWidget::DisplayHints hints = KDevelop::AbstractNavigationWidget::NoHints); static QString shortDescription(const KDevelop::IncludeItem&) { return QString(); }; }; } #endif // NAVIGATIONWIDGET_H diff --git a/duchain/pythonducontext.cpp b/duchain/pythonducontext.cpp index 7db9306c..0e4f48fd 100644 --- a/duchain/pythonducontext.cpp +++ b/duchain/pythonducontext.cpp @@ -1,62 +1,60 @@ /***************************************************************************** * This file is part of KDevelop * * Copyright 2011-2013 Sven Brauch * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************** */ #include "pythonducontext.h" #include #include #include #include #include "navigation/navigationwidget.h" #include #include "duchaindebug.h" using namespace KDevelop; namespace Python { REGISTER_DUCHAIN_ITEM_WITH_DATA(PythonTopDUContext, TopDUContextData); REGISTER_DUCHAIN_ITEM_WITH_DATA(PythonNormalDUContext, DUContextData); template<> QWidget* PythonTopDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) const { if ( ! decl ) { qCDebug(KDEV_PYTHON_DUCHAIN) << "no declaration, not returning navigationwidget"; return nullptr; } - return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), htmlPrefix, htmlSuffix, hints); + return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), hints); } template<> QWidget* PythonNormalDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) const { if ( ! decl ) { qCDebug(KDEV_PYTHON_DUCHAIN) << "no declaration, not returning navigationwidget"; return nullptr; } - return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), htmlPrefix, htmlSuffix, hints); + return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), hints); } } diff --git a/duchain/pythonducontext.h b/duchain/pythonducontext.h index d5fc95dc..3e0328a6 100644 --- a/duchain/pythonducontext.h +++ b/duchain/pythonducontext.h @@ -1,77 +1,76 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2013 Sven Brauch * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************** */ #ifndef PYTHONDUCONTEXT_H #define PYTHONDUCONTEXT_H #include #include #include class QWidget; namespace KDevelop { class Declaration; class TopDUContext; } namespace Python { template class PythonDUContext : public BaseContext { public: template PythonDUContext(Data& data) : BaseContext(data) { } ///Parameters will be reached to the base-class template PythonDUContext(const Param1& p1, const Param2& p2, bool isInstantiationContext) : BaseContext(p1, p2, isInstantiationContext) { static_cast(this)->d_func_dynamic()->setClassId(this); } ///Both parameters will be reached to the base-class. This fits TopDUContext. template PythonDUContext(const Param1& p1, const Param2& p2, const Param3& p3) : BaseContext(p1, p2, p3) { static_cast(this)->d_func_dynamic()->setClassId(this); } template PythonDUContext(const Param1& p1, const Param2& p2) : BaseContext(p1, p2) { static_cast(this)->d_func_dynamic()->setClassId(this); } QWidget* createNavigationWidget(KDevelop::Declaration* decl, KDevelop::TopDUContext* topContext, - const QString& htmlPrefix, const QString& htmlSuffix, KDevelop::AbstractNavigationWidget::DisplayHints hints) const override; enum { Identity = IdentityT }; }; typedef PythonDUContext PythonTopDUContext; typedef PythonDUContext PythonNormalDUContext; } #endif // PYTHONDUCONTEXT_H