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->setEnabled(false);
connect(bnOpenScope, &QPushButton::clicked, this, [=](){
if( digi ){
if( !scope ){
scope = new Scope(digi, nDigi, readDataThread, this);
}else{
scope->show();
}
}
});
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope);
bnOpenDigitizers = new QPushButton("Open Digitizers", this);
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers()));
@ -85,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnSOLSettings = new QPushButton("SOLARIS Settings", this);
bnSOLSettings->setEnabled(false);
//QPushButton * newScope = new QPushButton("Scope2", this);
//QPushButton * bnCustomCommand = new QPushButton("Command line", this);
layout1->addWidget(bnProgramSettings, 0, 0);
@ -97,7 +89,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->addWidget(bnOpenDigitizers, 1, 1);
layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2);
//layout1->addWidget(newScope, 2, 0);
layout1->addWidget(bnDigiSettings, 2, 1);
layout1->addWidget(bnSOLSettings, 2, 2, 1, 2);
@ -107,7 +98,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->setColumnStretch(2, 1);
layout1->setColumnStretch(3, 1);
}
@ -231,8 +221,6 @@ void MainWindow::StartACQ(){
bnStopACQ->setEnabled(true);
bnOpenScope->setEnabled(false);
//updateTraceThread->start();
LogMsg("end of " + QString::fromStdString(__func__));
}
@ -299,15 +287,6 @@ void MainWindow::OpenDigitizers(){
bnOpenDigitizers->setEnabled(false);
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(){
@ -346,6 +325,21 @@ void MainWindow::CloseDigitizers(){
}
//^###################################################################### 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
void MainWindow::OpenDigitizersSettings(){

View File

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

View File

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

View File

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