polished the UI flow

This commit is contained in:
Ryan Tang 2023-02-09 18:40:47 -05:00
parent 15a8abd395
commit 1579e38322
4 changed files with 22 additions and 25 deletions

View File

@ -61,15 +61,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnOpenScope = new QPushButton("Open scope", this); bnOpenScope = new QPushButton("Open scope", this);
bnOpenScope->setEnabled(false); bnOpenScope->setEnabled(false);
connect(bnOpenScope, &QPushButton::clicked, this, [=](){ connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope);
if( digi ){
if( !scope ){
scope = new Scope(digi, nDigi, readDataThread, this);
}else{
scope->show();
}
}
});
bnOpenDigitizers = new QPushButton("Open Digitizers", this); bnOpenDigitizers = new QPushButton("Open Digitizers", this);
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers())); connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers()));
@ -85,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnSOLSettings = new QPushButton("SOLARIS Settings", this); bnSOLSettings = new QPushButton("SOLARIS Settings", this);
bnSOLSettings->setEnabled(false); bnSOLSettings->setEnabled(false);
//QPushButton * newScope = new QPushButton("Scope2", this); //QPushButton * bnCustomCommand = new QPushButton("Command line", this);
layout1->addWidget(bnProgramSettings, 0, 0); layout1->addWidget(bnProgramSettings, 0, 0);
@ -97,7 +89,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->addWidget(bnOpenDigitizers, 1, 1); layout1->addWidget(bnOpenDigitizers, 1, 1);
layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2); layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2);
//layout1->addWidget(newScope, 2, 0);
layout1->addWidget(bnDigiSettings, 2, 1); layout1->addWidget(bnDigiSettings, 2, 1);
layout1->addWidget(bnSOLSettings, 2, 2, 1, 2); layout1->addWidget(bnSOLSettings, 2, 2, 1, 2);
@ -107,7 +98,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->setColumnStretch(2, 1); layout1->setColumnStretch(2, 1);
layout1->setColumnStretch(3, 1); layout1->setColumnStretch(3, 1);
} }
@ -231,8 +221,6 @@ void MainWindow::StartACQ(){
bnStopACQ->setEnabled(true); bnStopACQ->setEnabled(true);
bnOpenScope->setEnabled(false); bnOpenScope->setEnabled(false);
//updateTraceThread->start();
LogMsg("end of " + QString::fromStdString(__func__)); LogMsg("end of " + QString::fromStdString(__func__));
} }
@ -299,15 +287,6 @@ void MainWindow::OpenDigitizers(){
bnOpenDigitizers->setEnabled(false); bnOpenDigitizers->setEnabled(false);
bnOpenDigitizers->setStyleSheet(""); bnOpenDigitizers->setStyleSheet("");
///// set scope digitizer
//allowChange = false;
//cbScopeDigi->clear(); ///this will also trigger QComboBox::currentIndexChanged
//cbScopeCh->clear();
//for( int i = 0 ; i < nDigi; i++) {
// cbScopeDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
//}
//allowChange = true;
} }
void MainWindow::CloseDigitizers(){ void MainWindow::CloseDigitizers(){
@ -346,6 +325,21 @@ void MainWindow::CloseDigitizers(){
} }
//^###################################################################### Open Scope //^###################################################################### Open Scope
void MainWindow::OpenScope(){
if( digi ){
if( !scope ){
scope = new Scope(digi, nDigi, readDataThread, this);
connect(scope, &Scope::CloseWindow, this, [=](){
bnStartACQ->setEnabled(true);
});
}else{
scope->show();
}
}
bnStartACQ->setEnabled(false);
}
//^###################################################################### Open digitizer setting panel //^###################################################################### Open digitizer setting panel
void MainWindow::OpenDigitizersSettings(){ void MainWindow::OpenDigitizersSettings(){

View File

@ -38,7 +38,8 @@ private slots:
void OpenDigitizers(); void OpenDigitizers();
void CloseDigitizers(); void CloseDigitizers();
void OpenScope();
void OpenDigitizersSettings(); void OpenDigitizersSettings();
void ProgramSettings(); void ProgramSettings();

View File

@ -339,7 +339,6 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
QPushButton * bnClose = new QPushButton("Close", this); QPushButton * bnClose = new QPushButton("Close", this);
layout->addWidget(bnClose, rowID, 5); layout->addWidget(bnClose, rowID, 5);
connect(bnClose, &QPushButton::clicked, this, &Scope::StopScope);
connect(bnClose, &QPushButton::clicked, this, &Scope::close); connect(bnClose, &QPushButton::clicked, this, &Scope::close);

View File

@ -37,11 +37,14 @@ private slots:
void closeEvent(QCloseEvent * event){ void closeEvent(QCloseEvent * event){
StopScope(); StopScope();
emit CloseWindow();
event->accept(); event->accept();
} }
signals: signals:
void CloseWindow();
private: private:
Digitizer2Gen ** digi; Digitizer2Gen ** digi;