@@ -111,7 +111,6 @@ void MainWindow::setupGUI()
111
111
ui->lineEditSaveFileName ->setText (" Log.txt" );
112
112
ui->lineEditSaveLogPath ->setText (qApp->applicationDirPath () + " /Logs" );
113
113
ui->splitterGraphTable ->setSizes ({this ->height (), 0 });
114
- ui->stackedWidgetTableView ->setCurrentIndex (ui->comboBoxTableViewMode ->currentIndex ());
115
114
116
115
emit on_checkBoxAutoLogging_toggled (ui->checkBoxAutoLogging ->isChecked ());
117
116
emit on_checkBoxShowLegend_toggled (ui->checkBoxShowLegend ->isChecked ());
@@ -165,8 +164,6 @@ void MainWindow::createChart()
165
164
166
165
ui->textBrowserLogs ->setHighlightEnabled (false );
167
166
emit on_comboBoxLogFormat_currentIndexChanged (ui->comboBoxLogFormat ->currentIndex ());
168
-
169
- ui->pushButtonEnableTableLog ->toggle ();
170
167
}
171
168
172
169
void MainWindow::create3DView ()
@@ -215,7 +212,7 @@ void MainWindow::settingsLoadAll()
215
212
}
216
213
217
214
if (appSettings.value (" Info/organizationName" ).value <QString>() != appSettings.organizationName () ||
218
- appSettings.value (" Info/applicationName" ).value <QString>() != appSettings.applicationName ())
215
+ appSettings.value (" Info/applicationName" ).value <QString>() != appSettings.applicationName ())
219
216
{
220
217
qDebug () << " Abort loading settings ! organizationName or applicationName incorrect. Config file might be missing." ;
221
218
addLog (" App >>\t Error loading settings. Config file incorrect !" , true );
@@ -280,10 +277,7 @@ void MainWindow::settingsLoadAll()
280
277
ui->checkBoxWrapText ->setChecked (appSettings.value (" GUI_Elements/checkBoxWrapText.isChecked" ).value <bool >());
281
278
ui->checkBoxAutoScrollLogTable ->setChecked (appSettings.value (" GUI_Elements/checkBoxAutoScrollLogTable.isChecked" , true ).value <bool >());
282
279
ui->checkBoxAutoSizeColumnsLogTable ->setChecked (appSettings.value (" GUI_Elements/checkBoxAutoSizeColumnsLogTable.isChecked" , true ).value <bool >());
283
- ui->checkBoxScrollLogEnableSorting ->setChecked (appSettings.value (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , true ).value <bool >());
284
- ui->checkBoxAutoSizeColumnsLogTable ->setChecked (appSettings.value (" GUI_Elements/checkBoxAutoSizeColumnsLogTable.isChecked" , true ).value <bool >());
285
- ui->checkBoxAutoScrollLogTable ->setChecked (appSettings.value (" GUI_Elements/checkBoxAutoScrollLogTable.isChecked" , true ).value <bool >());
286
- ui->checkBoxScrollLogEnableSorting ->setChecked (appSettings.value (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , true ).value <bool >());
280
+ ui->checkBoxScrollLogEnableSorting ->setChecked (appSettings.value (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , true ).value <bool >()); ui->checkBoxScrollLogEnableSorting ->setChecked (appSettings.value (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , true ).value <bool >());
287
281
ui->comboBoxAddTextMode ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxAddTextMode.currentIndex" ).value <int >());
288
282
ui->comboBoxBaudRates ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxBaudRates.currentIndex" ).value <int >());
289
283
ui->comboBoxClockSource ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxClockSource.currentIndex" ).value <int >());
@@ -302,15 +296,15 @@ void MainWindow::settingsLoadAll()
302
296
ui->comboBoxTracerStyle ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxTracerStyle.currentIndex" ).value <int >());
303
297
ui->comboBoxUDPReceiveMode ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxUDPReceiveMode.currentIndex" ).value <int >());
304
298
ui->comboBoxUDPSendMode ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxUDPSendMode.currentIndex" ).value <int >());
305
- ui->comboBoxTableViewMode ->setCurrentIndex (appSettings.value (" GUI_Elements/comboBoxTableViewMode .currentIndex" ).value <int >());
299
+ ui->tabWidgetTableView ->setCurrentIndex (appSettings.value (" GUI_Elements/tabWidgetTableView .currentIndex" ).value <int >());
306
300
ui->lineEditCustomParsingRules ->setText (appSettings.value (" data/lineEditCustomParsingRules.text" ).value <QString>());
307
301
ui->lineEditExternalClockLabel ->setText (appSettings.value (" data/lineEditExternalClockLabel.text" ).value <QString>());
308
302
ui->lineEditLoadFilePath ->setText (appSettings.value (" data/lineEditLoadFilePath.text" ).value <QString>());
309
303
ui->lineEditSaveFileName ->setText (appSettings.value (" data/lineEditSaveFileName.text" ).value <QString>());
310
304
ui->lineEditSaveLogPath ->setText (appSettings.value (" data/lineEditSaveLogPath.text" ).value <QString>());
311
305
ui->lineEditUDPTargetIP ->setText (appSettings.value (" data/lineEditUDPTargetIP.text" ).value <QString>());
312
306
ui->pushButtonEnablePlot ->setChecked (appSettings.value (" GUI_Elements/pushButtonEnablePlot.isChecked" , false ).value <bool >());
313
- ui->pushButtonEnableTableLog ->setChecked (appSettings.value (" GUI_Elements/pushButtonEnableTableLog.isChecked" , false ).value <bool >());
307
+ ui->pushButtonEnableTableLog ->setChecked (appSettings.value (" GUI_Elements/pushButtonEnableTableLog.isChecked" , true ).value <bool >());
314
308
ui->spinBoxMaxGraphs ->setValue (appSettings.value (" layout/spinBoxMaxGraphs.value" ).value <int >());
315
309
ui->spinBoxMaxLines ->setValue (appSettings.value (" layout/spinBoxMaxLines.value" ).value <int >());
316
310
ui->spinBoxMaxTimeRange ->setValue (appSettings.value (" layout/spinBoxMaxTimeRange.value" ).value <int >());
@@ -392,12 +386,9 @@ void MainWindow::settingsSaveAll()
392
386
appSettings.setValue (" GUI_Elements/checkBoxTableAutoResize.isChecked" , ui->checkBoxTableAutoResize ->isChecked ());
393
387
appSettings.setValue (" GUI_Elements/checkBoxTruncateFileOnSave.isChecked" , ui->checkBoxTruncateFileOnSave ->isChecked ());
394
388
appSettings.setValue (" GUI_Elements/checkBoxWrapText.isChecked" , ui->checkBoxWrapText ->isChecked ());
395
- appSettings.setValue (" GUI_Elements/checkBoxAutoScrollLogTable.isChecked" , ui->checkBoxAutoScrollLogTable ->isChecked ());
396
- appSettings.setValue (" GUI_Elements/checkBoxAutoSizeColumnsLogTable.isChecked" , ui->checkBoxAutoSizeColumnsLogTable ->isChecked ());
397
389
appSettings.setValue (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , ui->checkBoxScrollLogEnableSorting ->isChecked ());
398
390
appSettings.setValue (" GUI_Elements/checkBoxAutoSizeColumnsLogTable.isChecked" , ui->checkBoxAutoSizeColumnsLogTable ->isChecked ());
399
391
appSettings.setValue (" GUI_Elements/checkBoxAutoScrollLogTable.isChecked" , ui->checkBoxAutoScrollLogTable ->isChecked ());
400
- appSettings.setValue (" GUI_Elements/checkBoxScrollLogEnableSorting.isChecked" , ui->checkBoxScrollLogEnableSorting ->isChecked ());
401
392
appSettings.setValue (" GUI_Elements/comboBoxAddTextMode.currentIndex" , ui->comboBoxAddTextMode ->currentIndex ());
402
393
appSettings.setValue (" GUI_Elements/comboBoxBaudRates.currentIndex" , ui->comboBoxBaudRates ->currentIndex ());
403
394
appSettings.setValue (" GUI_Elements/comboBoxClockSource.currentIndex" , ui->comboBoxClockSource ->currentIndex ());
@@ -416,7 +407,7 @@ void MainWindow::settingsSaveAll()
416
407
appSettings.setValue (" GUI_Elements/comboBoxTracerStyle.currentIndex" , ui->comboBoxTracerStyle ->currentIndex ());
417
408
appSettings.setValue (" GUI_Elements/comboBoxUDPReceiveMode.currentIndex" , ui->comboBoxUDPReceiveMode ->currentIndex ());
418
409
appSettings.setValue (" GUI_Elements/comboBoxUDPSendMode.currentIndex" , ui->comboBoxUDPSendMode ->currentIndex ());
419
- appSettings.setValue (" GUI_Elements/comboBoxTableViewMode .currentIndex" , ui->comboBoxTableViewMode ->currentIndex ());
410
+ appSettings.setValue (" GUI_Elements/tabWidgetTableView .currentIndex" , ui->tabWidgetTableView ->currentIndex ());
420
411
appSettings.setValue (" GUI_Elements/pushButtonEnablePlot.isChecked" , ui->pushButtonEnablePlot ->isChecked ());
421
412
appSettings.setValue (" GUI_Elements/tabWidgetControlSection.currentIndex" , ui->tabWidgetControlSection ->currentIndex ());
422
413
appSettings.setValue (" layout/spinBoxMaxGraphs.value" , ui->spinBoxMaxGraphs ->value ());
@@ -509,9 +500,11 @@ void MainWindow::processLogTable(QList<long> timeTable, QStringList labelTable,
509
500
for (auto i = 0 ; i < ui->tableWidgetLogTable ->columnCount (); ++i)
510
501
firstRow.append (ui->tableWidgetLogTable ->horizontalHeaderItem (i)->text ().trimmed ());
511
502
503
+ bool resizeFlag = false ;
504
+
512
505
foreach (auto label, labelTable)
513
506
{
514
- while (firstRow.contains (label) == false ) // optimise
507
+ if (firstRow.contains (label) == false ) // optimise
515
508
{
516
509
ui->tableWidgetLogTable ->setColumnCount (ui->tableWidgetLogTable ->columnCount () + 1 );
517
510
ui->tableWidgetLogTable ->setHorizontalHeaderItem (ui->tableWidgetLogTable ->columnCount () - 1 , new QTableWidgetItem (label.trimmed ()));
@@ -520,25 +513,24 @@ void MainWindow::processLogTable(QList<long> timeTable, QStringList labelTable,
520
513
for (auto i = 0 ; i < ui->tableWidgetLogTable ->columnCount (); ++i)
521
514
firstRow.append (ui->tableWidgetLogTable ->horizontalHeaderItem (i)->text ().trimmed ());
522
515
523
- if (ui->checkBoxAutoSizeColumnsLogTable ->isChecked ())
524
- ui->tableWidgetLogTable ->resizeColumnsToContents ();
516
+ resizeFlag = true ;
525
517
}
526
-
527
- if (firstRow.contains (label))
518
+ else
528
519
{
529
520
if (oldRowCount == ui->tableWidgetLogTable ->rowCount ())
530
- {
531
521
ui->tableWidgetLogTable ->setRowCount (oldRowCount + 1 );
532
- ui->tableWidgetLogTable ->setItem (oldRowCount, 0 , new QTableWidgetItem (QTime::fromMSecsSinceStartOfDay (timeTable[labelTable.indexOf (label)]).toString (parser.searchTimeFormatList [0 ])));
533
- }
534
522
523
+ ui->tableWidgetLogTable ->setItem (oldRowCount, 0 , new QTableWidgetItem (QTime::fromMSecsSinceStartOfDay (timeTable[labelTable.indexOf (label)]).toString (parser.searchTimeFormatList [0 ])));
535
524
ui->tableWidgetLogTable ->setItem (oldRowCount, firstRow.indexOf (label), new QTableWidgetItem (QString::number (valueTable[labelTable.indexOf (label)])));
536
525
}
537
526
}
538
527
539
528
if (ui->checkBoxAutoScrollLogTable ->isChecked ())
540
529
ui->tableWidgetLogTable ->scrollToBottom ();
541
530
531
+ if (ui->checkBoxAutoSizeColumnsLogTable ->isChecked () && resizeFlag)
532
+ ui->tableWidgetLogTable ->resizeColumnsToContents ();
533
+
542
534
if (ui->spinBoxMaxRowsLogTable ->value () > 0 )
543
535
{
544
536
while (ui->tableWidgetLogTable ->rowCount () > ui->spinBoxMaxRowsLogTable ->value ())
@@ -832,9 +824,9 @@ void MainWindow::on_tracerShowPointValue(QMouseEvent *event)
832
824
" <td>Y: %L3</td>"
833
825
" </tr>"
834
826
" </table>" )
835
- .arg (graph->name ())
836
- .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
837
- .arg (QString::number (temp.y (), ' f' , 5 )),
827
+ .arg (graph->name ())
828
+ .arg (QTime::fromMSecsSinceStartOfDay (temp.x () * 1000 ).toString (" hh:mm:ss:zzz" ))
829
+ .arg (QString::number (temp.y (), ' f' , 5 )),
838
830
ui->widgetChart , ui->widgetChart ->rect ());
839
831
}
840
832
@@ -1049,11 +1041,16 @@ void MainWindow::on_processSerial()
1049
1041
QList<double > numericDataList = parser.getListNumericValues ();
1050
1042
QList<long > timeStamps = parser.getListTimeStamp ();
1051
1043
1052
- this ->processLogWrite (serialInput, labelList, numericDataList, timeStamps);
1053
1044
this ->processChart (labelList, numericDataList, timeStamps);
1045
+ this ->processLogWrite (serialInput, labelList, numericDataList, timeStamps);
1054
1046
this ->saveToRAM (labelList, numericDataList, timeStamps, ui->comboBoxRAMSaveMode ->currentIndex (), serialInput);
1055
- this ->processTable (labelList, numericDataList); // Fill tableWidget
1047
+ this ->processTable (labelList, numericDataList);
1056
1048
this ->processLogTable (timeStamps, labelList, numericDataList);
1049
+
1050
+ // QFuture<void> future = QtConcurrent::run([=]() // Cool !
1051
+ // {
1052
+
1053
+ // });
1057
1054
}
1058
1055
}
1059
1056
@@ -1155,13 +1152,13 @@ void MainWindow::processChart(QStringList labelList, QList<double> numericDataLi
1155
1152
1156
1153
if (canAddGraph && ui->widgetChart ->graphCount () < ui->spinBoxMaxGraphs ->value () &&
1157
1154
1158
- ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
1155
+ ((ui->comboBoxGraphDisplayMode ->currentIndex () == 0 ) ||
1159
1156
1160
- (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
1161
- ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive)) ||
1157
+ (ui->comboBoxGraphDisplayMode ->currentIndex () == 1 &&
1158
+ ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive)) ||
1162
1159
1163
- (ui->comboBoxGraphDisplayMode ->currentIndex () == 2 &&
1164
- !ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
1160
+ (ui->comboBoxGraphDisplayMode ->currentIndex () == 2 &&
1161
+ !ui->lineEditCustomParsingRules ->text ().simplified ().contains (label, Qt::CaseSensitivity::CaseSensitive))))
1165
1162
{
1166
1163
ui->widgetChart ->addGraph ();
1167
1164
ui->widgetChart ->graph ()->setName (label);
@@ -2320,11 +2317,6 @@ void MainWindow::on_comboBoxGraphDisplayMode_currentIndexChanged(int index)
2320
2317
}
2321
2318
}
2322
2319
2323
- void MainWindow::on_comboBoxTableViewMode_currentIndexChanged (int index)
2324
- {
2325
- this ->ui ->stackedWidgetTableView ->setCurrentIndex (index);
2326
- }
2327
-
2328
2320
void MainWindow::on_pushButtonClearLogTable_clicked ()
2329
2321
{
2330
2322
ui->tableWidgetLogTable ->setRowCount (0 );
0 commit comments