aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlprofilertracefile.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-02-20 18:55:45 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-02-24 11:55:10 +0000
commit1ee8d0fb64b4a7c59fa4601fc8cad41372a8dd19 (patch)
tree9b846c8929ce6d6144d6c7b6f7c0ed4356dbd8d0 /src/plugins/qmlprofiler/qmlprofilertracefile.h
parent07f4ae622770cc99782edc8bf14d2a385bf17778 (diff)
QmlProfiler: Improve error and progress handling for loading and saving
* Clear the trace and send the loadingFinished() signal when loading fails or is canceled. loadingFinished() re-enables the UI, which is in fact important. * Check more consistently for whether the operation was canceled and add a separate signal for that. * When saving fails or is canceled, remove the half-written file. * Don't try to guess the number of events for progress reporting when saving. Use the event timestamps and start/end time instead. * Properly initialize the progress range in all cases. * Drop the bool return value from the load methods. Nobody uses that. * Send loadFinished() only after loading a file, not every time we reach the Done state. Change-Id: I507f11c667e20534ea335e84798de11aa06fb6f2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertracefile.h')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertracefile.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.h b/src/plugins/qmlprofiler/qmlprofilertracefile.h
index b705f07e689..b3d9bbc47b0 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.h
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.h
@@ -51,8 +51,8 @@ public:
void setFuture(QFutureInterface<void> *future);
- bool loadQtd(QIODevice *device);
- bool loadQzt(QIODevice *device);
+ void loadQtd(QIODevice *device);
+ void loadQzt(QIODevice *device);
quint64 loadedFeatures() const;
@@ -65,6 +65,7 @@ signals:
void qmlEventsLoaded(const QVector<QmlProfiler::QmlEvent> &event);
void error(const QString &error);
void success();
+ void canceled();
private:
void loadEventTypes(QXmlStreamReader &reader);
@@ -96,16 +97,26 @@ public:
void saveQtd(QIODevice *device);
void saveQzt(QFile *file);
+signals:
+ void error(const QString &error);
+ void success();
+ void canceled();
+
private:
- void calculateMeasuredTime();
- void incrementProgress();
+ void updateProgress(qint64 timestamp);
bool isCanceled() const;
+ enum ProgressValues {
+ ProgressTypes = -128,
+ ProgressNotes = -32,
+ ProgressEvents = 1024,
+ ProgressTotal = ProgressEvents - ProgressTypes - ProgressNotes
+ };
+
qint64 m_startTime, m_endTime, m_measuredTime;
QFutureInterface<void> *m_future;
const QmlProfilerDataModel *m_model;
QVector<QmlNote> m_notes;
- int m_newProgressValue;
};