diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 6c9d719..2c52284 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -104,6 +104,15 @@ FlowViewWindow::FlowViewWindow(const QVector *frames, QWidget *parent) connect(ui->txtTrigger5, SIGNAL(textEdited(QString)), this, SLOT(updateTriggerValues())); connect(ui->txtTrigger6, SIGNAL(textEdited(QString)), this, SLOT(updateTriggerValues())); connect(ui->txtTrigger7, SIGNAL(textEdited(QString)), this, SLOT(updateTriggerValues())); + connect(ui->graphRangeSlider, &QSlider::valueChanged, this, &FlowViewWindow::graphRangeChanged); + connect(ui->check_0, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_1, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_2, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_3, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_4, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_5, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_6, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); + connect(ui->check_7, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); // Using lambda expression to strip away the possible filter label before passing the ID to updateDetailsWindow connect(ui->listFrameID, &QListWidget::currentTextChanged, @@ -234,6 +243,21 @@ bool FlowViewWindow::eventFilter(QObject *obj, QEvent *event) } } +void FlowViewWindow::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); + } + } + + ui->graphView->replot(); + } +} void FlowViewWindow::gotCellClick(int x, int y) { int bitnum = (7-x) + (8 * y); @@ -243,6 +267,11 @@ void FlowViewWindow::gotCellClick(int x, int y) qDebug() << "Bit Num: " << bitnum << " Hex of trigger bits: " << QString::number(triggerBits, 16); } +void FlowViewWindow::graphRangeChanged(int range) { + ui->rangeValue->setText(QString::number(range)); + updateGraphLocation(); +} + void FlowViewWindow::updateTriggerValues() { triggerValues[0] = Utility::ParseStringToNum(ui->txtTrigger0->text()); @@ -623,6 +652,14 @@ void FlowViewWindow::changeID(QString newID) memcpy(refBytes, currBytes, 8); updateDataView(); + 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); } void FlowViewWindow::btnBackOneClick() @@ -800,9 +837,9 @@ void FlowViewWindow::updatePosition(bool forward) void FlowViewWindow::updateGraphLocation() { if (frameCache.count() == 0) return; - int start = currentPosition - 5; + int start = currentPosition - ui->graphRangeSlider->value(); if (start < 0) start = 0; - int end = currentPosition + 5; + int end = currentPosition + ui->graphRangeSlider->value(); if (end >= frameCache.count()) end = frameCache.count() - 1; if (ui->cbTimeGraph->isChecked()) { diff --git a/re/flowviewwindow.h b/re/flowviewwindow.h index 826912e..d2b0a16 100644 --- a/re/flowviewwindow.h +++ b/re/flowviewwindow.h @@ -2,6 +2,7 @@ #define FLOWVIEWWINDOW_H #include +#include #include "qcustomplot.h" #include "can_structs.h" @@ -38,6 +39,8 @@ private slots: void gotCenterTimeID(int32_t ID, double timestamp); void updateTriggerValues(); void gotCellClick(int x, int y); + void graphRangeChanged(int range); + void changeGraphVisibility(int state); signals: void sendCenterTimeID(uint32_t ID, double timestamp); diff --git a/ui/flowviewwindow.ui b/ui/flowviewwindow.ui index b9034ba..9e54b26 100644 --- a/ui/flowviewwindow.ui +++ b/ui/flowviewwindow.ui @@ -1030,26 +1030,19 @@ - - - - Data Byte Colors: - - - - + - 0 - 0 - 255 + 52 + 101 + 164 @@ -1058,9 +1051,9 @@ - 0 - 0 - 255 + 52 + 101 + 164 @@ -1078,27 +1071,30 @@ + + + 13 + 75 + true + + - 0 = Blue + 0 + + + true - - - - 2 = Black - - - - - + + - 255 + 0 0 0 @@ -1109,7 +1105,7 @@ - 255 + 0 0 0 @@ -1129,65 +1125,85 @@ - - 3 = Red - - - - - - - - - - - - 133 - 133 - 199 - - - - - - - - - 133 - 133 - 199 - - - - - - - - - 120 - 120 - 120 - - - - - + + + 13 + 75 + true + - 4 = Gray + 2 + + + true - + - 0 - 170 + 78 + 154 + 6 + + + + + + + + + 78 + 154 + 6 + + + + + + + + + 120 + 120 + 120 + + + + + + + + + 13 + 75 + true + + + + 1 + + + true + + + + + + + + + + + + 204 + 0 0 @@ -1197,8 +1213,8 @@ - 0 - 170 + 204 + 0 0 @@ -1217,22 +1233,140 @@ + + + 13 + 75 + true + + - 1 = Green + 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 - + - 203 - 203 - 0 + 114 + 159 + 207 @@ -1241,9 +1375,9 @@ - 203 - 203 - 0 + 114 + 159 + 207 @@ -1261,22 +1395,32 @@ + + + 13 + 75 + true + + - 5 = Yellow + 6 + + + true - - + + - 68 - 204 - 204 + 173 + 127 + 168 @@ -1285,9 +1429,9 @@ - 68 - 204 - 204 + 173 + 127 + 168 @@ -1305,52 +1449,18 @@ - - 6 = Cyan - - - - - - - - - - - - 180 - 0 - 180 - - - - - - - - - 180 - 0 - 180 - - - - - - - - - 120 - 120 - 120 - - - - - + + + 13 + 75 + true + - 7 = Dk Magenta + 7 + + + true @@ -1368,6 +1478,81 @@ + + + + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + Chart range + + + + + + + + 0 + 0 + + + + + 75 + true + + + + 50 + + + + + + + + + + + 0 + 0 + + + + 1 + + + 500 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 10 + + +