use a custom comboBox and Spinbox to improve UI

This commit is contained in:
Ryan Tang 2023-03-03 15:23:26 -05:00
parent 64bded0aa6
commit 7a69904f5b
3 changed files with 214 additions and 173 deletions

View File

@ -226,18 +226,18 @@ namespace DIGIPARA{
{"LVDS", "LVDS"},
{"GPIO", "GPIO"},
{"P0", "Back Plane"}});
const Reg BoardVetoWidth ("BoardVetoWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"34359738360", ""}}, ANSTYPE::NUM, "ns");
const Reg BoardVetoWidth ("BoardVetoWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"34359738360", ""}, {"1", ""}}, ANSTYPE::NUM, "ns");
const Reg BoardVetoPolarity ("BoardVetoPolarity", RW::ReadWrite, TYPE::DIG, {{"ActiveHigh", "High"}, {"ActiveLow", "Low"}});
const Reg RunDelay ("RunDelay", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"524280", ""}}, ANSTYPE::NUM, "ns");
const Reg RunDelay ("RunDelay", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"524280", ""}, {"1", ""}}, ANSTYPE::NUM, "ns");
const Reg EnableAutoDisarmACQ ("EnAutoDisarmAcq", RW::ReadWrite, TYPE::DIG, {{"True", "Enabled"}, {"False", "Disabled"}});
const Reg EnableDataReduction ("EnDataReduction", RW::ReadWrite, TYPE::DIG, {{"False", "Disabled"}, {"True", "Enabled"}});
const Reg EnableStatisticEvents ("EnStatEvents", RW::ReadWrite, TYPE::DIG, {{"False", "Disabled"}, {"True", "Enabled"}});
const Reg VolatileClockOutDelay ("VolatileClockOutDelay", RW::ReadWrite, TYPE::DIG, {{"-18888.888", ""}, {"18888.888", ""}}, ANSTYPE::NUM, "ps");
const Reg PermanentClockOutDelay ("PermanentClockOutDelay", RW::ReadWrite, TYPE::DIG, {{"-18888.888", ""}, {"18888.888", ""}}, ANSTYPE::NUM, "ps");
const Reg TestPulsePeriod ("TestPulsePeriod", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}}, ANSTYPE::NUM, "ns");
const Reg VolatileClockOutDelay ("VolatileClockOutDelay", RW::ReadWrite, TYPE::DIG, {{"-18888.888", ""}, {"18888.888", ""}, {"74.074", ""}}, ANSTYPE::NUM, "ps");
const Reg PermanentClockOutDelay ("PermanentClockOutDelay", RW::ReadWrite, TYPE::DIG, {{"-18888.888", ""}, {"18888.888", ""}, {"74.074", ""}}, ANSTYPE::NUM, "ps");
const Reg TestPulsePeriod ("TestPulsePeriod", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}, {"8", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}, {"8", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::NUM, "ns");
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::NUM, "ns");
const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite, TYPE::DIG);
const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite, TYPE::DIG);
const Reg DACoutMode ("DACoutMode", RW::ReadWrite, TYPE::DIG, {{"Static", "DAC fixed level"},
@ -247,8 +247,8 @@ namespace DIGIPARA{
{"Ramp", "14-bit counter"},
{"Sin5MHz", "5 MHz Sin wave"},
{"Square", "Test Pulse"}});
const Reg DACoutStaticLevel ("DACoutStaticLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"16383", ""}}, ANSTYPE::NUM, "units");
const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"64", ""}}, ANSTYPE::NUM);
const Reg DACoutStaticLevel ("DACoutStaticLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"16383", ""}, {"1",""}}, ANSTYPE::NUM, "units");
const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"64", ""}, {"1",""}}, ANSTYPE::NUM);
const Reg EnableOffsetCalibration ("EnOffsetCalibration", RW::ReadWrite, TYPE::DIG, {{"True", "Applied Cali."}, {"False", "No Cali."}});
/// ========== command
@ -348,7 +348,7 @@ namespace DIGIPARA{
}
namespace VGA{
const Reg VGAGain ("VGAGain", RW::ReadWrite, TYPE::VGA, {{"0", ""},{"40", ""}}, ANSTYPE::NUM, "dB"); // VX2745 only
const Reg VGAGain ("VGAGain", RW::ReadWrite, TYPE::VGA, {{"0", ""},{"40", ""}, {"0.5",""}}, ANSTYPE::NUM, "dB"); // VX2745 only
}
namespace CH{
@ -367,8 +367,8 @@ namespace DIGIPARA{
/// ======= read write
const Reg ChannelEnable ("ChEnable", RW::ReadWrite, TYPE::CH, {{"True", "Enabled"}, {"False", "Disabled"}});
const Reg DC_Offset ("DCOffset", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"100", ""}}, ANSTYPE::NUM, "%");
const Reg TriggerThreshold ("TriggerThr", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8191", ""}}, ANSTYPE::NUM);
const Reg DC_Offset ("DCOffset", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"100", ""}, {"1",""}}, ANSTYPE::NUM, "%");
const Reg TriggerThreshold ("TriggerThr", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8191", ""}, {"1",""}}, ANSTYPE::NUM);
const Reg Polarity ("PulsePolarity", RW::ReadWrite, TYPE::CH, {{"Positive", "Pos. +"},{"Negative", "Neg. -"}});
const Reg WaveDataSource ("WaveDataSource", RW::ReadWrite, TYPE::CH, {{"ADC_DATA", "Input ADC"},
@ -377,19 +377,19 @@ namespace DIGIPARA{
{"ADC_TEST_SIN", "ADC produce SIN signal"},
{"Ramp", "Ramp generator"},
{"SquareWave", "Test Pusle (Square Wave)"} });
const Reg RecordLength ("ChRecordLengthT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"64800", ""}}, ANSTYPE::NUM, "ns");
const Reg PreTrigger ("ChPreTriggerT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"32000", ""}}, ANSTYPE::NUM, "ns");
const Reg RecordLength ("ChRecordLengthT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"64800", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg PreTrigger ("ChPreTriggerT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"32000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg WaveSaving ("WaveSaving", RW::ReadWrite, TYPE::CH, {{"Always", "Always"}, {"OnRequest", "On Request"}});
const Reg WaveResolution ("WaveResolution", RW::ReadWrite, TYPE::CH, {{"RES8", " 8 ns"},
{"RES16","16 ns"},
{"RES32","32 ns"},
{"RES64","64 ns"}});
const Reg TimeFilterRiseTime ("TimeFilterRiseTimeT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"2000", ""}}, ANSTYPE::NUM, "ns");
const Reg TimeFilterRetriggerGuard ("TimeFilterRetriggerGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterRiseTime ("EnergyFilterRiseTimeT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"13000", ""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterFlatTop ("EnergyFilterFlatTopT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"3000", ""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterPoleZero ("EnergyFilterPoleZeroT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"524000", ""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterPeakingPosition ("EnergyFilterPeakingPosition", RW::ReadWrite, TYPE::CH, {{"0", ""},{"100", ""}}, ANSTYPE::NUM, "%");
const Reg TimeFilterRiseTime ("TimeFilterRiseTimeT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"2000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg TimeFilterRetriggerGuard ("TimeFilterRetriggerGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterRiseTime ("EnergyFilterRiseTimeT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"13000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterFlatTop ("EnergyFilterFlatTopT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"3000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterPoleZero ("EnergyFilterPoleZeroT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"524000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterPeakingPosition ("EnergyFilterPeakingPosition", RW::ReadWrite, TYPE::CH, {{"0", ""},{"100", ""}, {"1",""}}, ANSTYPE::NUM, "%");
const Reg EnergyFilterPeakingAvg ("EnergyFilterPeakingAvg", RW::ReadWrite, TYPE::CH, {{"OneShot", "1 sample"},
{"LowAVG", "4 samples"},
{"MediumAVG", "16 samples"},
@ -401,9 +401,9 @@ namespace DIGIPARA{
{"Medium", "1024 samples"},
{"MediumHigh","4096 samples"},
{"High", "16384 samples"}});
const Reg EnergyFilterBaselineGuard ("EnergyFilterBaselineGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterFineGain ("EnergyFilterFineGain", RW::ReadWrite, TYPE::CH, {{"0", ""},{"10", ""}}, ANSTYPE::NUM);
const Reg EnergyFilterPileUpGuard ("EnergyFilterPileUpGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"64000", ""}}, ANSTYPE::NUM);
const Reg EnergyFilterBaselineGuard ("EnergyFilterBaselineGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""}, {"8",""}}, ANSTYPE::NUM, "ns");
const Reg EnergyFilterFineGain ("EnergyFilterFineGain", RW::ReadWrite, TYPE::CH, {{"0", ""},{"10", ""}, {"0.001",""}}, ANSTYPE::NUM);
const Reg EnergyFilterPileUpGuard ("EnergyFilterPileUpGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"64000", ""}, {"8",""}}, ANSTYPE::NUM);
const Reg EnergyFilterLowFreqFilter ("EnergyFilterLFLimitation", RW::ReadWrite, TYPE::CH, {{"Off", "Disabled"}, {"On", "Enabled"}});
const Reg WaveAnalogProbe0 ("WaveAnalogProbe0", RW::ReadWrite, TYPE::CH, {{"ADCInput", "ADC Input"},
{"TimeFilter", "Time Filter"},
@ -511,13 +511,13 @@ namespace DIGIPARA{
{"GlobalTriggerSource", "Global Trigger"},
{"ITLA", "ITLA"},
{"ITLB", "ITLB"}});
const Reg CoincidenceLength ("CoincidenceLengthT", RW::ReadWrite, TYPE::CH, {{"8", ""},{"524280", ""}}, ANSTYPE::NUM, "ns");
const Reg CoincidenceLength ("CoincidenceLengthT", RW::ReadWrite, TYPE::CH, {{"8", ""},{"524280", ""}, {"8", ""}}, ANSTYPE::NUM, "ns");
const Reg CoincidenceLengthSample ("CoincidenceLengthS", RW::ReadWrite);
const Reg ADCVetoWidth ("ADCVetoWidth", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"524280", ""}}, ANSTYPE::NONE, "ns");
const Reg ADCVetoWidth ("ADCVetoWidth", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"524280", ""}, {"1", ""}}, ANSTYPE::NONE, "ns");
const Reg EnergySkimLowDiscriminator ("EnergySkimLowDiscriminator", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"65534", ""}}, ANSTYPE::NUM);
const Reg EnergySkimHighDiscriminator ("EnergySkimHighDiscriminator", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"65534", ""}}, ANSTYPE::NUM);
const Reg EnergySkimLowDiscriminator ("EnergySkimLowDiscriminator", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"65534", ""}, {"1", ""}}, ANSTYPE::NUM);
const Reg EnergySkimHighDiscriminator ("EnergySkimHighDiscriminator", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"65534", ""}, {"1", ""}}, ANSTYPE::NUM);
const Reg RecordLengthSample ("ChRecordLengthS", RW::ReadWrite);
const Reg PreTriggerSample ("ChPreTriggerS", RW::ReadWrite);

View File

@ -23,7 +23,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
qDebug() << "DigiSettingsPanel constructor";
setWindowTitle("Digitizers Settings");
setGeometry(0, 0, 1850, 900);
setGeometry(0, 0, 1850, 1000);
//setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@ -254,7 +254,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lbAutoDisarmAcq->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbAutoDisarmAcq, rowId, 4, 1, 2);
cbbAutoDisarmAcq[iDigi] = new QComboBox(tab);
cbbAutoDisarmAcq[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbAutoDisarmAcq[iDigi], rowId, 6);
SetupShortComboBox(cbbAutoDisarmAcq[iDigi], DIGIPARA::DIG::EnableAutoDisarmACQ);
@ -266,10 +266,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lbStatEvents->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStatEvents, rowId, 4, 1, 2);
cbbStatEvents[iDigi] = new QComboBox(tab);
cbbStatEvents[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbStatEvents[iDigi], rowId, 6);
SetupShortComboBox(cbbStatEvents[iDigi], DIGIPARA::DIG::EnableStatisticEvents);
connect(cbbStatEvents[iDigi], &QComboBox::currentIndexChanged, this, [=](){
connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
digi[ID]->WriteValue(DIGIPARA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString());
});
@ -286,19 +286,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lbBdVetoWidth->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbBdVetoWidth, rowId, 3, 1, 2);
dsbBdVetoWidth[iDigi] = new QDoubleSpinBox(tab); // may be QDoubleSpinBox
dsbBdVetoWidth[iDigi] = new RSpinBox(tab, 0); // may be QDoubleSpinBox
dsbBdVetoWidth[iDigi]->setMinimum(0);
dsbBdVetoWidth[iDigi]->setMaximum(34359738360);
dsbBdVetoWidth[iDigi]->setDecimals(0);
dsbBdVetoWidth[iDigi]->setSingleStep(20);
boardLayout->addWidget(dsbBdVetoWidth[iDigi], rowId, 5);
connect(dsbBdVetoWidth[iDigi], &QDoubleSpinBox::valueChanged, this, [=](){
connect(dsbBdVetoWidth[iDigi], &RSpinBox::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(dsbBdVetoWidth[iDigi]->value()), -1);
});
cbbBdVetoPolarity[iDigi] = new QComboBox(tab);
cbbBdVetoPolarity[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbBdVetoPolarity[iDigi], rowId, 6);
SetupShortComboBox(cbbBdVetoPolarity[iDigi], DIGIPARA::DIG::BoardVetoPolarity);
@ -311,7 +310,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lbClockOutDelay->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay, rowId, 3, 1, 2);
dsbVolatileClockOutDelay[iDigi] = new QDoubleSpinBox(tab);
dsbVolatileClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbVolatileClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbVolatileClockOutDelay[iDigi]->setMaximum(18888.888);
dsbVolatileClockOutDelay[iDigi]->setValue(0);
@ -330,7 +329,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lbClockOutDelay2->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay2, rowId, 3, 1, 2);
dsbClockOutDelay[iDigi] = new QDoubleSpinBox(tab);
dsbClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbClockOutDelay[iDigi]->setMaximum(18888.888);
dsbClockOutDelay[iDigi]->setValue(0);
@ -374,7 +373,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
vgaLayout->addWidget(lb, 0, 2*k);
VGA[iDigi][k] = new QDoubleSpinBox(tab);
VGA[iDigi][k] = new RSpinBox(tab, 1);
VGA[iDigi][k]->setMinimum(0);
VGA[iDigi][k]->setMaximum(40);
VGA[iDigi][k]->setSingleStep(0.5);
@ -410,9 +409,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
rowID = 0;
SetupComboBox(cbbOnOff[iDigi][ch], DIGIPARA::CH::ChannelEnable, -1, true, "On/Off", layout1, rowID, 0);
rowID ++;
SetupComboBox(cbbWaveSource[iDigi][ch], DIGIPARA::CH::WaveDataSource, -1, true, "Wave Data Source", layout1, rowID, 0, 1, 2);
SetupComboBox(cbbWaveSource[iDigi][ch], DIGIPARA::CH::WaveDataSource, -1, true, "Wave Data Source", layout1, rowID, 2);
rowID ++;
SetupComboBox(cbbWaveRes[iDigi][ch], DIGIPARA::CH::WaveResolution, -1, true, "Wave Resol.", layout1, rowID, 0);
@ -497,13 +494,6 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
rowID ++;
SetupComboBox(cbbChVetoSrc[iDigi][ch], DIGIPARA::CH::ChannelVetoSource, -1, true, "Veto Source", layout5, rowID, 0);
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 ++;
SetupComboBox(cbbCoinMask[iDigi][ch], DIGIPARA::CH::CoincidenceMask, -1, true, "Coin. Mask", layout5, rowID, 0);
@ -562,11 +552,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){
cbbOnOff[iDigi][ch]->setItemData(1, QBrush(Qt::red), Qt::ForegroundRole);
connect(cbbOnOff[iDigi][ch], &QComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : red;" : "");});
connect(cbbOnOff[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : red;" : "");});
cbbParity[iDigi][ch]->setItemData(1, QBrush(Qt::red), Qt::ForegroundRole);
connect(cbbParity[iDigi][ch], &QComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : red;" : "");});
connect(cbbParity[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : red;" : "");});
cbbLowFilter[iDigi][ch]->setItemData(1, QBrush(Qt::red), Qt::ForegroundRole);
connect(cbbLowFilter[iDigi][ch], &QComboBox::currentIndexChanged, this, [=](int index){ cbbLowFilter[ID][ch]->setStyleSheet(index == 1 ? "color : blue;" : "");});
connect(cbbLowFilter[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbLowFilter[ID][ch]->setStyleSheet(index == 1 ? "color : blue;" : "");});
}
}
@ -623,52 +613,57 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
}
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(cbbOnOff[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbOnOff, ch);});
connect(spbDCOffset[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbDCOffset, ch);});
connect(spbThreshold[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbThreshold, ch);});
connect(cbbParity[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbParity, ch);});
connect(spbRecordLength[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbRecordLength, ch);});
connect(spbPreTrigger[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbPreTrigger, ch);});
connect(spbInputRiseTime[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbInputRiseTime, ch);});
connect(spbTriggerGuard[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbTriggerGuard, ch);});
connect(cbbLowFilter[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbLowFilter, ch);});
connect(cbbWaveSource[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbWaveSource, ch);});
connect(cbbWaveRes[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbWaveRes, ch);});
connect(cbbWaveSave[iDigi][ch], &RComboBox::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(spbTrapRiseTime[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbTrapRiseTime, ch);});
connect(spbTrapFlatTop[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbTrapFlatTop, ch);});
connect(spbTrapPoleZero[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbTrapPoleZero, ch);});
connect(spbPeaking[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbPeaking, ch);});
connect(cbbPeakingAvg[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbPeakingAvg, ch);});
connect(cbbBaselineAvg[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbBaselineAvg, ch);});
connect(spbFineGain[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbFineGain, ch);});
spbFineGain[iDigi][ch]->setSingleStep(0.001);
spbFineGain[iDigi][ch]->setDecimals(3);
connect(spbBaselineGuard[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbBaselineGuard, ch);});
connect(spbPileupGuard[iDigi][ch], &RSpinBox::returnPressed, 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(cbbAnaProbe0[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbAnaProbe0, ch);});
connect(cbbAnaProbe1[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbAnaProbe1, ch);});
connect(cbbDigProbe0[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbDigProbe0, ch);});
connect(cbbDigProbe1[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbDigProbe1, ch);});
connect(cbbDigProbe2[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbDigProbe2, ch);});
connect(cbbDigProbe3[iDigi][ch], &RComboBox::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(cbbEventSelector[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbEventSelector, ch);});
connect(cbbWaveSelector[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbWaveSelector, ch);});
connect(spbEnergySkimLow[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbEnergySkimLow, ch);});
connect(spbEnergySkimHigh[iDigi][ch], &RSpinBox::returnPressed, 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);});
connect(cbbEvtTrigger[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbEvtTrigger, ch);});
connect(cbbWaveTrigger[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbWaveTrigger, ch);});
connect(cbbChVetoSrc[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbChVetoSrc, ch);});
connect(cbbCoinMask[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbCoinMask, ch);});
connect(cbbAntiCoinMask[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbAntiCoinMask, ch);});
connect(spbCoinLength[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbCoinLength, ch);});
connect(spbADCVetoWidth[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbADCVetoWidth, ch);});
}
{//@============== Trigger Map tab
{//@============== Trigger Mask/Map tab
//TODO==========================
QTabWidget * triggerMapTab = new QTabWidget(tab);
chTabWidget->addTab(triggerMapTab, "Trigger Map");
@ -1028,51 +1023,66 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
}
//^###########################################################################
void DigiSettingsPanel::SetupShortComboBox(QComboBox *cbb, Reg para){
void DigiSettingsPanel::SetupShortComboBox(RComboBox *cbb, Reg para){
cbb->setFocusPolicy(Qt::StrongFocus);
for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){
cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second),
QString::fromStdString((para.GetAnswers())[i].first));
}
}
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){
void DigiSettingsPanel::SetupComboBox(RComboBox *&cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){
QLabel * lb = new QLabel(labelTxt, this);
layout->addWidget(lb, row, col);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
cbb = new QComboBox(this);
cbb = new RComboBox(this);
layout->addWidget(cbb, row, col+1, srow, scol);
for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){
cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second), QString::fromStdString((para.GetAnswers())[i].first));
}
if( isMaster && para.GetType() == TYPE::CH ) cbb->addItem("");
connect(cbb, &QComboBox::currentIndexChanged, this, [=](){
connect(cbb, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
digi[ID]->WriteValue(para, cbb->currentData().toString().toStdString(), ch_index);
});
}
//TODO ==== spin Box step
template<typename T> void DigiSettingsPanel::SetupSpinBox(T *&spb, const Reg para, int ch_index, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){
void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_index, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){
QLabel * lb = new QLabel(labelTxt, this);
layout->addWidget(lb, row, col);
lb->setAlignment(Qt::AlignRight| Qt::AlignCenter);
spb = new T(this);
spb = new RSpinBox(this);
if( para.GetType() == TYPE::DIG || ch_index >= 0 ){
spb->setMinimum(atof( para.GetAnswers()[0].first.c_str()));
}else{
spb->setMinimum(qMin(-1.0, atof( para.GetAnswers()[0].first.c_str())));
}
spb->setMaximum(atof( para.GetAnswers()[1].first.c_str()));
if( para.GetAnswers().size() >= 3 ) {
spb->setSingleStep(atof(para.GetAnswers()[2].first.c_str()));
}else{
printf("--- missed. %s\n", para.GetPara().c_str());
}
layout->addWidget(spb, row, col + 1, srow, scol);
connect(spb, &T::valueChanged, this, [=](){
connect(spb, &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
spb->setStyleSheet("color:blue;");
});
connect(spb, &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
if( spb->decimals() == 0 && spb->singleStep() != 1) {
double step = spb->singleStep();
double value = spb->value();
spb->setValue( (std::round(value/step) * step) );
}
spb->setStyleSheet("");
digi[ID]->WriteValue(para, std::to_string(spb->value()), ch_index);
});
}
void DigiSettingsPanel::SyncComboBox(QComboBox *(&cbb)[][MaxNumberOfChannel + 1], int ch){
void DigiSettingsPanel::SyncComboBox(RComboBox *(&cbb)[][MaxNumberOfChannel + 1], int ch){
if( !enableSignalSlot ) return;
const int nCh = digi[ID]->GetNChannels();
@ -1101,7 +1111,7 @@ void DigiSettingsPanel::SyncComboBox(QComboBox *(&cbb)[][MaxNumberOfChannel + 1]
}
}
void DigiSettingsPanel::SyncSpinBox(QSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch){
void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch){
if( !enableSignalSlot ) return;
const int nCh = digi[ID]->GetNChannels();
@ -1132,7 +1142,7 @@ void DigiSettingsPanel::SyncSpinBox(QSpinBox *(&spb)[][MaxNumberOfChannel+1], in
}
}
void DigiSettingsPanel::SetupSpinBoxTab(QSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel){
void DigiSettingsPanel::SetupSpinBoxTab(RSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel){
QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text);
QGridLayout * allLayout = new QGridLayout(tabPage);
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -1144,7 +1154,7 @@ void DigiSettingsPanel::SetupSpinBoxTab(QSpinBox *(&spb)[][MaxNumberOfChannel+1]
}
}
void DigiSettingsPanel::SetupComboBoxTab(QComboBox *(&cbb)[][MaxNumberOfChannel + 1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel, int nCol){
void DigiSettingsPanel::SetupComboBoxTab(RComboBox *(&cbb)[][MaxNumberOfChannel + 1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel, int nCol){
QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text);
QGridLayout * allLayout = new QGridLayout(tabPage);
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -1156,7 +1166,7 @@ void DigiSettingsPanel::SetupComboBoxTab(QComboBox *(&cbb)[][MaxNumberOfChannel
}
}
void DigiSettingsPanel::FillComboBoxValueFromMemory(QComboBox *&cbb, const Reg para, int ch_index){
void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, 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, cbb);
int index = cbb->findData(result);
@ -1167,7 +1177,7 @@ void DigiSettingsPanel::FillComboBoxValueFromMemory(QComboBox *&cbb, const Reg p
}
}
template<typename T> void DigiSettingsPanel::FillSpinBoxValueFromMemory(T *&spb, const Reg para, int ch_index){
void DigiSettingsPanel::FillSpinBoxValueFromMemory(RSpinBox *&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());

View File

@ -16,11 +16,44 @@
#include <QPushButton>
#include <QFrame>
#include <QSignalMapper>
#include <QWheelEvent>
#include "ClassDigitizer2Gen.h"
#define MaxNumberOfDigitizer 20
class RComboBox : public QComboBox{
public :
RComboBox(QWidget * parent = nullptr): QComboBox(parent){
setFocusPolicy(Qt::StrongFocus);
}
protected:
void wheelEvent(QWheelEvent * event) override{ event->ignore(); }
};
class RSpinBox : public QDoubleSpinBox{
Q_OBJECT
public :
RSpinBox(QWidget * parent = nullptr, int decimal = 0): QDoubleSpinBox(parent){
setFocusPolicy(Qt::StrongFocus);
setDecimals(decimal);
}
signals:
void returnPressed();
protected:
void wheelEvent(QWheelEvent * event) override{ event->ignore(); }
void keyPressEvent(QKeyEvent * event) override{
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
emit returnPressed();
} else {
QDoubleSpinBox::keyPressEvent(event);
}
}
};
//^#######################################################
class DigiSettingsPanel : public QWidget{
Q_OBJECT
@ -58,92 +91,90 @@ private:
QLineEdit * leTemp[MaxNumberOfDigitizer][8];
//-------------- board settings
QComboBox * cbbClockSource[MaxNumberOfDigitizer];
RComboBox * cbbClockSource[MaxNumberOfDigitizer];
QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5];
QCheckBox * ckbGlbTrgSource[MaxNumberOfDigitizer][5];
QComboBox * cbbTrgOut[MaxNumberOfDigitizer];
QComboBox * cbbGPIO[MaxNumberOfDigitizer];
QComboBox * cbbAutoDisarmAcq[MaxNumberOfDigitizer];
QComboBox * cbbBusyIn[MaxNumberOfDigitizer];
QComboBox * cbbStatEvents[MaxNumberOfDigitizer];
QComboBox * cbbSyncOut[MaxNumberOfDigitizer];
QComboBox * cbbBoardVetoSource[MaxNumberOfDigitizer];
QDoubleSpinBox * dsbBdVetoWidth[MaxNumberOfDigitizer];
QComboBox * cbbBdVetoPolarity[MaxNumberOfDigitizer];
QComboBox * cbbIOLevel[MaxNumberOfDigitizer];
QSpinBox * spbRunDelay[MaxNumberOfDigitizer];
QDoubleSpinBox * dsbVolatileClockOutDelay[MaxNumberOfDigitizer];
QDoubleSpinBox * dsbClockOutDelay[MaxNumberOfDigitizer];
RComboBox * cbbTrgOut[MaxNumberOfDigitizer];
RComboBox * cbbGPIO[MaxNumberOfDigitizer];
RComboBox * cbbAutoDisarmAcq[MaxNumberOfDigitizer];
RComboBox * cbbBusyIn[MaxNumberOfDigitizer];
RComboBox * cbbStatEvents[MaxNumberOfDigitizer];
RComboBox * cbbSyncOut[MaxNumberOfDigitizer];
RComboBox * cbbBoardVetoSource[MaxNumberOfDigitizer];
RSpinBox * dsbBdVetoWidth[MaxNumberOfDigitizer];
RComboBox * cbbBdVetoPolarity[MaxNumberOfDigitizer];
RComboBox * cbbIOLevel[MaxNumberOfDigitizer];
RSpinBox * spbRunDelay[MaxNumberOfDigitizer];
RSpinBox * dsbVolatileClockOutDelay[MaxNumberOfDigitizer];
RSpinBox * dsbClockOutDelay[MaxNumberOfDigitizer];
//-------------- Test pulse
QGroupBox * testPulseBox;
QDoubleSpinBox * dsbTestPuslePeriod[MaxNumberOfDigitizer];
QDoubleSpinBox * dsbTestPusleWidth[MaxNumberOfDigitizer];
QSpinBox * spbTestPusleLowLevel[MaxNumberOfDigitizer];
QSpinBox * spbTestPusleHighLevel[MaxNumberOfDigitizer];
RSpinBox * dsbTestPuslePeriod[MaxNumberOfDigitizer];
RSpinBox * dsbTestPusleWidth[MaxNumberOfDigitizer];
RSpinBox * spbTestPusleLowLevel[MaxNumberOfDigitizer];
RSpinBox * spbTestPusleHighLevel[MaxNumberOfDigitizer];
//-------------- VGA
QGroupBox * VGABox;
QDoubleSpinBox * VGA[MaxNumberOfDigitizer][4];
RSpinBox * VGA[MaxNumberOfDigitizer][4];
//---------------
QPushButton *bn[MaxNumberOfChannel][MaxNumberOfChannel];
bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];
//--------------- Channel settings
QComboBox * cbbOnOff[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbOnOff[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbRecordLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbPreTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbDCOffset[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbThreshold[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbRecordLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPreTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbDCOffset[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbThreshold[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbParity[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbWaveSource[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbWaveRes[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbWaveSave[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbParity[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSource[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveRes[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSave[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbInputRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbTriggerGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbInputRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTriggerGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbTrapRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbTrapFlatTop[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbTrapPoleZero[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTrapRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTrapFlatTop[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTrapPoleZero[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbPeaking[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbBaselineGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbPileupGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPeaking[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbBaselineGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPileupGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbPeakingAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbBaselineAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbFineGain[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbLowFilter[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbPeakingAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbBaselineAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbFineGain[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbLowFilter[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbAnaProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbAnaProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbAnaProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbAnaProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbDigProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbDigProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbDigProbe2[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbDigProbe3[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe2[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe3[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbEvtTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbWaveTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbChVetoSrc[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbEvtTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbChVetoSrc[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QLineEdit * leTriggerMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbEventSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbEventSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbWaveSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbAntiCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QComboBox * cbbAntiCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbCoinLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbADCVetoWidth[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbCoinLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbADCVetoWidth[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbEnergySkimLow[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbEnergySkimHigh[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbEnergySkimLow[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbEnergySkimHigh[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
//-------------------------
@ -152,19 +183,19 @@ private:
void SetStartSource();
void SetGlobalTriggerSource();
void SetupShortComboBox(QComboBox * cbb, Reg para);
void SetupShortComboBox(RComboBox * cbb, Reg para);
void SetupComboBox(QComboBox * &cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
template<typename T> void SetupSpinBox(T * &spb, const Reg para, int ch_index, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SetupComboBox(RComboBox * &cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SetupSpinBox(RSpinBox * &spb, const Reg para, int ch_index, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SyncComboBox(QComboBox *(&cbb)[][MaxNumberOfChannel+1], int ch);
void SyncSpinBox(QSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch);
void SyncComboBox(RComboBox *(&cbb)[][MaxNumberOfChannel+1], int ch);
void SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch);
void SetupComboBoxTab(QComboBox *(&cbb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel, int nCol = 4);
void SetupSpinBoxTab(QSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel);
void SetupComboBoxTab(RComboBox *(&cbb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel, int nCol = 4);
void SetupSpinBoxTab(RSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel);
void FillComboBoxValueFromMemory(QComboBox * &cbb, const Reg para, int ch_index = -1);
template<typename T> void FillSpinBoxValueFromMemory(T * &spb, const Reg para, int ch_index = -1 );
void FillComboBoxValueFromMemory(RComboBox * &cbb, const Reg para, int ch_index = -1);
void FillSpinBoxValueFromMemory(RSpinBox * &spb, const Reg para, int ch_index = -1 );