diff --git a/canframemodel.cpp b/canframemodel.cpp index 5f84930f..e41eb8c2 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -236,11 +236,11 @@ void CANFrameModel::setAllFilters(bool state) * quicksort on the columns and interpret the columns numerically. But, correct or not, this implementation is quite fast * and sorts the columns properly. */ -uint64_t CANFrameModel::getCANFrameVal(int row, Column col) +uint64_t CANFrameModel::getCANFrameVal(QVector *frames, int row, Column col) { uint64_t temp = 0; - if (row >= frames.count()) return 0; - CANFrame frame = frames[row]; + if (row >= frames->count()) return 0; + CANFrame frame = frames->at(row); switch (col) { case Column::TimeStamp: @@ -279,18 +279,18 @@ void CANFrameModel::qSortCANFrameAsc(QVector *frames, Column column, i qDebug() << "Lower " << lowerBound << " Upper" << upperBound; if (lowerBound < upperBound) { - uint64_t piv = getCANFrameVal(lowerBound + (upperBound - lowerBound) / 2, column); + uint64_t piv = getCANFrameVal(frames, lowerBound + (upperBound - lowerBound) / 2, column); i = lowerBound - 1; j = upperBound + 1; for (;;){ do { i++; - } while ((i < upperBound) && getCANFrameVal(i, column) < piv); + } while ((i < upperBound) && getCANFrameVal(frames, i, column) < piv); do { j--; - } while ((j > lowerBound) && getCANFrameVal(j, column) > piv); + } while ((j > lowerBound) && getCANFrameVal(frames, j, column) > piv); if (i < j) { CANFrame temp = frames->at(i); frames->replace(i, frames->at(j)); @@ -310,18 +310,18 @@ void CANFrameModel::qSortCANFrameDesc(QVector *frames, Column column, qDebug() << "Lower " << lowerBound << " Upper" << upperBound; if (lowerBound < upperBound) { - uint64_t piv = getCANFrameVal(lowerBound + (upperBound - lowerBound) / 2, column); + uint64_t piv = getCANFrameVal(frames, lowerBound + (upperBound - lowerBound) / 2, column); i = lowerBound - 1; j = upperBound + 1; for (;;){ do { i++; - } while ((i < upperBound) && getCANFrameVal(i, column) > piv); + } while ((i < upperBound) && getCANFrameVal(frames, i, column) > piv); do { j--; - } while ((j > lowerBound) && getCANFrameVal(j, column) < piv); + } while ((j > lowerBound) && getCANFrameVal(frames, j, column) < piv); if (i < j) { CANFrame temp = frames->at(i); frames->replace(i, frames->at(j)); @@ -338,11 +338,13 @@ void CANFrameModel::qSortCANFrameDesc(QVector *frames, Column column, void CANFrameModel::sortByColumn(int column) { sortDirAsc = !sortDirAsc; - //beginResetModel(); - if (sortDirAsc) qSortCANFrameAsc(&frames, Column(column), 0, frames.count()-1); - else qSortCANFrameDesc(&frames, Column(column), 0, frames.count()-1); - //endResetModel(); - sendRefresh(); + if (sortDirAsc) qSortCANFrameAsc(&filteredFrames, Column(column), 0, filteredFrames.count()-1); + else qSortCANFrameDesc(&filteredFrames, Column(column), 0, filteredFrames.count()-1); + + mutex.lock(); + beginResetModel(); + endResetModel(); + mutex.unlock(); } //End of custom sorting code @@ -365,34 +367,38 @@ void CANFrameModel::recalcOverwrite() idAugmented = frame.frameId(); idAugmented = idAugmented + (frame.bus << 29ull); - if (!overWriteFrames.contains(idAugmented)) - { - frame.timedelta = 0; - frame.frameCount = 1; - overWriteFrames.insert(idAugmented, frame); - } - else + if (filters[frame.frameId()] && busFilters[frame.bus]) { - frame.timedelta = frame.timeStamp().microSeconds() - overWriteFrames[idAugmented].timeStamp().microSeconds(); - frame.frameCount = overWriteFrames[idAugmented].frameCount + 1; - overWriteFrames[idAugmented] = frame; + if (!overWriteFrames.contains(idAugmented)) + { + frame.timedelta = 0; + frame.frameCount = 1; + overWriteFrames.insert(idAugmented, frame); + } + else + { + frame.timedelta = frame.timeStamp().microSeconds() - overWriteFrames[idAugmented].timeStamp().microSeconds(); + frame.frameCount = overWriteFrames[idAugmented].frameCount + 1; + overWriteFrames[idAugmented] = frame; + } } } //Then replace the old list of frames with just the unique list - frames.clear(); - frames.append(overWriteFrames.values().toVector()); - frames.reserve(preallocSize); + //frames.clear(); + //frames.append(overWriteFrames.values().toVector()); + //frames.reserve(preallocSize); filteredFrames.clear(); + filteredFrames.append(overWriteFrames.values().toVector()); filteredFrames.reserve(preallocSize); - for (int i = 0; i < frames.count(); i++) + /*for (int i = 0; i < frames.count(); i++) { if (filters[frames[i].frameId()] && busFilters[frames[i].bus]) { filteredFrames.append(frames[i]); } - } + }*/ endResetModel(); mutex.unlock(); @@ -705,20 +711,32 @@ void CANFrameModel::addFrame(const CANFrame& frame, bool autoRefresh = false) else //yes, overwrite dups { bool found = false; - for (int i = 0; i < frames.count(); i++) +// for (int i = 0; i < frames.count(); i++) +// { +// if ( (frames[i].frameId() == tempFrame.frameId()) && (frames[i].bus == tempFrame.bus) ) +// { +// tempFrame.frameCount = frames[i].frameCount + 1; +// tempFrame.timedelta = tempFrame.timeStamp().microSeconds() - frames[i].timeStamp().microSeconds(); +// frames.replace(i, tempFrame); +// found = true; +// break; +// } +// } + for (int i = 0; i < filteredFrames.count(); i++) { - if ( (frames[i].frameId() == tempFrame.frameId()) && (frames[i].bus == tempFrame.bus) ) + if ( (filteredFrames[i].frameId() == tempFrame.frameId()) && (filteredFrames[i].bus == tempFrame.bus) ) { - tempFrame.frameCount = frames[i].frameCount + 1; - tempFrame.timedelta = tempFrame.timeStamp().microSeconds() - frames[i].timeStamp().microSeconds(); - frames.replace(i, tempFrame); + tempFrame.frameCount = filteredFrames[i].frameCount + 1; + tempFrame.timedelta = tempFrame.timeStamp().microSeconds() - filteredFrames[i].timeStamp().microSeconds(); + filteredFrames.replace(i, tempFrame); found = true; break; } } + frames.append(tempFrame); if (!found) { - frames.append(tempFrame); + //frames.append(tempFrame); if (filters[tempFrame.frameId()] && busFilters[tempFrame.bus]) { if (autoRefresh) beginInsertRows(QModelIndex(), filteredFrames.count(), filteredFrames.count()); @@ -750,16 +768,20 @@ void CANFrameModel::addFrames(const CANConnection*, const QVector& pFr { if(frames.length() > frames.capacity() * 0.99) { + mutex.lock(); qDebug() << "Frames count: " << frames.length() << " of " << frames.capacity() << " capacity, removing first " << (int)(frames.capacity() * 0.05) << " frames"; frames.remove(0, (int)(frames.capacity() * 0.05)); qDebug() << "Frames removed, new count: " << frames.length(); + mutex.unlock(); } if(filteredFrames.length() > filteredFrames.capacity() * 0.99) { + mutex.lock(); qDebug() << "filteredFrames count: " << filteredFrames.length() << " of " << filteredFrames.capacity() << " capacity, removing first " << (int)(filteredFrames.capacity() * 0.05) << " frames"; filteredFrames.remove(0, (int)(filteredFrames.capacity() * 0.05)); qDebug() << "filteredFrames removed, new count: " << filteredFrames.length(); + mutex.unlock(); } foreach(const CANFrame& frame, pFrames) @@ -775,25 +797,33 @@ void CANFrameModel::addFrames(const CANConnection*, const QVector& pFr void CANFrameModel::sendRefresh() { - qDebug() << "Sending mass refresh"; - QVector tempContainer; - int count = frames.count(); - for (int i = 0; i < count; i++) + qDebug() << "Sending mass refresh"; + + if(overwriteDups) { - if (filters[frames[i].frameId()] && busFilters[frames[i].bus]) + recalcOverwrite(); + } + else + { + QVector tempContainer; + int count = frames.count(); + for (int i = 0; i < count; i++) { - tempContainer.append(frames[i]); + if (filters[frames[i].frameId()] && busFilters[frames[i].bus]) + { + tempContainer.append(frames[i]); + } } - } - mutex.lock(); - beginResetModel(); - filteredFrames.clear(); - filteredFrames.append(tempContainer); - filteredFrames.reserve(preallocSize); - lastUpdateNumFrames = 0; - endResetModel(); - mutex.unlock(); + mutex.lock(); + beginResetModel(); + filteredFrames.clear(); + filteredFrames.append(tempContainer); + filteredFrames.reserve(preallocSize); + lastUpdateNumFrames = 0; + endResetModel(); + mutex.unlock(); + } } void CANFrameModel::sendRefresh(int pos) @@ -811,7 +841,7 @@ int CANFrameModel::sendBulkRefresh() if (lastUpdateNumFrames <= 0) return 0; if (lastUpdateNumFrames == 0 && !overwriteDups) return 0; - if (filteredFrames.count() == 0) return 0; + //if (filteredFrames.count() == 0) return 0; //qDebug() << "Bulk refresh of " << lastUpdateNumFrames; diff --git a/canframemodel.h b/canframemodel.h index 49ad74da..be138886 100644 --- a/canframemodel.h +++ b/canframemodel.h @@ -78,7 +78,7 @@ public slots: private: void qSortCANFrameAsc(QVector* frames, Column column, int lowerBound, int upperBound); void qSortCANFrameDesc(QVector* frames, Column column, int lowerBound, int upperBound); - uint64_t getCANFrameVal(int row, Column col); + uint64_t getCANFrameVal(QVector *frames, int row, Column col); bool any_filters_are_configured(void); bool any_busfilters_are_configured(void); diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index fe97759c..4340670c 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -204,7 +204,6 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) { int busBase = 0; CANFrame workingFrame = pFrame; - CANFrame *txFrame; if (mConns.count() == 0) { @@ -228,10 +227,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) workingFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, mElapsedTimer.nsecsElapsed() / 1000)); //workingFrame.timestamp -= mTimestampBasis; } - txFrame = conn->getQueue().get(); - QCoreApplication::processEvents(); - *txFrame = workingFrame; - conn->getQueue().queue(); + return conn->sendFrame(workingFrame); } busBase += conn->getNumBuses(); diff --git a/connections/canconnection.cpp b/connections/canconnection.cpp index dc9d7751..8edd17c3 100644 --- a/connections/canconnection.cpp +++ b/connections/canconnection.cpp @@ -173,6 +173,11 @@ bool CANConnection::sendFrame(const CANFrame& pFrame) return ret; } + CANFrame *txFrame; + txFrame = getQueue().get(); + *txFrame = pFrame; + getQueue().queue(); + return piSendFrame(pFrame); } diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index 76954423..84bd5142 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -426,14 +426,12 @@ void ConnectionWindow::currentTabChanged(int newIdx) void ConnectionWindow::currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous) { - Q_UNUSED(previous); - int selIdx = current.row(); - - disconnect(connModel->getAtIdx(previous.row()), SIGNAL(debugOutput(QString)), nullptr, nullptr); + CANConnection* prevConn = connModel->getAtIdx(previous.row()); + if(prevConn != nullptr) + disconnect(prevConn, SIGNAL(debugOutput(QString)), nullptr, nullptr); disconnect(this, SIGNAL(sendDebugData(QByteArray)), nullptr, nullptr); - /* set parameters */ if (selIdx == -1) { ui->groupBus->setEnabled(false); diff --git a/connections/socketcand.cpp b/connections/socketcand.cpp index abb5cebe..1f9c8731 100644 --- a/connections/socketcand.cpp +++ b/connections/socketcand.cpp @@ -64,7 +64,7 @@ void SocketCANd::sendBytesToTCP(const QByteArray &bytes, int busNum) byt = (unsigned char)byt; buildDebug = buildDebug % QString::number(byt, 16) % " "; } - sendDebug(buildDebug); + //sendDebug(buildDebug); if (tcpClient[busNum]) tcpClient[busNum]->write(bytes); } @@ -77,9 +77,9 @@ void SocketCANd::sendStringToTCP(const char* data, int busNum) return; } - QString buildDebug; - buildDebug = "Send data to " + hostIP.toString() + ":" + QString::number(hostPort) + " -> " + data; - sendDebug(buildDebug); + //QString buildDebug; + //buildDebug = "Send data to " + hostIP.toString() + ":" + QString::number(hostPort) + " -> " + data; + //sendDebug(buildDebug); //qInfo() << buildDebug; if (tcpClient[busNum]) tcpClient[busNum]->write(data); @@ -295,6 +295,7 @@ QString SocketCANd::decodeFrames(QString data, int busNum) framelength = frameParsed[3].length() * 0.5; } + QByteArray buildData; buildData.resize(framelength); int c; @@ -366,15 +367,15 @@ void SocketCANd::invokeReadTCPData() void SocketCANd::readTCPData(int busNum) { - QByteArray data; + QString data; - if (tcpClient[busNum]) data = tcpClient[busNum]->readAll(); + if (tcpClient[busNum]) + data = QString(tcpClient[busNum]->readAll()); //sendDebug("Got data from TCP. Len = " % QString::number(data.length())); //qDebug() << "Received datagramm: " << data; procRXData(data, busNum); } - void SocketCANd::procRXData(QString data, int busNum) { if (data != "") diff --git a/connections/socketcand.h b/connections/socketcand.h index aa8510a0..06c7a6d4 100644 --- a/connections/socketcand.h +++ b/connections/socketcand.h @@ -73,7 +73,6 @@ private slots: int hostPort; QList hostCanIDs; int framesRapid; - QByteArray buildData; QVarLengthArray rx_state; CANFrame buildFrame; QVarLengthArray unprocessedData; diff --git a/framesenderwindow.cpp b/framesenderwindow.cpp index 4d66317d..dd092160 100644 --- a/framesenderwindow.cpp +++ b/framesenderwindow.cpp @@ -181,8 +181,8 @@ void FrameSenderWindow::processIncomingFrame(CANFrame *frame) for (int trig = 0; trig < sendingData[sd].triggers.count(); trig++) { Trigger *thisTrigger = &sendingData[sd].triggers[trig]; - qDebug() << "Trigger ID: " << thisTrigger->ID; - qDebug() << "Frame ID: " << frame->frameId(); + //qDebug() << "Trigger ID: " << thisTrigger->ID; + //qDebug() << "Frame ID: " << frame->frameId(); if (thisTrigger->ID > 0 && (uint32_t)thisTrigger->ID == frame->frameId()) { if (thisTrigger->bus == frame->bus || thisTrigger->bus == -1) @@ -290,6 +290,8 @@ void FrameSenderWindow::loadGrid() } } + createBlankRow(); + setupGrid(); } @@ -424,44 +426,54 @@ void FrameSenderWindow::handleTick() { FrameSendData *sendData; Trigger *trigger; - int elapsed = elapsedTimer.restart(); - if (elapsed == 0) elapsed = 1; - //Modifier modifier; - for (int i = 0; i < sendingData.count(); i++) + if(mutex.tryLock()) { - sendData = &sendingData[i]; - if (!sendData->enabled) + int elapsed = elapsedTimer.restart(); + if (elapsed == 0) elapsed = 1; + //Modifier modifier; + for (int i = 0; i < sendingData.count(); i++) { - if (sendData->triggers.count() > 0) + sendData = &sendingData[i]; + if (!sendData->enabled) { - for (int j = 0; j < sendData->triggers.count(); j++) //resetting currCount when line is disabled + if (sendData->triggers.count() > 0) { - sendData->triggers[j].currCount = 0; + for (int j = 0; j < sendData->triggers.count(); j++) //resetting currCount when line is disabled + { + sendData->triggers[j].currCount = 0; + } } + continue; //abort any processing on this if it is not enabled. } - continue; //abort any processing on this if it is not enabled. - } - if (sendData->triggers.count() == 0) return; - for (int j = 0; j < sendData->triggers.count(); j++) - { - trigger = &sendData->triggers[j]; - if (trigger->currCount >= trigger->maxCount) continue; //don't process if we've sent max frames we were supposed to - if (!trigger->readyCount) continue; //don't tick if not ready to tick - //is it time to fire? - trigger->msCounter += elapsed; //gives proper tracking even if timer doesn't fire as fast as it should - if (trigger->msCounter >= trigger->milliseconds) + if (sendData->triggers.count() == 0) break; + for (int j = 0; j < sendData->triggers.count(); j++) { - trigger->msCounter = 0; - sendData->count++; - trigger->currCount++; - doModifiers(i); - updateGridRow(i); - qDebug() << "About to try to send a frame"; - CANConManager::getInstance()->sendFrame(sendingData[i]); - if (trigger->ID > 0) trigger->readyCount = false; //reset flag if this is a timed ID trigger + trigger = &sendData->triggers[j]; + if (trigger->currCount >= trigger->maxCount) continue; //don't process if we've sent max frames we were supposed to + if (!trigger->readyCount) continue; //don't tick if not ready to tick + //is it time to fire? + trigger->msCounter += elapsed; //gives proper tracking even if timer doesn't fire as fast as it should + if (trigger->msCounter >= trigger->milliseconds) + { + trigger->msCounter = 0; + sendData->count++; + trigger->currCount++; + doModifiers(i); + updateGridRow(i); + //qDebug() << "About to try to send a frame"; + CANConManager::getInstance()->sendFrame(sendingData[i]); + if (trigger->ID > 0) trigger->readyCount = false; //reset flag if this is a timed ID trigger + } } } + + mutex.unlock(); + } + else + { + qDebug() << "framesenderwindow::handleTick() couldn't get mutex, elapsed is: " << elapsedTimer.elapsed(); } + } /// @@ -479,7 +491,7 @@ void FrameSenderWindow::doModifiers(int idx) if (sendData->modifiers.count() == 0) return; //if no modifiers just leave right now - qDebug() << "Executing mods"; + //qDebug() << "Executing mods"; for (int i = 0; i < sendData->modifiers.count(); i++) { @@ -648,10 +660,10 @@ void FrameSenderWindow::processModifierText(int line) { thisOp.operation = parseOperation(operation); QString secondOp = Utility::grabAlphaNumeric(mods[i]); - if (mods[i][0] == '~') + if (secondOp.length() > 0 && secondOp[0] == '~') { thisOp.second.notOper = true; - mods[i] = mods[i].remove(0, 1); //remove the ~ character + secondOp = secondOp.remove(0, 1); //remove the ~ character } else thisOp.second.notOper = false; thisOp.second.bus = sendingData[line].bus; @@ -797,7 +809,7 @@ ModifierOperationType FrameSenderWindow::parseOperation(QString op) /// void FrameSenderWindow::updateGridRow(int idx) { - qDebug() << "updateGridRow"; + //qDebug() << "updateGridRow"; inhibitChanged = true; FrameSendData *temp = &sendingData[idx]; @@ -807,16 +819,28 @@ void FrameSenderWindow::updateGridRow(int idx) const unsigned char *data = reinterpret_cast(temp->payload().constData()); int dataLen = temp->payload().length(); - if (item == nullptr) item = new QTableWidgetItem(); - item->setText(QString::number(temp->count)); - if (temp->frameType() != QCanBusFrame::RemoteRequestFrame) { + if (item == nullptr) + { + item = new QTableWidgetItem(); + item->setText(QString::number(temp->count)); + ui->tableSender->setItem(gridLine, 9, item); + } + else + { + item->setText(QString::number(temp->count)); + } + + if (temp->frameType() != QCanBusFrame::RemoteRequestFrame) + { for (int i = 0; i < dataLen; i++) { dataString.append(Utility::formatNumber(data[i])); dataString.append(" "); } ui->tableSender->item(gridLine, 6)->setText(dataString); - } else { + } + else + { ui->tableSender->item(gridLine, 6)->setText(""); } inhibitChanged = false; diff --git a/framesenderwindow.h b/framesenderwindow.h index d4f399cf..c07531d9 100644 --- a/framesenderwindow.h +++ b/framesenderwindow.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "can_structs.h" #include "can_trigger_structs.h" @@ -38,6 +39,7 @@ private slots: QTimer *intervalTimer; QElapsedTimer elapsedTimer; bool inhibitChanged = false; + QMutex mutex; void createBlankRow(); void doModifiers(int); diff --git a/main.cpp b/main.cpp index c9466dcc..df2f4a4a 100644 --- a/main.cpp +++ b/main.cpp @@ -24,6 +24,12 @@ class SavvyCANApplication : public QApplication int main(int argc, char *argv[]) { +#ifdef QT_DEBUG + //uncomment for verbose debug data in application output + //qputenv("QT_FATAL_WARNINGS", "1"); + //qSetMessagePattern("Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}"); +#endif + SavvyCANApplication a(argc, argv); //Add a local path for Qt extensions, to allow for per-application extensions. diff --git a/mainwindow.cpp b/mainwindow.cpp index dde76918..b0bdf56f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -442,6 +442,8 @@ void MainWindow::headerClicked(int logicalIndex) { //ui->canFramesView->sortByColumn(logicalIndex); model->sortByColumn(logicalIndex); + + manageRowExpansion(); } void MainWindow::expandAllRows() @@ -462,9 +464,17 @@ void MainWindow::expandAllRows() if (goAhead) { ui->canFramesView->resizeRowsToContents(); + + rowExpansionActive = true; } } +void MainWindow::manageRowExpansion() +{ + if(rowExpansionActive && model->getInterpretMode()) + ui->canFramesView->resizeRowsToContents(); +} + void MainWindow::collapseAllRows() { bool goAhead = false; @@ -483,6 +493,8 @@ void MainWindow::collapseAllRows() if (goAhead) { for (int i = 0; i < numRows; i++) ui->canFramesView->setRowHeight(i, normalRowHeight); + + rowExpansionActive = false; } } @@ -622,6 +634,7 @@ void MainWindow::overwriteToggled(bool state) } else { + rowExpansionActive = false; model->setOverwriteMode(false); } } @@ -680,6 +693,8 @@ void MainWindow::filterListItemChanged(QListWidgetItem *item) if (item->checkState() == Qt::Checked) isSet = true; model->setFilterState(ID, isSet); + + manageRowExpansion(); } void MainWindow::busFilterListItemChanged(QListWidgetItem *item) @@ -693,6 +708,8 @@ void MainWindow::busFilterListItemChanged(QListWidgetItem *item) if (item->checkState() == Qt::Checked) isSet = true; model->setBusFilterState(ID, isSet); + + manageRowExpansion(); } void MainWindow::filterSetAll() @@ -704,6 +721,8 @@ void MainWindow::filterSetAll() } inhibitFilterUpdate = false; model->setAllFilters(true); + + manageRowExpansion(); } void MainWindow::filterClearAll() @@ -739,12 +758,14 @@ void MainWindow::tickGUIUpdate() framesPerSec = 0; ui->lbNumFrames->setText(QString::number(model->rowCount())); - if (rxFrames > 0 && /*allowCapture && */ ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom(); + if (rxFrames > 0 && /*allowCapture && */ ui->cbAutoScroll->isChecked()) + ui->canFramesView->scrollToBottom(); ui->lbFPS->setText(QString::number(framesPerSec)); if (rxFrames > 0) { bDirty = true; emit framesUpdated(rxFrames); //anyone care that frames were updated? + manageRowExpansion(); } if (model->needsFilterRefresh()) updateFilterList(); @@ -795,7 +816,7 @@ void MainWindow::addFrameToDisplay(CANFrame &frame, bool autoRefresh = false) //A sub-window is sending us a center on timestamp and ID signal //try to find the relevant frame in the list and focus on it. -void MainWindow::gotCenterTimeID(int32_t ID, double timestamp) +void MainWindow::gotCenterTimeID(uint32_t ID, double timestamp) { int idx = model->getIndexFromTimeID(ID, timestamp); if (idx > -1) @@ -1322,13 +1343,13 @@ void MainWindow::showGraphingWindow() lastGraphingWindow = new GraphingWindow(model->getListReference()); graphWindows.append(lastGraphingWindow); - connect(lastGraphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, SLOT(gotCenterTimeID(int32_t,double))); - connect(this, SIGNAL(sendCenterTimeID(uint32_t,double)), lastGraphingWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(lastGraphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), this, SLOT(gotCenterTimeID(uint32_t,double))); + connect(this, SIGNAL(sendCenterTimeID(uint32_t,double)), lastGraphingWindow, SLOT(gotCenterTimeID(uint32_t,double))); if (flowViewWindow) //connect the two external windows together { - connect(lastGraphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(int32_t,double))); - connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), lastGraphingWindow, SLOT(gotCenterTimeID(int32_t,double))); + connect(lastGraphingWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), flowViewWindow, SLOT(gotCenterTimeID(uint32_t,double))); + connect(flowViewWindow, SIGNAL(sendCenterTimeID(uint32_t,double)), lastGraphingWindow, SLOT(gotCenterTimeID(uint32_t,double))); } lastGraphingWindow->show(); diff --git a/mainwindow.h b/mainwindow.h index 64b8cdfa..2001860f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -117,7 +117,7 @@ public slots: void gotFrames(int); void updateSettings(); void readUpdateableSettings(); - void gotCenterTimeID(int32_t ID, double timestamp); + void gotCenterTimeID(uint32_t ID, double timestamp); void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1); signals: @@ -192,6 +192,7 @@ public slots: int normalRowHeight; bool isConnected; QPoint contextMenuPosition; + bool rowExpansionActive = false; //private methods QString getSignalNameFromPosition(QPoint pos); @@ -207,6 +208,7 @@ public slots: void readSettings(); void writeSettings(); bool eventFilter(QObject *obj, QEvent *event); + void manageRowExpansion(); }; #endif // MAINWINDOW_H diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 37236dd8..9d1f58a5 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -298,7 +298,7 @@ void FlowViewWindow::plottableDoubleClick(QCPAbstractPlottable* plottable, QMous else emit sendCenterTimeID(id, coord / 1000000.0); } -void FlowViewWindow::gotCenterTimeID(int32_t ID, double timestamp) +void FlowViewWindow::gotCenterTimeID(uint32_t ID, double timestamp) { int64_t t_stamp; diff --git a/re/flowviewwindow.h b/re/flowviewwindow.h index e2705c19..9f437f28 100644 --- a/re/flowviewwindow.h +++ b/re/flowviewwindow.h @@ -37,7 +37,7 @@ private slots: void saveFileFlow(); void saveFileGraph(); void plottableDoubleClick(QCPAbstractPlottable* plottable, QMouseEvent* event); - void gotCenterTimeID(int32_t ID, double timestamp); + void gotCenterTimeID(uint32_t ID, double timestamp); void updateTriggerValues(); void gotCellClick(int x, int y); void graphRangeChanged(int range); diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index 30c67e93..fdd509fd 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -281,7 +281,7 @@ void GraphingWindow::plottableDoubleClick(QCPAbstractPlottable* plottable, int d locationText->setText("X: " + QString::number(x) + " Y: " + QString::number(itemTracer->position->value())); } -void GraphingWindow::gotCenterTimeID(int32_t ID, double timestamp) +void GraphingWindow::gotCenterTimeID(uint32_t ID, double timestamp) { Q_UNUSED(ID) //its problematic to try to highlight a graph since we get the ID diff --git a/re/graphingwindow.h b/re/graphingwindow.h index 830384e5..2cea4385 100644 --- a/re/graphingwindow.h +++ b/re/graphingwindow.h @@ -81,7 +81,7 @@ private slots: void appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector &x, QVector &y); void editSelectedGraph(); void updatedFrames(int); - void gotCenterTimeID(int32_t ID, double timestamp); + void gotCenterTimeID(uint32_t ID, double timestamp); void resetView(); void zoomIn(); void zoomOut();