Merge pull request #135 from collin80/WIP

Merge over changes from WIP
This commit is contained in:
Collin Kidder
2018-05-17 20:42:57 -04:00
committed by GitHub
4 changed files with 30 additions and 25 deletions
+8 -6
View File
@@ -72,12 +72,6 @@ void GVRetSerial::sendToSerial(const QByteArray &bytes)
void GVRetSerial::piStarted()
{
connectDevice();
/* start timer */
connect(&mTimer, SIGNAL(timeout()), this, SLOT(handleTick()));
mTimer.setInterval(250); //tick four times per second
mTimer.setSingleShot(false); //keep ticking
mTimer.start();
}
@@ -287,12 +281,14 @@ void GVRetSerial::connectDevice()
/* open new device */
if (getPort().contains('.')) //TCP/IP mode then since it looks like an IP address
{
qDebug() << "TCP Connection to a GVRET device";
tcpClient = new QTcpSocket();
tcpClient->connectToHost(getPort(), 23);
connect(tcpClient, SIGNAL(readyRead()), this, SLOT(readSerialData()));
connect(tcpClient, SIGNAL(connected()), this, SLOT(tcpConnected()));
}
else {
qDebug() << "Serial connection to a GVRET device";
serial = new QSerialPort(QSerialPortInfo(getPort()));
if(!serial) {
qDebug() << "can't open serial port " << getPort();
@@ -362,6 +358,12 @@ void GVRetSerial::tcpConnected()
sendToSerial(output);
/* start timer */
connect(&mTimer, SIGNAL(timeout()), this, SLOT(handleTick()));
mTimer.setInterval(250); //tick four times per second
mTimer.setSingleShot(false); //keep ticking
mTimer.start();
if(doValidation) {
QTimer::singleShot(1000, this, SLOT(connectionTimeout()));
}
+2 -2
View File
@@ -325,7 +325,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
{
QList<QByteArray> tokens = line.split(' ');
int multiplier;
if (tokens.length() > 3)
if (tokens.length() > 2)
{
int idxOfDecimal = tokens[0].indexOf('.');
if (idxOfDecimal > -1) {
@@ -699,7 +699,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
if (line.length() > 2)
{
QList<QByteArray> tokens = line.split(',');
if (tokens.length() >= 6)
if (tokens.length() >= 5)
{
if (tokens[0].length() > 3)
{
+6 -16
View File
@@ -10,7 +10,7 @@ HelpWindow::HelpWindow(QWidget *parent) :
{
ui->setupUi(this);
m_helpEngine = new QHelpEngineCore("SavvyCAN.qhc", this);
m_helpEngine = new QHelpEngineCore(QApplication::applicationDirPath() +"/SavvyCAN.qhc", this);
if (!m_helpEngine->setupData()) {
delete m_helpEngine;
m_helpEngine = 0;
@@ -66,8 +66,10 @@ HelpWindow* HelpWindow::getRef()
void HelpWindow::showHelp(QString help)
{
if (m_helpEngine) {
qDebug() << "Searching for " << help;
QByteArray helpData = m_helpEngine->fileData(QUrl("qthelp://org.sphinx.savvycan.181/doc/" + help));
QString url = "qthelp://org.sphinx.savvycan.181/doc/" + help;
qDebug() << "Searching for " << url;
QByteArray helpData = m_helpEngine->fileData(QUrl(url));
qDebug() << "Help file size: " << helpData.length();
ui->textHelp->setText(helpData);
}
else
@@ -78,17 +80,5 @@ void HelpWindow::showHelp(QString help)
readSettings();
self->show();
}
/*
QVariant HelpBrowser::loadResource(int type, const QUrl &name)
{
QByteArray ba;
if (type < 4 && m_helpEngine) {
QUrl url(name);
if (name.isRelative())
url = source().resolved(url);
ba = m_helpEngine->fileData(url);
}
return ba;
}
*/
+14 -1
View File
@@ -545,7 +545,20 @@ void MainWindow::handleLoadFile()
QString filename;
QVector<CANFrame> tempFrames;
if (FrameFileIO::loadFrameFile(filename, &tempFrames))
QMessageBox::StandardButton confirmDialog;
bool loadResult = FrameFileIO::loadFrameFile(filename, &tempFrames);
if (!loadResult)
{
confirmDialog = QMessageBox::question(this, "Error Loading", "Do you want to salvage what could be loaded?",
QMessageBox::Yes|QMessageBox::No);
if (confirmDialog == QMessageBox::Yes) {
loadResult = true;
}
}
if (loadResult)
{
ui->canFramesView->scrollToTop();
model->clearFrames();