X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fretracer.h;h=70170f5ce4605949789083d555ab76307976df7e;hb=46963dad18214fc45b248ecdc9f5931cf417705d;hp=37502e45b79e5d580396c2eb34db1bb4df592ac5;hpb=3acde366b677d3d68e85116f795c7a569ee3d18a;p=apitrace diff --git a/gui/retracer.h b/gui/retracer.h index 37502e4..70170f5 100644 --- a/gui/retracer.h +++ b/gui/retracer.h @@ -1,14 +1,30 @@ #ifndef RETRACER_H #define RETRACER_H -#include +#include #include -class Retracer : public QObject +class ApiTraceState; +namespace QJson { + class Parser; +} + +struct RetraceError { + int callIndex; + QString type; + QString message; +}; + +/* internal class used by the retracer to run + * in the thread */ +class RetraceProcess : public QObject { Q_OBJECT public: - Retracer(QObject *parent=0); + RetraceProcess(QObject *parent=0); + ~RetraceProcess(); + + QProcess *process() const; QString fileName() const; void setFileName(const QString &name); @@ -30,12 +46,15 @@ public slots: void terminate(); signals: - void finished(const QByteArray &output); + void finished(const QString &output); void error(const QString &msg); + void foundState(ApiTraceState *state); + void retraceErrors(const QList &errors); private slots: void replayFinished(); void replayError(QProcess::ProcessError err); + private: QString m_fileName; bool m_benchmarking; @@ -44,6 +63,49 @@ private: qlonglong m_captureCall; QProcess *m_process; + QJson::Parser *m_jsonParser; +}; + +class Retracer : public QThread +{ + Q_OBJECT +public: + Retracer(QObject *parent=0); + + QString fileName() const; + void setFileName(const QString &name); + + bool isBenchmarking() const; + void setBenchmarking(bool bench); + + bool isDoubleBuffered() const; + void setDoubleBuffered(bool db); + + void setCaptureAtCallNumber(qlonglong num); + qlonglong captureAtCallNumber() const; + + bool captureState() const; + void setCaptureState(bool enable); + +signals: + void finished(const QString &output); + void foundState(ApiTraceState *state); + void error(const QString &msg); + void retraceErrors(const QList &errors); + +protected: + virtual void run(); + +private slots: + void cleanup(); +private: + QString m_fileName; + bool m_benchmarking; + bool m_doubleBuffered; + bool m_captureState; + qlonglong m_captureCall; + + QProcessEnvironment m_processEnvironment; }; #endif