diff --git a/re/frameinfowindow.cpp b/re/frameinfowindow.cpp index 3701210..1a10fb6 100644 --- a/re/frameinfowindow.cpp +++ b/re/frameinfowindow.cpp @@ -34,15 +34,15 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren connect(MainWindow::getReference(), &MainWindow::framesUpdated, this, &FrameInfoWindow::updatedFrames); connect(ui->btnSave, &QAbstractButton::clicked, this, &FrameInfoWindow::saveDetails); - connect(ui->check_0, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_1, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_2, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_3, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_4, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_5, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_6, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); - connect(ui->check_7, &QCheckBox::stateChanged, this, &FrameInfoWindow::changeGraphVisibility); + ui->splitter->setStretchFactor(0, 1); //idx, stretch factor + ui->splitter->setStretchFactor(1, 4); //goal is to make right hand side larger by default + for (int i = 0; i < 8; i++) + { + graphByte[i] = new QCustomPlot(); + setupByteGraph(graphByte[i], i); + ui->gridLayout->addWidget(graphByte[i], i / 4, i & 3); + } ui->graphHistogram->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables); @@ -63,25 +63,6 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren ui->graphHistogram->legend->setVisible(false); - ui->graphBytes->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | - QCP::iSelectLegend | QCP::iSelectPlottables); - - ui->graphBytes->xAxis->setRange(0, 63); - ui->graphBytes->yAxis->setRange(0, 265); - if (useHexTicker) - { - QSharedPointer hexTicker(new QCPAxisTickerHex); - ui->graphBytes->yAxis->setTicker(hexTicker); - } - ui->graphBytes->axisRect()->setupFullAxesBox(); - - ui->graphBytes->xAxis->setLabel("Time"); - if (useHexTicker) ui->graphBytes->yAxis->setLabel("Value (HEX)"); - else ui->graphBytes->yAxis->setLabel("Value (Dec)"); - - ui->graphBytes->legend->setVisible(false); - ui->graphBytes->setBufferDevicePixelRatio(1); - ui->timeHistogram->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables); @@ -105,8 +86,6 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren { ui->graphHistogram->setAntialiasedElements(QCP::aeAll); ui->graphHistogram->setOpenGl(true); - ui->graphBytes->setAntialiasedElements(QCP::aeAll); - ui->graphBytes->setOpenGl(true); ui->timeHistogram->setAntialiasedElements(QCP::aeAll); ui->timeHistogram->setOpenGl(true); } @@ -114,8 +93,6 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren { ui->graphHistogram->setOpenGl(false); ui->graphHistogram->setAntialiasedElements(QCP::aeNone); - ui->graphBytes->setOpenGl(false); - ui->graphBytes->setAntialiasedElements(QCP::aeNone); ui->timeHistogram->setOpenGl(false); ui->timeHistogram->setAntialiasedElements(QCP::aeNone); } @@ -134,6 +111,40 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren dbcHandler = DBCHandler::getReference(); } +void FrameInfoWindow::setupByteGraph(QCustomPlot *plot, int num) +{ + plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | + QCP::iSelectLegend | QCP::iSelectPlottables); + + plot->xAxis->setRange(0, 63); + plot->yAxis->setRange(0, 265); + if (useHexTicker) + { + QSharedPointer hexTicker(new QCPAxisTickerHex); + plot->yAxis->setTicker(hexTicker); + } + plot->axisRect()->setupFullAxesBox(); + + plot->xAxis->setLabel("Time [" + QString::number(num) + "]"); + //if (useHexTicker) plot->yAxis->setLabel("Value (HEX)"); + //else plot->yAxis->setLabel("Value (Dec)"); + plot->yAxis->setLabel(""); + + plot->legend->setVisible(false); + plot->setBufferDevicePixelRatio(1); + + if (useOpenGL) + { + plot->setAntialiasedElements(QCP::aeAll); + plot->setOpenGl(true); + } + else + { + plot->setOpenGl(false); + plot->setAntialiasedElements(QCP::aeNone); + } +} + void FrameInfoWindow::showEvent(QShowEvent* event) { QDialog::showEvent(event); @@ -270,7 +281,7 @@ void FrameInfoWindow::updatedFrames(int numFrames) } //default is to sort in ascending order ui->listFrameID->sortItems(); - ui->lblFrameID->setText(tr("Frame IDs: (") + QString::number(ui->listFrameID->count()) + tr(" unique ids)")); + ui->lblUniqueID->setText(")" + QString::number(ui->listFrameID->count()) + tr(" unique ids)")); } } @@ -684,15 +695,15 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) ui->graphHistogram->axisRect()->setupFullAxesBox(); ui->graphHistogram->replot(); - ui->graphBytes->clearGraphs(); for (int graphs = 0; graphs < 8; graphs++) { - graphRef[graphs] = ui->graphBytes->addGraph(); - ui->graphBytes->graph()->setData(byteGraphX, byteGraphY[graphs]); - ui->graphBytes->graph()->setPen(bytePens[graphs]); + graphByte[graphs]->clearGraphs(); + graphRef[graphs] = graphByte[graphs]->addGraph(); + graphByte[graphs]->graph()->setData(byteGraphX, byteGraphY[graphs]); + graphByte[graphs]->graph()->setPen(bytePens[graphs]); + graphByte[graphs]->xAxis->setRange(0, byteGraphX.count()); + graphByte[graphs]->replot(); } - ui->graphBytes->xAxis->setRange(0, byteGraphX.count()); - ui->graphBytes->replot(); ui->timeHistogram->clearGraphs(); ui->timeHistogram->addGraph(); @@ -708,15 +719,6 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) ui->timeHistogram->axisRect()->setupFullAxesBox(); ui->timeHistogram->rescaleAxes(); ui->timeHistogram->replot(); - - ui->check_0->setChecked(true); - ui->check_1->setChecked(true); - ui->check_2->setChecked(true); - ui->check_3->setChecked(true); - ui->check_4->setChecked(true); - ui->check_5->setChecked(true); - ui->check_6->setChecked(true); - ui->check_7->setChecked(true); } else { @@ -744,7 +746,7 @@ void FrameInfoWindow::refreshIDList() } //default is to sort in ascending order ui->listFrameID->sortItems(); - ui->lblFrameID->setText(tr("Frame IDs: (") + QString::number(ui->listFrameID->count()) + tr(" unique ids)")); + ui->lblUniqueID->setText("(" + QString::number(ui->listFrameID->count()) + tr(" unique ids)")); } void FrameInfoWindow::saveDetails() @@ -791,24 +793,6 @@ void FrameInfoWindow::saveDetails() } } -void FrameInfoWindow::changeGraphVisibility(int state){ - QCheckBox *sender = qobject_cast(QObject::sender()); - if(sender){ - sender->objectName(); - int graphId = sender->objectName().right(1).toInt(); - for (int k = 0; k < 8; k++) - { - if (k == graphId && graphRef[k] && graphRef[k]->data()){ - graphRef[k]->setVisible(state); - qDebug() << graphId << state << k; - } - } - qDebug() << graphId << state; - - ui->graphBytes->replot(); - } -} - void FrameInfoWindow::dumpNode(QTreeWidgetItem* item, QFile *file, int indent) { for (int i = 0; i < indent; i++) file->write("\t"); diff --git a/re/frameinfowindow.h b/re/frameinfowindow.h index 5196d93..8d3998c 100644 --- a/re/frameinfowindow.h +++ b/re/frameinfowindow.h @@ -28,10 +28,10 @@ private slots: void updateDetailsWindow(QString); void updatedFrames(int); void saveDetails(); - void changeGraphVisibility(int state); private: Ui::FrameInfoWindow *ui; + QCustomPlot *graphByte[8]; QList foundID; QList frameCache; @@ -47,6 +47,7 @@ private: void refreshIDList(); void closeEvent(QCloseEvent *event); bool eventFilter(QObject *obj, QEvent *event); + void setupByteGraph(QCustomPlot *plot, int num); void readSettings(); void writeSettings(); void dumpNode(QTreeWidgetItem* item, QFile *file, int indent); diff --git a/ui/frameinfowindow.ui b/ui/frameinfowindow.ui index 406b02a..579a709 100644 --- a/ui/frameinfowindow.ui +++ b/ui/frameinfowindow.ui @@ -6,567 +6,151 @@ 0 0 - 794 - 494 + 1142 + 651 Detailed Frame Information - + - - - + + + Qt::Horizontal + + + 8 + + + - + - - - Frame IDs: - - + + + + + Frame IDs: + + + + + + + Unique IDs + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + + - - - - 0 - 0 - - - - - 120 - 0 - - - - - - - - - - - - Details: - - - - - - - - 1 - - - - - - - - Save details to file - - - - - - - Interval Histogram - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - + + + + + Details: + + + + + + + Qt::ScrollBarAlwaysOn + + + + 1 + + + + + + + + Save details to file + + + + + + + Interval Histogram + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + - - - - - - - - - Bit Histograph - - - Qt::AlignCenter - - - - - - - - - - Bytes Graph - - - Qt::AlignCenter - - - - - - - - + + + - - - - - - - - 52 - 101 - 164 - - - - - - - - - 52 - 101 - 164 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - + - 0 + Bit Histograph - - true + + Qt::AlignCenter - - - - - - - - 78 - 154 - 6 - - - - - - - - - 78 - 154 - 6 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - + + + + - 1 + Bytes Graph - - true + + Qt::AlignCenter - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 2 - - - true - - - - - - - - - - - - 204 - 0 - 0 - - - - - - - - - 204 - 0 - 0 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 3 - - - true - - - - - - - - - - - - 136 - 138 - 133 - - - - - - - - - 136 - 138 - 133 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 4 - - - true - - - - - - - - - - - - 252 - 233 - 79 - - - - - - - - - 252 - 233 - 79 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 5 - - - true - - - - - - - - - - - - 114 - 159 - 207 - - - - - - - - - 114 - 159 - 207 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 6 - - - true - - - - - - - - - - - - 173 - 127 - 168 - - - - - - - - - 173 - 127 - 168 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - 13 - 75 - true - - - - 7 - - - true - - + - - + +