@@ -47,12 +47,12 @@ MainWindow::MainWindow(QWidget *parent)
47
47
48
48
, glWidget_(nullptr )
49
49
, receiver_(new TCPReceiver())
50
- , reader_(new OsiReader(&config_.ch1DeltaDelay_))
50
+ , reader_(new OsiReader(&config_.ch1DeltaDelay_, config_.ch1EnableSendOut_, config_.ch1SendOutPortNum_.toStdString() ))
51
51
, osiparser_(new OsiParser(config_.osiMsgSaveThreshold_))
52
52
53
53
, glWidget2_(nullptr )
54
54
, receiver2_(new TCPReceiver())
55
- , reader2_(new OsiReader(&config_.ch2DeltaDelay_))
55
+ , reader2_(new OsiReader(&config_.ch2DeltaDelay_, config_.ch2EnableSendOut_, config_.ch2SendOutPortNum_.toStdString() ))
56
56
, osiparser2_(new OsiParser(config_.osiMsgSaveThreshold_))
57
57
58
58
, colorWidgets_()
@@ -199,6 +199,18 @@ MainWindow::LoadFileBrowse2()
199
199
}
200
200
}
201
201
202
+ void
203
+ MainWindow::EnableSendToNetwork ()
204
+ {
205
+ ui_->sendOutPortNum ->setEnabled (ui_->enableSendToNetwork ->checkState () == Qt::Checked);
206
+ }
207
+
208
+ void
209
+ MainWindow::EnableSendToNetwork2 ()
210
+ {
211
+ ui_->sendOutPortNum_2 ->setEnabled (ui_->enableSendToNetwork_2 ->checkState () == Qt::Checked);
212
+ }
213
+
202
214
void
203
215
MainWindow::UpdateCombineChannelMenu ()
204
216
{
@@ -432,11 +444,15 @@ MainWindow::ConnectSignalsToSlots()
432
444
connect (ui_->rbPlayback_2 , &QRadioButton::clicked, this , &MainWindow::RBPlayback2);
433
445
434
446
// load/save playback file
435
- connect (ui_->loadFile , &QLineEdit::textEdited, this , &MainWindow::LoadFileEdited);
447
+ connect (ui_->loadFile , &QLineEdit::textEdited, this , &MainWindow::LoadFileEdited);
436
448
connect (ui_->loadFileBrowse , &QPushButton::clicked, this , &MainWindow::LoadFileBrowse);
437
- connect (ui_->loadFile_2 , &QLineEdit::textEdited, this , &MainWindow::LoadFileEdited2);
449
+ connect (ui_->loadFile_2 , &QLineEdit::textEdited, this , &MainWindow::LoadFileEdited2);
438
450
connect (ui_->loadFileBrowse_2 , &QPushButton::clicked, this , &MainWindow::LoadFileBrowse2);
439
451
452
+ // enable sent out
453
+ connect (ui_->enableSendToNetwork , &QCheckBox::clicked, this , &MainWindow::EnableSendToNetwork);
454
+ connect (ui_->enableSendToNetwork_2 , &QCheckBox::clicked, this , &MainWindow::EnableSendToNetwork2);
455
+
440
456
// Play/Pause
441
457
connect (ui_->playPauseButton , &QToolButton::clicked, this , &MainWindow::PlayPauseButtonClicked);
442
458
connect (ui_->playPauseButton_2 , &QToolButton::clicked, this , &MainWindow::PlayPauseButtonClicked2);
@@ -617,6 +633,8 @@ MainWindow::EnablePlaybackGroup1(bool enable)
617
633
ui_->loadFileBrowse ->setEnabled (enable);
618
634
ui_->playbackDataType ->setEnabled (enable);
619
635
ui_->deltaDelay ->setEnabled (enable);
636
+ ui_->enableSendToNetwork ->setEnabled (enable);
637
+ ui_->sendOutPortNum ->setEnabled (enable && ui_->enableSendToNetwork ->checkState () == Qt::Checked);
620
638
}
621
639
622
640
void
@@ -626,6 +644,8 @@ MainWindow::EnablePlaybackGroup2(bool enable)
626
644
ui_->loadFileBrowse_2 ->setEnabled (enable);
627
645
ui_->playbackDataType_2 ->setEnabled (enable);
628
646
ui_->deltaDelay_2 ->setEnabled (enable);
647
+ ui_->enableSendToNetwork_2 ->setEnabled (enable);
648
+ ui_->sendOutPortNum_2 ->setEnabled (enable && ui_->enableSendToNetwork_2 ->checkState () == Qt::Checked);
629
649
}
630
650
631
651
void
756
776
MainWindow::UpdateConfigure ()
757
777
{
758
778
bool hasChange (false );
779
+ bool saveChange (false );
759
780
760
781
if (config_.ch1IPAddress_ != ui_->ipAddress ->text ())
761
782
{
@@ -789,10 +810,24 @@ MainWindow::UpdateConfigure()
789
810
790
811
if (config_.ch1DeltaDelay_ != ui_->deltaDelay ->text ().toInt ())
791
812
{
813
+ saveChange = true ;
792
814
config_.ch1DeltaDelay_ = ui_->deltaDelay ->text ().toInt ();
793
- config_.Save ();
794
815
}
795
- else if (hasChange)
816
+
817
+ if (config_.ch1EnableSendOut_ != (ui_->enableSendToNetwork ->checkState () == Qt::Checked))
818
+ {
819
+ saveChange = true ;
820
+ config_.ch1EnableSendOut_ = (ui_->enableSendToNetwork ->checkState () == Qt::Checked);
821
+ }
822
+
823
+ if (config_.ch1SendOutPortNum_ != ui_->sendOutPortNum ->text ())
824
+ {
825
+ saveChange = true ;
826
+ config_.ch1SendOutPortNum_ = ui_->sendOutPortNum ->text ();
827
+ reader_->SetSendOutPortNum (config_.ch1SendOutPortNum_ .toStdString ());
828
+ }
829
+
830
+ if (hasChange || saveChange)
796
831
config_.Save ();
797
832
798
833
return hasChange;
802
837
MainWindow::UpdateConfigure2 ()
803
838
{
804
839
bool hasChange (false );
840
+ bool saveChange (false );
805
841
806
842
if (config_.ch2IPAddress_ != ui_->ipAddress_2 ->text ())
807
843
{
@@ -835,10 +871,24 @@ MainWindow::UpdateConfigure2()
835
871
836
872
if (config_.ch2DeltaDelay_ != ui_->deltaDelay_2 ->text ().toInt ())
837
873
{
874
+ saveChange = true ;
838
875
config_.ch2DeltaDelay_ = ui_->deltaDelay_2 ->text ().toInt ();
839
- config_.Save ();
840
876
}
841
- else if (hasChange)
877
+
878
+ if (config_.ch2EnableSendOut_ != (ui_->enableSendToNetwork_2 ->checkState () == Qt::Checked))
879
+ {
880
+ saveChange = true ;
881
+ config_.ch2EnableSendOut_ = (ui_->enableSendToNetwork_2 ->checkState () == Qt::Checked);
882
+ }
883
+
884
+ if (config_.ch2SendOutPortNum_ != ui_->sendOutPortNum_2 ->text ())
885
+ {
886
+ saveChange = true ;
887
+ config_.ch2SendOutPortNum_ = ui_->sendOutPortNum_2 ->text ();
888
+ reader2_->SetSendOutPortNum (config_.ch2SendOutPortNum_ .toStdString ());
889
+ }
890
+
891
+ if (hasChange || saveChange)
842
892
config_.Save ();
843
893
844
894
return hasChange;
@@ -855,13 +905,25 @@ MainWindow::InitLoadConfigure()
855
905
ui_->loadFile ->setText (config_.ch1LoadFile_ );
856
906
ui_->playbackDataType ->setCurrentIndex ( static_cast <int >(config_.ch1PlaybackDataType_ ) );
857
907
ui_->deltaDelay ->setText (QString::number (config_.ch1DeltaDelay_ ));
908
+ if (config_.ch1EnableSendOut_ )
909
+ ui_->enableSendToNetwork ->setCheckState (Qt::Checked);
910
+ else
911
+ ui_->enableSendToNetwork ->setCheckState (Qt::Unchecked);
912
+ ui_->sendOutPortNum ->setText (config_.ch1SendOutPortNum_ );
913
+ reader_->SetSendOutPortNum (config_.ch1SendOutPortNum_ .toStdString ());
858
914
859
915
ui_->ipAddress_2 ->setText (config_.ch2IPAddress_ );
860
916
ui_->portNumber_2 ->setText (config_.ch2PortNum_ );
861
917
ui_->dataType_2 ->setCurrentIndex ( static_cast <int >(config_.ch2DataType_ ) );
862
918
ui_->loadFile_2 ->setText (config_.ch2LoadFile_ );
863
919
ui_->playbackDataType_2 ->setCurrentIndex ( static_cast <int >(config_.ch2PlaybackDataType_ ) );
864
920
ui_->deltaDelay_2 ->setText (QString::number (config_.ch2DeltaDelay_ ));
921
+ if (config_.ch2EnableSendOut_ )
922
+ ui_->enableSendToNetwork_2 ->setCheckState (Qt::Checked);
923
+ else
924
+ ui_->enableSendToNetwork_2 ->setCheckState (Qt::Unchecked);
925
+ ui_->sendOutPortNum_2 ->setText (config_.ch2SendOutPortNum_ );
926
+ reader2_->SetSendOutPortNum (config_.ch2SendOutPortNum_ .toStdString ());
865
927
866
928
ui_->actionCombiCh ->setChecked (config_.combineChannel_ );
867
929
ui_->actionShowGrid ->setChecked (config_.showGrid_ );
@@ -1122,17 +1184,32 @@ MainWindow::Play()
1122
1184
void
1123
1185
MainWindow::TogglePause ()
1124
1186
{
1187
+ QString errMsg;
1188
+
1125
1189
if (isConnected_)
1126
1190
{
1127
1191
receiver_->isPaused_ = isPlaying_;
1128
1192
}
1129
1193
1130
1194
if (isPlayed_)
1131
1195
{
1132
- reader_->isPaused_ = isPlaying_;
1196
+ if (isPlaying_)
1197
+ {
1198
+ reader_->isPaused_ = true ;
1199
+ reader_->SetupConnection (false );
1200
+ }
1201
+ else
1202
+ {
1203
+ errMsg = reader_->SetupConnection (true );
1204
+ if (errMsg.isEmpty ())
1205
+ reader_->isPaused_ = false ;
1206
+ else
1207
+ ShowErrorMessage (errMsg);
1208
+ }
1133
1209
}
1134
1210
1135
- isPlaying_ = !isPlaying_;
1211
+ if (errMsg.isEmpty ())
1212
+ isPlaying_ = !isPlaying_;
1136
1213
}
1137
1214
1138
1215
void
@@ -1167,17 +1244,31 @@ MainWindow::Play2()
1167
1244
void
1168
1245
MainWindow::TogglePause2 ()
1169
1246
{
1247
+ QString errMsg;
1248
+
1170
1249
if (isConnected2_)
1171
1250
{
1172
1251
receiver2_->isPaused_ = isPlaying2_;
1173
1252
}
1174
-
1175
- if (isPlayed2_)
1253
+ else if (isPlayed2_)
1176
1254
{
1177
- reader2_->isPaused_ = isPlaying2_;
1255
+ if (isPlaying2_)
1256
+ {
1257
+ reader2_->isPaused_ = true ;
1258
+ reader2_->SetupConnection (false );
1259
+ }
1260
+ else
1261
+ {
1262
+ errMsg = reader2_->SetupConnection (true );
1263
+ if (errMsg.isEmpty ())
1264
+ reader2_->isPaused_ = false ;
1265
+ else
1266
+ ShowErrorMessage (errMsg);
1267
+ }
1178
1268
}
1179
1269
1180
- isPlaying2_ = !isPlaying2_;
1270
+ if (errMsg.isEmpty ())
1271
+ isPlaying2_ = !isPlaying2_;
1181
1272
}
1182
1273
1183
1274
void
@@ -1269,7 +1360,8 @@ MainWindow::Disconnected2(const QString& message)
1269
1360
UpdateCombineChannelMenu ();
1270
1361
}
1271
1362
1272
- QString MainWindow::GetStringFromMilliSecond (int milliSec)
1363
+ QString
1364
+ MainWindow::GetStringFromMilliSecond (int milliSec)
1273
1365
{
1274
1366
QString varString;
1275
1367
0 commit comments