Fix bugs in bisector window, add bus number as a bisecting option,
allow upper/lower radio buttons to switch text for more clarify as to what they do.
This commit is contained in:
+58
-3
@@ -25,7 +25,14 @@ BisectWindow::BisectWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
|||||||
connect(ui->slidePercentage, &QSlider::sliderReleased, this, &BisectWindow::updatePercentText);
|
connect(ui->slidePercentage, &QSlider::sliderReleased, this, &BisectWindow::updatePercentText);
|
||||||
connect(ui->editFrameNumber, &QLineEdit::editingFinished, this, &BisectWindow::updateFrameNumSlider);
|
connect(ui->editFrameNumber, &QLineEdit::editingFinished, this, &BisectWindow::updateFrameNumSlider);
|
||||||
connect(ui->editPercentage, &QLineEdit::editingFinished, this, &BisectWindow::updatePercentSlider);
|
connect(ui->editPercentage, &QLineEdit::editingFinished, this, &BisectWindow::updatePercentSlider);
|
||||||
|
connect(ui->rbFrameNumber, &QRadioButton::toggled, this, &BisectWindow::updateSectionsText);
|
||||||
|
connect(ui->rbPercentage, &QRadioButton::toggled, this, &BisectWindow::updateSectionsText);
|
||||||
|
connect(ui->rbBusNum, &QRadioButton::toggled, this, &BisectWindow::updateSectionsText);
|
||||||
|
connect(ui->rbIDRange, &QRadioButton::toggled, this, &BisectWindow::updateSectionsText);
|
||||||
|
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
|
|
||||||
|
updateSectionsText();
|
||||||
}
|
}
|
||||||
|
|
||||||
BisectWindow::~BisectWindow()
|
BisectWindow::~BisectWindow()
|
||||||
@@ -61,6 +68,31 @@ bool BisectWindow::eventFilter(QObject *obj, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BisectWindow::updateSectionsText()
|
||||||
|
{
|
||||||
|
if (ui->rbBusNum->isChecked())
|
||||||
|
{
|
||||||
|
ui->rbLowerSection->setText("Only this bus");
|
||||||
|
ui->rbUpperSection->setText("Not this bus");
|
||||||
|
}
|
||||||
|
if (ui->rbFrameNumber->isChecked())
|
||||||
|
{
|
||||||
|
ui->rbLowerSection->setText("Up to this frame number");
|
||||||
|
ui->rbUpperSection->setText("After this frame number");
|
||||||
|
}
|
||||||
|
if (ui->rbIDRange->isChecked())
|
||||||
|
{
|
||||||
|
ui->rbLowerSection->setText("Inside the ID range");
|
||||||
|
ui->rbUpperSection->setText("Outside the ID range");
|
||||||
|
}
|
||||||
|
if (ui->rbPercentage->isChecked())
|
||||||
|
{
|
||||||
|
ui->rbLowerSection->setText("Up to this percentage into the file");
|
||||||
|
ui->rbUpperSection->setText("After this percentage into the file");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void BisectWindow::refreshIDList()
|
void BisectWindow::refreshIDList()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
@@ -112,11 +144,12 @@ void BisectWindow::handleCalculateButton()
|
|||||||
{
|
{
|
||||||
splitFrames.clear();
|
splitFrames.clear();
|
||||||
bool saveLower = ui->rbLowerSection->isChecked();
|
bool saveLower = ui->rbLowerSection->isChecked();
|
||||||
int targetFrameNum;
|
int targetFrameNum = 0;
|
||||||
if (ui->rbFrameNumber->isChecked() || ui->rbPercentage->isChecked())
|
if (ui->rbFrameNumber->isChecked() || ui->rbPercentage->isChecked())
|
||||||
{
|
{
|
||||||
if (ui->rbFrameNumber->isChecked()) targetFrameNum = ui->slideFrameNumber->value();
|
if (ui->rbFrameNumber->isChecked()) targetFrameNum = ui->slideFrameNumber->value();
|
||||||
else targetFrameNum = modelFrames->count() * ui->slidePercentage->value() / 10000;
|
else targetFrameNum = modelFrames->count() * (ui->slidePercentage->value() / 10000.0);
|
||||||
|
qDebug() << "Target frame num " << targetFrameNum;
|
||||||
if (saveLower)
|
if (saveLower)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targetFrameNum; i++) splitFrames.append(modelFrames->at(i));
|
for (int i = 0; i < targetFrameNum; i++) splitFrames.append(modelFrames->at(i));
|
||||||
@@ -132,7 +165,29 @@ void BisectWindow::handleCalculateButton()
|
|||||||
uint32_t upperID = Utility::ParseStringToNum2(ui->cbIDUpper->currentText());
|
uint32_t upperID = Utility::ParseStringToNum2(ui->cbIDUpper->currentText());
|
||||||
for (int i = 0; i < modelFrames->count(); i++)
|
for (int i = 0; i < modelFrames->count(); i++)
|
||||||
{
|
{
|
||||||
if (modelFrames->at(i).frameId() >= lowerID && modelFrames->at(i).frameId() <= upperID) splitFrames.append(modelFrames->at(i));
|
if (modelFrames->at(i).frameId() >= lowerID && modelFrames->at(i).frameId() <= upperID)
|
||||||
|
{
|
||||||
|
if (saveLower) splitFrames.append(modelFrames->at(i));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!saveLower) splitFrames.append(modelFrames->at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ui->rbBusNum->isChecked())
|
||||||
|
{
|
||||||
|
int targetBus = Utility::ParseStringToNum(ui->editBusNum->text());
|
||||||
|
for (int i = 0; i < modelFrames->count(); i++)
|
||||||
|
{
|
||||||
|
if (modelFrames->at(i).bus == targetBus)
|
||||||
|
{
|
||||||
|
if (saveLower) splitFrames.append(modelFrames->at(i));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!saveLower) splitFrames.append(modelFrames->at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refreshFrameNumbers();
|
refreshFrameNumbers();
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ private slots:
|
|||||||
void updatePercentSlider();
|
void updatePercentSlider();
|
||||||
void updateFrameNumText();
|
void updateFrameNumText();
|
||||||
void updatePercentText();
|
void updatePercentText();
|
||||||
|
void updateSectionsText();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BisectWindow *ui;
|
Ui::BisectWindow *ui;
|
||||||
|
|||||||
@@ -107,6 +107,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbBusNum">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bus Number</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="editBusNum"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user