summaryrefslogtreecommitdiff
path: root/src/plugins/classview/classviewparser.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-02-08 12:22:21 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-02-08 15:49:40 +0000
commita673fca1445a0f34b6799d9d60e521c8ae9b68af (patch)
treede7311f471c8becc121430903d5110083bbacc2f /src/plugins/classview/classviewparser.cpp
parent33d2d736ea4f52725c0714064f5380277181e9a2 (diff)
downloadqt-creator-a673fca1445a0f34b6799d9d60e521c8ae9b68af.tar.gz
Simplify interface of classes in ClassViewPlugin
Allow for direct connections where signal emitter and receiver live in the same thread. Remove unneeded mutexState, as changes to state and all queries of state are done in the same thread. Remove some indirections by removing some signals and by calling respective slots through QMetaObject::invokeMethod() or directly. Remove some unused methods. Remove a code path of setState(false), as this was never called. Remove an initial call to onProjectListChanged(), as initially the state is false and a call is no-op. This change doesn't influence the existing behavior. Task-number: QTCREATORBUG-25317 Change-Id: I683525b49afaf04e155d1859bb85ee5dd8e26dd2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/classview/classviewparser.cpp')
-rw-r--r--src/plugins/classview/classviewparser.cpp59
1 files changed, 3 insertions, 56 deletions
diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp
index 0755da374b..414118df9a 100644
--- a/src/plugins/classview/classviewparser.cpp
+++ b/src/plugins/classview/classviewparser.cpp
@@ -83,14 +83,6 @@ namespace Internal {
Emits a signal about a tree data update.
*/
-/*!
- \fn void Parser::resetDataDone()
-
- Emits a signal that internal data is reset.
-
- \sa resetData, resetDataToCurrentState
-*/
-
class ParserPrivate
{
public:
@@ -167,12 +159,8 @@ Parser::Parser(QObject *parent)
{
d->timer.setSingleShot(true);
- // connect signal/slots
- // internal data reset
- connect(this, &Parser::resetDataDone, this, &Parser::onResetDataDone, Qt::QueuedConnection);
-
// timer for emitting changes
- connect(&d->timer, &QTimer::timeout, this, &Parser::requestCurrentState, Qt::QueuedConnection);
+ connect(&d->timer, &QTimer::timeout, this, &Parser::requestCurrentState);
}
/*!
@@ -230,7 +218,7 @@ void Parser::setFlatMode(bool flatMode)
d->flatMode = flatMode;
// regenerate and resend current tree
- emitCurrentTree();
+ requestCurrentState();
}
/*!
@@ -549,23 +537,6 @@ void Parser::parseDocument(const CPlusPlus::Document::Ptr &doc)
}
/*!
- Requests to clear full internal stored data.
-*/
-
-void Parser::clearCacheAll()
-{
- d->docLocker.lockForWrite();
-
- d->cachedDocTrees.clear();
- d->cachedDocTreesRevision.clear();
- d->documentList.clear();
-
- d->docLocker.unlock();
-
- clearCache();
-}
-
-/*!
Requests to clear internal stored data. The data has to be regenerated on
the next request.
*/
@@ -612,8 +583,6 @@ void Parser::removeFiles(const QStringList &fileList)
d->cachedPrjTrees.remove(name);
d->cachedPrjFileLists.clear();
}
-
- emit filesAreRemoved();
}
/*!
@@ -643,7 +612,7 @@ void Parser::resetData(const CPlusPlus::Snapshot &snapshot)
fileList += prj->files(Project::SourceFiles);
setFileList(Utils::transform(fileList, &FilePath::toString));
- emit resetDataDone();
+ requestCurrentState();
}
/*!
@@ -659,33 +628,11 @@ void Parser::resetDataToCurrentState()
}
/*!
- Regenerates the tree when internal data changes.
-
- \sa resetDataDone
-*/
-
-void Parser::onResetDataDone()
-{
- // internal data is reset, update a tree and send it back
- emitCurrentTree();
-}
-
-/*!
Requests to emit a signal with the current tree state.
*/
void Parser::requestCurrentState()
{
- emitCurrentTree();
-}
-
-/*!
- Sends the current tree to listeners.
-*/
-
-void Parser::emitCurrentTree()
-{
- // stop timer if it is active right now
d->timer.stop();
d->rootItemLocker.lockForWrite();