mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
separated start gui button into start and stop to prevent multiple click syndrome
This commit is contained in:
parent
fe2ba8621b
commit
252e924f92
@ -133,44 +133,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="btnStartStop">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>289</y>
|
|
||||||
<width>319</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Starts or Stops Acquisition</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Start</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../include/icons.qrc">
|
|
||||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Shift+Space</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QFrame" name="frameTimeResolved">
|
<widget class="QFrame" name="frameTimeResolved">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -999,6 +961,107 @@ Frame period between exposures.
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>297</y>
|
||||||
|
<width>318</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnStart">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Starts Acquisition</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Start</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Shift+Space</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnStop">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>70</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Stops Acquisition</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/stop.png</normaloff>:/icons/images/stop.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Shift+Space</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>spinNumMeasurements</tabstop>
|
<tabstop>spinNumMeasurements</tabstop>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorGui
|
Path: slsDetectorsPackage/slsDetectorGui
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: b8bdbf4da61f95b88893b02ddabc2491b16fa10f
|
Repsitory UUID: fe2ba8621b33bc00f51c8cd4d33e98b7d4ebfa41
|
||||||
Revision: 492
|
Revision: 493
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 3746
|
Last Changed Rev: 3747
|
||||||
Last Changed Date: 2018-03-26 17:27:44.000000002 +0200 ./src/qTabSettings.cpp
|
Last Changed Date: 2018-03-27 17:30:53.000000002 +0200 ./include/qTabMeasurement.h
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "b8bdbf4da61f95b88893b02ddabc2491b16fa10f"
|
#define GITREPUUID "fe2ba8621b33bc00f51c8cd4d33e98b7d4ebfa41"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x3746
|
#define GITREV 0x3747
|
||||||
#define GITDATE 0x20180326
|
#define GITDATE 0x20180327
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "developer"
|
||||||
|
@ -617,7 +617,6 @@ void saveErrorSignal(QString);
|
|||||||
void AcquisitionErrorSignal(QString);
|
void AcquisitionErrorSignal(QString);
|
||||||
void UpdatePlotSignal();
|
void UpdatePlotSignal();
|
||||||
void GainPlotSignal(bool);
|
void GainPlotSignal(bool);
|
||||||
void AcquisitionFinishedSignal();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,14 +50,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetExpertMode(bool enable);
|
void SetExpertMode(bool enable);
|
||||||
|
|
||||||
/** Returns the status of the Start/Stop Acquisition button
|
/** Returns the status of the acquisition in gui
|
||||||
*/
|
*/
|
||||||
bool GetStartStatus(){return btnStartStop->isChecked();};
|
bool GetStartStatus(){return (!btnStart->isEnabled());};
|
||||||
|
|
||||||
/** Click the Start/Stop Acquisition button
|
/** Click the Start/Stop Acquisition button
|
||||||
* This is used if this command came from gui client
|
* This is used if this command came from gui client
|
||||||
*/
|
*/
|
||||||
void ClickStartStop(){btnStartStop->click();myPlot->SetClientInitiated();};
|
void ClickStartStop(){startAcquisition();myPlot->SetClientInitiated();};
|
||||||
|
|
||||||
/** Returns progress bar value */
|
/** Returns progress bar value */
|
||||||
int GetProgress(){return progressBar->value();};
|
int GetProgress(){return progressBar->value();};
|
||||||
@ -65,10 +65,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/** Unconnects start/stop button when acquisition is finished
|
|
||||||
*/
|
|
||||||
void AcquisitionFinished();
|
|
||||||
|
|
||||||
/** update plot is finished,
|
/** update plot is finished,
|
||||||
* changes start/stop text and enables/disables all widgets
|
* changes start/stop text and enables/disables all widgets
|
||||||
*/
|
*/
|
||||||
@ -131,9 +127,13 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void setRunIndex(int index);
|
void setRunIndex(int index);
|
||||||
|
|
||||||
/** starts/stops Acquisition
|
/** starts Acquisition
|
||||||
*/
|
*/
|
||||||
void startStopAcquisition();
|
void startAcquisition();
|
||||||
|
|
||||||
|
/** stops Acquisition
|
||||||
|
*/
|
||||||
|
void stopAcquisition();
|
||||||
|
|
||||||
/** Set number of frames
|
/** Set number of frames
|
||||||
* @param val number of frames to be set
|
* @param val number of frames to be set
|
||||||
@ -193,8 +193,6 @@ private:
|
|||||||
QPalette red;
|
QPalette red;
|
||||||
/** expert mode */
|
/** expert mode */
|
||||||
bool expertMode;
|
bool expertMode;
|
||||||
QIcon *iconStart;
|
|
||||||
QIcon *iconStop;
|
|
||||||
/** to access items in settings combobox */
|
/** to access items in settings combobox */
|
||||||
QStandardItemModel* model;
|
QStandardItemModel* model;
|
||||||
|
|
||||||
|
@ -336,7 +336,6 @@ void qDetectorMain::Initialization(){
|
|||||||
// Plotting
|
// Plotting
|
||||||
// When the acquisition is finished, must update the meas tab
|
// When the acquisition is finished, must update the meas tab
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||||
connect(myPlot, SIGNAL(AcquisitionFinishedSignal()), tab_measurement, SLOT(AcquisitionFinished()));
|
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
||||||
//This should not be called as it will change file name to measurement when run finished
|
//This should not be called as it will change file name to measurement when run finished
|
||||||
//connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
//connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||||
|
@ -1296,7 +1296,6 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "\nEntering Acquisition Finished with status " ;
|
cout << "\nEntering Acquisition Finished with status " ;
|
||||||
#endif
|
#endif
|
||||||
emit AcquisitionFinishedSignal();
|
|
||||||
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
|
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
|
cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
|
||||||
|
@ -94,12 +94,6 @@ void qTabMeasurement::SetupWidgetWindow(){
|
|||||||
chkFile->setChecked(myDet->enableWriteToFile());
|
chkFile->setChecked(myDet->enableWriteToFile());
|
||||||
dispFileName->setEnabled(myDet->enableWriteToFile());
|
dispFileName->setEnabled(myDet->enableWriteToFile());
|
||||||
|
|
||||||
|
|
||||||
//creating the icons for the buttons
|
|
||||||
iconStart = new QIcon(":/icons/images/start.png");
|
|
||||||
iconStop = new QIcon(":/icons/images/stop.png");
|
|
||||||
|
|
||||||
|
|
||||||
//Timer to update the progress bar
|
//Timer to update the progress bar
|
||||||
progressTimer = new QTimer(this);
|
progressTimer = new QTimer(this);
|
||||||
|
|
||||||
@ -267,8 +261,10 @@ void qTabMeasurement::Initialization(){
|
|||||||
connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName()));
|
connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName()));
|
||||||
//File Index
|
//File Index
|
||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||||
//Start/Stop Acquisition
|
//Start Acquisition
|
||||||
connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition()));
|
connect(btnStart, SIGNAL(clicked()), this, SLOT(startAcquisition()));
|
||||||
|
//Stop Acquisition
|
||||||
|
connect(btnStop, SIGNAL(clicked()), this, SLOT(stopAcquisition()));
|
||||||
//Timing Mode
|
//Timing Mode
|
||||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));//
|
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));//
|
||||||
//progress bar
|
//progress bar
|
||||||
@ -309,75 +305,53 @@ void qTabMeasurement::Enable(bool enable){
|
|||||||
frameNotTimeResolved->setEnabled(enable);
|
frameNotTimeResolved->setEnabled(enable);
|
||||||
|
|
||||||
//shortcut each time, else it doesnt work a second time
|
//shortcut each time, else it doesnt work a second time
|
||||||
btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
btnStart->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabMeasurement::startStopAcquisition(){
|
void qTabMeasurement::startAcquisition(){
|
||||||
if(btnStartStop->isChecked()){
|
btnStart->setEnabled(false);
|
||||||
|
//if file write enabled and output dir doesnt exist
|
||||||
//if file write enabled and output dir doesnt exist
|
if((chkFile->isChecked())&&(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL)){
|
||||||
if((chkFile->isChecked())&&(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL)){
|
if(qDefs::Message(qDefs::QUESTION,
|
||||||
if(qDefs::Message(qDefs::QUESTION,
|
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>",
|
||||||
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>",
|
"qTabMeasurement::startAcquisition") == slsDetectorDefs::FAIL){
|
||||||
"qTabMeasurement::startStopAcquisition") == slsDetectorDefs::FAIL){
|
btnStart->setEnabled(true);
|
||||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
return;
|
||||||
btnStartStop->click();
|
}else{
|
||||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
//done because for receiver it cant save a file with blank file path and returns without acquiring even to the gui
|
||||||
return;
|
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||||
}else{
|
chkFile->setChecked(false);
|
||||||
//done because for receiver it cant save a file with blank file path and returns without acquiring even to the gui
|
EnableFileWrite(false);
|
||||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||||
chkFile->setChecked(false);
|
}
|
||||||
EnableFileWrite(false);
|
}
|
||||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << endl << endl << "Starting Acquisition" << endl;
|
cout << endl << endl << "Starting Acquisition" << endl;
|
||||||
#endif
|
#endif
|
||||||
//btnStartStop->setStyleSheet("color:red");
|
lblProgressIndex->setText(QString::number(0));
|
||||||
btnStartStop->setText("Stop");
|
Enable(0);
|
||||||
btnStartStop->setIcon(*iconStop);
|
progressBar->setValue(0);
|
||||||
lblProgressIndex->setText(QString::number(0));
|
progressTimer->start(100);
|
||||||
Enable(0);
|
|
||||||
progressBar->setValue(0);
|
|
||||||
progressTimer->start(100);
|
|
||||||
|
|
||||||
emit StartSignal();
|
emit StartSignal();
|
||||||
}else{
|
qDefs::checkErrorMessage(myDet,"qTabMeasurement::startAcquisition");
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Stopping Acquisition" << endl<< endl;
|
|
||||||
#endif
|
|
||||||
//emit StopSignal(); commented out to prevent undefined state
|
|
||||||
myDet->stopAcquisition();
|
|
||||||
/* commented out to prevent undefined state
|
|
||||||
myDet->waitForReceiverReadToFinish();
|
|
||||||
UpdateProgress();
|
|
||||||
//spin index
|
|
||||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
|
||||||
spinIndex->setValue(myDet->getFileIndex());
|
|
||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
|
||||||
progressTimer->stop();
|
|
||||||
btnStartStop->setText("Start");
|
|
||||||
btnStartStop->setIcon(*iconStart);
|
|
||||||
btnStartStop->setChecked(false);
|
|
||||||
Enable(1);*/
|
|
||||||
}
|
|
||||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::startStopAcquisition");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabMeasurement::AcquisitionFinished(){
|
void qTabMeasurement::stopAcquisition(){
|
||||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
#ifdef VERBOSE
|
||||||
btnStartStop->setText("Wait");
|
cout << "Stopping Acquisition" << endl<< endl;
|
||||||
|
#endif
|
||||||
|
myDet->stopAcquisition();
|
||||||
|
qDefs::checkErrorMessage(myDet,"qTabMeasurement::stopAcquisition");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -391,12 +365,8 @@ void qTabMeasurement::UpdateFinished(){
|
|||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||||
progressTimer->stop();
|
progressTimer->stop();
|
||||||
|
|
||||||
/*disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); done in AcquisitionFinished() already */
|
|
||||||
btnStartStop->setText("Start");
|
|
||||||
btnStartStop->setIcon(*iconStart);
|
|
||||||
btnStartStop->setChecked(false);
|
|
||||||
Enable(1);
|
Enable(1);
|
||||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
btnStart->setEnabled(true);
|
||||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateFinished");
|
qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateFinished");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user