diff options
author | jasplin <qt-info@nokia.com> | 2010-04-30 10:53:08 +0200 |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2010-04-30 10:53:08 +0200 |
commit | 7eb9319de2b4ee839943ded29e9d9974a1181f3f (patch) | |
tree | 8f605afbe2881dccfc621b961d9b9fdeed4010a2 | |
parent | eb2427e5a86bfd3d730f8e8be6f6bedb95ed28fd (diff) |
Redefined meaning of a negative index base time.
A negative index base time now corresponds to the last
contributing timestamp instead of the current time.
-rw-r--r-- | src/bm/bmrequest.cpp | 2 | ||||
-rw-r--r-- | src/bm/index.cpp | 10 | ||||
-rw-r--r-- | src/bm/plotter.cpp | 6 | ||||
-rw-r--r-- | src/bm/plotter.h | 2 |
4 files changed, 9 insertions, 11 deletions
diff --git a/src/bm/bmrequest.cpp b/src/bm/bmrequest.cpp index 71691ec..e9aac8f 100644 --- a/src/bm/bmrequest.cpp +++ b/src/bm/bmrequest.cpp @@ -4906,8 +4906,6 @@ QByteArray BMRequest_IndexGetValues::toReplyBuffer() // Get base timestamp ... baseTimestamp = argsElem.attributeNode("baseTimestamp").value().toInt(&ok); Q_ASSERT(ok); - if (baseTimestamp == -1) - baseTimestamp = QDateTime::currentDateTime().toTime_t(); // Get median window size ... medianWinSize = argsElem.attributeNode("medianWinSize").value().toInt(&ok); diff --git a/src/bm/index.cpp b/src/bm/index.cpp index afb5ab1..6bc6c78 100644 --- a/src/bm/index.cpp +++ b/src/bm/index.cpp @@ -51,13 +51,6 @@ void Index::init( const QList<ResultHistoryInfo *> &candidateRHInfos, QList<int> *evalTimestamps, int *rejectedNonPositive) { - if (baseTimestamp < 0) { - valid = false; - invalidReason_ = "negative base timestamp"; - return; - } - - int rejectedNonPositive_ = 0; QSet<int> etset; @@ -99,6 +92,9 @@ void Index::init( qSort(*evalTimestamps); evalTimestamps_ = *evalTimestamps; + if (baseTimestamp < 0) + baseTimestamp = evalTimestamps_.last(); + valid = true; invalidReason_ = ""; } diff --git a/src/bm/plotter.cpp b/src/bm/plotter.cpp index e2ce934..a0e5d73 100644 --- a/src/bm/plotter.cpp +++ b/src/bm/plotter.cpp @@ -490,11 +490,15 @@ bool IndexPlotter::drawScenes( scene_far->addLine(xmin, y_base, xmax, y_base, QPen(color, 2)); } + if (baseTimestamp < 0) + baseTimestamp = timestamps.last(); + if ((baseTimestamp >= timestamps.first()) && (baseTimestamp <= timestamps.last())) { // Draw line indicating the base timestamp ... QColor color(50, 50, 255); const qreal btx = xmin + (baseTimestamp - loTimestamp) * xfact; - scene_far->addLine(btx, ymin, btx, ymax, QPen(color, 2)); + QGraphicsItem *btItem = scene_far->addLine(btx, ymin, btx, ymax, QPen(color, 2)); + btItem->setZValue(1); } const int nDispTimestamps = 8; diff --git a/src/bm/plotter.h b/src/bm/plotter.h index 789daae..ca15d72 100644 --- a/src/bm/plotter.h +++ b/src/bm/plotter.h @@ -84,7 +84,7 @@ private: QList<int> timestamps; QList<qreal> values; QList<int> contributions; - int baseTimestamp; + mutable int baseTimestamp; int baseValuePos; qreal width; |