minor changes and fixes

This commit is contained in:
canpadawan
2016-06-29 12:02:16 +02:00
parent a9fa6dcd90
commit d4b6575f5d
5 changed files with 42 additions and 58 deletions
+4 -2
View File
@@ -54,7 +54,8 @@ SOURCES += main.cpp\
connections/canconnection.cpp \ connections/canconnection.cpp \
connections/socketcan.cpp \ connections/socketcan.cpp \
connections/canconfactory.cpp \ connections/canconfactory.cpp \
connections/gvretserial.cpp connections/gvretserial.cpp \
connections/canconmanager.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
can_structs.h \ can_structs.h \
@@ -97,7 +98,8 @@ HEADERS += mainwindow.h \
connections/socketcan.h \ connections/socketcan.h \
connections/canconconst.h \ connections/canconconst.h \
connections/canconfactory.h \ connections/canconfactory.h \
connections/gvretserial.h connections/gvretserial.h \
connections/canconmanager.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
graphingwindow.ui \ graphingwindow.ui \
+1 -1
View File
@@ -10,7 +10,7 @@ public:
void setFilter(uint32_t id, uint32_t mask, int bus); void setFilter(uint32_t id, uint32_t mask, int bus);
bool checkFilter(uint32_t id, int bus); bool checkFilter(uint32_t id, int bus);
private: public:
uint32_t ID; uint32_t ID;
uint32_t mask; uint32_t mask;
int bus; int bus;
+2 -2
View File
@@ -74,7 +74,7 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="gbType">
<property name="title"> <property name="title">
<string>Connection Type</string> <string>Connection Type</string>
</property> </property>
@@ -116,7 +116,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="lPort">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
+15 -36
View File
@@ -4,7 +4,7 @@
#include <QDateTime> #include <QDateTime>
#include <QFileDialog> #include <QFileDialog>
#include <QtSerialPort/QSerialPortInfo> #include <QtSerialPort/QSerialPortInfo>
#include "canframemodel.h" #include "connections/canconmanager.h"
#include "utility.h" #include "utility.h"
#include "serialworker.h" #include "serialworker.h"
@@ -62,28 +62,6 @@ MainWindow::MainWindow(QWidget *parent) :
ui->canFramesView->setColumnWidth(6, 275); ui->canFramesView->setColumnWidth(6, 275);
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader(); QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
//enabling the below line kills performance in every way imaginable. Left here as a warning. Do not do this.
//ui->canFramesView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
/*
worker = new SerialWorker(model);
worker->moveToThread(&serialWorkerThread);
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(&serialWorkerThread, &QThread::started, worker, &SerialWorker::run); //setup timers within the proper thread
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
connect(worker, &SerialWorker::frameUpdateRapid, this, &MainWindow::gotFrames, Qt::QueuedConnection);
connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection);
connect(this, &MainWindow::sendCANFrame, worker, &SerialWorker::sendFrame, Qt::QueuedConnection);
connect(worker, &SerialWorker::connectionSuccess, this, &MainWindow::connectionSucceeded, Qt::QueuedConnection);
connect(worker, &SerialWorker::connectionFailure, this, &MainWindow::connectionFailed, Qt::QueuedConnection);
connect(worker, &SerialWorker::deviceInfo, this, &MainWindow::gotDeviceInfo, Qt::QueuedConnection);
connect(this, &MainWindow::closeSerialPort, worker, &SerialWorker::closeSerialPort, Qt::QueuedConnection);
connect(this, &MainWindow::startFrameCapturing, worker, &SerialWorker::startFrameCapture);
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
connect(this, &MainWindow::settingsUpdated, worker, &SerialWorker::readSettings);
serialWorkerThread.start();
serialWorkerThread.setPriority(QThread::HighPriority);
*/
graphingWindow = NULL; graphingWindow = NULL;
frameInfoWindow = NULL; frameInfoWindow = NULL;
@@ -146,6 +124,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionUDS_Scanner, &QAction::triggered, this, &MainWindow::showUDSScanWindow); connect(ui->actionUDS_Scanner, &QAction::triggered, this, &MainWindow::showUDSScanWindow);
connect(ui->actionISO_TP_Decoder, &QAction::triggered, this, &MainWindow::showISOInterpreterWindow); connect(ui->actionISO_TP_Decoder, &QAction::triggered, this, &MainWindow::showISOInterpreterWindow);
connect(CANConManager::getInstance(), &CANConManager::framesReceived, model, &CANFrameModel::addFrames);
lbStatusConnected.setText(tr("Not connected")); lbStatusConnected.setText(tr("Not connected"));
updateFileStatus(); updateFileStatus();
lbStatusDatabase.setText(tr("No DBC database loaded")); lbStatusDatabase.setText(tr("No DBC database loaded"));
@@ -179,8 +159,7 @@ MainWindow::MainWindow(QWidget *parent) :
model->clearFrames(); model->clearFrames();
//Automatically create the connection window so it can be updated even if we never opened it. //Automatically create the connection window so it can be updated even if we never opened it.
connectionWindow = new ConnectionWindow(model); connectionWindow = new ConnectionWindow();
connect(connectionWindow, SIGNAL(updateConnectionSettings(QString,QString,int,int)), this, SLOT(updateConnectionSettings(QString,QString,int,int)));
connect(this, SIGNAL(suspendCapturing(bool)), connectionWindow, SLOT(setSuspendAll(bool))); connect(this, SIGNAL(suspendCapturing(bool)), connectionWindow, SLOT(setSuspendAll(bool)));
} }
@@ -480,19 +459,20 @@ void MainWindow::filterClearAll()
void MainWindow::tickGUIUpdate() void MainWindow::tickGUIUpdate()
{ {
rxFrames = model->sendBulkRefresh();
if(rxFrames>0)
{
int elapsed = elapsedTime->elapsed(); int elapsed = elapsedTime->elapsed();
if(elapsed) { if(elapsed) {
framesPerSec += rxFrames * 1000 / elapsed - (framesPerSec / 4); framesPerSec = rxFrames * 1000 / elapsed;
elapsedTime->restart(); elapsedTime->restart();
} }
else else
framesPerSec = 0; framesPerSec = 0;
model->sendBulkRefresh(rxFrames);
ui->lbNumFrames->setText(QString::number(model->rowCount())); ui->lbNumFrames->setText(QString::number(model->rowCount()));
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom(); if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
ui->lbFPS->setText(QString::number(framesPerSec / 4)); ui->lbFPS->setText(QString::number(framesPerSec));
if (rxFrames > 0) if (rxFrames > 0)
{ {
bDirty = true; bDirty = true;
@@ -502,6 +482,7 @@ void MainWindow::tickGUIUpdate()
if (model->needsFilterRefresh()) updateFilterList(); if (model->needsFilterRefresh()) updateFilterList();
rxFrames = 0; rxFrames = 0;
}
} }
void MainWindow::gotFrames(int framesSinceLastUpdate) void MainWindow::gotFrames(int framesSinceLastUpdate)
@@ -867,7 +848,7 @@ void MainWindow::showFrameSenderWindow()
else else
frameSenderWindow = new FrameSenderWindow(model->getFilteredListReference()); frameSenderWindow = new FrameSenderWindow(model->getFilteredListReference());
connect(frameSenderWindow, &FrameSenderWindow::sendCANFrame, connectionWindow, &ConnectionWindow::sendFrame); //connect(frameSenderWindow, &FrameSenderWindow::sendCANFrame, connectionWindow, &ConnectionWindow::sendFrame);
} }
frameSenderWindow->show(); frameSenderWindow->show();
} }
@@ -881,8 +862,8 @@ void MainWindow::showPlaybackWindow()
else else
playbackWindow = new FramePlaybackWindow(model->getFilteredListReference()); playbackWindow = new FramePlaybackWindow(model->getFilteredListReference());
connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)), Qt::QueuedConnection); //connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)), Qt::QueuedConnection);
connect(playbackWindow, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), connectionWindow, SLOT(sendFrameBatch(const QList<CANFrame>*)), Qt::QueuedConnection); //connect(playbackWindow, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), connectionWindow, SLOT(sendFrameBatch(const QList<CANFrame>*)), Qt::QueuedConnection);
} }
playbackWindow->show(); playbackWindow->show();
} }
@@ -892,7 +873,7 @@ void MainWindow::showFirmwareUploaderWindow()
if (!firmwareUploaderWindow) if (!firmwareUploaderWindow)
{ {
firmwareUploaderWindow = new FirmwareUploaderWindow(model->getListReference()); firmwareUploaderWindow = new FirmwareUploaderWindow(model->getListReference());
connect(firmwareUploaderWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*))); //connect(firmwareUploaderWindow, SIGNAL(sendCANFrame(const CANFrame*)), connectionWindow, SLOT(sendFrame(const CANFrame*)));
//connect(worker, SIGNAL(gotTargettedFrame(int)), firmwareUploaderWindow, SLOT(gotTargettedFrame(int))); //connect(worker, SIGNAL(gotTargettedFrame(int)), firmwareUploaderWindow, SLOT(gotTargettedFrame(int)));
} }
firmwareUploaderWindow->show(); firmwareUploaderWindow->show();
@@ -942,7 +923,6 @@ void MainWindow::showScriptingWindow()
if (!scriptingWindow) if (!scriptingWindow)
{ {
scriptingWindow = new ScriptingWindow(model->getListReference()); scriptingWindow = new ScriptingWindow(model->getListReference());
connect(scriptingWindow, &ScriptingWindow::sendCANFrame, connectionWindow, &ConnectionWindow::sendFrame);
} }
scriptingWindow->show(); scriptingWindow->show();
} }
@@ -995,8 +975,7 @@ void MainWindow::showConnectionSettingsWindow()
{ {
if (!connectionWindow) if (!connectionWindow)
{ {
connectionWindow = new ConnectionWindow(model); connectionWindow = new ConnectionWindow();
connect(connectionWindow, SIGNAL(updateConnectionSettings(QString,QString,int,int)), this, SLOT(updateConnectionSettings(QString,QString,int,int)));
} }
connectionWindow->show(); connectionWindow->show();
} }
+4 -1
View File
@@ -103,6 +103,9 @@
<property name="text"> <property name="text">
<string>Suspend Capturing</string> <string>Suspend Capturing</string>
</property> </property>
<property name="checkable">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@@ -197,7 +200,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>27</height> <height>19</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_RE_Tools"> <widget class="QMenu" name="menu_RE_Tools">