From 1b9c0c7ef5ade38d2c435c1b9a2d88089d51f630 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 8 Feb 2021 16:52:42 +0100 Subject: [PATCH] Simplify interface of classes in ClassViewPlugin Remove unused methods. Replace one slot with a call to lambda. Amends a673fca1445a0f34b6799d9d60e521c8ae9b68af Task-number: QTCREATORBUG-25317 Change-Id: I1125b62b9ea66b8dc43038a6b748d52a5a27224f Reviewed-by: Christian Kandeler --- src/plugins/classview/classviewmanager.cpp | 23 ++++------- src/plugins/classview/classviewmanager.h | 1 - .../classview/classviewparsertreeitem.cpp | 39 ------------------- .../classview/classviewparsertreeitem.h | 8 ---- 4 files changed, 8 insertions(+), 63 deletions(-) diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index bf9ed8f58fd..a1cf4053751 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -199,7 +199,14 @@ void Manager::initialize() // translate data update from the parser to listeners connect(&d->parser, &Parser::treeDataUpdate, - this, &Manager::onTreeDataUpdate, Qt::QueuedConnection); + this, [this](QSharedPointer result) { + // do nothing if Manager is disabled + if (!state()) + return; + + emit treeDataUpdate(result); + + }, Qt::QueuedConnection); // connect to the cpp model manager for signals about document updates CppTools::CppModelManager *codeModelManager = CppTools::CppModelManager::instance(); @@ -352,19 +359,5 @@ void Manager::setFlatMode(bool flat) }, Qt::QueuedConnection); } -/*! - Sends a new tree data update to a tree view. \a result holds the item with - the current tree. -*/ - -void Manager::onTreeDataUpdate(QSharedPointer result) -{ - // do nothing if Manager is disabled - if (!state()) - return; - - emit treeDataUpdate(result); -} - } // namespace Internal } // namespace ClassView diff --git a/src/plugins/classview/classviewmanager.h b/src/plugins/classview/classviewmanager.h index 2b0513e5738..af6d60ef045 100644 --- a/src/plugins/classview/classviewmanager.h +++ b/src/plugins/classview/classviewmanager.h @@ -60,7 +60,6 @@ signals: private: void onProjectListChanged(); - void onTreeDataUpdate(QSharedPointer result); void resetParser(); void initialize(); diff --git a/src/plugins/classview/classviewparsertreeitem.cpp b/src/plugins/classview/classviewparsertreeitem.cpp index 102abf23815..bce502262e9 100644 --- a/src/plugins/classview/classviewparsertreeitem.cpp +++ b/src/plugins/classview/classviewparsertreeitem.cpp @@ -146,36 +146,6 @@ void ParserTreeItem::addSymbolLocation(const SymbolLocation &location) d->symbolLocations.insert(location); } -/*! - Adds information about symbol locations from \a locations. - \sa SymbolLocation, removeSymbolLocation, symbolLocations -*/ - -void ParserTreeItem::addSymbolLocation(const QSet &locations) -{ - d->symbolLocations.unite(locations); -} - -/*! - Removes information about \a location. - \sa SymbolLocation, addSymbolLocation, symbolLocations -*/ - -void ParserTreeItem::removeSymbolLocation(const SymbolLocation &location) -{ - d->symbolLocations.remove(location); -} - -/*! - Removes information about \a locations. - \sa SymbolLocation, addSymbolLocation, symbolLocations -*/ - -void ParserTreeItem::removeSymbolLocations(const QSet &locations) -{ - d->symbolLocations.subtract(locations); -} - /*! Gets information about symbol positions. \sa SymbolLocation, addSymbolLocation, removeSymbolLocation @@ -199,15 +169,6 @@ void ParserTreeItem::appendChild(const ParserTreeItem::Ptr &item, const SymbolIn d->symbolInformations[inf] = item; } -/*! - Removes the \a inf symbol information. -*/ - -void ParserTreeItem::removeChild(const SymbolInformation &inf) -{ - d->symbolInformations.remove(inf); -} - /*! Returns the child item specified by \a inf symbol information. */ diff --git a/src/plugins/classview/classviewparsertreeitem.h b/src/plugins/classview/classviewparsertreeitem.h index d3ca68007ef..15a12c5f80a 100644 --- a/src/plugins/classview/classviewparsertreeitem.h +++ b/src/plugins/classview/classviewparsertreeitem.h @@ -54,18 +54,10 @@ public: void addSymbolLocation(const SymbolLocation &location); - void addSymbolLocation(const QSet &locations); - - void removeSymbolLocation(const SymbolLocation &location); - - void removeSymbolLocations(const QSet &locations); - QSet symbolLocations() const; void appendChild(const ParserTreeItem::Ptr &item, const SymbolInformation &inf); - void removeChild(const SymbolInformation &inf); - ParserTreeItem::Ptr child(const SymbolInformation &inf) const; int childCount() const;