@@ -119,7 +119,7 @@ void MainWindow::settingsLoadAll()
119
119
}
120
120
121
121
if (appSettings.value (" Info/organizationName" ).value <QString>() != appSettings.organizationName () &&
122
- appSettings.value (" Info/applicationName" ).value <QString>() != appSettings.applicationName ())
122
+ appSettings.value (" Info/applicationName" ).value <QString>() != appSettings.applicationName ())
123
123
{
124
124
qDebug () << " Abort loading settings ! organizationName or applicationName incorrect. Config file might be missing." ;
125
125
return ;
@@ -168,7 +168,7 @@ void MainWindow::settingsLoadAll()
168
168
ui->comboBoxRAMSaveMode ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxRAMSaveMode.currentIndex" ).value <int >());
169
169
170
170
ui->checkBoxDTR ->setChecked (appSettings.value (" GUI_Elements/checkBoxDTR.isChecked" ).value <bool >());
171
- ui->checkBoxTrim ->setChecked (appSettings.value (" GUI_Elements/checkBoxTrim .isChecked" ).value <bool >());
171
+ ui->checkBoxSimplify ->setChecked (appSettings.value (" GUI_Elements/checkBoxSimplify .isChecked" ).value <bool >());
172
172
ui->checkBoxSendKey ->setChecked (appSettings.value (" GUI_Elements/checkBoxSendKey.isChecked" ).value <bool >());
173
173
ui->checkBoxWrapText ->setChecked (appSettings.value (" GUI_Elements/checkBoxWrapText.isChecked" ).value <bool >());
174
174
ui->checkBoxAutoTrack ->setChecked (appSettings.value (" GUI_Elements/checkBoxAutoTrack.isChecked" ).value <bool >());
@@ -249,7 +249,7 @@ void MainWindow::settingsSaveAll()
249
249
appSettings.setValue (" GUI_Elements/comboBoxRAMSaveMode.currentIndex" , ui->comboBoxRAMSaveMode ->currentIndex ());
250
250
251
251
appSettings.setValue (" GUI_Elements/checkBoxDTR.isChecked" , ui->checkBoxDTR ->isChecked ());
252
- appSettings.setValue (" GUI_Elements/checkBoxTrim .isChecked" , ui->checkBoxTrim ->isChecked ());
252
+ appSettings.setValue (" GUI_Elements/checkBoxSimplify .isChecked" , ui->checkBoxSimplify ->isChecked ());
253
253
appSettings.setValue (" GUI_Elements/checkBoxSendKey.isChecked" , ui->checkBoxSendKey ->isChecked ());
254
254
appSettings.setValue (" GUI_Elements/checkBoxWrapText.isChecked" , ui->checkBoxWrapText ->isChecked ());
255
255
appSettings.setValue (" GUI_Elements/checkBoxAutoTrack.isChecked" , ui->checkBoxAutoTrack ->isChecked ());
@@ -724,9 +724,9 @@ void MainWindow::tracerShowPointValue(QMouseEvent *event)
724
724
" <td>Y: %L3</td>"
725
725
" </tr>"
726
726
" </table>" )
727
- .arg (graph->name ())
728
- .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
729
- .arg (QString::number (temp.y (), ' f' , 5 )),
727
+ .arg (graph->name ())
728
+ .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
729
+ .arg (QString::number (temp.y (), ' f' , 5 )),
730
730
ui->widgetChart , ui->widgetChart ->rect ());
731
731
}
732
732
@@ -797,17 +797,55 @@ void MainWindow::addLog(QString text)
797
797
}
798
798
}
799
799
800
+ void MainWindow::addLogBytes (QString prefix, QByteArray bytes, bool hexToBinary)
801
+ {
802
+ if (ui->pushButtonTextLogToggle ->isChecked () == false )
803
+ {
804
+ QString currentDateTime = QDateTime::currentDateTime ().toString (" hh:mm:ss:zzz " );
805
+
806
+ QString bytesText;
807
+
808
+ if (hexToBinary == false )
809
+ bytesText = prefix + bytes.toHex (' ' );
810
+ else
811
+ {
812
+ bytesText.append (prefix);
813
+ for (auto i = 0 ; i < bytes.size (); ++i)
814
+ {
815
+ bytesText.append (QString::number (bytes[i], 2 ) + ' ' );
816
+ }
817
+ }
818
+
819
+ if (ui->checkBoxShowTime ->isChecked ())
820
+ bytesText = currentDateTime + bytesText;
821
+
822
+ ui->textBrowserLogs ->append (bytesText);
823
+ }
824
+ }
825
+
800
826
void MainWindow::processSerial ()
801
827
{
802
- QString serialInput = serial.getString ();
828
+ QString serialInput = serial.getString ().trimmed ();
829
+ QByteArray serialInputBytes = serial.getBytes ();
803
830
804
- if (serialInput.isEmpty () == false )
831
+ if (ui-> comboBoxFormat -> currentIndex () == 0 && serialInput.isEmpty () == false )
805
832
{
806
- if (ui->checkBoxTrim ->isChecked ()) // Append text to textBrowser
807
- addLog (" Serial <<\t " + serialInput.trimmed ());
833
+ if (ui->checkBoxSimplify ->isChecked ()) // Append text to textBrowser
834
+ addLog (" Serial <<\t " + serialInput.simplified ());
808
835
else
809
836
addLog (" Serial <<\t " + serialInput);
837
+ }
838
+ else if (ui->comboBoxFormat ->currentIndex () == 1 && serialInputBytes.length () > 0 )
839
+ {
840
+ addLogBytes (" Serial (HEX) <<\t " , serialInputBytes);
841
+ }
842
+ else if (ui->comboBoxFormat ->currentIndex () == 2 && serialInputBytes.length () > 0 )
843
+ {
844
+ addLogBytes (" Serial (BIN) <<\t " , serialInputBytes, true );
845
+ }
810
846
847
+ if (serialInput.isEmpty () == false )
848
+ {
811
849
parser.parse (serialInput, ui->checkBoxSyncSystemClock ->isChecked (), ui->checkBoxExternalTimeReference ->isChecked (), ui->lineEditExternalClockLabel ->text ()); // Parse string - split into labels + numeric data
812
850
QStringList labelList = parser.getStringListLabels ();
813
851
QList<double > numericDataList = parser.getListNumericValues ();
@@ -834,14 +872,27 @@ void MainWindow::writeLogToFile(QString rawLine, QStringList labelList, QList<do
834
872
835
873
void MainWindow::processUDP ()
836
874
{
837
- QString udpInput = networkUDP.readString ();
838
- if (udpInput.isEmpty () == false )
875
+ QString udpInput = networkUDP.readString ().trimmed ();
876
+ QByteArray udpInputBytes = networkUDP.readBytes ();
877
+
878
+ if (ui->comboBoxFormat ->currentIndex () == 0 && udpInput.isEmpty () == false )
839
879
{
840
- if (ui->checkBoxTrim ->isChecked ())
841
- addLog (" UDP <<\t " + udpInput.trimmed ());
880
+ if (ui->checkBoxSimplify ->isChecked ())
881
+ addLog (" UDP <<\t " + udpInput.simplified ());
842
882
else
843
883
addLog (" UDP <<\t " + udpInput);
884
+ }
885
+ else if (ui->comboBoxFormat ->currentIndex () == 1 && udpInputBytes.length () > 0 )
886
+ {
887
+ addLogBytes (" UDP (HEX) <<\t " , udpInputBytes);
888
+ }
889
+ else if (ui->comboBoxFormat ->currentIndex () == 2 && udpInputBytes.length () > 0 )
890
+ {
891
+ addLogBytes (" UDP (BIN) <<\t " , udpInputBytes, true );
892
+ }
844
893
894
+ if (udpInput.isEmpty () == false )
895
+ {
845
896
parser.parse (udpInput, ui->checkBoxSyncSystemClock ->isChecked (), ui->checkBoxExternalTimeReference ->isChecked (), ui->lineEditExternalClockLabel ->text ()); // Parse string - split into labels + numeric data
846
897
QStringList labelList = parser.getStringListLabels ();
847
898
QList<double > numericDataList = parser.getListNumericValues ();
@@ -877,9 +928,9 @@ void MainWindow::processChart(QStringList labelList, QList<double> numericDataLi
877
928
}
878
929
879
930
if (canAddGraph && ui->widgetChart ->graphCount () < ui->spinBoxMaxGraphs ->value () &&
880
- ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
881
- (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
882
- ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
931
+ ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
932
+ (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
933
+ ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
883
934
{
884
935
ui->widgetChart ->addGraph ();
885
936
ui->widgetChart ->graph ()->setName (label);
@@ -1031,9 +1082,9 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
1031
1082
void MainWindow::sendSerial (QString message)
1032
1083
{
1033
1084
if (serial.send (message))
1034
- this ->addLog (" S >>\t " + message);
1085
+ this ->addLog (" Serial >>\t " + message);
1035
1086
else
1036
- this ->addLog (" S >>\t Unable to send! Serial port closed !" );
1087
+ this ->addLog (" Serial >>\t Unable to send! Serial port closed !" );
1037
1088
}
1038
1089
1039
1090
void MainWindow::on_checkBoxAutoRefresh_toggled (bool checked)
@@ -1559,7 +1610,7 @@ void MainWindow::sendDatagram(QString message)
1559
1610
networkUDP.write (message, QHostAddress (ui->lineEditUDPTargetIP ->text ()), ui->spinBoxUDPTargetPort ->value ());
1560
1611
}
1561
1612
1562
- addLog (" App >>\t " + message);
1613
+ addLog (" UDP >>\t " + message);
1563
1614
}
1564
1615
1565
1616
void MainWindow::on_comboBoxUDPSendMode_currentIndexChanged (const QString &arg1)
@@ -1925,7 +1976,7 @@ void MainWindow::loadFromRAM(bool loadText)
1925
1976
{
1926
1977
QStringList RAMText = parser.getTextList ();
1927
1978
foreach (auto line, RAMText)
1928
- addLog (line);
1979
+ addLog (" Mem >> \t " + line);
1929
1980
}
1930
1981
1931
1982
if (RAMLabels.isEmpty () || RAMData.isEmpty () || RAMTime.isEmpty ())
@@ -1973,18 +2024,18 @@ void MainWindow::on_pushButtonLoadFile_clicked()
1973
2024
1974
2025
if (fileReader.readAllAtOnce (&inputFile))
1975
2026
{
1976
- addLog (" Read file succesfully... " );
2027
+ addLog (" App >> \t Read file succesfully... " );
1977
2028
}
1978
2029
else
1979
2030
{
1980
- addLog (" invalid file !" );
2031
+ addLog (" App >> \t invalid file !" );
1981
2032
ui->pushButtonLoadFile ->setText (" Load File" );
1982
2033
ui->progressBarLoadFile ->setValue (0 );
1983
2034
}
1984
2035
}
1985
2036
else
1986
2037
{
1987
- addLog (" File Reader - Invalid file path !" );
2038
+ addLog (" App >> \t file reader error - invalid file path !" );
1988
2039
ui->pushButtonLoadFile ->setText (" Load File" );
1989
2040
ui->progressBarLoadFile ->setValue (0 );
1990
2041
}
0 commit comments