QmlProfiler: Keep an extra time window in ZoomControl

This window is dynamically sized so that no integer overflows can occur
when using it in the timeline view instead of the whole trace time.

Task-number: QTCREATORBUG-11879
Change-Id: Id86faaf614b5f833e47ce26bb859b63eb09e7547
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-03-28 16:06:07 +01:00
parent a0239e3e71
commit be1a94ef1f
4 changed files with 126 additions and 8 deletions

View File

@@ -30,8 +30,10 @@
#ifndef QMLPROFILERTRACEVIEW_H
#define QMLPROFILERTRACEVIEW_H
#include "qmlprofilermodelmanager.h"
#include <QQuickView>
#include <QWidget>
#include <QTimer>
namespace Analyzer { class IAnalyzerTool; }
@@ -47,19 +49,38 @@ class QmlProfilerViewManager;
class ZoomControl : public QObject {
Q_OBJECT
public:
ZoomControl(QObject *parent=0):QObject(parent),m_startTime(0),m_endTime(0) {}
static const qint64 MAX_ZOOM_FACTOR = 1 << 12;
ZoomControl(const QmlProfilerTraceTime *traceTime, QObject *parent = 0);
~ZoomControl(){}
Q_INVOKABLE void setRange(qint64 startTime, qint64 endTime);
Q_INVOKABLE qint64 startTime() { return m_startTime; }
Q_INVOKABLE qint64 endTime() { return m_endTime; }
Q_INVOKABLE qint64 startTime() const { return m_startTime; }
Q_INVOKABLE qint64 endTime() const { return m_endTime; }
Q_INVOKABLE qint64 duration() const { return m_endTime - m_startTime; }
Q_INVOKABLE qint64 windowStart() const { return m_windowStart; }
Q_INVOKABLE qint64 windowEnd() const { return m_windowEnd; }
Q_INVOKABLE qint64 windowLength() const { return m_windowEnd - m_windowStart; }
void setWindowLocked(bool lock) { m_windowLocked = lock; }
signals:
void rangeChanged();
void windowChanged();
private slots:
void rebuildWindow();
void moveWindow();
private:
qint64 m_startTime;
qint64 m_endTime;
qint64 m_windowStart;
qint64 m_windowEnd;
const QmlProfilerTraceTime *m_traceTime;
QTimer m_timer;
bool m_windowLocked;
};
class QmlProfilerTraceView : public QWidget
@@ -97,6 +118,8 @@ private slots:
protected:
virtual void resizeEvent(QResizeEvent *event);
virtual void contextMenuEvent(QContextMenuEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
private slots:
void setZoomSliderEnabled(bool enabled);