diff --git a/src/ScanFormWidget.cpp b/src/ScanFormWidget.cpp index d543b68..0feb6c5 100644 --- a/src/ScanFormWidget.cpp +++ b/src/ScanFormWidget.cpp @@ -99,12 +99,34 @@ ScanFormWidget::ScanFormWidget(QWidget *parent) : TabFormWidget(parent) { contentLayout->addWidget(param_widget); pat_inf = patient_information; + btnScan->setEnabled(false); + btnRefresh->setEnabled(false); + btnPreview->setEnabled(false); + btnStop->setEnabled(false); + + //Events--------------------------------------------------------------- connect(EventCenter::Default(),&EventCenter::PatientSelected,[=](QObject* sender,QObject* data){ + if(unset) + { + btnScan->setEnabled(true); + btnRefresh->setEnabled(true); + btnPreview->setEnabled(true); + btnStop->setEnabled(true); + unset = false; + } patient_information->setPatientInformation((PatientInformation*)data); }); connect(group, SIGNAL(buttonClicked(int)),this,SLOT(protocolChanged(int))); + + previewfunc = [=](bool val)->void{ + btnPreview->setCheckable(val); + btnPreview->setChecked(val); + btnPreview->setEnabled(!val); + btnRefresh->setEnabled(!val); + btnScan->setEnabled(!val); + }; } ScanFormWidget::~ScanFormWidget() { @@ -115,3 +137,9 @@ void ScanFormWidget::protocolChanged(int type) { printf("%d\r\n",type); pat_inf->setProtocol(type); } + +void ScanFormWidget::setPreviewing(bool val) { + if(previewfunc) previewfunc(val); +} + + diff --git a/src/ScanFormWidget.h b/src/ScanFormWidget.h index a60d757..d76526e 100644 --- a/src/ScanFormWidget.h +++ b/src/ScanFormWidget.h @@ -6,15 +6,19 @@ #define GUI_SCANFORMWIDGET_H #include "tabformwidget.h" +#include class PatientInformationForm; class ScanFormWidget :public TabFormWidget { Q_OBJECT public: - explicit ScanFormWidget(QWidget *parent = nullptr); - ~ScanFormWidget(); - + explicit ScanFormWidget(QWidget *parent = nullptr); + ~ScanFormWidget(); + void setPreviewing(bool val); private: PatientInformationForm* pat_inf= nullptr; + bool unset = true; + bool previewing= false; + std::function previewfunc = nullptr; private slots: void protocolChanged(int type);