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>
This commit is contained in:
Jarek Kobus
2021-02-08 12:22:21 +01:00
parent 33d2d736ea
commit a673fca144
6 changed files with 70 additions and 358 deletions

View File

@@ -41,67 +41,33 @@ class ManagerPrivate;
class Manager : public QObject
{
Q_OBJECT
public:
explicit Manager(QObject *parent = nullptr);
~Manager() override;
//! Get an instance of Manager
static Manager *instance();
bool canFetchMore(QStandardItem *item, bool skipRoot = false) const;
void fetchMore(QStandardItem *item, bool skipRoot = false);
bool hasChildren(QStandardItem *item) const;
signals:
void stateChanged(bool state);
void treeDataUpdate(QSharedPointer<QStandardItem> result);
void requestTreeDataUpdate();
void requestDocumentUpdated(CPlusPlus::Document::Ptr doc);
void requestResetCurrentState();
void requestClearCache();
void requestClearCacheAll();
void requestSetFlatMode(bool flat);
public:
void gotoLocation(const QString &fileName, int line = 0, int column = 0);
void gotoLocations(const QList<QVariant> &locations);
void onRequestTreeDataUpdate();
void setFlatMode(bool flat);
void onWidgetVisibilityIsChanged(bool visibility);
protected:
void onStateChanged(bool state);
void onProjectListChanged();
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
void onTaskStarted(Utils::Id type);
void onAllTasksFinished(Utils::Id type);
void onTreeDataUpdate(QSharedPointer<QStandardItem> result);
signals:
void treeDataUpdate(QSharedPointer<QStandardItem> result);
private:
void onProjectListChanged();
void onTreeDataUpdate(QSharedPointer<QStandardItem> result);
void resetParser();
protected:
//! Perform an initialization
void initialize();
inline bool state() const;
void setState(bool state);
private:
//! private class data pointer
ManagerPrivate *d;
};