SOLARIS_QT6_DAQ/digiSettings.h

128 lines
3.2 KiB
C
Raw Normal View History

2023-01-25 17:16:14 -05:00
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QWidget>
2023-01-26 19:12:18 -05:00
#include <QLineEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QGridLayout>
#include <QScrollArea>
#include <QTabWidget>
#include <QGroupBox>
#include <QCheckBox>
#include <QComboBox>
#include <QTableWidget>
#include <QDebug>
#include <QPushButton>
#include <QFrame>
#include <QSignalMapper>
2023-01-25 17:16:14 -05:00
#include "ClassDigitizer2Gen.h"
2023-01-30 18:40:24 -05:00
#define MaxNumberOfDigitizer 10
2023-01-25 17:16:14 -05:00
class DigiSettings : public QWidget{
Q_OBJECT
public:
2023-02-02 19:01:10 -05:00
DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget * parent = nullptr);
2023-01-25 17:16:14 -05:00
~DigiSettings();
private slots:
2023-01-30 18:40:24 -05:00
2023-02-02 19:01:10 -05:00
void onReset(int id){
emit sendLogMsg("Reset Digitizer-" + QString::number(digi[id]->GetSerialNumber()));
digi[id]->Reset();
2023-01-30 18:40:24 -05:00
}
2023-02-02 19:01:10 -05:00
void onDefault(int id){
emit sendLogMsg("Program Digitizer-" + QString::number(digi[id]->GetSerialNumber()) + " to default PHA.");
digi[id]->ProgramPHA();
2023-01-30 18:40:24 -05:00
}
2023-01-26 19:12:18 -05:00
void onTriggerClick(int haha){
2023-01-30 18:40:24 -05:00
unsigned short iDig = haha >> 12;
unsigned short ch = (haha >> 8 ) & 0xF;
unsigned short ch2 = haha & 0xFF;
qDebug() << "Digi-" << iDig << ", Ch-" << ch << ", " << ch2;
2023-01-26 19:12:18 -05:00
if(bnClickStatus[ch][ch2]){
bn[ch][ch2]->setStyleSheet("");
bnClickStatus[ch][ch2] = false;
}else{
bn[ch][ch2]->setStyleSheet("background-color: red;");
bnClickStatus[ch][ch2] = true;
}
}
2023-01-25 17:16:14 -05:00
2023-01-30 18:40:24 -05:00
void onChannelonOff(int haha){
2023-01-30 18:40:24 -05:00
unsigned short iDig = haha >> 12;
//qDebug()<< "nDigi-" << iDig << ", ch-" << (haha & 0xFF);
if( (haha & 0xFF) == 64){
2023-01-30 18:40:24 -05:00
if( cbCh[iDig][64]->isChecked() ){
2023-02-02 19:01:10 -05:00
for( int i = 0 ; i < digi[iDig]->GetNChannels() ; i++){
2023-01-30 18:40:24 -05:00
cbCh[iDig][i]->setChecked(true);
}
}else{
2023-02-02 19:01:10 -05:00
for( int i = 0 ; i < digi[iDig]->GetNChannels() ; i++){
2023-01-30 18:40:24 -05:00
cbCh[iDig][i]->setChecked(false);
}
}
2023-01-30 18:40:24 -05:00
}else{
unsigned int nOn = 0;
2023-02-02 19:01:10 -05:00
for( int i = 0; i < digi[iDig]->GetNChannels(); i++){
2023-01-30 18:40:24 -05:00
nOn += (cbCh[iDig][i]->isChecked() ? 1 : 0);
}
if( nOn == 64){
cbCh[iDig][64]->setChecked(true);
}else{
cbCh[iDig][64]->setChecked(false);
}
}
}
2023-01-25 17:16:14 -05:00
signals:
2023-01-30 18:40:24 -05:00
void sendLogMsg(const QString &msg);
2023-01-25 17:16:14 -05:00
private:
2023-02-02 19:01:10 -05:00
Digitizer2Gen ** digi;
2023-01-25 17:16:14 -05:00
unsigned short nDigi;
QPushButton *bn[MaxNumberOfChannel][MaxNumberOfChannel];
bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];
2023-01-30 18:40:24 -05:00
QCheckBox * cbCh[MaxNumberOfDigitizer][MaxNumberOfChannel + 1]; // index = 64 is for all channels
QSpinBox * sbRecordLength[MaxNumberOfChannel + 1];
QSpinBox * sbPreTrigger[MaxNumberOfChannel + 1];
2023-01-30 18:40:24 -05:00
QComboBox * cmbWaveRes[MaxNumberOfChannel + 1];
QComboBox * cmbAnaProbe0[MaxNumberOfChannel + 1];
QComboBox * cmbAnaProbe1[MaxNumberOfChannel + 1];
QComboBox * cmbDigProbe0[MaxNumberOfChannel + 1];
QComboBox * cmbDigProbe1[MaxNumberOfChannel + 1];
QComboBox * cmbDigProbe2[MaxNumberOfChannel + 1];
QComboBox * cmbDigProbe3[MaxNumberOfChannel + 1];
QComboBox * cmbEvtTrigger[MaxNumberOfChannel + 1];
QComboBox * cmbWaveTrigger[MaxNumberOfChannel + 1];
QComboBox * cmbWaveSave[MaxNumberOfChannel + 1];
QComboBox * cmbWaveSource[MaxNumberOfChannel + 1];
QComboBox * cmbChVetoSrc[MaxNumberOfChannel + 1];
QSpinBox * sbChADCVetoWidth[MaxNumberOfChannel + 1];
2023-01-30 18:40:24 -05:00
2023-01-25 17:16:14 -05:00
};
#endif