implement seeking in playback window and add playback line in graphing view
This commit is contained in:
@@ -69,6 +69,13 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
itemTracer->setStyle(QCPItemTracer::tsCircle);
|
||||
itemTracer->setSize(20);
|
||||
|
||||
playbackPen.setWidth(1);
|
||||
playbackPen.setColor(Qt::red);
|
||||
playbackLine = new QCPItemStraightLine(ui->graphingView);
|
||||
playbackLine->setSelectable(false);
|
||||
playbackLine->setPen(playbackPen);
|
||||
playbackLine->setVisible(false);
|
||||
|
||||
// connect slot that ties some axis selections together (especially opposite axes):
|
||||
connect(ui->graphingView, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
|
||||
//connect up the mouse controls
|
||||
@@ -329,6 +336,28 @@ void GraphingWindow::gotCenterTimeID(uint32_t ID, double timestamp)
|
||||
ui->graphingView->replot();
|
||||
}
|
||||
|
||||
void GraphingWindow::gotPlaybackTimestamp(double timestamp)
|
||||
{
|
||||
if (timestamp == INFINITY) {
|
||||
playbackLine->setVisible(false);
|
||||
return;
|
||||
}
|
||||
playbackLine->setVisible(true);
|
||||
|
||||
// timestamp is always givin in seconds
|
||||
if (Utility::timeStyle == TS_MICROS)
|
||||
timestamp *= 1000000;
|
||||
else if (Utility::timeStyle == TS_MILLIS)
|
||||
timestamp *= 1000;
|
||||
else if (Utility::timeStyle == TS_CLOCK)
|
||||
timestamp += 3600; // offset of one hour needed
|
||||
|
||||
playbackLine->point1->setCoords(timestamp, 0);
|
||||
playbackLine->point2->setCoords(timestamp, 1);
|
||||
|
||||
ui->graphingView->replot();
|
||||
}
|
||||
|
||||
void GraphingWindow::titleDoubleClick(QMouseEvent* event, QCPTextElement* title)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
@@ -84,6 +84,7 @@ private slots:
|
||||
void editSelectedGraph();
|
||||
void updatedFrames(int);
|
||||
void gotCenterTimeID(uint32_t ID, double timestamp);
|
||||
void gotPlaybackTimestamp(double timestamp);
|
||||
void resetView();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
@@ -105,6 +106,8 @@ private:
|
||||
QCPSelectionDecorator *selDecorator;
|
||||
QCPItemText *locationText;
|
||||
QCPItemTracer *itemTracer;
|
||||
QPen playbackPen;
|
||||
QCPItemStraightLine *playbackLine;
|
||||
bool needScaleSetup; //do we need to set x,y graphing extents?
|
||||
bool useOpenGL;
|
||||
bool followGraphEnd;
|
||||
|
||||
Reference in New Issue
Block a user