Add two new buttons to expand or collapse all signals.

This commit is contained in:
Collin Kidder
2020-04-02 21:47:20 -04:00
parent 503e662feb
commit 9c143c2b12
4 changed files with 84 additions and 6 deletions
+44
View File
@@ -129,6 +129,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionSignal_Viewer, &QAction::triggered, this, &MainWindow::showSignalViewer);
connect(ui->actionSave_Continuous_Logfile, &QAction::triggered, this, &MainWindow::handleContinousLogging);
connect(ui->actionTemporal_Graph, &QAction::triggered, this, &MainWindow::showTemporalGraphWindow);
connect(ui->btnExpandAll, &QAbstractButton::clicked, this, &MainWindow::expandAllRows);
connect(ui->btnCollapseAll, &QAbstractButton::clicked, this, &MainWindow::collapseAllRows);
connect(CANConManager::getInstance(), &CANConManager::framesReceived, model, &CANFrameModel::addFrames);
@@ -382,6 +384,48 @@ void MainWindow::headerClicked(int logicalIndex)
model->sortByColumn(logicalIndex);
}
void MainWindow::expandAllRows()
{
bool goAhead = false;
int numRows = ui->canFramesView->model()->rowCount();
if (numRows > 20000)
{
QMessageBox::StandardButton confirmDialog;
confirmDialog = QMessageBox::question(this, "Really?", "It's not recommended to use this\non more than 20000 frames.\nIt can take a long time.\n\nYou have been warned!\nStill do it?",
QMessageBox::Yes|QMessageBox::No);
if (confirmDialog == QMessageBox::Yes) goAhead = true;
}
else goAhead = true;
if (goAhead)
{
ui->canFramesView->resizeRowsToContents();
}
}
void MainWindow::collapseAllRows()
{
bool goAhead = false;
int numRows = ui->canFramesView->model()->rowCount();
if (numRows > 50000)
{
QMessageBox::StandardButton confirmDialog;
confirmDialog = QMessageBox::question(this, "Really?", "It's not recommended to use this\non more than 50000 frames.\nIt can take a long time.\n\nYou have been warned!\nStill do it?",
QMessageBox::Yes|QMessageBox::No);
if (confirmDialog == QMessageBox::Yes) goAhead = true;
}
else goAhead = true;
if (goAhead)
{
for (int i = 0; i < numRows; i++) ui->canFramesView->setRowHeight(i, normalRowHeight);
}
}
void MainWindow::gridClicked(QModelIndex idx)
{
//qDebug() << "Grid Clicked";
+2
View File
@@ -63,6 +63,8 @@ private slots:
void showGraphingWindow();
void showFrameDataAnalysis();
void clearFrames();
void expandAllRows();
void collapseAllRows();
void showPlaybackWindow();
void showFlowViewWindow();
void showFrameSenderWindow();
+34 -6
View File
@@ -191,6 +191,23 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbOverwrite">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Overwrite Mode</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbInterpret">
<property name="text">
@@ -199,12 +216,23 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbOverwrite">
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QPushButton" name="btnExpandAll">
<property name="text">
<string>Overwrite Mode</string>
<string>Expand All Rows</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCollapseAll">
<property name="text">
<string>Collapse All Rows</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
@@ -265,7 +293,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu_RE_Tools">
+4
View File
@@ -194,6 +194,8 @@ public:
for (int bitpos = 0; bitpos < sigSize; bitpos++)
{
if (bit < 64) {
int bytePos = bit / 8;
if (bytePos >= data.count()) return 0; //error!
if (data[bit / 8] & (1 << (bit % 8)))
result += (1ULL << bitpos);
}
@@ -206,6 +208,8 @@ public:
for (int bitpos = 0; bitpos < sigSize; bitpos++)
{
if (bit < 64) {
int bytePos = bit / 8;
if (bytePos >= data.count()) return 0; //error!
if (data[bit / 8] & (1 << (bit % 8)))
result += (1ULL << (sigSize - bitpos - 1));
}