added scalar panel, only UI
This commit is contained in:
parent
166cc4357c
commit
e3b16f7694
|
@ -6,7 +6,7 @@ Digitizer2Gen::Digitizer2Gen(){
|
||||||
}
|
}
|
||||||
|
|
||||||
Digitizer2Gen::~Digitizer2Gen(){
|
Digitizer2Gen::~Digitizer2Gen(){
|
||||||
printf("========Digitizer2Gen::%s \n",__func__);
|
printf("========Digitizer2Gen::%s (%d)\n",__func__, serialNumber);
|
||||||
if(isConnected ) CloseDigitizer();
|
if(isConnected ) CloseDigitizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,10 @@ void Digitizer2Gen::Initialization(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Digitizer2Gen::SetDummy(){
|
void Digitizer2Gen::SetDummy(unsigned short sn){
|
||||||
|
|
||||||
isDummy = true;
|
isDummy = true;
|
||||||
|
serialNumber = sn;
|
||||||
nChannels = 64;
|
nChannels = 64;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Digitizer2Gen {
|
||||||
|
|
||||||
unsigned short GetSerialNumber() {return serialNumber;}
|
unsigned short GetSerialNumber() {return serialNumber;}
|
||||||
|
|
||||||
void SetDummy();
|
void SetDummy(unsigned short sn);
|
||||||
bool IsDummy() {return isDummy;}
|
bool IsDummy() {return isDummy;}
|
||||||
|
|
||||||
int OpenDigitizer(const char * url);
|
int OpenDigitizer(const char * url);
|
||||||
|
|
163
mainwindow.cpp
163
mainwindow.cpp
|
@ -28,18 +28,28 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
setWindowIcon(icon);
|
setWindowIcon(icon);
|
||||||
|
|
||||||
nDigi = 0;
|
nDigi = 0;
|
||||||
digiSerialNum.clear();
|
|
||||||
digiSetting = NULL;
|
digiSetting = NULL;
|
||||||
readDataThread = NULL;
|
readDataThread = NULL;
|
||||||
|
|
||||||
scope = NULL;
|
scope = NULL;
|
||||||
|
|
||||||
|
{
|
||||||
|
scalar = new QMainWindow(this);
|
||||||
|
scalar->setWindowTitle("Scalar");
|
||||||
|
scalar->setGeometry(0, 0, 1000, 800);
|
||||||
|
|
||||||
|
QWidget * layoutWidget = new QWidget(scalar);
|
||||||
|
scalar->setCentralWidget(layoutWidget);
|
||||||
|
scalarLayout = new QGridLayout(layoutWidget);
|
||||||
|
scalarLayout->setSpacing(0);
|
||||||
|
|
||||||
|
leTrigger = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget * mainLayoutWidget = new QWidget(this);
|
QWidget * mainLayoutWidget = new QWidget(this);
|
||||||
setCentralWidget(mainLayoutWidget);
|
setCentralWidget(mainLayoutWidget);
|
||||||
QVBoxLayout * layoutMain = new QVBoxLayout(mainLayoutWidget);
|
QVBoxLayout * layoutMain = new QVBoxLayout(mainLayoutWidget);
|
||||||
mainLayoutWidget->setLayout(layoutMain);
|
mainLayoutWidget->setLayout(layoutMain);
|
||||||
|
|
||||||
|
|
||||||
{//====================== General
|
{//====================== General
|
||||||
QGroupBox * box1 = new QGroupBox("General", mainLayoutWidget);
|
QGroupBox * box1 = new QGroupBox("General", mainLayoutWidget);
|
||||||
layoutMain->addWidget(box1);
|
layoutMain->addWidget(box1);
|
||||||
|
@ -113,6 +123,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
leRawDataPath->setReadOnly(true);
|
leRawDataPath->setReadOnly(true);
|
||||||
leRawDataPath->setStyleSheet("background-color: #F3F3F3;");
|
leRawDataPath->setStyleSheet("background-color: #F3F3F3;");
|
||||||
|
|
||||||
|
bnOpenScalar = new QPushButton("Open Scalar", this);
|
||||||
|
bnOpenScalar->setEnabled(false);
|
||||||
|
connect(bnOpenScalar, &QPushButton::clicked, this, &MainWindow::OpenScaler);
|
||||||
|
|
||||||
bnStartACQ = new QPushButton("Start ACQ", this);
|
bnStartACQ = new QPushButton("Start ACQ", this);
|
||||||
bnStartACQ->setEnabled(false);
|
bnStartACQ->setEnabled(false);
|
||||||
connect(bnStartACQ, &QPushButton::clicked, this, &MainWindow::StartACQ);
|
connect(bnStartACQ, &QPushButton::clicked, this, &MainWindow::StartACQ);
|
||||||
|
@ -134,7 +148,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
runComment->setReadOnly(true);
|
runComment->setReadOnly(true);
|
||||||
|
|
||||||
layout2->addWidget(lbRawDataPath, 0, 0);
|
layout2->addWidget(lbRawDataPath, 0, 0);
|
||||||
layout2->addWidget(leRawDataPath, 0, 1, 1, 3);
|
layout2->addWidget(leRawDataPath, 0, 1, 1, 2);
|
||||||
|
layout2->addWidget(bnOpenScalar, 0, 3);
|
||||||
|
|
||||||
layout2->addWidget(lbRunID, 1, 0);
|
layout2->addWidget(lbRunID, 1, 0);
|
||||||
layout2->addWidget(leRunID, 1, 1);
|
layout2->addWidget(leRunID, 1, 1);
|
||||||
|
@ -187,6 +202,7 @@ MainWindow::~MainWindow(){
|
||||||
//delete logInfo;
|
//delete logInfo;
|
||||||
printf("- %s\n", __func__);
|
printf("- %s\n", __func__);
|
||||||
|
|
||||||
|
DeleteTriggerLineEdit();
|
||||||
CloseDigitizers();
|
CloseDigitizers();
|
||||||
|
|
||||||
//---- need manually delete
|
//---- need manually delete
|
||||||
|
@ -263,8 +279,6 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
if(digi[i]->IsConnected()){
|
if(digi[i]->IsConnected()){
|
||||||
|
|
||||||
digiSerialNum.push_back(digi[i]->GetSerialNumber());
|
|
||||||
|
|
||||||
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
||||||
bnStartACQ->setEnabled(true);
|
bnStartACQ->setEnabled(true);
|
||||||
bnStopACQ->setEnabled(false);
|
bnStopACQ->setEnabled(false);
|
||||||
|
@ -274,9 +288,8 @@ void MainWindow::OpenDigitizers(){
|
||||||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
LogMsg("Cannot open digitizer. Use a dummy with serial number " + QString::number(i));
|
digi[i]->SetDummy(i);
|
||||||
digi[i]->SetDummy();
|
LogMsg("Cannot open digitizer. Use a dummy with serial number " + QString::number(i) + " and " + QString::number(digi[i]->GetNChannels()) + " ch.");
|
||||||
digiSerialNum.push_back(i);
|
|
||||||
|
|
||||||
readDataThread[i] = NULL;
|
readDataThread[i] = NULL;
|
||||||
}
|
}
|
||||||
|
@ -287,26 +300,23 @@ void MainWindow::OpenDigitizers(){
|
||||||
bnOpenDigitizers->setEnabled(false);
|
bnOpenDigitizers->setEnabled(false);
|
||||||
bnOpenDigitizers->setStyleSheet("");
|
bnOpenDigitizers->setStyleSheet("");
|
||||||
|
|
||||||
|
SetUpScalar();
|
||||||
|
bnOpenScalar->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CloseDigitizers(){
|
void MainWindow::CloseDigitizers(){
|
||||||
|
|
||||||
if( digi == NULL) return;
|
if( digi == NULL) return;
|
||||||
|
|
||||||
|
scalar->close();
|
||||||
|
DeleteTriggerLineEdit(); // this use digi->GetNChannels();
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
if( digi[i] == NULL) return;
|
if( digi[i] == NULL) return;
|
||||||
digi[i]->CloseDigitizer();
|
digi[i]->CloseDigitizer();
|
||||||
delete digi[i];
|
delete digi[i];
|
||||||
|
|
||||||
LogMsg("Closed Digitizer : " + QString::number(digiSerialNum[0]));
|
LogMsg("Closed Digitizer : " + QString::number(digi[i]->GetSerialNumber()));
|
||||||
|
|
||||||
digiSerialNum.clear();
|
|
||||||
|
|
||||||
bnOpenDigitizers->setEnabled(true);
|
|
||||||
bnCloseDigitizers->setEnabled(false);
|
|
||||||
bnDigiSettings->setEnabled(false);
|
|
||||||
bnStartACQ->setEnabled(false);
|
|
||||||
bnStopACQ->setEnabled(false);
|
|
||||||
|
|
||||||
if( digiSetting != NULL ) digiSetting->close();
|
if( digiSetting != NULL ) digiSetting->close();
|
||||||
|
|
||||||
|
@ -321,7 +331,15 @@ void MainWindow::CloseDigitizers(){
|
||||||
digi = NULL;
|
digi = NULL;
|
||||||
readDataThread = NULL;
|
readDataThread = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
bnOpenDigitizers->setEnabled(true);
|
||||||
|
bnCloseDigitizers->setEnabled(false);
|
||||||
|
bnDigiSettings->setEnabled(false);
|
||||||
|
bnStartACQ->setEnabled(false);
|
||||||
|
bnStopACQ->setEnabled(false);
|
||||||
bnOpenDigitizers->setFocus();
|
bnOpenDigitizers->setFocus();
|
||||||
|
bnOpenScalar->setEnabled(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//^###################################################################### Open Scope
|
//^###################################################################### Open Scope
|
||||||
|
@ -329,7 +347,7 @@ void MainWindow::OpenScope(){
|
||||||
|
|
||||||
if( digi ){
|
if( digi ){
|
||||||
if( !scope ){
|
if( !scope ){
|
||||||
scope = new Scope(digi, nDigi, readDataThread, this);
|
scope = new Scope(digi, nDigi, readDataThread);
|
||||||
connect(scope, &Scope::CloseWindow, this, [=](){
|
connect(scope, &Scope::CloseWindow, this, [=](){
|
||||||
bnStartACQ->setEnabled(true);
|
bnStartACQ->setEnabled(true);
|
||||||
});
|
});
|
||||||
|
@ -354,6 +372,69 @@ void MainWindow::OpenDigitizersSettings(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//^###################################################################### Open Scaler, when DAQ is running
|
||||||
|
//TODO #################################
|
||||||
|
void MainWindow::OpenScaler(){
|
||||||
|
scalar->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::SetUpScalar(){
|
||||||
|
|
||||||
|
scalar->setGeometry(0, 0, 10 + nDigi * 100, 1000);
|
||||||
|
|
||||||
|
int rowID = 0;
|
||||||
|
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||||
|
|
||||||
|
if( ch == 0 ){
|
||||||
|
QLabel * lbCH_H = new QLabel("Ch", scalar); scalarLayout->addWidget(lbCH_H, rowID, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
rowID ++;
|
||||||
|
QLabel * lbCH = new QLabel(QString::number(ch), scalar);
|
||||||
|
lbCH->setAlignment(Qt::AlignCenter);
|
||||||
|
scalarLayout->addWidget(lbCH, rowID, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
leTrigger = new QLineEdit**[nDigi];
|
||||||
|
for( int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||||
|
rowID = 0;
|
||||||
|
leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
||||||
|
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||||
|
|
||||||
|
if( ch == 0 ){
|
||||||
|
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
|
||||||
|
lbDigi->setAlignment(Qt::AlignCenter);
|
||||||
|
scalarLayout->addWidget(lbDigi, rowID, iDigi+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
rowID ++;
|
||||||
|
|
||||||
|
leTrigger[iDigi][ch] = new QLineEdit();
|
||||||
|
leTrigger[iDigi][ch]->setReadOnly(true);
|
||||||
|
scalarLayout->addWidget(leTrigger[iDigi][ch], rowID, iDigi+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::DeleteTriggerLineEdit(){
|
||||||
|
|
||||||
|
printf("__________ %s \n", __func__);
|
||||||
|
|
||||||
|
if( leTrigger == NULL ) return;
|
||||||
|
|
||||||
|
for( int i = 0; i < nDigi; i++){
|
||||||
|
for( int ch = 0; ch < digi[i]->GetNChannels(); ch ++){
|
||||||
|
delete leTrigger[i][ch];
|
||||||
|
}
|
||||||
|
delete [] leTrigger[i];
|
||||||
|
}
|
||||||
|
delete [] leTrigger;
|
||||||
|
leTrigger = NULL;
|
||||||
|
printf("end of ____ %s \n", __func__);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//^###################################################################### Program Settings
|
//^###################################################################### Program Settings
|
||||||
void MainWindow::ProgramSettings(){
|
void MainWindow::ProgramSettings(){
|
||||||
|
|
||||||
|
@ -460,7 +541,6 @@ void MainWindow::ProgramSettings(){
|
||||||
QObject::connect(button2, &QPushButton::clicked, this, [=](){this->LogMsg("Cancel <b>Program Settings</b>");});
|
QObject::connect(button2, &QPushButton::clicked, this, [=](){this->LogMsg("Cancel <b>Program Settings</b>");});
|
||||||
QObject::connect(button2, &QPushButton::clicked, &dialog, &QDialog::reject);
|
QObject::connect(button2, &QPushButton::clicked, &dialog, &QDialog::reject);
|
||||||
|
|
||||||
|
|
||||||
layout->setColumnStretch(0, 2);
|
layout->setColumnStretch(0, 2);
|
||||||
layout->setColumnStretch(1, 2);
|
layout->setColumnStretch(1, 2);
|
||||||
layout->setColumnStretch(2, 2);
|
layout->setColumnStretch(2, 2);
|
||||||
|
@ -540,24 +620,7 @@ bool MainWindow::OpenProgramSettings(){
|
||||||
|
|
||||||
if( ret ){
|
if( ret ){
|
||||||
|
|
||||||
//------- decode IPListStr
|
DecodeIPList();
|
||||||
nDigi = 0;
|
|
||||||
QStringList parts = IPListStr.split(".");
|
|
||||||
QString IPDomain = parts[0] + "." + parts[1] + "." + parts[2] + ".";
|
|
||||||
parts = parts[3].split(",");
|
|
||||||
for(int i = 0; i < parts.size(); i++){
|
|
||||||
if( parts[i].indexOf("-") != -1){
|
|
||||||
QStringList haha = parts[i].split("-");
|
|
||||||
for( int j = haha[0].toInt(); j <= haha.last().toInt(); j++){
|
|
||||||
IPList << IPDomain + QString::number(j);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
IPList << IPDomain + parts[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nDigi = IPList.size();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
@ -569,6 +632,26 @@ bool MainWindow::OpenProgramSettings(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::DecodeIPList(){
|
||||||
|
//------- decode IPListStr
|
||||||
|
nDigi = 0;
|
||||||
|
IPList.clear();
|
||||||
|
QStringList parts = IPListStr.split(".");
|
||||||
|
QString IPDomain = parts[0] + "." + parts[1] + "." + parts[2] + ".";
|
||||||
|
parts = parts[3].split(",");
|
||||||
|
for(int i = 0; i < parts.size(); i++){
|
||||||
|
if( parts[i].indexOf("-") != -1){
|
||||||
|
QStringList haha = parts[i].split("-");
|
||||||
|
for( int j = haha[0].toInt(); j <= haha.last().toInt(); j++){
|
||||||
|
IPList << IPDomain + QString::number(j);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
IPList << IPDomain + parts[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nDigi = IPList.size();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::SaveProgramSettings(){
|
void MainWindow::SaveProgramSettings(){
|
||||||
|
|
||||||
IPListStr = lIPDomain->text();
|
IPListStr = lIPDomain->text();
|
||||||
|
@ -600,6 +683,8 @@ void MainWindow::SaveProgramSettings(){
|
||||||
bnNewExp->setEnabled(true);
|
bnNewExp->setEnabled(true);
|
||||||
bnOpenDigitizers->setEnabled(true);
|
bnOpenDigitizers->setEnabled(true);
|
||||||
|
|
||||||
|
DecodeIPList();
|
||||||
|
|
||||||
OpenExpSettings();
|
OpenExpSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
23
mainwindow.h
23
mainwindow.h
|
@ -42,9 +42,14 @@ private slots:
|
||||||
void OpenScope();
|
void OpenScope();
|
||||||
void OpenDigitizersSettings();
|
void OpenDigitizersSettings();
|
||||||
|
|
||||||
|
void OpenScaler();
|
||||||
|
void SetUpScalar();
|
||||||
|
void DeleteTriggerLineEdit();
|
||||||
|
|
||||||
void ProgramSettings();
|
void ProgramSettings();
|
||||||
bool OpenProgramSettings();
|
bool OpenProgramSettings();
|
||||||
void SaveProgramSettings();
|
void SaveProgramSettings();
|
||||||
|
void DecodeIPList();
|
||||||
void OpenDirectory(int id);
|
void OpenDirectory(int id);
|
||||||
|
|
||||||
void SetupNewExp();
|
void SetupNewExp();
|
||||||
|
@ -54,7 +59,10 @@ private slots:
|
||||||
void CreateRawDataFolderAndLink(const QString newExpName);
|
void CreateRawDataFolderAndLink(const QString newExpName);
|
||||||
|
|
||||||
void closeEvent(QCloseEvent * event){
|
void closeEvent(QCloseEvent * event){
|
||||||
|
printf("___ %s \n", __func__);
|
||||||
|
printf("+++++++++++++++ digiSetting %p\n", digiSetting);
|
||||||
if( digiSetting != NULL ) digiSetting->close();
|
if( digiSetting != NULL ) digiSetting->close();
|
||||||
|
printf("+++++++++++++++ scope %p\n", scope);
|
||||||
if( scope != NULL ) scope->close();
|
if( scope != NULL ) scope->close();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@ -78,11 +86,20 @@ private:
|
||||||
Scope * scope;
|
Scope * scope;
|
||||||
QPushButton * bnOpenScope;
|
QPushButton * bnOpenScope;
|
||||||
|
|
||||||
|
//@----- scalar;
|
||||||
|
QMainWindow * scalar;
|
||||||
|
QPushButton * bnOpenScalar;
|
||||||
|
QLineEdit *** leTrigger; // need to delete manually
|
||||||
|
QGridLayout * scalarLayout;
|
||||||
|
|
||||||
//@------ ACQ things
|
//@------ ACQ things
|
||||||
QPushButton * bnStartACQ;
|
QPushButton * bnStartACQ;
|
||||||
QPushButton * bnStopACQ;
|
QPushButton * bnStopACQ;
|
||||||
QLineEdit * leRunID;
|
QLineEdit * leRunID;
|
||||||
QLineEdit * leRawDataPath;
|
QLineEdit * leRawDataPath;
|
||||||
|
ReadDataThread ** readDataThread;
|
||||||
|
void StartACQ();
|
||||||
|
void StopACQ();
|
||||||
|
|
||||||
DigiSettings * digiSetting;
|
DigiSettings * digiSetting;
|
||||||
|
|
||||||
|
@ -90,12 +107,6 @@ private:
|
||||||
|
|
||||||
static Digitizer2Gen ** digi;
|
static Digitizer2Gen ** digi;
|
||||||
unsigned short nDigi;
|
unsigned short nDigi;
|
||||||
std::vector<unsigned short> digiSerialNum;
|
|
||||||
|
|
||||||
void StartACQ();
|
|
||||||
void StopACQ();
|
|
||||||
|
|
||||||
ReadDataThread ** readDataThread;
|
|
||||||
|
|
||||||
void LogMsg(QString msg);
|
void LogMsg(QString msg);
|
||||||
bool logMsgHTMLMode = true;
|
bool logMsgHTMLMode = true;
|
||||||
|
|
|
@ -338,7 +338,6 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
layout->addWidget(bnClose, rowID, 5);
|
layout->addWidget(bnClose, rowID, 5);
|
||||||
connect(bnClose, &QPushButton::clicked, this, &Scope::close);
|
connect(bnClose, &QPushButton::clicked, this, &Scope::close);
|
||||||
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
StartScope();
|
StartScope();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user