2023-02-23 16:08:47 -05:00
# include "digiSettingsPanel.h"
2023-01-25 17:16:14 -05:00
# include <QLabel>
2023-02-23 16:08:47 -05:00
# include <QFileDialog>
2023-02-28 17:08:34 -05:00
std : : vector < std : : pair < std : : string , Reg > > infoIndex = { { " Serial Num : " , DIGIPARA : : DIG : : SerialNumber } ,
{ " IP : " , DIGIPARA : : DIG : : IPAddress } ,
{ " Model Name : " , DIGIPARA : : DIG : : ModelName } ,
{ " FPGA version : " , DIGIPARA : : DIG : : FPGA_firmwareVersion } ,
{ " DPP Type : " , DIGIPARA : : DIG : : FirmwareType } ,
{ " CUP version : " , DIGIPARA : : DIG : : CupVer } ,
{ " ADC bits : " , DIGIPARA : : DIG : : ADC_bit } ,
{ " ADC rate [Msps] : " , DIGIPARA : : DIG : : ADC_SampleRate } ,
{ " Num. of Channel : " , DIGIPARA : : DIG : : NumberOfChannel } ,
{ " Input range [Vpp] : " , DIGIPARA : : DIG : : InputDynamicRange } ,
{ " Input Type : " , DIGIPARA : : DIG : : InputType } ,
{ " Input Impedance [Ohm] : " , DIGIPARA : : DIG : : InputImpedance }
2023-02-23 16:08:47 -05:00
} ;
DigiSettingsPanel : : DigiSettingsPanel ( Digitizer2Gen * * digi , unsigned short nDigi , QWidget * parent ) : QWidget ( parent ) {
qDebug ( ) < < " DigiSettingsPanel constructor " ;
2023-01-25 17:16:14 -05:00
setWindowTitle ( " Digitizers Settings " ) ;
2023-02-28 13:28:30 -05:00
setGeometry ( 0 , 0 , 1800 , 900 ) ;
2023-01-25 18:27:05 -05:00
//setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
2023-01-25 17:16:14 -05:00
this - > digi = digi ;
this - > nDigi = nDigi ;
2023-02-23 16:08:47 -05:00
if ( nDigi > MaxNumberOfDigitizer ) {
this - > nDigi = MaxNumberOfChannel ;
qDebug ( ) < < " Please increase the MaxNumberOfChannel " ;
}
2023-01-25 17:16:14 -05:00
2023-02-23 16:08:47 -05:00
ID = 0 ;
2023-02-24 19:21:27 -05:00
enableSignalSlot = false ;
2023-01-25 17:16:14 -05:00
2023-01-30 18:40:24 -05:00
QVBoxLayout * mainLayout = new QVBoxLayout ( this ) ; this - > setLayout ( mainLayout ) ;
QTabWidget * tabWidget = new QTabWidget ( this ) ; mainLayout - > addWidget ( tabWidget ) ;
2023-02-23 16:08:47 -05:00
connect ( tabWidget , & QTabWidget : : currentChanged , this , [ = ] ( int index ) { ID = index ; } ) ;
2023-01-25 17:16:14 -05:00
2023-02-22 20:07:39 -05:00
//@========================== Tab for each digitizer
2023-01-30 18:40:24 -05:00
for ( unsigned short iDigi = 0 ; iDigi < this - > nDigi ; iDigi + + ) {
2023-01-25 17:16:14 -05:00
2023-02-23 16:08:47 -05:00
QScrollArea * scrollArea = new QScrollArea ( this ) ;
2023-01-25 17:16:14 -05:00
scrollArea - > setWidgetResizable ( true ) ;
scrollArea - > setSizePolicy ( QSizePolicy : : Expanding , QSizePolicy : : Expanding ) ;
2023-02-02 19:01:10 -05:00
tabWidget - > addTab ( scrollArea , " Digi- " + QString : : number ( digi [ iDigi ] - > GetSerialNumber ( ) ) ) ;
2023-02-23 16:08:47 -05:00
QWidget * tab = new QWidget ( tabWidget ) ;
scrollArea - > setWidget ( tab ) ;
2023-01-27 18:52:03 -05:00
2023-02-23 16:08:47 -05:00
QHBoxLayout * tabLayout_H = new QHBoxLayout ( tab ) ; //tab->setLayout(tabLayout_H);
QVBoxLayout * tabLayout_V1 = new QVBoxLayout ( ) ; tabLayout_H - > addLayout ( tabLayout_V1 ) ;
QVBoxLayout * tabLayout_V2 = new QVBoxLayout ( ) ; tabLayout_H - > addLayout ( tabLayout_V2 ) ;
2023-01-25 17:16:14 -05:00
2023-02-22 20:07:39 -05:00
{ //^====================== Group of Digitizer Info
2023-01-27 18:52:03 -05:00
QGroupBox * infoBox = new QGroupBox ( " Board Info " , tab ) ;
2023-02-28 13:28:30 -05:00
//infoBox->setSizePolicy(sizePolicy);
2023-01-27 18:52:03 -05:00
QGridLayout * infoLayout = new QGridLayout ( infoBox ) ;
2023-02-23 16:08:47 -05:00
tabLayout_V1 - > addWidget ( infoBox ) ;
2023-01-27 18:52:03 -05:00
const unsigned short nRow = 4 ;
2023-02-23 16:08:47 -05:00
for ( unsigned short j = 0 ; j < ( unsigned short ) infoIndex . size ( ) ; j + + ) {
QLabel * lab = new QLabel ( QString : : fromStdString ( infoIndex [ j ] . first ) , tab ) ;
2023-02-28 17:08:34 -05:00
lab - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
2023-02-23 16:08:47 -05:00
leInfo [ iDigi ] [ j ] = new QLineEdit ( tab ) ;
leInfo [ iDigi ] [ j ] - > setReadOnly ( true ) ;
2023-02-28 17:08:34 -05:00
leInfo [ iDigi ] [ j ] - > setText ( QString : : fromStdString ( digi [ iDigi ] - > ReadValue ( infoIndex [ j ] . second ) ) ) ;
2023-01-27 18:52:03 -05:00
infoLayout - > addWidget ( lab , j % nRow , 2 * ( j / nRow ) ) ;
2023-02-23 16:08:47 -05:00
infoLayout - > addWidget ( leInfo [ iDigi ] [ j ] , j % nRow , 2 * ( j / nRow ) + 1 ) ;
2023-01-27 18:52:03 -05:00
}
2023-01-25 17:16:14 -05:00
}
2023-01-27 18:52:03 -05:00
2023-02-22 20:07:39 -05:00
{ //^====================== Group Board status
2023-01-27 18:52:03 -05:00
QGroupBox * statusBox = new QGroupBox ( " Board Status " , tab ) ;
QGridLayout * statusLayout = new QGridLayout ( statusBox ) ;
2023-02-28 13:28:30 -05:00
statusLayout - > setAlignment ( Qt : : AlignLeft ) ;
2023-02-22 20:07:39 -05:00
statusLayout - > setHorizontalSpacing ( 0 ) ;
2023-02-23 16:08:47 -05:00
tabLayout_V1 - > addWidget ( statusBox ) ;
2023-02-22 20:07:39 -05:00
//------- LED Status
QLabel * lbLED = new QLabel ( " LED status : " ) ;
lbLED - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
statusLayout - > addWidget ( lbLED , 0 , 0 ) ;
for ( int i = 0 ; i < 19 ; i + + ) {
2023-02-23 16:08:47 -05:00
LEDStatus [ iDigi ] [ i ] = new QPushButton ( tab ) ;
LEDStatus [ iDigi ] [ i ] - > setEnabled ( false ) ;
LEDStatus [ iDigi ] [ i ] - > setFixedSize ( QSize ( 30 , 30 ) ) ;
statusLayout - > addWidget ( LEDStatus [ iDigi ] [ i ] , 0 , 1 + i ) ;
2023-02-22 20:07:39 -05:00
}
//------- ACD Status
QLabel * lbACQ = new QLabel ( " ACQ status : " ) ;
lbACQ - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
statusLayout - > addWidget ( lbACQ , 1 , 0 ) ;
for ( int i = 0 ; i < 7 ; i + + ) {
2023-02-23 16:08:47 -05:00
ACQStatus [ iDigi ] [ i ] = new QPushButton ( tab ) ;
ACQStatus [ iDigi ] [ i ] - > setEnabled ( false ) ;
ACQStatus [ iDigi ] [ i ] - > setFixedSize ( QSize ( 30 , 30 ) ) ;
statusLayout - > addWidget ( ACQStatus [ iDigi ] [ i ] , 1 , 1 + i ) ;
2023-02-22 20:07:39 -05:00
}
//------- Temperatures
QLabel * lbTemp = new QLabel ( " ADC Temperature [C] : " ) ;
lbTemp - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
statusLayout - > addWidget ( lbTemp , 2 , 0 ) ;
2023-02-24 19:21:27 -05:00
for ( int i = 0 ; i < 8 ; i + + ) {
leTemp [ iDigi ] [ i ] = new QLineEdit ( tab ) ;
leTemp [ iDigi ] [ i ] - > setReadOnly ( true ) ;
leTemp [ iDigi ] [ i ] - > setAlignment ( Qt : : AlignHCenter ) ;
statusLayout - > addWidget ( leTemp [ iDigi ] [ i ] , 2 , 1 + 2 * i , 1 , 2 ) ;
2023-02-22 20:07:39 -05:00
}
2023-02-28 13:28:30 -05:00
for ( int i = 0 ; i < statusLayout - > columnCount ( ) ; i + + ) statusLayout - > setColumnStretch ( i , 0 ) ;
2023-01-27 18:52:03 -05:00
}
2023-02-23 16:08:47 -05:00
{ //^====================== Board Setting Buttons
QGridLayout * bnLayout = new QGridLayout ( ) ;
2023-02-28 13:28:30 -05:00
tabLayout_V1 - > addLayout ( bnLayout ) ;
2023-01-25 18:27:05 -05:00
int rowId = 0 ;
//-------------------------------------
2023-02-23 16:08:47 -05:00
QLabel * lbSettingFile = new QLabel ( " Setting File : " , tab ) ;
lbSettingFile - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
bnLayout - > addWidget ( lbSettingFile , rowId , 0 ) ;
leSettingFile [ iDigi ] = new QLineEdit ( tab ) ;
leSettingFile [ iDigi ] - > setReadOnly ( true ) ;
bnLayout - > addWidget ( leSettingFile [ iDigi ] , rowId , 1 , 1 , 9 ) ;
//-------------------------------------
rowId + + ;
QPushButton * bnReadSettngs = new QPushButton ( " Refresh Settings " , tab ) ;
bnLayout - > addWidget ( bnReadSettngs , rowId , 0 , 1 , 2 ) ;
connect ( bnReadSettngs , & QPushButton : : clicked , this , & DigiSettingsPanel : : RefreshSettings ) ;
2023-01-26 19:12:18 -05:00
QPushButton * bnResetBd = new QPushButton ( " Reset Board " , tab ) ;
2023-02-23 16:08:47 -05:00
bnLayout - > addWidget ( bnResetBd , rowId , 2 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
connect ( bnResetBd , & QPushButton : : clicked , this , [ = ] ( ) {
emit sendLogMsg ( " Reset Digitizer- " + QString : : number ( digi [ ID ] - > GetSerialNumber ( ) ) ) ;
digi [ ID ] - > Reset ( ) ;
} ) ;
2023-01-26 19:12:18 -05:00
QPushButton * bnDefaultSetting = new QPushButton ( " Set Default Settings " , tab ) ;
2023-02-23 16:08:47 -05:00
bnLayout - > addWidget ( bnDefaultSetting , rowId , 4 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
connect ( bnDefaultSetting , & QPushButton : : clicked , this , [ = ] ( ) {
emit sendLogMsg ( " Program Digitizer- " + QString : : number ( digi [ ID ] - > GetSerialNumber ( ) ) + " to default PHA. " ) ;
digi [ ID ] - > ProgramPHA ( ) ;
} ) ;
2023-01-26 19:12:18 -05:00
2023-02-22 20:07:39 -05:00
QPushButton * bnSaveSettings = new QPushButton ( " Save Settings " , tab ) ;
2023-02-23 16:08:47 -05:00
bnLayout - > addWidget ( bnSaveSettings , rowId , 6 , 1 , 2 ) ;
connect ( bnSaveSettings , & QPushButton : : clicked , this , & DigiSettingsPanel : : SaveSettings ) ;
2023-02-22 20:07:39 -05:00
QPushButton * bnLoadSettings = new QPushButton ( " Load Settings " , tab ) ;
2023-02-23 16:08:47 -05:00
bnLayout - > addWidget ( bnLoadSettings , rowId , 8 , 1 , 2 ) ;
connect ( bnLoadSettings , & QPushButton : : clicked , this , & DigiSettingsPanel : : LoadSettings ) ;
2023-02-22 20:07:39 -05:00
2023-02-27 15:23:28 -05:00
//---------------------------------------
rowId + + ;
QPushButton * bnClearData = new QPushButton ( " Clear Data " , tab ) ;
bnLayout - > addWidget ( bnClearData , rowId , 0 , 1 , 2 ) ;
connect ( bnClearData , & QPushButton : : clicked , this , [ = ] ( ) {
digi [ ID ] - > SendCommand ( DIGIPARA : : DIG : : ClearData ) ; } ) ;
QPushButton * bnArmACQ = new QPushButton ( " Arm ACQ " , tab ) ;
bnLayout - > addWidget ( bnArmACQ , rowId , 2 , 1 , 2 ) ;
connect ( bnArmACQ , & QPushButton : : clicked , this , [ = ] ( ) {
digi [ ID ] - > SendCommand ( DIGIPARA : : DIG : : ArmACQ ) ; } ) ;
QPushButton * bnDisarmACQ = new QPushButton ( " Disarm ACQ " , tab ) ;
bnLayout - > addWidget ( bnDisarmACQ , rowId , 4 , 1 , 2 ) ;
connect ( bnDisarmACQ , & QPushButton : : clicked , this , [ = ] ( ) {
digi [ ID ] - > SendCommand ( DIGIPARA : : DIG : : DisarmACQ ) ; } ) ;
QPushButton * bnSoftwareStart = new QPushButton ( " Software Start ACQ " , tab ) ;
bnLayout - > addWidget ( bnSoftwareStart , rowId , 6 , 1 , 2 ) ;
connect ( bnSoftwareStart , & QPushButton : : clicked , this , [ = ] ( ) {
digi [ ID ] - > SendCommand ( DIGIPARA : : DIG : : SoftwareStartACQ ) ; } ) ;
QPushButton * bnSoftwareStop = new QPushButton ( " Software Stop ACQ " , tab ) ;
bnLayout - > addWidget ( bnSoftwareStop , rowId , 8 , 1 , 2 ) ;
connect ( bnSoftwareStop , & QPushButton : : clicked , this , [ = ] ( ) {
digi [ ID ] - > SendCommand ( DIGIPARA : : DIG : : SoftwareStopACQ ) ; } ) ;
2023-02-28 13:28:30 -05:00
//---------------
if ( digi [ iDigi ] - > IsDummy ( ) ) {
bnReadSettngs - > setEnabled ( false ) ;
bnResetBd - > setEnabled ( false ) ;
bnDefaultSetting - > setEnabled ( false ) ;
bnClearData - > setEnabled ( false ) ;
bnArmACQ - > setEnabled ( false ) ;
bnDisarmACQ - > setEnabled ( false ) ;
bnSoftwareStart - > setEnabled ( false ) ;
bnSoftwareStop - > setEnabled ( false ) ;
}
2023-02-23 16:08:47 -05:00
}
2023-03-01 18:27:17 -05:00
2023-02-23 16:08:47 -05:00
{ //^====================== Group Board settings
QGroupBox * digiBox = new QGroupBox ( " Board Settings " , tab ) ;
2023-02-28 13:28:30 -05:00
//digiBox->setSizePolicy(sizePolicy);
2023-02-23 16:08:47 -05:00
QGridLayout * boardLayout = new QGridLayout ( digiBox ) ;
2023-02-28 13:28:30 -05:00
tabLayout_V1 - > addWidget ( digiBox ) ;
2023-02-23 16:08:47 -05:00
int rowId = 0 ;
2023-01-27 18:52:03 -05:00
//-------------------------------------
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbClockSource [ iDigi ] , DIGIPARA : : DIG : : ClockSource , - 1 , true , " Clock Source : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-01-27 18:52:03 -05:00
2023-01-26 19:12:18 -05:00
//-------------------------------------
rowId + + ;
2023-01-25 18:27:05 -05:00
QLabel * lbStartSource = new QLabel ( " Start Source : " , tab ) ;
lbStartSource - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbStartSource , rowId , 0 ) ;
2023-02-27 15:23:28 -05:00
for ( int i = 0 ; i < ( int ) DIGIPARA : : DIG : : StartSource . GetAnswers ( ) . size ( ) ; i + + ) {
ckbStartSource [ iDigi ] [ i ] = new QCheckBox ( QString : : fromStdString ( ( DIGIPARA : : DIG : : StartSource . GetAnswers ( ) ) [ i ] . second ) , tab ) ;
boardLayout - > addWidget ( ckbStartSource [ iDigi ] [ i ] , rowId , 1 + i ) ;
2023-03-01 12:26:37 -05:00
connect ( ckbStartSource [ iDigi ] [ i ] , & QCheckBox : : stateChanged , this , & DigiSettingsPanel : : SetStartSource ) ;
2023-02-24 19:21:27 -05:00
}
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
QLabel * lbGlobalTrgSource = new QLabel ( " Global Trigger Source : " , tab ) ;
lbGlobalTrgSource - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbGlobalTrgSource , rowId , 0 ) ;
2023-02-27 15:23:28 -05:00
for ( int i = 0 ; i < ( int ) DIGIPARA : : DIG : : GlobalTriggerSource . GetAnswers ( ) . size ( ) ; i + + ) {
ckbGlbTrgSource [ iDigi ] [ i ] = new QCheckBox ( QString : : fromStdString ( ( DIGIPARA : : DIG : : GlobalTriggerSource . GetAnswers ( ) ) [ i ] . second ) , tab ) ;
boardLayout - > addWidget ( ckbGlbTrgSource [ iDigi ] [ i ] , rowId , 1 + i ) ;
}
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbTrgOut [ iDigi ] , DIGIPARA : : DIG : : TrgOutMode , - 1 , true , " Trg-OUT Mode : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbGPIO [ iDigi ] , DIGIPARA : : DIG : : GPIOMode , - 1 , true , " GPIO Mode : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-01-25 18:27:05 -05:00
2023-02-22 20:07:39 -05:00
//-------------------------------------
QLabel * lbAutoDisarmAcq = new QLabel ( " Auto disarm ACQ : " , tab ) ;
lbAutoDisarmAcq - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbAutoDisarmAcq , rowId , 4 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
cbbAutoDisarmAcq [ iDigi ] = new QComboBox ( tab ) ;
boardLayout - > addWidget ( cbbAutoDisarmAcq [ iDigi ] , rowId , 6 ) ;
2023-02-28 13:28:30 -05:00
SetupShortComboBox ( cbbAutoDisarmAcq [ iDigi ] , DIGIPARA : : DIG : : EnableAutoDisarmACQ ) ;
2023-02-22 20:07:39 -05:00
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbBusyIn [ iDigi ] , DIGIPARA : : DIG : : BusyInSource , - 1 , true , " Busy In Source : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
2023-02-22 20:07:39 -05:00
QLabel * lbStatEvents = new QLabel ( " Stat. Event : " , tab ) ;
lbStatEvents - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbStatEvents , rowId , 4 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
cbbStatEvents [ iDigi ] = new QComboBox ( tab ) ;
boardLayout - > addWidget ( cbbStatEvents [ iDigi ] , rowId , 6 ) ;
2023-02-28 13:28:30 -05:00
SetupShortComboBox ( cbbStatEvents [ iDigi ] , DIGIPARA : : DIG : : EnableStatisticEvents ) ;
2023-03-01 12:26:37 -05:00
connect ( cbbStatEvents [ iDigi ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : EnableStatisticEvents , cbbStatEvents [ ID ] - > currentData ( ) . toString ( ) . toStdString ( ) ) ;
} ) ;
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbSyncOut [ iDigi ] , DIGIPARA : : DIG : : SyncOutMode , - 1 , true , " Sync Out mode : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-01-25 17:16:14 -05:00
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbBoardVetoSource [ iDigi ] , DIGIPARA : : DIG : : BoardVetoSource , - 1 , true , " Board Veto Source : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
QLabel * lbBdVetoWidth = new QLabel ( " Board Veto Width [ns] : " , tab ) ;
2023-01-25 18:27:05 -05:00
lbBdVetoWidth - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbBdVetoWidth , rowId , 3 , 1 , 2 ) ;
2023-02-27 15:23:28 -05:00
spbBdVetoWidth [ iDigi ] = new QSpinBox ( tab ) ; // may be QDoubleSpinBox
spbBdVetoWidth [ iDigi ] - > setMinimum ( 0 ) ;
spbBdVetoWidth [ iDigi ] - > setMaximum ( 38360 ) ;
spbBdVetoWidth [ iDigi ] - > setSingleStep ( 20 ) ;
boardLayout - > addWidget ( spbBdVetoWidth [ iDigi ] , rowId , 5 ) ;
2023-03-01 18:27:17 -05:00
connect ( spbBdVetoWidth [ iDigi ] , & QSpinBox : : valueChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : BoardVetoWidth , std : : to_string ( spbBdVetoWidth [ iDigi ] - > value ( ) ) , - 1 ) ;
} ) ;
2023-01-25 18:27:05 -05:00
2023-02-27 15:23:28 -05:00
cbbBdVetoPolarity [ iDigi ] = new QComboBox ( tab ) ;
boardLayout - > addWidget ( cbbBdVetoPolarity [ iDigi ] , rowId , 6 ) ;
2023-02-28 13:28:30 -05:00
SetupShortComboBox ( cbbBdVetoPolarity [ iDigi ] , DIGIPARA : : DIG : : BoardVetoPolarity ) ;
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbRunDelay [ iDigi ] , DIGIPARA : : DIG : : RunDelay , - 1 , " Run Delay [ns] : " , boardLayout , rowId , 0 ) ;
2023-01-25 18:27:05 -05:00
//-------------------------------------
2023-02-27 15:23:28 -05:00
QLabel * lbClockOutDelay = new QLabel ( " Temp. Clock Out Delay [ps] : " , tab ) ;
2023-01-25 18:27:05 -05:00
lbClockOutDelay - > setAlignment ( Qt : : AlignRight ) ;
2023-02-22 20:07:39 -05:00
boardLayout - > addWidget ( lbClockOutDelay , rowId , 3 , 1 , 2 ) ;
2023-01-25 18:27:05 -05:00
2023-02-27 15:23:28 -05:00
dsbVolatileClockOutDelay [ iDigi ] = new QDoubleSpinBox ( tab ) ;
dsbVolatileClockOutDelay [ iDigi ] - > setMinimum ( - 18888.888 ) ;
dsbVolatileClockOutDelay [ iDigi ] - > setMaximum ( 18888.888 ) ;
dsbVolatileClockOutDelay [ iDigi ] - > setValue ( 0 ) ;
boardLayout - > addWidget ( dsbVolatileClockOutDelay [ iDigi ] , rowId , 5 ) ;
2023-03-01 18:27:17 -05:00
connect ( dsbVolatileClockOutDelay [ iDigi ] , & QDoubleSpinBox : : valueChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : VolatileClockOutDelay , std : : to_string ( dsbVolatileClockOutDelay [ iDigi ] - > value ( ) ) , - 1 ) ;
} ) ;
2023-01-25 18:27:05 -05:00
//-------------------------------------
rowId + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbIOLevel [ iDigi ] , DIGIPARA : : DIG : : IO_Level , - 1 , true , " IO Level : " , boardLayout , rowId , 0 , 1 , 2 ) ;
2023-01-25 18:27:05 -05:00
2023-02-27 15:23:28 -05:00
QLabel * lbClockOutDelay2 = new QLabel ( " Perm. Clock Out Delay [ps] : " , tab ) ;
lbClockOutDelay2 - > setAlignment ( Qt : : AlignRight ) ;
boardLayout - > addWidget ( lbClockOutDelay2 , rowId , 3 , 1 , 2 ) ;
dsbClockOutDelay [ iDigi ] = new QDoubleSpinBox ( tab ) ;
dsbClockOutDelay [ iDigi ] - > setMinimum ( - 18888.888 ) ;
dsbClockOutDelay [ iDigi ] - > setMaximum ( 18888.888 ) ;
dsbClockOutDelay [ iDigi ] - > setValue ( 0 ) ;
boardLayout - > addWidget ( dsbClockOutDelay [ iDigi ] , rowId , 5 ) ;
2023-03-01 18:27:17 -05:00
connect ( dsbClockOutDelay [ iDigi ] , & QDoubleSpinBox : : valueChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : VolatileClockOutDelay , std : : to_string ( dsbClockOutDelay [ iDigi ] - > value ( ) ) , - 1 ) ;
} ) ;
2023-01-25 18:27:05 -05:00
}
2023-03-01 18:27:17 -05:00
2023-02-27 15:23:28 -05:00
{ //^====================== Test Pulse settings
testPulseBox = new QGroupBox ( " Test Pulse Settings " , tab ) ;
2023-02-28 13:28:30 -05:00
//testPulseBox->setSizePolicy(sizePolicy);
tabLayout_V1 - > addWidget ( testPulseBox ) ;
2023-02-27 15:23:28 -05:00
QGridLayout * testPulseLayout = new QGridLayout ( testPulseBox ) ;
2023-02-28 13:28:30 -05:00
testPulseLayout - > setAlignment ( Qt : : AlignLeft ) ;
2023-02-27 15:23:28 -05:00
QLabel * lbtestPuslePeriod = new QLabel ( " Period [ns] : " , tab ) ;
lbtestPuslePeriod - > setAlignment ( Qt : : AlignRight ) ;
testPulseLayout - > addWidget ( lbtestPuslePeriod , 0 , 0 ) ;
dsbTestPuslePeriod [ iDigi ] = new QDoubleSpinBox ( tab ) ;
dsbTestPuslePeriod [ iDigi ] - > setMinimum ( 0 ) ;
dsbTestPuslePeriod [ iDigi ] - > setMaximum ( 34359738360 ) ;
testPulseLayout - > addWidget ( dsbTestPuslePeriod [ iDigi ] , 0 , 1 ) ;
QLabel * lbtestPusleWidth = new QLabel ( " Width [ns] : " , tab ) ;
lbtestPusleWidth - > setAlignment ( Qt : : AlignRight ) ;
testPulseLayout - > addWidget ( lbtestPusleWidth , 0 , 2 ) ;
dsbTestPusleWidth [ iDigi ] = new QDoubleSpinBox ( tab ) ;
dsbTestPusleWidth [ iDigi ] - > setMinimum ( 0 ) ;
dsbTestPusleWidth [ iDigi ] - > setMaximum ( 34359738360 ) ;
testPulseLayout - > addWidget ( dsbTestPusleWidth [ iDigi ] , 0 , 3 ) ;
//------------------------------
QLabel * lbtestPusleLow = new QLabel ( " Low Level [LSB] : " , tab ) ;
lbtestPusleLow - > setAlignment ( Qt : : AlignRight ) ;
testPulseLayout - > addWidget ( lbtestPusleLow , 1 , 0 ) ;
spbTestPusleLowLevel [ iDigi ] = new QSpinBox ( tab ) ;
spbTestPusleLowLevel [ iDigi ] - > setMinimum ( 0 ) ;
spbTestPusleLowLevel [ iDigi ] - > setMaximum ( 65535 ) ;
testPulseLayout - > addWidget ( spbTestPusleLowLevel [ iDigi ] , 1 , 1 ) ;
QLabel * lbtestPusleHigh = new QLabel ( " High Level [LSB] : " , tab ) ;
lbtestPusleHigh - > setAlignment ( Qt : : AlignRight ) ;
testPulseLayout - > addWidget ( lbtestPusleHigh , 1 , 2 ) ;
spbTestPusleHighLevel [ iDigi ] = new QSpinBox ( tab ) ;
spbTestPusleHighLevel [ iDigi ] - > setMinimum ( 0 ) ;
spbTestPusleHighLevel [ iDigi ] - > setMaximum ( 65535 ) ;
testPulseLayout - > addWidget ( spbTestPusleHighLevel [ iDigi ] , 1 , 3 ) ;
}
2023-03-01 18:27:17 -05:00
2023-02-22 20:07:39 -05:00
{ //^====================== Group channel settings
2023-02-23 16:08:47 -05:00
QGroupBox * chBox = new QGroupBox ( " Channel Settings " , tab ) ;
2023-02-28 13:28:30 -05:00
//chBox->setSizePolicy(sizePolicy);
2023-02-23 16:08:47 -05:00
tabLayout_V2 - > addWidget ( chBox ) ;
2023-01-30 18:40:24 -05:00
QGridLayout * chLayout = new QGridLayout ( chBox ) ; //chBox->setLayout(chLayout);
2023-02-27 15:23:28 -05:00
QTabWidget * chTabWidget = new QTabWidget ( tab ) ; chLayout - > addWidget ( chTabWidget ) ;
2023-01-30 18:40:24 -05:00
2023-02-28 13:28:30 -05:00
{ //@.......... All Settings tab
2023-01-30 18:40:24 -05:00
QWidget * tab_All = new QWidget ( tab ) ;
2023-02-27 15:23:28 -05:00
//tab_All->setStyleSheet("background-color: #EEEEEE");
2023-02-28 13:28:30 -05:00
chTabWidget - > addTab ( tab_All , " All Settings " ) ;
2023-01-30 18:40:24 -05:00
QGridLayout * allLayout = new QGridLayout ( tab_All ) ;
2023-02-28 13:28:30 -05:00
allLayout - > setAlignment ( Qt : : AlignTop ) ;
2023-01-30 18:40:24 -05:00
2023-02-02 19:01:10 -05:00
unsigned short ch = digi [ iDigi ] - > GetNChannels ( ) ;
2023-01-30 18:40:24 -05:00
2023-02-27 15:23:28 -05:00
int rowID = 0 ;
2023-02-28 13:28:30 -05:00
{ //*--------- Group 1
QGroupBox * box1 = new QGroupBox ( " Input Settings " , tab ) ;
allLayout - > addWidget ( box1 ) ;
QGridLayout * layout1 = new QGridLayout ( box1 ) ;
rowID = 0 ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbOnOff [ iDigi ] [ ch ] , DIGIPARA : : CH : : ChannelEnable , - 1 , true , " On/Off " , layout1 , rowID , 0 ) ;
2023-02-28 13:28:30 -05:00
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbWaveSource [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveDataSource , - 1 , true , " Wave Data Source " , layout1 , rowID , 0 , 1 , 2 ) ;
2023-02-28 13:28:30 -05:00
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbWaveRes [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveResolution , - 1 , true , " Wave Resol. " , layout1 , rowID , 0 ) ;
SetupComboBox ( cbbWaveSave [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveSaving , - 1 , true , " Wave Save " , layout1 , rowID , 2 ) ;
rowID + + ;
SetupComboBox ( cbbParity [ iDigi ] [ ch ] , DIGIPARA : : CH : : Polarity , - 1 , true , " Parity " , layout1 , rowID , 0 ) ;
SetupComboBox ( cbbLowFilter [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterLowFreqFilter , - 1 , true , " Low Freq. Filter " , layout1 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbDCOffset [ iDigi ] [ ch ] , DIGIPARA : : CH : : DC_Offset , - 1 , " DC Offset [%] " , layout1 , rowID , 0 ) ;
SetupSpinBox ( spbThreshold [ iDigi ] [ ch ] , DIGIPARA : : CH : : TriggerThreshold , - 1 , " Threshold [LSB] " , layout1 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbInputRiseTime [ iDigi ] [ ch ] , DIGIPARA : : CH : : TimeFilterRiseTime , - 1 , " Input Rise Time [ns] " , layout1 , rowID , 0 ) ;
SetupSpinBox ( spbTriggerGuard [ iDigi ] [ ch ] , DIGIPARA : : CH : : TimeFilterRetriggerGuard , - 1 , " Trigger Guard [ns] " , layout1 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbRecordLength [ iDigi ] [ ch ] , DIGIPARA : : CH : : RecordLength , - 1 , " Record Length [ns] " , layout1 , rowID , 0 ) ;
SetupSpinBox ( spbPreTrigger [ iDigi ] [ ch ] , DIGIPARA : : CH : : PreTrigger , - 1 , " Pre Trigger [ns] " , layout1 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
}
2023-02-27 15:23:28 -05:00
2023-02-28 13:28:30 -05:00
{ //*--------- Group 3
QGroupBox * box3 = new QGroupBox ( " Trap. Settings " , tab ) ;
allLayout - > addWidget ( box3 ) ;
QGridLayout * layout3 = new QGridLayout ( box3 ) ;
//------------------------------
2023-03-01 12:26:37 -05:00
rowID = 0 ;
SetupSpinBox ( spbTrapRiseTime [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterRiseTime , - 1 , " Trap. Rise Time [ns] " , layout3 , rowID , 0 ) ;
SetupSpinBox ( spbTrapFlatTop [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterFlatTop , - 1 , " Trap. Flat Top [ns] " , layout3 , rowID , 2 ) ;
SetupSpinBox ( spbTrapPoleZero [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPoleZero , - 1 , " Trap. Pole Zero [ns] " , layout3 , rowID , 4 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbPeaking [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPeakingPosition , - 1 , " Peaking [%] " , layout3 , rowID , 0 ) ;
SetupSpinBox ( spbBaselineGuard [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterBaselineGuard , - 1 , " Baseline Guard [ns] " , layout3 , rowID , 2 ) ;
SetupSpinBox ( spbPileupGuard [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPileUpGuard , - 1 , " Pile-up Guard [ns] " , layout3 , rowID , 4 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbPeakingAvg [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPeakingAvg , - 1 , true , " Peak Avg " , layout3 , rowID , 0 ) ;
SetupComboBox ( cbbBaselineAvg [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterBaselineAvg , - 1 , true , " Baseline Avg " , layout3 , rowID , 2 ) ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbFineGain [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergyFilterFineGain , - 1 , " Fine Gain " , layout3 , rowID , 4 ) ;
2023-02-28 13:28:30 -05:00
}
{ //*--------- Group 4
QGroupBox * box4 = new QGroupBox ( " Probe Settings " , tab ) ;
allLayout - > addWidget ( box4 ) ;
QGridLayout * layout4 = new QGridLayout ( box4 ) ;
//------------------------------
rowID = 0 ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbAnaProbe0 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveAnalogProbe0 , - 1 , true , " Analog Prob. 0 " , layout4 , rowID , 0 , 1 , 2 ) ;
SetupComboBox ( cbbAnaProbe1 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveAnalogProbe1 , - 1 , true , " Analog Prob. 1 " , layout4 , rowID , 3 , 1 , 2 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbDigProbe0 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe0 , - 1 , true , " Digitial Prob. 0 " , layout4 , rowID , 0 , 1 , 2 ) ;
SetupComboBox ( cbbDigProbe1 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe1 , - 1 , true , " Digitial Prob. 1 " , layout4 , rowID , 3 , 1 , 2 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbDigProbe2 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe2 , - 1 , true , " Digitial Prob. 2 " , layout4 , rowID , 0 , 1 , 2 ) ;
SetupComboBox ( cbbDigProbe3 [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe3 , - 1 , true , " Digitial Prob. 3 " , layout4 , rowID , 3 , 1 , 2 ) ;
2023-02-28 13:28:30 -05:00
}
{ //*--------- Group 5
QGroupBox * box5 = new QGroupBox ( " Trigger Settings " , tab ) ;
allLayout - > addWidget ( box5 ) ;
QGridLayout * layout5 = new QGridLayout ( box5 ) ;
//------------------------------
rowID = 0 ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbEvtTrigger [ iDigi ] [ ch ] , DIGIPARA : : CH : : EventTriggerSource , - 1 , true , " Event Trig. Source " , layout5 , rowID , 0 ) ;
SetupComboBox ( cbbWaveTrigger [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveTriggerSource , - 1 , true , " Wave Trig. Source " , layout5 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbChVetoSrc [ iDigi ] [ ch ] , DIGIPARA : : CH : : ChannelVetoSource , - 1 , true , " Veto Source " , layout5 , rowID , 0 ) ;
2023-02-28 13:28:30 -05:00
QLabel * lbTriggerMask = new QLabel ( " Trigger Mask " , tab ) ;
lbTriggerMask - > setAlignment ( Qt : : AlignCenter | Qt : : AlignRight ) ;
layout5 - > addWidget ( lbTriggerMask , rowID , 2 ) ;
leTriggerMask [ iDigi ] [ ch ] = new QLineEdit ( tab ) ;
layout5 - > addWidget ( leTriggerMask [ iDigi ] [ ch ] , rowID , 3 ) ;
//------------------------------
rowID + + ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbCoinMask [ iDigi ] [ ch ] , DIGIPARA : : CH : : CoincidenceMask , - 1 , true , " Coin. Mask " , layout5 , rowID , 0 ) ;
SetupComboBox ( cbbAntiCoinMask [ iDigi ] [ ch ] , DIGIPARA : : CH : : AntiCoincidenceMask , - 1 , true , " Anti-Coin. Mask " , layout5 , rowID , 2 ) ;
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbCoinLength [ iDigi ] [ ch ] , DIGIPARA : : CH : : CoincidenceLength , - 1 , " Coin. Length [ns] " , layout5 , rowID , 0 ) ;
SetupSpinBox ( spbADCVetoWidth [ iDigi ] [ ch ] , DIGIPARA : : CH : : ADCVetoWidth , - 1 , " ADC Veto Length [ns] " , layout5 , rowID , 2 ) ;
2023-02-28 17:08:34 -05:00
for ( int i = 0 ; i < layout5 - > columnCount ( ) ; i + + ) layout5 - > setColumnStretch ( i , 1 ) ;
}
{ //*--------- Group 6
QGroupBox * box6 = new QGroupBox ( " Other Settings " , tab ) ;
allLayout - > addWidget ( box6 ) ;
QGridLayout * layout6 = new QGridLayout ( box6 ) ;
//------------------------------
rowID = 0 ;
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbbEventSelector [ iDigi ] [ ch ] , DIGIPARA : : CH : : EventSelector , - 1 , true , " Event Selector " , layout6 , rowID , 0 ) ;
SetupComboBox ( cbbWaveSelector [ iDigi ] [ ch ] , DIGIPARA : : CH : : WaveSelector , - 1 , true , " Wave Selector " , layout6 , rowID , 2 ) ;
2023-02-28 17:08:34 -05:00
2023-02-28 13:28:30 -05:00
//------------------------------
rowID + + ;
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spbEnergySkimLow [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergySkimLowDiscriminator , - 1 , " Energy Skim Low " , layout6 , rowID , 0 ) ;
SetupSpinBox ( spbEnergySkimHigh [ iDigi ] [ ch ] , DIGIPARA : : CH : : EnergySkimHighDiscriminator , - 1 , " Energy Skim High " , layout6 , rowID , 2 ) ;
2023-02-28 17:08:34 -05:00
}
}
{ //@============== Status tab
QTabWidget * statusTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( statusTab , " Status " ) ;
2023-02-27 15:23:28 -05:00
2023-02-28 13:28:30 -05:00
}
2023-03-01 12:26:37 -05:00
2023-02-28 13:28:30 -05:00
{ //@============== input tab
QTabWidget * inputTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( inputTab , " Input " ) ;
2023-02-27 15:23:28 -05:00
2023-03-01 18:27:17 -05:00
SetupComboBoxTab ( cbbOnOff , DIGIPARA : : CH : : ChannelEnable , " On/Off " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
2023-02-28 13:28:30 -05:00
SetupSpinBoxTab ( spbDCOffset , DIGIPARA : : CH : : DC_Offset , " DC Offset [%] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbThreshold , DIGIPARA : : CH : : TriggerThreshold , " Threshold [LSB] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbParity , DIGIPARA : : CH : : Polarity , " Parity " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbRecordLength , DIGIPARA : : CH : : RecordLength , " Record Length [ns] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbPreTrigger , DIGIPARA : : CH : : PreTrigger , " PreTrigger [ns] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbInputRiseTime , DIGIPARA : : CH : : TimeFilterRiseTime , " Input Rise Time [ns] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbTriggerGuard , DIGIPARA : : CH : : TimeFilterRetriggerGuard , " Trigger Guard [ns] " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbLowFilter , DIGIPARA : : CH : : EnergyFilterLowFreqFilter , " Low Freq. Filter " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbWaveSource , DIGIPARA : : CH : : WaveDataSource , " Wave Data Dource " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbWaveRes , DIGIPARA : : CH : : WaveResolution , " Wave Resol. " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbWaveSave , DIGIPARA : : CH : : WaveSaving , " Wave Save " , inputTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
2023-01-30 18:40:24 -05:00
}
2023-03-01 12:26:37 -05:00
2023-02-28 13:28:30 -05:00
{ //@============== Trap tab
QTabWidget * trapTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( trapTab , " Trapezoid " ) ;
2023-01-30 18:40:24 -05:00
2023-02-28 13:28:30 -05:00
SetupSpinBoxTab ( spbTrapRiseTime , DIGIPARA : : CH : : EnergyFilterRiseTime , " Trap. Rise Time [ns] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbTrapFlatTop , DIGIPARA : : CH : : EnergyFilterFlatTop , " Trap. Flat Top [ns] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbTrapPoleZero , DIGIPARA : : CH : : EnergyFilterPoleZero , " Trap. Pole Zero [ns] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbPeaking , DIGIPARA : : CH : : EnergyFilterPeakingAvg , " Peaking [%] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbPeakingAvg , DIGIPARA : : CH : : EnergyFilterPeakingAvg , " Peak Avg. " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbBaselineAvg , DIGIPARA : : CH : : EnergyFilterBaselineAvg , " Baseline Avg. " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbFineGain , DIGIPARA : : CH : : EnergyFilterFineGain , " Fine Gain " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbBaselineGuard , DIGIPARA : : CH : : EnergyFilterBaselineGuard , " Baseline Guard [ns] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbPileupGuard , DIGIPARA : : CH : : EnergyFilterPileUpGuard , " Pile-up Guard [ns] " , trapTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
2023-01-30 18:40:24 -05:00
}
2023-01-27 18:52:03 -05:00
2023-02-28 13:28:30 -05:00
{ //@============== Probe tab
QTabWidget * probeTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( probeTab , " Probe " ) ;
SetupComboBoxTab ( cbbAnaProbe0 , DIGIPARA : : CH : : WaveAnalogProbe0 , " Analog Prob. 0 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbAnaProbe1 , DIGIPARA : : CH : : WaveAnalogProbe1 , " Analog Prob. 1 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbDigProbe0 , DIGIPARA : : CH : : WaveDigitalProbe0 , " Digital Prob. 0 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbDigProbe1 , DIGIPARA : : CH : : WaveDigitalProbe1 , " Digital Prob. 1 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbDigProbe2 , DIGIPARA : : CH : : WaveDigitalProbe2 , " Digital Prob. 2 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbDigProbe3 , DIGIPARA : : CH : : WaveDigitalProbe3 , " Digital Prob. 3 " , probeTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
}
2023-02-28 17:08:34 -05:00
{ //@============== Other tab
QTabWidget * otherTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( otherTab , " Others " ) ;
SetupComboBoxTab ( cbbEventSelector , DIGIPARA : : CH : : EventSelector , " Event Selector " , otherTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbWaveSelector , DIGIPARA : : CH : : WaveSelector , " Wave Selector " , otherTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupSpinBoxTab ( spbEnergySkimLow , DIGIPARA : : CH : : EnergySkimLowDiscriminator , " Energy Skim Low " , otherTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbEnergySkimHigh , DIGIPARA : : CH : : EnergySkimHighDiscriminator , " Energy Skim High " , otherTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
}
2023-02-28 13:28:30 -05:00
{ //@============== Trigger tab
QTabWidget * triggerTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( triggerTab , " Trigger " ) ;
2023-02-28 17:08:34 -05:00
SetupComboBoxTab ( cbbEvtTrigger , DIGIPARA : : CH : : EventTriggerSource , " Event Trig. Source " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbWaveTrigger , DIGIPARA : : CH : : WaveTriggerSource , " Wave Trig. Source " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbChVetoSrc , DIGIPARA : : CH : : ChannelVetoSource , " Veto Source " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) , 2 ) ;
SetupComboBoxTab ( cbbCoinMask , DIGIPARA : : CH : : CoincidenceMask , " Coin. Mask " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupComboBoxTab ( cbbAntiCoinMask , DIGIPARA : : CH : : AntiCoincidenceMask , " Anti-Coin. Mask " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbCoinLength , DIGIPARA : : CH : : CoincidenceLength , " Coin. Length [ns] " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
SetupSpinBoxTab ( spbADCVetoWidth , DIGIPARA : : CH : : ADCVetoWidth , " ADC Veto Length [ns] " , triggerTab , iDigi , digi [ iDigi ] - > GetNChannels ( ) ) ;
}
2023-01-26 19:12:18 -05:00
2023-03-01 18:27:17 -05:00
for ( int ch = 0 ; ch < digi [ ID ] - > GetNChannels ( ) + 1 ; ch + + ) {
connect ( cbbOnOff [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbOnOff , ch ) ; } ) ;
connect ( spbDCOffset [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbDCOffset , ch ) ; } ) ;
connect ( spbThreshold [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbThreshold , ch ) ; } ) ;
connect ( cbbParity [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbParity , ch ) ; } ) ;
connect ( spbRecordLength [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbRecordLength , ch ) ; } ) ;
connect ( spbPreTrigger [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbPreTrigger , ch ) ; } ) ;
connect ( spbInputRiseTime [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbInputRiseTime , ch ) ; } ) ;
connect ( spbTriggerGuard [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbTriggerGuard , ch ) ; } ) ;
connect ( cbbLowFilter [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbLowFilter , ch ) ; } ) ;
connect ( cbbWaveSource [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbWaveSource , ch ) ; } ) ;
connect ( cbbWaveRes [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbWaveRes , ch ) ; } ) ;
connect ( cbbWaveSave [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbWaveSave , ch ) ; } ) ;
connect ( spbTrapRiseTime [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbTrapRiseTime , ch ) ; } ) ;
connect ( spbTrapFlatTop [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbTrapFlatTop , ch ) ; } ) ;
connect ( spbTrapPoleZero [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbTrapPoleZero , ch ) ; } ) ;
connect ( spbPeaking [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbPeaking , ch ) ; } ) ;
connect ( cbbPeakingAvg [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbPeakingAvg , ch ) ; } ) ;
connect ( cbbBaselineAvg [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbBaselineAvg , ch ) ; } ) ;
connect ( spbFineGain [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbFineGain , ch ) ; } ) ;
connect ( spbBaselineGuard [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbBaselineGuard , ch ) ; } ) ;
connect ( spbPileupGuard [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbPileupGuard , ch ) ; } ) ;
connect ( cbbAnaProbe0 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbAnaProbe0 , ch ) ; } ) ;
connect ( cbbAnaProbe1 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbAnaProbe1 , ch ) ; } ) ;
connect ( cbbDigProbe0 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbDigProbe0 , ch ) ; } ) ;
connect ( cbbDigProbe1 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbDigProbe1 , ch ) ; } ) ;
connect ( cbbDigProbe2 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbDigProbe2 , ch ) ; } ) ;
connect ( cbbDigProbe3 [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbDigProbe3 , ch ) ; } ) ;
connect ( cbbEventSelector [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbEventSelector , ch ) ; } ) ;
connect ( cbbWaveSelector [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbWaveSelector , ch ) ; } ) ;
connect ( spbEnergySkimLow [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbEnergySkimLow , ch ) ; } ) ;
connect ( spbEnergySkimHigh [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbEnergySkimHigh , ch ) ; } ) ;
connect ( cbbEvtTrigger [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbEvtTrigger , ch ) ; } ) ;
connect ( cbbWaveTrigger [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbWaveTrigger , ch ) ; } ) ;
connect ( cbbChVetoSrc [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbChVetoSrc , ch ) ; } ) ;
connect ( cbbCoinMask [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbCoinMask , ch ) ; } ) ;
connect ( cbbAntiCoinMask [ iDigi ] [ ch ] , & QComboBox : : currentIndexChanged , this , [ = ] ( ) { SyncComboBox ( cbbAntiCoinMask , ch ) ; } ) ;
connect ( spbCoinLength [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbCoinLength , ch ) ; } ) ;
connect ( spbADCVetoWidth [ iDigi ] [ ch ] , & QSpinBox : : valueChanged , this , [ = ] ( ) { SyncSpinBox ( spbADCVetoWidth , ch ) ; } ) ;
}
2023-01-25 17:16:14 -05:00
2023-03-01 18:27:17 -05:00
2023-02-28 17:08:34 -05:00
{ //@============== Trigger Map tab
QTabWidget * triggerMapTab = new QTabWidget ( tab ) ;
chTabWidget - > addTab ( triggerMapTab , " Trigger Map " ) ;
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
QGridLayout * triggerLayout = new QGridLayout ( triggerMapTab ) ;
triggerLayout - > setAlignment ( Qt : : AlignCenter ) ;
triggerLayout - > setSpacing ( 0 ) ;
QLabel * instr = new QLabel ( " Reading: Column (C) represents a trigger channel for Row (R) channel. \n For example, R3C1 = ch-3 trigger source is ch-1. \n " , tab ) ;
triggerLayout - > addWidget ( instr , 0 , 0 , 1 , 64 + 15 ) ;
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
QSignalMapper * triggerMapper = new QSignalMapper ( tab ) ;
connect ( triggerMapper , & QSignalMapper : : mappedInt , this , & DigiSettingsPanel : : onTriggerClick ) ;
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
int rowID = 1 ;
int colID = 0 ;
for ( int i = 0 ; i < digi [ iDigi ] - > GetNChannels ( ) ; i + + ) {
colID = 0 ;
for ( int j = 0 ; j < digi [ iDigi ] - > GetNChannels ( ) ; j + + ) {
bn [ i ] [ j ] = new QPushButton ( tab ) ;
bn [ i ] [ j ] - > setFixedSize ( QSize ( 10 , 10 ) ) ;
bnClickStatus [ i ] [ j ] = false ;
//if( i%4 != 0 && j == (i/4)*4) {
// bn[i][j]->setStyleSheet("background-color: red;");
// bnClickStatus[i][j] = true;
//}
triggerLayout - > addWidget ( bn [ i ] [ j ] , rowID , colID ) ;
triggerMapper - > setMapping ( bn [ i ] [ j ] , ( iDigi < < 12 ) + ( i < < 8 ) + j ) ;
connect ( bn [ i ] [ j ] , SIGNAL ( clicked ( ) ) , triggerMapper , SLOT ( map ( ) ) ) ;
colID + + ;
if ( j % 4 = = 3 & & j ! = digi [ iDigi ] - > GetNChannels ( ) - 1 ) {
QFrame * vSeparator = new QFrame ( tab ) ;
vSeparator - > setFrameShape ( QFrame : : VLine ) ;
triggerLayout - > addWidget ( vSeparator , rowID , colID ) ;
colID + + ;
}
}
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
rowID + + ;
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
if ( i % 4 = = 3 & & i ! = digi [ iDigi ] - > GetNChannels ( ) - 1 ) {
QFrame * hSeparator = new QFrame ( tab ) ;
hSeparator - > setFrameShape ( QFrame : : HLine ) ;
triggerLayout - > addWidget ( hSeparator , rowID , 0 , 1 , digi [ iDigi ] - > GetNChannels ( ) + 15 ) ;
rowID + + ;
}
2023-01-26 19:12:18 -05:00
2023-02-28 17:08:34 -05:00
}
}
2023-03-01 12:26:37 -05:00
2023-02-28 17:08:34 -05:00
} //=== end of channel group
2023-03-01 18:27:17 -05:00
2023-01-26 19:12:18 -05:00
} //=== end of tab
2023-01-25 17:16:14 -05:00
2023-03-01 12:26:37 -05:00
enableSignalSlot = true ;
2023-01-25 17:16:14 -05:00
}
2023-02-23 16:08:47 -05:00
DigiSettingsPanel : : ~ DigiSettingsPanel ( ) {
2023-01-25 17:16:14 -05:00
2023-01-27 18:52:03 -05:00
printf ( " %s \n " , __func__ ) ;
2023-02-23 16:08:47 -05:00
}
//^================================================================
void DigiSettingsPanel : : onTriggerClick ( int haha ) {
unsigned short iDig = haha > > 12 ;
unsigned short ch = ( haha > > 8 ) & 0xF ;
unsigned short ch2 = haha & 0xFF ;
qDebug ( ) < < " Digi- " < < iDig < < " , Ch- " < < ch < < " , " < < ch2 ;
if ( bnClickStatus [ ch ] [ ch2 ] ) {
bn [ ch ] [ ch2 ] - > setStyleSheet ( " " ) ;
bnClickStatus [ ch ] [ ch2 ] = false ;
} else {
bn [ ch ] [ ch2 ] - > setStyleSheet ( " background-color: red; " ) ;
bnClickStatus [ ch ] [ ch2 ] = true ;
}
}
//^================================================================
void DigiSettingsPanel : : RefreshSettings ( ) {
digi [ ID ] - > ReadAllSettings ( ) ;
ShowSettingsToPanel ( ) ;
}
void DigiSettingsPanel : : SaveSettings ( ) {
2023-03-02 15:00:59 -05:00
QString filePath = QFileDialog : : getSaveFileName ( this , " Save Settings File " , " " , " Data file (*.dat);;Text files (*.txt);;All files (*.*) " ) ;
if ( ! filePath . isEmpty ( ) ) {
QFileInfo fileInfo ( filePath ) ;
QString ext = fileInfo . suffix ( ) ;
if ( ext = = " " ) filePath + = " .dat " ;
int flag = digi [ ID ] - > SaveSettingsToFile ( filePath . toStdString ( ) . c_str ( ) ) ;
switch ( flag ) {
case 1 : {
leSettingFile [ ID ] - > setText ( filePath ) ;
sendLogMsg ( " Saved setting file <b> " + filePath + " </b>. " ) ;
} ; break ;
case 0 : {
leSettingFile [ ID ] - > setText ( " fail to write setting file. " ) ;
sendLogMsg ( " <font style= \" color:red; \" > Fail to write setting file.</font> " ) ;
} ; break ;
case - 1 : {
leSettingFile [ ID ] - > setText ( " fail to save setting file, same settings are empty. " ) ;
sendLogMsg ( " <font style= \" color:red; \" > Fail to save setting file, same settings are empty.</font> " ) ;
} ; break ;
} ;
}
2023-02-23 16:08:47 -05:00
}
void DigiSettingsPanel : : LoadSettings ( ) {
QFileDialog fileDialog ( this ) ;
fileDialog . setFileMode ( QFileDialog : : ExistingFile ) ;
fileDialog . setNameFilter ( " Data file (*.dat);;Text file (*.txt);;All file (*.*) " ) ;
fileDialog . exec ( ) ;
QString fileName = fileDialog . selectedFiles ( ) . at ( 0 ) ;
leSettingFile [ ID ] - > setText ( fileName ) ;
//TODO ==== check is the file valid;
if ( digi [ ID ] - > LoadSettingsFromFile ( fileName . toStdString ( ) . c_str ( ) ) ) {
2023-03-02 15:00:59 -05:00
sendLogMsg ( " Loaded settings file " + fileName + " for Digi- " + QString : : number ( digi [ ID ] - > GetSerialNumber ( ) ) ) ;
2023-02-23 16:08:47 -05:00
} else {
2023-03-02 15:00:59 -05:00
sendLogMsg ( " Fail to Loaded settings file " + fileName + " for Digi- " + QString : : number ( digi [ ID ] - > GetSerialNumber ( ) ) ) ;
2023-02-23 16:08:47 -05:00
}
//TODO ==== show result
ShowSettingsToPanel ( ) ;
}
void DigiSettingsPanel : : ShowSettingsToPanel ( ) {
2023-02-24 19:21:27 -05:00
enableSignalSlot = false ;
2023-02-23 16:08:47 -05:00
for ( unsigned short j = 0 ; j < ( unsigned short ) infoIndex . size ( ) ; j + + ) {
2023-02-28 17:08:34 -05:00
leInfo [ ID ] [ j ] - > setText ( QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( infoIndex [ j ] . second ) ) ) ;
2023-02-23 16:08:47 -05:00
}
//--------- LED Status
2023-02-28 17:08:34 -05:00
unsigned int ledStatus = atoi ( digi [ ID ] - > GetSettingValue ( DIGIPARA : : DIG : : LED_status ) . c_str ( ) ) ;
2023-02-23 16:08:47 -05:00
for ( int i = 0 ; i < 19 ; i + + ) {
if ( ( ledStatus > > i ) & 0x1 ) {
LEDStatus [ ID ] [ i ] - > setStyleSheet ( " background-color:green; " ) ;
} else {
LEDStatus [ ID ] [ i ] - > setStyleSheet ( " " ) ;
}
}
//--------- ACQ Status
2023-02-28 17:08:34 -05:00
unsigned int acqStatus = atoi ( digi [ ID ] - > GetSettingValue ( DIGIPARA : : DIG : : ACQ_status ) . c_str ( ) ) ;
2023-02-23 16:08:47 -05:00
for ( int i = 0 ; i < 7 ; i + + ) {
if ( ( acqStatus > > i ) & 0x1 ) {
ACQStatus [ ID ] [ i ] - > setStyleSheet ( " background-color:green; " ) ;
} else {
ACQStatus [ ID ] [ i ] - > setStyleSheet ( " " ) ;
}
}
2023-02-24 19:21:27 -05:00
//-------- temperature
for ( int i = 0 ; i < 8 ; i + + ) {
2023-02-28 17:08:34 -05:00
leTemp [ ID ] [ i ] - > setText ( QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( DIGIPARA : : DIG : : TempSensADC [ i ] ) ) ) ;
2023-02-24 19:21:27 -05:00
}
//-------- board settings
2023-03-02 15:00:59 -05:00
FillComboBoxValueFromMemory ( cbbClockSource [ ID ] , DIGIPARA : : DIG : : ClockSource ) ;
2023-02-24 19:21:27 -05:00
2023-02-28 17:08:34 -05:00
QString result = QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( DIGIPARA : : DIG : : StartSource ) ) ;
2023-02-24 19:21:27 -05:00
QStringList resultList = result . remove ( QChar ( ' ' ) ) . split ( " | " ) ;
2023-02-27 15:23:28 -05:00
//qDebug() << resultList << "," << resultList.count();
for ( int j = 0 ; j < ( int ) DIGIPARA : : DIG : : StartSource . GetAnswers ( ) . size ( ) ; j + + ) {
ckbStartSource [ ID ] [ j ] - > setChecked ( false ) ;
for ( int i = 0 ; i < resultList . count ( ) ; i + + ) {
//qDebug() << resultList[i] << ", " << QString::fromStdString((DIGIPARA::DIG::StartSource.GetAnswers())[j].first);
if ( resultList [ i ] = = QString : : fromStdString ( ( DIGIPARA : : DIG : : StartSource . GetAnswers ( ) ) [ j ] . first ) ) ckbStartSource [ ID ] [ j ] - > setChecked ( true ) ;
}
}
2023-02-23 16:08:47 -05:00
2023-02-28 17:08:34 -05:00
result = QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( DIGIPARA : : DIG : : GlobalTriggerSource ) ) ;
2023-02-27 15:23:28 -05:00
resultList = result . remove ( QChar ( ' ' ) ) . split ( " | " ) ;
for ( int j = 0 ; j < ( int ) DIGIPARA : : DIG : : StartSource . GetAnswers ( ) . size ( ) ; j + + ) {
ckbGlbTrgSource [ ID ] [ j ] - > setChecked ( false ) ;
for ( int i = 0 ; i < resultList . count ( ) ; i + + ) {
if ( resultList [ i ] = = QString : : fromStdString ( ( DIGIPARA : : DIG : : GlobalTriggerSource . GetAnswers ( ) ) [ j ] . first ) ) ckbGlbTrgSource [ ID ] [ j ] - > setChecked ( true ) ;
}
}
2023-02-23 16:08:47 -05:00
2023-03-02 15:00:59 -05:00
FillComboBoxValueFromMemory ( cbbTrgOut [ ID ] , DIGIPARA : : DIG : : TrgOutMode ) ;
FillComboBoxValueFromMemory ( cbbGPIO [ ID ] , DIGIPARA : : DIG : : GPIOMode ) ;
FillComboBoxValueFromMemory ( cbbBusyIn [ ID ] , DIGIPARA : : DIG : : BusyInSource ) ;
FillComboBoxValueFromMemory ( cbbSyncOut [ ID ] , DIGIPARA : : DIG : : SyncOutMode ) ;
FillComboBoxValueFromMemory ( cbbAutoDisarmAcq [ ID ] , DIGIPARA : : DIG : : EnableAutoDisarmACQ ) ;
FillComboBoxValueFromMemory ( cbbStatEvents [ ID ] , DIGIPARA : : DIG : : EnableStatisticEvents ) ;
FillComboBoxValueFromMemory ( cbbBdVetoPolarity [ ID ] , DIGIPARA : : DIG : : BoardVetoPolarity ) ;
FillComboBoxValueFromMemory ( cbbBoardVetoSource [ ID ] , DIGIPARA : : DIG : : BoardVetoSource ) ;
FillComboBoxValueFromMemory ( cbbIOLevel [ ID ] , DIGIPARA : : DIG : : IO_Level ) ;
FillSpinBoxValueFromMemory ( spbBdVetoWidth [ ID ] , DIGIPARA : : DIG : : BoardVetoWidth ) ;
FillSpinBoxValueFromMemory ( spbRunDelay [ ID ] , DIGIPARA : : DIG : : RunDelay ) ;
FillSpinBoxValueFromMemory ( dsbVolatileClockOutDelay [ ID ] , DIGIPARA : : DIG : : VolatileClockOutDelay ) ;
FillSpinBoxValueFromMemory ( dsbClockOutDelay [ ID ] , DIGIPARA : : DIG : : PermanentClockOutDelay ) ;
2023-02-27 15:23:28 -05:00
//------------- test pulse
2023-03-02 15:00:59 -05:00
FillSpinBoxValueFromMemory ( dsbTestPuslePeriod [ ID ] , DIGIPARA : : DIG : : TestPulsePeriod ) ;
FillSpinBoxValueFromMemory ( dsbTestPusleWidth [ ID ] , DIGIPARA : : DIG : : TestPulseWidth ) ;
FillSpinBoxValueFromMemory ( spbTestPusleLowLevel [ ID ] , DIGIPARA : : DIG : : TestPulseLowLevel ) ;
FillSpinBoxValueFromMemory ( spbTestPusleHighLevel [ ID ] , DIGIPARA : : DIG : : TestPulseHighLevel ) ;
//@============================== Channel setting
for ( int ch = 0 ; ch < digi [ ID ] - > GetNChannels ( ) ; ch + + ) {
FillComboBoxValueFromMemory ( cbbOnOff [ ID ] [ ch ] , DIGIPARA : : CH : : ChannelEnable , ch ) ;
FillSpinBoxValueFromMemory ( spbDCOffset [ ID ] [ ch ] , DIGIPARA : : CH : : DC_Offset , ch ) ;
FillSpinBoxValueFromMemory ( spbThreshold [ ID ] [ ch ] , DIGIPARA : : CH : : TriggerThreshold , ch ) ;
FillComboBoxValueFromMemory ( cbbParity [ ID ] [ ch ] , DIGIPARA : : CH : : Polarity , ch ) ;
FillSpinBoxValueFromMemory ( spbRecordLength [ ID ] [ ch ] , DIGIPARA : : CH : : RecordLength , ch ) ;
FillSpinBoxValueFromMemory ( spbPreTrigger [ ID ] [ ch ] , DIGIPARA : : CH : : PreTrigger , ch ) ;
FillSpinBoxValueFromMemory ( spbInputRiseTime [ ID ] [ ch ] , DIGIPARA : : CH : : TimeFilterRiseTime , ch ) ;
FillSpinBoxValueFromMemory ( spbTriggerGuard [ ID ] [ ch ] , DIGIPARA : : CH : : TimeFilterRetriggerGuard , ch ) ;
FillComboBoxValueFromMemory ( cbbLowFilter [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterLowFreqFilter , ch ) ;
FillComboBoxValueFromMemory ( cbbWaveSource [ ID ] [ ch ] , DIGIPARA : : CH : : WaveDataSource , ch ) ;
FillComboBoxValueFromMemory ( cbbWaveRes [ ID ] [ ch ] , DIGIPARA : : CH : : WaveResolution , ch ) ;
FillComboBoxValueFromMemory ( cbbWaveSave [ ID ] [ ch ] , DIGIPARA : : CH : : WaveSaving , ch ) ;
FillSpinBoxValueFromMemory ( spbTrapRiseTime [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterRiseTime , ch ) ;
FillSpinBoxValueFromMemory ( spbTrapFlatTop [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterFlatTop , ch ) ;
FillSpinBoxValueFromMemory ( spbTrapPoleZero [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPoleZero , ch ) ;
FillSpinBoxValueFromMemory ( spbPeaking [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPeakingPosition , ch ) ;
FillComboBoxValueFromMemory ( cbbPeakingAvg [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPeakingAvg , ch ) ;
FillComboBoxValueFromMemory ( cbbBaselineAvg [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterBaselineAvg , ch ) ;
FillSpinBoxValueFromMemory ( spbFineGain [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterFineGain , ch ) ;
FillSpinBoxValueFromMemory ( spbBaselineGuard [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterBaselineGuard , ch ) ;
FillSpinBoxValueFromMemory ( spbPileupGuard [ ID ] [ ch ] , DIGIPARA : : CH : : EnergyFilterPileUpGuard , ch ) ;
FillComboBoxValueFromMemory ( cbbAnaProbe0 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveAnalogProbe0 , ch ) ;
FillComboBoxValueFromMemory ( cbbAnaProbe1 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveAnalogProbe1 , ch ) ;
FillComboBoxValueFromMemory ( cbbDigProbe0 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe0 , ch ) ;
FillComboBoxValueFromMemory ( cbbDigProbe1 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe1 , ch ) ;
FillComboBoxValueFromMemory ( cbbDigProbe2 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe2 , ch ) ;
FillComboBoxValueFromMemory ( cbbDigProbe3 [ ID ] [ ch ] , DIGIPARA : : CH : : WaveDigitalProbe3 , ch ) ;
FillComboBoxValueFromMemory ( cbbEventSelector [ ID ] [ ch ] , DIGIPARA : : CH : : EventSelector , ch ) ;
FillComboBoxValueFromMemory ( cbbWaveSelector [ ID ] [ ch ] , DIGIPARA : : CH : : WaveSelector , ch ) ;
FillSpinBoxValueFromMemory ( spbEnergySkimLow [ ID ] [ ch ] , DIGIPARA : : CH : : EnergySkimLowDiscriminator , ch ) ;
FillSpinBoxValueFromMemory ( spbEnergySkimHigh [ ID ] [ ch ] , DIGIPARA : : CH : : EnergySkimHighDiscriminator , ch ) ;
FillComboBoxValueFromMemory ( cbbEvtTrigger [ ID ] [ ch ] , DIGIPARA : : CH : : EventTriggerSource , ch ) ;
FillComboBoxValueFromMemory ( cbbWaveTrigger [ ID ] [ ch ] , DIGIPARA : : CH : : WaveTriggerSource , ch ) ;
FillComboBoxValueFromMemory ( cbbChVetoSrc [ ID ] [ ch ] , DIGIPARA : : CH : : ChannelVetoSource , ch ) ;
FillComboBoxValueFromMemory ( cbbCoinMask [ ID ] [ ch ] , DIGIPARA : : CH : : CoincidenceMask , ch ) ;
FillComboBoxValueFromMemory ( cbbAntiCoinMask [ ID ] [ ch ] , DIGIPARA : : CH : : AntiCoincidenceMask , ch ) ;
FillSpinBoxValueFromMemory ( spbCoinLength [ ID ] [ ch ] , DIGIPARA : : CH : : CoincidenceLength , ch ) ;
FillSpinBoxValueFromMemory ( spbADCVetoWidth [ ID ] [ ch ] , DIGIPARA : : CH : : ADCVetoWidth , ch ) ;
}
2023-02-27 15:23:28 -05:00
2023-02-24 19:21:27 -05:00
enableSignalSlot = true ;
2023-03-02 15:00:59 -05:00
SyncComboBox ( cbbOnOff , - 1 ) ;
SyncComboBox ( cbbParity , - 1 ) ;
SyncComboBox ( cbbLowFilter , - 1 ) ;
SyncComboBox ( cbbWaveSource , - 1 ) ;
SyncComboBox ( cbbWaveRes , - 1 ) ;
SyncComboBox ( cbbWaveSave , - 1 ) ;
SyncComboBox ( cbbPeakingAvg , - 1 ) ;
SyncComboBox ( cbbBaselineAvg , - 1 ) ;
SyncComboBox ( cbbAnaProbe0 , - 1 ) ;
SyncComboBox ( cbbAnaProbe1 , - 1 ) ;
SyncComboBox ( cbbDigProbe0 , - 1 ) ;
SyncComboBox ( cbbDigProbe1 , - 1 ) ;
SyncComboBox ( cbbDigProbe2 , - 1 ) ;
SyncComboBox ( cbbDigProbe3 , - 1 ) ;
SyncComboBox ( cbbEventSelector , - 1 ) ;
SyncComboBox ( cbbWaveSelector , - 1 ) ;
SyncComboBox ( cbbEvtTrigger , - 1 ) ;
SyncComboBox ( cbbWaveTrigger , - 1 ) ;
SyncComboBox ( cbbChVetoSrc , - 1 ) ;
SyncComboBox ( cbbCoinMask , - 1 ) ;
SyncComboBox ( cbbAntiCoinMask , - 1 ) ;
SyncSpinBox ( spbDCOffset , - 1 ) ;
SyncSpinBox ( spbThreshold , - 1 ) ;
SyncSpinBox ( spbRecordLength , - 1 ) ;
SyncSpinBox ( spbPreTrigger , - 1 ) ;
SyncSpinBox ( spbInputRiseTime , - 1 ) ;
SyncSpinBox ( spbTriggerGuard , - 1 ) ;
SyncSpinBox ( spbTrapRiseTime , - 1 ) ;
SyncSpinBox ( spbTrapFlatTop , - 1 ) ;
SyncSpinBox ( spbTrapPoleZero , - 1 ) ;
SyncSpinBox ( spbPeaking , - 1 ) ;
SyncSpinBox ( spbFineGain , - 1 ) ;
SyncSpinBox ( spbBaselineGuard , - 1 ) ;
SyncSpinBox ( spbPileupGuard , - 1 ) ;
SyncSpinBox ( spbEnergySkimHigh , - 1 ) ;
SyncSpinBox ( spbEnergySkimLow , - 1 ) ;
SyncSpinBox ( spbCoinLength , - 1 ) ;
SyncSpinBox ( spbADCVetoWidth , - 1 ) ;
2023-02-23 16:08:47 -05:00
2023-03-01 12:26:37 -05:00
}
//^###########################################################################
void DigiSettingsPanel : : SetStartSource ( ) {
if ( ! enableSignalSlot ) return ;
std : : string value = " " ;
for ( int i = 0 ; i < ( int ) DIGIPARA : : DIG : : StartSource . GetAnswers ( ) . size ( ) ; i + + ) {
if ( ckbStartSource [ ID ] [ i ] - > isChecked ( ) ) {
//printf("----- %s \n", DIGIPARA::DIG::StartSource.GetAnswers()[i].first.c_str());
if ( value ! = " " ) value + = " | " ;
value + = DIGIPARA : : DIG : : StartSource . GetAnswers ( ) [ i ] . first ;
}
}
printf ( " ================ %s \n " , value . c_str ( ) ) ;
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : StartSource , value ) ;
}
void DigiSettingsPanel : : SetGlobalTriggerSource ( ) {
if ( ! enableSignalSlot ) return ;
std : : string value = " " ;
for ( int i = 0 ; i < ( int ) DIGIPARA : : DIG : : GlobalTriggerSource . GetAnswers ( ) . size ( ) ; i + + ) {
if ( ckbGlbTrgSource [ ID ] [ i ] - > isChecked ( ) ) {
//printf("----- %s \n", DIGIPARA::DIG::StartSource.GetAnswers()[i].first.c_str());
if ( value ! = " " ) value + = " | " ;
value + = DIGIPARA : : DIG : : GlobalTriggerSource . GetAnswers ( ) [ i ] . first ;
}
}
printf ( " ================ %s \n " , value . c_str ( ) ) ;
digi [ ID ] - > WriteValue ( DIGIPARA : : DIG : : GlobalTriggerSource , value ) ;
2023-02-23 16:08:47 -05:00
}
2023-02-24 19:21:27 -05:00
2023-03-01 12:26:37 -05:00
//^###########################################################################
2023-02-28 13:28:30 -05:00
void DigiSettingsPanel : : SetupShortComboBox ( QComboBox * cbb , Reg para ) {
2023-02-27 15:23:28 -05:00
for ( int i = 0 ; i < ( int ) para . GetAnswers ( ) . size ( ) ; i + + ) {
cbb - > addItem ( QString : : fromStdString ( ( para . GetAnswers ( ) ) [ i ] . second ) ,
QString : : fromStdString ( ( para . GetAnswers ( ) ) [ i ] . first ) ) ;
}
}
2023-03-01 18:27:17 -05:00
void DigiSettingsPanel : : SetupComboBox ( QComboBox * & cbb , const Reg para , int ch_index , bool isMaster , QString labelTxt , QGridLayout * layout , int row , int col , int srow , int scol ) {
2023-02-28 13:28:30 -05:00
QLabel * lb = new QLabel ( labelTxt , this ) ;
2023-02-27 15:23:28 -05:00
layout - > addWidget ( lb , row , col ) ;
lb - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
2023-03-01 12:26:37 -05:00
cbb = new QComboBox ( this ) ;
2023-02-27 15:23:28 -05:00
layout - > addWidget ( cbb , row , col + 1 , srow , scol ) ;
for ( int i = 0 ; i < ( int ) para . GetAnswers ( ) . size ( ) ; i + + ) {
2023-02-28 13:28:30 -05:00
cbb - > addItem ( QString : : fromStdString ( ( para . GetAnswers ( ) ) [ i ] . second ) , QString : : fromStdString ( ( para . GetAnswers ( ) ) [ i ] . first ) ) ;
2023-02-27 15:23:28 -05:00
}
2023-03-01 18:27:17 -05:00
if ( isMaster & & para . GetType ( ) = = TYPE : : CH ) cbb - > addItem ( " " ) ;
2023-03-01 12:26:37 -05:00
connect ( cbb , & QComboBox : : currentIndexChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
2023-03-01 18:27:17 -05:00
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
2023-03-01 12:26:37 -05:00
digi [ ID ] - > WriteValue ( para , cbb - > currentData ( ) . toString ( ) . toStdString ( ) , ch_index ) ;
} ) ;
2023-02-28 13:28:30 -05:00
}
2023-03-02 15:00:59 -05:00
//TODO ==== spin Box step
2023-03-01 12:26:37 -05:00
void DigiSettingsPanel : : SetupSpinBox ( QSpinBox * & spb , const Reg para , int ch_index , QString labelTxt , QGridLayout * layout , int row , int col , int srow , int scol ) {
2023-02-28 13:28:30 -05:00
QLabel * lb = new QLabel ( labelTxt , this ) ;
layout - > addWidget ( lb , row , col ) ;
lb - > setAlignment ( Qt : : AlignRight | Qt : : AlignCenter ) ;
2023-03-01 12:26:37 -05:00
spb = new QSpinBox ( this ) ;
2023-03-02 15:00:59 -05:00
spb - > setMinimum ( std : : min ( - 1 , atoi ( para . GetAnswers ( ) [ 0 ] . first . c_str ( ) ) ) ) ;
2023-02-28 13:28:30 -05:00
spb - > setMaximum ( atoi ( para . GetAnswers ( ) [ 1 ] . first . c_str ( ) ) ) ;
layout - > addWidget ( spb , row , col + 1 , srow , scol ) ;
2023-03-01 12:26:37 -05:00
connect ( spb , & QSpinBox : : valueChanged , this , [ = ] ( ) {
if ( ! enableSignalSlot ) return ;
2023-03-01 18:27:17 -05:00
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
2023-03-01 12:26:37 -05:00
digi [ ID ] - > WriteValue ( para , std : : to_string ( spb - > value ( ) ) , ch_index ) ;
} ) ;
2023-02-28 13:28:30 -05:00
}
2023-02-27 15:23:28 -05:00
2023-03-01 18:27:17 -05:00
void DigiSettingsPanel : : SyncComboBox ( QComboBox * ( & cbb ) [ ] [ MaxNumberOfChannel + 1 ] , int ch ) {
if ( ! enableSignalSlot ) return ;
const int nCh = digi [ ID ] - > GetNChannels ( ) ;
if ( ch = = nCh ) {
const int index = cbb [ ID ] [ nCh ] - > currentIndex ( ) ;
if ( cbb [ ID ] [ nCh ] - > currentText ( ) = = " " ) return ;
enableSignalSlot = false ;
for ( int i = 0 ; i < nCh ; i + + ) cbb [ ID ] [ i ] - > setCurrentIndex ( index ) ;
enableSignalSlot = true ;
} else {
//check is all ComboBox has same index;
int count = 1 ;
const int index = cbb [ ID ] [ 0 ] - > currentIndex ( ) ;
for ( int i = 1 ; i < nCh ; i + + ) {
if ( cbb [ ID ] [ i ] - > currentIndex ( ) = = index ) count + + ;
}
enableSignalSlot = false ;
if ( count ! = nCh ) {
cbb [ ID ] [ nCh ] - > setCurrentText ( " " ) ;
} else {
cbb [ ID ] [ nCh ] - > setCurrentIndex ( index ) ;
}
enableSignalSlot = true ;
}
}
void DigiSettingsPanel : : SyncSpinBox ( QSpinBox * ( & spb ) [ ] [ MaxNumberOfChannel + 1 ] , int ch ) {
if ( ! enableSignalSlot ) return ;
const int nCh = digi [ ID ] - > GetNChannels ( ) ;
if ( ch = = nCh ) {
const int value = spb [ ID ] [ nCh ] - > value ( ) ;
if ( spb [ ID ] [ nCh ] - > value ( ) = = - 999 ) return ;
enableSignalSlot = false ;
for ( int i = 0 ; i < nCh ; i + + ) spb [ ID ] [ i ] - > setValue ( value ) ;
enableSignalSlot = true ;
} else {
//check is all ComboBox has same index;
int count = 1 ;
const int value = spb [ ID ] [ 0 ] - > value ( ) ;
for ( int i = 1 ; i < nCh ; i + + ) {
if ( spb [ ID ] [ i ] - > value ( ) = = value ) count + + ;
}
2023-03-02 15:00:59 -05:00
//printf("%d =? %d \n", count, nCh);
2023-03-01 18:27:17 -05:00
enableSignalSlot = false ;
if ( count ! = nCh ) {
2023-03-02 15:00:59 -05:00
spb [ ID ] [ nCh ] - > setValue ( - 1 ) ;
2023-03-01 18:27:17 -05:00
} else {
spb [ ID ] [ nCh ] - > setValue ( value ) ;
}
enableSignalSlot = true ;
}
}
2023-03-01 12:26:37 -05:00
void DigiSettingsPanel : : SetupSpinBoxTab ( QSpinBox * ( & spb ) [ ] [ MaxNumberOfChannel + 1 ] , const Reg para , QString text , QTabWidget * tabWidget , int iDigi , int nChannel ) {
2023-02-28 13:28:30 -05:00
QWidget * tabPage = new QWidget ( this ) ; tabWidget - > addTab ( tabPage , text ) ;
QGridLayout * allLayout = new QGridLayout ( tabPage ) ;
2023-02-28 17:08:34 -05:00
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
2023-02-28 13:28:30 -05:00
allLayout - > setAlignment ( Qt : : AlignTop ) ;
2023-02-28 17:08:34 -05:00
allLayout - > setHorizontalSpacing ( 10 ) ;
2023-02-28 13:28:30 -05:00
allLayout - > setVerticalSpacing ( 0 ) ;
for ( int ch = 0 ; ch < nChannel ; ch + + ) {
2023-03-01 12:26:37 -05:00
SetupSpinBox ( spb [ iDigi ] [ ch ] , para , ch , " ch- " + QString : : number ( ch ) + " " , allLayout , ch / 4 , ch % 4 * 2 ) ;
2023-02-28 13:28:30 -05:00
}
}
2023-03-01 12:26:37 -05:00
void DigiSettingsPanel : : SetupComboBoxTab ( QComboBox * ( & cbb ) [ ] [ MaxNumberOfChannel + 1 ] , const Reg para , QString text , QTabWidget * tabWidget , int iDigi , int nChannel , int nCol ) {
2023-02-28 13:28:30 -05:00
QWidget * tabPage = new QWidget ( this ) ; tabWidget - > addTab ( tabPage , text ) ;
QGridLayout * allLayout = new QGridLayout ( tabPage ) ;
2023-02-28 17:08:34 -05:00
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
2023-02-28 13:28:30 -05:00
allLayout - > setAlignment ( Qt : : AlignTop ) ;
2023-02-28 17:08:34 -05:00
allLayout - > setHorizontalSpacing ( 10 ) ;
2023-02-28 13:28:30 -05:00
allLayout - > setVerticalSpacing ( 0 ) ;
for ( int ch = 0 ; ch < nChannel ; ch + + ) {
2023-03-01 18:27:17 -05:00
SetupComboBox ( cbb [ iDigi ] [ ch ] , para , ch , false , " ch- " + QString : : number ( ch ) + " " , allLayout , ch / nCol , ch % nCol * 3 ) ;
2023-02-28 13:28:30 -05:00
}
2023-02-27 15:23:28 -05:00
}
2023-03-02 15:00:59 -05:00
void DigiSettingsPanel : : FillComboBoxValueFromMemory ( QComboBox * & cbb , const Reg para , int ch_index ) {
QString result = QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( para , ch_index ) ) ;
2023-02-28 13:28:30 -05:00
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, cbb);
2023-02-27 15:23:28 -05:00
int index = cbb - > findData ( result ) ;
if ( index > = 0 & & index < cbb - > count ( ) ) {
cbb - > setCurrentIndex ( index ) ;
2023-02-24 19:21:27 -05:00
} else {
2023-03-02 15:00:59 -05:00
printf ( " %s %s \n " , para . GetPara ( ) . c_str ( ) , result . toStdString ( ) . c_str ( ) ) ;
2023-02-24 19:21:27 -05:00
}
}
2023-03-02 15:00:59 -05:00
template < typename T > void DigiSettingsPanel : : FillSpinBoxValueFromMemory ( T * & spb , const Reg para , int ch_index ) {
QString result = QString : : fromStdString ( digi [ ID ] - > GetSettingValue ( para , ch_index ) ) ;
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, spb);
spb - > setValue ( result . toDouble ( ) ) ;
}