From 26056070f007a8a25bda2660452430e7fc810135 Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Mon, 24 Apr 2023 17:37:03 -0400 Subject: [PATCH] added digitizer Info --- ClassDigitizer.h | 1 + DigiSettings.cpp | 18 -------- DigiSettings.h | 32 ------------- DigiSettingsPanel.cpp | 101 ++++++++++++++++++++++++++++++++++++++++++ DigiSettingsPanel.h | 39 ++++++++++++++++ FSUDAQ.cpp | 2 +- FSUDAQ.h | 4 +- FSUDAQ_Qt6.pro | 4 +- macro.h | 3 ++ 9 files changed, 149 insertions(+), 55 deletions(-) delete mode 100644 DigiSettings.cpp delete mode 100644 DigiSettings.h create mode 100644 DigiSettingsPanel.cpp create mode 100644 DigiSettingsPanel.h diff --git a/ClassDigitizer.h b/ClassDigitizer.h index 6352dbe..49c4397 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -99,6 +99,7 @@ class Digitizer{ uint32_t PrintRegister(uint32_t address, std::string msg); //^================ Get Board info + CAEN_DGTZ_BoardInfo_t GetBoardInfo() const {return BoardInfo;} std::string GetModelName() const {return BoardInfo.ModelName;} int GetSerialNumber() const {return BoardInfo.SerialNumber;} int GetChannelMask() const {return channelMask;} diff --git a/DigiSettings.cpp b/DigiSettings.cpp deleted file mode 100644 index c7a0618..0000000 --- a/DigiSettings.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "DigiSettings.h" - -DigiSettings::DigiSettings(Digitizer ** digi, unsigned int nDigi, QMainWindow *parent): QMainWindow(parent){ - - this->digi = digi; - this->nDigi = nDigi; - - enableSignalSlot = false; - - setWindowTitle("Digitizer Settings"); - setGeometry(0, 0, 1000, 800); - -} - -DigiSettings::~DigiSettings(){ - printf("%s \n", __func__); - -} diff --git a/DigiSettings.h b/DigiSettings.h deleted file mode 100644 index 65cb977..0000000 --- a/DigiSettings.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef DigiSettings_H -#define DigiSettings_H - -#include - -#include "macro.h" -#include "ClassDigitizer.h" -#include "CustomWidgets.h" - -class DigiSettings : public QMainWindow{ - Q_OBJECT - -public: - DigiSettings(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr); - ~DigiSettings(); - -private slots: - -signals: - void SendLogMsg(const QString &msg); - -private: - - Digitizer ** digi; - unsigned int nDigi; - - bool enableSignalSlot; - -}; - - -#endif \ No newline at end of file diff --git a/DigiSettingsPanel.cpp b/DigiSettingsPanel.cpp new file mode 100644 index 0000000..13bb78c --- /dev/null +++ b/DigiSettingsPanel.cpp @@ -0,0 +1,101 @@ +#include "DigiSettingsPanel.h" + +#include +#include +#include +#include + +DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMainWindow *parent): QMainWindow(parent){ + + this->digi = digi; + this->nDigi = nDigi; + + enableSignalSlot = false; + + setWindowTitle("Digitizer Settings"); + setGeometry(0, 0, 1000, 800); + + tabWidget = new QTabWidget(this); + setCentralWidget(tabWidget); + + //@===================================== tab + for( unsigned int iDigi = 0 ; iDigi < this->nDigi; iDigi ++ ){ + + QScrollArea * scrollArea = new QScrollArea(this); + scrollArea->setWidgetResizable(true); + scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + tabWidget->addTab(scrollArea, "Digi-" + QString::number(digi[iDigi]->GetSerialNumber())); + + QWidget * tab = new QWidget(tabWidget); + scrollArea->setWidget(tab); + + QHBoxLayout * tabLayout_H = new QHBoxLayout(tab); //tab->setLayout(tabLayout_H); + + QVBoxLayout * tabLayout_V1 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V1); + QVBoxLayout * tabLayout_V2 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V2); + + {//^====================== Group of Digitizer Info + QGroupBox * infoBox = new QGroupBox("Board Info", tab); + //infoBox->setSizePolicy(sizePolicy); + + QGridLayout * infoLayout = new QGridLayout(infoBox); + tabLayout_V1->addWidget(infoBox); + + SetUpInfo( "Model ", digi[iDigi]->GetModelName(), infoLayout, 0, 0); + SetUpInfo( "DPP Type ", digi[iDigi]->GetDPPString(), infoLayout, 0, 2); + SetUpInfo("Link Type ", digi[iDigi]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link" , infoLayout, 0, 4); + + SetUpInfo( "S/N No. ", std::to_string(digi[iDigi]->GetSerialNumber()), infoLayout, 1, 0); + SetUpInfo( "No. Ch. ", std::to_string(digi[iDigi]->GetNChannels()), infoLayout, 1, 2); + SetUpInfo("Sampling Rate ", std::to_string(digi[iDigi]->GetCh2ns()), infoLayout, 1, 4); + + SetUpInfo("ADC bit ", std::to_string(digi[iDigi]->GetADCBits()), infoLayout, 2, 0); + SetUpInfo("ROC version ", digi[iDigi]->GetROCVersion(), infoLayout, 2, 2); + SetUpInfo("AMC version ", digi[iDigi]->GetAMCVersion(), infoLayout, 2, 4); + } + + {//^======================= Board status + QGroupBox * bardStatusBox = new QGroupBox("Board Status", tab); + QGridLayout * statusLayout = new QGridLayout(bardStatusBox); + tabLayout_V1->addWidget(bardStatusBox); + } + + {//^======================= Board Settings + QGroupBox * boardSettingBox = new QGroupBox("Board Settings", tab); + QGridLayout * settingLayout = new QGridLayout(boardSettingBox); + tabLayout_V1->addWidget(boardSettingBox); + + } + + {//^======================= Channel Settings + + QTabWidget * chTab = new QTabWidget(tab); + tabLayout_H->addWidget(chTab); + + QScrollArea * scrollArea = new QScrollArea(this); + scrollArea->setWidgetResizable(true); + scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + chTab->addTab(scrollArea, "Channel Settings"); + + } + + } + +} + +DigiSettingsPanel::~DigiSettingsPanel(){ + printf("%s \n", __func__); + +} + +//*================================================================ +//*================================================================ +void DigiSettingsPanel::SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col){ + QLabel * lab = new QLabel(name, this); + lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); + QLineEdit * leInfo = new QLineEdit(this); + leInfo->setReadOnly(true); + leInfo->setText(QString::fromStdString(value)); + gLayout->addWidget(lab, row, col); + gLayout->addWidget(leInfo, row, col + 1); +} diff --git a/DigiSettingsPanel.h b/DigiSettingsPanel.h new file mode 100644 index 0000000..510a4a0 --- /dev/null +++ b/DigiSettingsPanel.h @@ -0,0 +1,39 @@ +#ifndef DigiSettings_H +#define DigiSettings_H + +#include +#include +#include +#include + +#include "macro.h" +#include "ClassDigitizer.h" +#include "CustomWidgets.h" + +class DigiSettingsPanel : public QMainWindow{ + Q_OBJECT + +public: + DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr); + ~DigiSettingsPanel(); + +private slots: + +signals: + void SendLogMsg(const QString &msg); + +private: + + void SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col); + + Digitizer ** digi; + unsigned int nDigi; + + bool enableSignalSlot; + + QTabWidget * tabWidget; + +}; + + +#endif \ No newline at end of file diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 930d459..33ed168 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -744,7 +744,7 @@ void MainWindow::OpenScope(){ void MainWindow::OpenDigiSettings(){ if( digiSettings == nullptr ) { - digiSettings = new DigiSettings(digi, nDigi); + digiSettings = new DigiSettingsPanel(digi, nDigi); //connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg); digiSettings->show(); }else{ diff --git a/FSUDAQ.h b/FSUDAQ.h index adf153e..625a43c 100644 --- a/FSUDAQ.h +++ b/FSUDAQ.h @@ -14,7 +14,7 @@ #include "ClassDigitizer.h" #include "CustomThreads.h" #include "Scope.h" -#include "DigiSettings.h" +#include "DigiSettingsPanel.h" //^#===================================================== MainWindow class MainWindow : public QMainWindow{ @@ -109,7 +109,7 @@ private: Scope * scope; //@----- DigiSettings - DigiSettings * digiSettings; + DigiSettingsPanel * digiSettings; }; diff --git a/FSUDAQ_Qt6.pro b/FSUDAQ_Qt6.pro index a8502fe..a8eded2 100644 --- a/FSUDAQ_Qt6.pro +++ b/FSUDAQ_Qt6.pro @@ -23,13 +23,13 @@ HEADERS += ClassData.h \ ClassDigitizer.h \ CustomThreads.h \ CustomWidgets.h \ - DigiSettings.h \ + DigiSettingsPanel.h \ FSUDAQ.h \ macro.h \ RegisterAddress.h \ Scope.h SOURCES += ClassDigitizer.cpp \ - DigiSettings.cpp \ + DigiSettingsPanel.cpp \ FSUDAQ.cpp \ main.cpp \ Scope.cpp diff --git a/macro.h b/macro.h index 438bacf..b238feb 100644 --- a/macro.h +++ b/macro.h @@ -3,6 +3,9 @@ #define MaxNPorts 1 #define MaxNBoards 1 + +#define MaxNDigitizer MaxNPorts * MaxNBoards + #define MaxNChannels 16 #define MaxRecordLength 0x3fff * 8 #define MaxSaveFileSize 1024 * 1024 * 1024 * 2