Updated version number, made it possible to quickly set and unset all filters on main form, added setting to cause sub-forms to use filtered frames instead of all frames

This commit is contained in:
Collin Kidder
2015-07-12 11:52:02 -04:00
parent 2dbaa6f5b9
commit 54bd2ee587
8 changed files with 100 additions and 11 deletions
+11
View File
@@ -96,6 +96,16 @@ void CANFrameModel::setFilterState(int ID, bool state)
sendRefresh(); sendRefresh();
} }
void CANFrameModel::setAllFilters(bool state)
{
QMap<int, bool>::iterator it;
for (it = filters.begin(); it != filters.end(); ++it)
{
it.value() = state;
}
sendRefresh();
}
void CANFrameModel::recalcOverwrite() void CANFrameModel::recalcOverwrite()
{ {
if (!overwriteDups) return; //no need to do a thing if mode is disabled if (!overwriteDups) return; //no need to do a thing if mode is disabled
@@ -301,6 +311,7 @@ void CANFrameModel::addFrame(CANFrame &frame, bool autoRefresh = false)
void CANFrameModel::sendRefresh() void CANFrameModel::sendRefresh()
{ {
qDebug() << "Sending mass refresh";
beginResetModel(); beginResetModel();
filteredFrames.clear(); filteredFrames.clear();
for (int i = 0; i < frames.count(); i++) for (int i = 0; i < frames.count(); i++)
+1
View File
@@ -33,6 +33,7 @@ public:
void setOverwriteMode(bool); void setOverwriteMode(bool);
void setHexMode(bool); void setHexMode(bool);
void setFilterState(int ID, bool state); void setFilterState(int ID, bool state);
void setAllFilters(bool state);
void setSecondsMode(bool); void setSecondsMode(bool);
void loadFilterFile(QString filename); void loadFilterFile(QString filename);
void saveFilterFile(QString filename); void saveFilterFile(QString filename);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef CONFIG #ifndef CONFIG
#define CONFIG #define CONFIG
#define VERSION 121 #define VERSION 122
//try to keep this in sync. //try to keep this in sync.
//SavvyCAN will complain if you connect a GVRET board with a revision //SavvyCAN will complain if you connect a GVRET board with a revision
+3
View File
@@ -28,6 +28,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
ui->spinPlaybackSpeed->setValue(settings->value("Playback/DefSpeed", 5).toInt()); ui->spinPlaybackSpeed->setValue(settings->value("Playback/DefSpeed", 5).toInt());
ui->cbTimeSeconds->setChecked(settings->value("Main/TimeSeconds", false).toBool()); ui->cbTimeSeconds->setChecked(settings->value("Main/TimeSeconds", false).toBool());
ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt()); ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt());
ui->cbUseFiltered->setChecked(settings->value("Main/UseFiltered", false).toBool());
//just for simplicity they all call the same function and that function updates all settings at once //just for simplicity they all call the same function and that function updates all settings at once
connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings())); connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
@@ -41,6 +42,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
connect(ui->spinPlaybackSpeed, SIGNAL(valueChanged(int)), this, SLOT(updateSettings())); connect(ui->spinPlaybackSpeed, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
connect(ui->cbTimeSeconds, SIGNAL(toggled(bool)), this, SLOT(updateSettings())); connect(ui->cbTimeSeconds, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
connect(ui->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings())); connect(ui->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings()));
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
} }
MainSettingsDialog::~MainSettingsDialog() MainSettingsDialog::~MainSettingsDialog()
@@ -67,6 +69,7 @@ void MainSettingsDialog::updateSettings()
settings->setValue("Playback/DefSpeed", ui->spinPlaybackSpeed->value()); settings->setValue("Playback/DefSpeed", ui->spinPlaybackSpeed->value());
settings->setValue("Main/TimeSeconds", ui->cbTimeSeconds->isChecked()); settings->setValue("Main/TimeSeconds", ui->cbTimeSeconds->isChecked());
settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex()); settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
settings->setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
settings->sync(); settings->sync();
} }
+7
View File
@@ -48,6 +48,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="cbUseFiltered">
<property name="text">
<string>Use filtered frames in sub-windows</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
+53 -8
View File
@@ -115,6 +115,7 @@ MainWindow::MainWindow(QWidget *parent) :
settingsDialog = NULL; settingsDialog = NULL;
dbcHandler = new DBCHandler; dbcHandler = new DBCHandler;
bDirty = false; bDirty = false;
inhibitFilterUpdate = false;
model->setDBCHandler(dbcHandler); model->setDBCHandler(dbcHandler);
@@ -148,6 +149,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionPreferences, SIGNAL(triggered(bool)), this, SLOT(showSettingsDialog())); connect(ui->actionPreferences, SIGNAL(triggered(bool)), this, SLOT(showSettingsDialog()));
connect(model, SIGNAL(updatedFiltersList()), this, SLOT(updateFilterList())); connect(model, SIGNAL(updatedFiltersList()), this, SLOT(updateFilterList()));
connect(ui->listFilters, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(filterListItemChanged(QListWidgetItem*))); connect(ui->listFilters, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(filterListItemChanged(QListWidgetItem*)));
connect(ui->btnFilterAll, SIGNAL(clicked(bool)), this, SLOT(filterSetAll()));
connect(ui->btnFilterNone, SIGNAL(clicked(bool)), this, SLOT(filterClearAll()));
lbStatusConnected.setText(tr("Not connected")); lbStatusConnected.setText(tr("Not connected"));
updateFileStatus(); updateFileStatus();
@@ -249,7 +252,7 @@ void MainWindow::readSettings()
QSettings settings; QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool()) if (settings.value("Main/SaveRestorePositions", false).toBool())
{ {
resize(settings.value("Main/WindowSize", QSize(800, 572)).toSize()); resize(settings.value("Main/WindowSize", QSize(800, 682)).toSize());
move(settings.value("Main/WindowPos", QPoint(100, 100)).toPoint()); move(settings.value("Main/WindowPos", QPoint(100, 100)).toPoint());
} }
if (settings.value("Main/AutoScroll", false).toBool()) if (settings.value("Main/AutoScroll", false).toBool())
@@ -265,6 +268,7 @@ void MainWindow::readUpdateableSettings()
useHex = settings.value("Main/UseHex", true).toBool(); useHex = settings.value("Main/UseHex", true).toBool();
model->setHexMode(useHex); model->setHexMode(useHex);
model->setSecondsMode(settings.value("Main/TimeSeconds", false).toBool()); model->setSecondsMode(settings.value("Main/TimeSeconds", false).toBool());
useFiltered = settings.value("Main/UseFiltered", false).toBool();
} }
void MainWindow::writeSettings() void MainWindow::writeSettings()
@@ -326,6 +330,7 @@ void MainWindow::updateFilterList()
void MainWindow::filterListItemChanged(QListWidgetItem *item) void MainWindow::filterListItemChanged(QListWidgetItem *item)
{ {
if (inhibitFilterUpdate) return;
//qDebug() << item->text(); //qDebug() << item->text();
int ID; int ID;
bool isSet = false; bool isSet = false;
@@ -336,6 +341,28 @@ void MainWindow::filterListItemChanged(QListWidgetItem *item)
model->setFilterState(ID, isSet); model->setFilterState(ID, isSet);
} }
void MainWindow::filterSetAll()
{
inhibitFilterUpdate = true;
for (int i = 0; i < ui->listFilters->count(); i++)
{
ui->listFilters->item(i)->setCheckState(Qt::Checked);
}
inhibitFilterUpdate = false;
model->setAllFilters(true);
}
void MainWindow::filterClearAll()
{
inhibitFilterUpdate = true;
for (int i = 0; i < ui->listFilters->count(); i++)
{
ui->listFilters->item(i)->setCheckState(Qt::Unchecked);
}
inhibitFilterUpdate = false;
model->setAllFilters(false);
}
//most of the work is handled elsewhere. Need only to update the # of frames //most of the work is handled elsewhere. Need only to update the # of frames
//and maybe auto scroll //and maybe auto scroll
void MainWindow::gotFrames(int FPS, int framesSinceLastUpdate) void MainWindow::gotFrames(int FPS, int framesSinceLastUpdate)
@@ -791,9 +818,12 @@ void MainWindow::showSettingsDialog()
settingsDialog->show(); settingsDialog->show();
} }
//always gets unfiltered list. You ask for the graphs so there is no need to send filtered frames
void MainWindow::showGraphingWindow() void MainWindow::showGraphingWindow()
{ {
if (!graphingWindow) graphingWindow = new GraphingWindow(model->getListReference()); if (!graphingWindow) {
graphingWindow = new GraphingWindow(model->getListReference());
}
graphingWindow->show(); graphingWindow->show();
} }
@@ -802,14 +832,23 @@ void MainWindow::showFrameDataAnalysis()
//only create an instance of the object if we dont have one. Otherwise just display the existing one. //only create an instance of the object if we dont have one. Otherwise just display the existing one.
if (!frameInfoWindow) if (!frameInfoWindow)
{ {
frameInfoWindow = new FrameInfoWindow(model->getListReference()); if (!useFiltered)
frameInfoWindow = new FrameInfoWindow(model->getListReference());
else
frameInfoWindow = new FrameInfoWindow(model->getFilteredListReference());
} }
frameInfoWindow->show(); frameInfoWindow->show();
} }
void MainWindow::showFrameSenderWindow() void MainWindow::showFrameSenderWindow()
{ {
if (!frameSenderWindow) frameSenderWindow = new FrameSenderWindow(model->getListReference()); if (!frameSenderWindow)
{
if (!useFiltered)
frameSenderWindow = new FrameSenderWindow(model->getListReference());
else
frameSenderWindow = new FrameSenderWindow(model->getFilteredListReference());
}
frameSenderWindow->show(); frameSenderWindow->show();
} }
@@ -817,9 +856,10 @@ void MainWindow::showPlaybackWindow()
{ {
if (!playbackWindow) if (!playbackWindow)
{ {
playbackWindow = new FramePlaybackWindow(model->getListReference(), worker); if (!useFiltered)
//connect signal to signal to pass the signal through to whoever is handling the slot playbackWindow = new FramePlaybackWindow(model->getListReference(), worker);
//connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), this, SIGNAL(sendCANFrame(const CANFrame*,int))); else
playbackWindow = new FramePlaybackWindow(model->getFilteredListReference(), worker);
} }
playbackWindow->show(); playbackWindow->show();
} }
@@ -863,11 +903,16 @@ void MainWindow::showFlowViewWindow()
{ {
if (!flowViewWindow) if (!flowViewWindow)
{ {
flowViewWindow = new FlowViewWindow(model->getListReference()); if (!useFiltered)
flowViewWindow = new FlowViewWindow(model->getListReference());
else
flowViewWindow = new FlowViewWindow(model->getFilteredListReference());
} }
flowViewWindow->show(); flowViewWindow->show();
} }
//this one always gets the unfiltered list intentionally.
void MainWindow::showDBCEditor() void MainWindow::showDBCEditor()
{ {
if (!dbcMainEditor) if (!dbcMainEditor)
+4
View File
@@ -66,6 +66,8 @@ private slots:
void normalizeTiming(); void normalizeTiming();
void updateFilterList(); void updateFilterList();
void filterListItemChanged(QListWidgetItem *item); void filterListItemChanged(QListWidgetItem *item);
void filterSetAll();
void filterClearAll();
public slots: public slots:
void gotFrames(int, int); void gotFrames(int, int);
@@ -95,9 +97,11 @@ private:
QThread serialWorkerThread; QThread serialWorkerThread;
SerialWorker *worker; SerialWorker *worker;
QByteArray inputBuffer; QByteArray inputBuffer;
bool inhibitFilterUpdate;
bool useHex; bool useHex;
bool allowCapture; bool allowCapture;
bool bDirty; //have frames been added or subtracted since the last save/load? bool bDirty; //have frames been added or subtracted since the last save/load?
bool useFiltered; //should sub-windows use the unfiltered or filtered frames list?
//References to other windows we can display //References to other windows we can display
GraphingWindow *graphingWindow; GraphingWindow *graphingWindow;
+20 -2
View File
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>572</height> <height>682</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -243,7 +243,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item alignment="Qt::AlignHCenter">
<widget class="QListWidget" name="listFilters"> <widget class="QListWidget" name="listFilters">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
@@ -265,6 +265,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="btnFilterAll">
<property name="text">
<string>All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnFilterNone">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>