QmlProfiler: Methods for dispatching events by feature

When announcing features models have to provide functions that handle
events for those features now. The model manager gets a function to
dispatch events to the models that subscribe to them.

Change-Id: I3fd80443a68ba264a513d8d53ed473cf072f1dc7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Ulf Hermann
2016-04-28 16:19:17 +02:00
parent 911c8842b2
commit 1e8996b438
8 changed files with 77 additions and 9 deletions

View File

@@ -28,10 +28,13 @@
#include "qmlprofiler_global.h"
#include "qmlprofilereventtypes.h"
#include "qmleventlocation.h"
#include "qmlevent.h"
#include "qmleventtype.h"
#include <utils/fileinprojectfinder.h>
#include <QObject>
#include <functional>
namespace QmlProfiler {
class QmlProfilerModelManager;
@@ -80,6 +83,9 @@ public:
Done
};
typedef std::function<void(const QmlEvent &, const QmlEventType &)> EventLoader;
typedef std::function<void()> Finalizer;
explicit QmlProfilerModelManager(Utils::FileInProjectFinder *finder, QObject *parent = 0);
~QmlProfilerModelManager();
@@ -91,7 +97,10 @@ public:
bool isEmpty() const;
int registerModelProxy();
void announceFeatures(int proxyId, quint64 features);
void announceFeatures(quint64 features, EventLoader eventLoader, Finalizer finalizer);
void dispatch(const QmlEvent &event, const QmlEventType &type);
quint64 availableFeatures() const;
quint64 visibleFeatures() const;
void setVisibleFeatures(quint64 features);