mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Creating Classes, Libraries and Functions for the Common SLS Detector GUI
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@1 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
56
slsDetectorGui/src/qCloneWidget.cpp
Normal file
56
slsDetectorGui/src/qCloneWidget.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* qCloneWidget.cpp
|
||||
*
|
||||
* Created on: May 18, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "qCloneWidget.h"
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
/** Qt Include Headers */
|
||||
#include <QFrame>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
|
||||
/** C++ Include Headers */
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){
|
||||
|
||||
QGroupBox *cloneBox = new QGroupBox(this);
|
||||
QGridLayout *gridClone = new QGridLayout(cloneBox);
|
||||
cloneBox->setLayout(gridClone);
|
||||
cloneBox->setFlat(1);
|
||||
cloneBox->setTitle("Startup Image");
|
||||
cloneBox->resize(fSize);
|
||||
|
||||
if(numDim==1){
|
||||
cloneplot1D = plot1D;
|
||||
gridClone->addWidget(cloneplot1D,0,0);
|
||||
}else{
|
||||
cloneplot2D = plot2D;
|
||||
gridClone->addWidget(cloneplot2D,0,0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
qCloneWidget::~qCloneWidget(){
|
||||
delete cloneplot1D;
|
||||
delete cloneplot2D;
|
||||
}
|
||||
|
||||
|
||||
void qCloneWidget::closeEvent(QCloseEvent* event){
|
||||
emit CloneClosedSignal(id);
|
||||
event->accept();
|
||||
}
|
291
slsDetectorGui/src/qDetectorMain.cpp
Normal file
291
slsDetectorGui/src/qDetectorMain.cpp
Normal file
@ -0,0 +1,291 @@
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDetectorMain.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabActions.h"
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qTabSettings.h"
|
||||
#include "qTabDebugging.h"
|
||||
#include "qTabDeveloper.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
/** Qt Include Headers */
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0);
|
||||
det->show();
|
||||
theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit()));
|
||||
return theApp->exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){
|
||||
myDet = 0;
|
||||
setupUi(this);
|
||||
SetUpWidgetWindow();
|
||||
Initialization();
|
||||
SetDeveloperMode();
|
||||
/**need to use argc and argv to determine which slsdet or multidet to use.*/
|
||||
}
|
||||
|
||||
|
||||
//Qt::ScrollBarAsNeeded
|
||||
|
||||
|
||||
qDetectorMain::~qDetectorMain(){
|
||||
delete myDet;
|
||||
if (menubar) delete menubar;
|
||||
if (centralwidget) delete centralwidget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow(){
|
||||
|
||||
|
||||
/* scrollMain = new QScrollArea;
|
||||
setCentralWidget(scrollMain);
|
||||
scrollMain ->setWidget(centralwidget);
|
||||
scrollMain->setWidgetResizable(true);*/
|
||||
|
||||
SetUpDetector();
|
||||
|
||||
/** plot setup*/
|
||||
myPlot = new qDrawPlot(framePlot,myDet);
|
||||
|
||||
/**tabs setup*/
|
||||
tabs = new QTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
/** creating all the tab widgets */
|
||||
tab_measurement = new qTabMeasurement (this, myDet,myPlot);
|
||||
tab_dataoutput = new qTabDataOutput (this, myDet);
|
||||
tab_plot = new qTabPlot (this, myDet,myPlot);
|
||||
tab_actions = new qTabActions (this, myDet);
|
||||
tab_advanced = new qTabAdvanced (this, myDet);
|
||||
tab_Settings = new qTabSettings (this, myDet);
|
||||
tab_debugging = new qTabDebugging (this, myDet);
|
||||
tab_developer = new qTabDeveloper (this, myDet);
|
||||
/** creating the scroll area widgets for the tabs */
|
||||
for(int i=0;i<NUMBER_OF_TABS;i++){
|
||||
scroll[i] = new QScrollArea;
|
||||
scroll[i]->setFrameShape(QFrame::NoFrame);
|
||||
}
|
||||
/** setting the tab widgets to the scrollareas*/
|
||||
scroll[Measurement] ->setWidget(tab_measurement);
|
||||
scroll[DataOutput] ->setWidget(tab_dataoutput);
|
||||
scroll[Plot] ->setWidget(tab_plot);
|
||||
scroll[Actions] ->setWidget(tab_actions);
|
||||
scroll[Advanced] ->setWidget(tab_advanced);
|
||||
scroll[Settings] ->setWidget(tab_Settings);
|
||||
scroll[Debugging] ->setWidget(tab_debugging);
|
||||
scroll[Developer] ->setWidget(tab_developer);
|
||||
/** inserting all the tabs*/
|
||||
tabs->insertTab(Measurement, scroll[Measurement], "Measurement");
|
||||
tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output");
|
||||
tabs->insertTab(Plot, scroll[Plot], "Plot");
|
||||
tabs->insertTab(Actions, scroll[Actions], "Actions");
|
||||
tabs->insertTab(Advanced, scroll[Advanced], "Advanced");
|
||||
tabs->insertTab(Settings, scroll[Settings], "Settings");
|
||||
tabs->insertTab(Debugging, scroll[Debugging], "Debugging");
|
||||
tabs->insertTab(Developer, scroll[Developer], "Developer");
|
||||
|
||||
/** mode setup - to set up the tabs initially as disabled, not in form so done here */
|
||||
SetDebugMode(false);
|
||||
SetBeamlineMode(false);
|
||||
SetExpertMode(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qDetectorMain::SetUpDetector(){
|
||||
/**instantiate detector and set window title*/
|
||||
myDet = new multiSlsDetector(Detector_Index);
|
||||
if(!myDet->getHostname(Detector_Index).length()){
|
||||
setWindowTitle("SLS Detector GUI : No Detector Connected");
|
||||
#ifdef VERBOSE
|
||||
cout<<endl<<"No Detector Connected"<<endl;
|
||||
#endif
|
||||
myDet = 0;
|
||||
}
|
||||
else{
|
||||
setWindowTitle("SLS Detector GUI : "+QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str()));
|
||||
#ifdef VERBOSE
|
||||
cout<<endl<<"Type : "<<slsDetectorBase::getDetectorType(myDet->getDetectorsType())<<"\t\t\tDetector : "<<myDet->getHostname(Detector_Index)<<endl;
|
||||
#endif
|
||||
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qDetectorMain::Initialization(){
|
||||
|
||||
|
||||
/** tabs */
|
||||
connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*)));
|
||||
/** Measurement tab*/
|
||||
/** Plot tab */
|
||||
|
||||
|
||||
/** Plotting */
|
||||
/** When the acquisition is finished, must update the meas tab */
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement,SLOT(UpdateFinished()));
|
||||
|
||||
|
||||
/** menubar */
|
||||
/** Modes Menu */
|
||||
connect(actionDebug, SIGNAL(toggled(bool)),this,SLOT(SetDebugMode(bool)));
|
||||
connect(actionBeamline, SIGNAL(toggled(bool)),this,SLOT(SetBeamlineMode(bool)));
|
||||
connect(actionExpert, SIGNAL(toggled(bool)),this,SLOT(SetExpertMode(bool)));
|
||||
connect(actionDockable, SIGNAL(toggled(bool)),this,SLOT(SetDockableMode(bool)));
|
||||
|
||||
|
||||
/** Utilities Menu */
|
||||
connect(actionOpenSetup,SIGNAL(triggered()),this,SLOT(OpenSetup()));
|
||||
connect(actionSaveSetup,SIGNAL(triggered()),this,SLOT(SaveSetup()));
|
||||
connect(actionMeasurementWizard,SIGNAL(triggered()),this,SLOT(MeasurementWizard()));
|
||||
connect(actionOpenConfiguration,SIGNAL(triggered()),this,SLOT(OpenConfiguration()));
|
||||
connect(actionSaveConfiguration,SIGNAL(triggered()),this,SLOT(SaveConfiguration()));
|
||||
connect(actionEnergyCalibration,SIGNAL(triggered()),this,SLOT(EnergyCalibration()));
|
||||
connect(actionAngularCalibration,SIGNAL(triggered()),this,SLOT(AngularCalibration()));
|
||||
connect(actionAbout,SIGNAL(triggered()),this,SLOT(About()));
|
||||
connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::SetDeveloperMode(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Enabling Developer Mode "<<endl;
|
||||
#endif
|
||||
tabs->setTabEnabled(Developer,true);
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::SetDebugMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Debug Mode to "<<b<<endl;
|
||||
#endif
|
||||
tabs->setTabEnabled(Debugging,b);
|
||||
}
|
||||
|
||||
void qDetectorMain::SetBeamlineMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Beamline Mode to "<<b<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void qDetectorMain::SetExpertMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Expert Mode to "<<b<<endl;
|
||||
#endif
|
||||
//threshold part in measu is enabled
|
||||
tabs->setTabEnabled(Advanced,b);
|
||||
tabs->setTabEnabled(Settings,b);
|
||||
tab_advanced->setEnabled(b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qDetectorMain::refresh(int index){
|
||||
if(!tabs->isTabEnabled(index))
|
||||
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
|
||||
else{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::SetDockableMode(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Dockable Plot Mode to "<<b<<endl;
|
||||
#endif
|
||||
if(b)
|
||||
dockWidgetPlot->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
|
||||
else
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::OpenSetup(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Opening Setup"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::SaveSetup(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Saving Setup"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::MeasurementWizard(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Measurement Wizard"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::OpenConfiguration(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Opening Configuration"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::SaveConfiguration(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Saving Configuration"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::EnergyCalibration(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing Energy Calibration"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::AngularCalibration(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing Angular Calibration"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::Version(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing Version"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qDetectorMain::About(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing About"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
434
slsDetectorGui/src/qDrawPlot.cpp
Normal file
434
slsDetectorGui/src/qDrawPlot.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
/*
|
||||
* qDrawPlot.cpp
|
||||
*
|
||||
* Created on: May 7, 2012
|
||||
* Author: Ian Johnson
|
||||
*/
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDrawPlot.h"
|
||||
#include "qCloneWidget.h"
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** Qt Include Headers */
|
||||
#include <QTimer>
|
||||
/** C++ Include Headers */
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
if(myDet) {
|
||||
setupUi(this);
|
||||
Initialization();
|
||||
SetupWidgetWindow();
|
||||
StartStopDaqToggle(); //as default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qDrawPlot::~qDrawPlot(){
|
||||
/** Clear plot*/
|
||||
Clear1DPlot();
|
||||
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++){
|
||||
delete *h;
|
||||
}
|
||||
plot1D_hists.clear();
|
||||
|
||||
|
||||
delete[] lastImageArray; lastImageArray=0;
|
||||
StartOrStopThread(0);
|
||||
|
||||
/** delete detector object pointer*/
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::Initialization(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting up plot variables"<<endl;
|
||||
#endif
|
||||
stop_signal = 0;
|
||||
pthread_mutex_init(&last_image_complete_mutex,NULL);
|
||||
|
||||
plot_in_scope = 0;
|
||||
lastImageNumber = 0;
|
||||
nPixelsX = 0;
|
||||
nPixelsY = 0;
|
||||
lastImageArray = 0;
|
||||
|
||||
nHists = 0;
|
||||
histNBins = 0;
|
||||
histXAxis = 0;
|
||||
for(int i=0;i<10;i++) histYAxis[i]=0;
|
||||
|
||||
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::SetupWidgetWindow(){
|
||||
plot_update_timer = new QTimer(this);
|
||||
connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));
|
||||
|
||||
plot1D = new SlsQt1DPlot(boxPlot);
|
||||
plot1D->SetXTitle("x axis");
|
||||
plot1D->SetYTitle("y axis");
|
||||
plot1D->hide();
|
||||
|
||||
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
||||
plot2D->SetXTitle("pixel");
|
||||
plot2D->SetYTitle("pixel");
|
||||
plot2D->SetZTitle("Intensity");
|
||||
boxPlot->setFlat(1);
|
||||
boxPlot->setTitle("Startup Image");
|
||||
|
||||
plotLayout = new QGridLayout(boxPlot);
|
||||
plotLayout->addWidget(plot1D,1,1,1,1);
|
||||
plotLayout->addWidget(plot2D,1,1,1,1);
|
||||
|
||||
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
||||
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
||||
static bool running = 1;
|
||||
if(running){ //stopping
|
||||
StartDaq(0);
|
||||
running=!running;
|
||||
}else if(!stop_if_running){ //then start
|
||||
StartDaq(1);
|
||||
running=!running;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::StartDaq(bool start){
|
||||
if(start){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Start Daq(1) function"<<endl;
|
||||
#endif
|
||||
number_of_exposures= (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
cout<<"\tNumber of Exposures:"<<number_of_exposures<<endl;
|
||||
|
||||
acquisitionTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9);
|
||||
cout<<"\tAcquisition Time:"<<setprecision (10)<<acquisitionTime<<endl;
|
||||
|
||||
framePeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
|
||||
cout<<"\tFrame Period:"<<setprecision (10)<<framePeriod<<endl;
|
||||
|
||||
ResetDaqForGui();
|
||||
StartDaqForGui();
|
||||
UpdatePlot();
|
||||
}else{
|
||||
#ifdef VERBOSE
|
||||
cout<<"Start Daq(0) function"<<endl;
|
||||
#endif
|
||||
StopDaqForGui();
|
||||
StopUpdatePlot();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int qDrawPlot::ResetDaqForGui(){
|
||||
if(!StopDaqForGui()) return 0;
|
||||
lastImageNumber = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool qDrawPlot::StartOrStopThread(bool start){
|
||||
static bool gui_acquisition_thread_running = 0;
|
||||
static pthread_t gui_acquisition_thread;
|
||||
static pthread_mutex_t gui_acquisition_start_stop_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
pthread_mutex_lock(&gui_acquisition_start_stop_mutex);
|
||||
//stop part, before start or restart
|
||||
if(gui_acquisition_thread_running){
|
||||
cout<<"Stopping current acquisition thread ...."<<endl;
|
||||
stop_signal = 1;
|
||||
pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
|
||||
gui_acquisition_thread_running = 0;
|
||||
}
|
||||
|
||||
//start part
|
||||
if(start){
|
||||
stop_signal = 0;
|
||||
cout<<"Starting new acquisition thread ...."<<endl;
|
||||
gui_acquisition_thread_running = !pthread_create(&gui_acquisition_thread, NULL,qDrawPlot::DataAcquisionThread, (void*) this);
|
||||
cout<<"created"<<endl;
|
||||
//myDet->acquire(1);//acquiring
|
||||
}
|
||||
pthread_mutex_unlock(&gui_acquisition_start_stop_mutex);
|
||||
|
||||
return gui_acquisition_thread_running;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void* qDrawPlot::DataAcquisionThread(void *this_pointer){
|
||||
((qDrawPlot*)this_pointer)->AcquireImages();
|
||||
return this_pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void* qDrawPlot::AcquireImages(){
|
||||
//send data to detector
|
||||
|
||||
static unsigned int nx=1280,ny=100;
|
||||
static double* image_data = new double[nx*ny];
|
||||
if(!lastImageArray) lastImageArray = new double[nx*ny];
|
||||
static double* xvalues = new double [nx];
|
||||
static double* yvalues0 = new double [nx];
|
||||
static double* yvalues1 = new double [nx];
|
||||
if(!histXAxis) histXAxis = new double [nx];
|
||||
if(!histYAxis[0]) histYAxis[0] = new double [nx];
|
||||
if(!histYAxis[1]) histYAxis[1] = new double [nx];
|
||||
|
||||
|
||||
|
||||
char cIndex[200];
|
||||
|
||||
//string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_';
|
||||
//cout<<"filePath:"<<filePath<<endl;
|
||||
//string fileName;
|
||||
|
||||
for(int i=0;i<number_of_exposures;i++){
|
||||
|
||||
/////
|
||||
//fileName.assign(filePath);
|
||||
//sprintf(cIndex,"%d",i);
|
||||
//fileName.append(cIndex);
|
||||
//fileName.append(".raw");
|
||||
//cout<<"filename:"<<fileName<<endl;
|
||||
//short int arg[1280];
|
||||
|
||||
//while(myDet->readDataFile(fileName,arg)==-1);
|
||||
|
||||
|
||||
/////////
|
||||
|
||||
|
||||
//readout detector
|
||||
//fill and write data here
|
||||
for(unsigned int px=0;px<nx;px++)
|
||||
for(unsigned int py=0;py<ny;py++)
|
||||
image_data[py*nx+px] = sqrt(pow(i+1,2)*pow(double(px)-nx/2,2)/pow(nx/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-ny/2,2)/pow(ny/2,2))/sqrt(2);
|
||||
|
||||
for(unsigned int px=0;px<nx;px++){
|
||||
/*
|
||||
xvalues[px] = px;//+10;
|
||||
yvalues0[px] = (double)arg[px];//i + pow(1 - 2*fabs(double(px)-nx/2)/nx,2);
|
||||
yvalues1[px] = 0;//i + pow(1 - 2*fabs(double(px)-nx/2)/nx,4);
|
||||
*/
|
||||
xvalues[px] = px+10;
|
||||
yvalues0[px] = i + pow(1 - 2*fabs(double(px)-nx/2)/nx,2);
|
||||
yvalues1[px] = i + pow(1 - 2*fabs(double(px)-nx/2)/nx,4);
|
||||
|
||||
}
|
||||
|
||||
/* if(framePeriod<acquisitionTime) usleep((int)acquisitionTime*1e6);
|
||||
else usleep((int)framePeriod*1e6);*/
|
||||
cout<<"Reading in image: "<<i<<endl;
|
||||
//usleep(1000000);
|
||||
if(stop_signal) break; //stop_signal should also go to readout function
|
||||
if(!pthread_mutex_trylock(&last_image_complete_mutex)){
|
||||
|
||||
//plot_in_scope = 1;//i%2 + 1;
|
||||
plot_in_scope = 2;
|
||||
cout<<"value:"<<image_data[6]<<endl;
|
||||
|
||||
lastImageNumber = i+1;
|
||||
char temp_title[2000];
|
||||
//1d image stuff
|
||||
nHists = 2;
|
||||
sprintf(temp_title,"curve one %d",i); histTitle[0] = temp_title;
|
||||
sprintf(temp_title,"curve two %d",i); histTitle[1] = temp_title;
|
||||
sprintf(temp_title,"Channel Number"); histXAxisTitle=temp_title;
|
||||
sprintf(temp_title,"Intensity"); histYAxisTitle=temp_title;
|
||||
histNBins = nx;
|
||||
memcpy(histXAxis, xvalues,nx*sizeof(double));
|
||||
memcpy(histYAxis[0],yvalues0,nx*sizeof(double));
|
||||
memcpy(histYAxis[1],yvalues1,nx*sizeof(double));
|
||||
|
||||
//2d image stuff
|
||||
sprintf(temp_title,"Image number %d",i); imageTitle=temp_title;
|
||||
sprintf(temp_title,"The x-axis title"); imageXAxisTitle=temp_title;
|
||||
sprintf(temp_title,"The y-axis title"); imageYAxisTitle=temp_title;
|
||||
sprintf(temp_title,"The z-axis title"); imageZAxisTitle=temp_title;
|
||||
nPixelsX = nx;
|
||||
nPixelsY = ny;
|
||||
memcpy(lastImageArray,image_data,nx*ny*sizeof(double));
|
||||
|
||||
pthread_mutex_unlock(&last_image_complete_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
|
||||
if(i==1){
|
||||
plot1D->show();
|
||||
plot2D->hide();
|
||||
}else{
|
||||
plot1D->hide();
|
||||
plot2D->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::Clear1DPlot(){
|
||||
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();
|
||||
h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::UpdatePlot(){
|
||||
//emit UpdatingPlot();
|
||||
|
||||
plot_update_timer->stop();
|
||||
|
||||
LockLastImageArray();
|
||||
//1-d plot stuff
|
||||
if(GetHistNBins()){
|
||||
plot1D->SetXTitle(GetHistXAxisTitle());
|
||||
plot1D->SetYTitle(GetHistYAxisTitle());
|
||||
for(int hist_num=0;hist_num<GetNHists();hist_num++){
|
||||
SlsQtH1D* h;
|
||||
if(hist_num+1>plot1D_hists.size()){
|
||||
plot1D_hists.append(h=new SlsQtH1D("1d plot",GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num)));
|
||||
h->SetLineColor(hist_num+1);
|
||||
}else{
|
||||
h=plot1D_hists.at(hist_num);
|
||||
h->SetData(GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num));
|
||||
}
|
||||
h->setTitle(GetHistTitle(hist_num));
|
||||
h->Attach(plot1D);
|
||||
}
|
||||
plot1D->UnZoom();
|
||||
}
|
||||
|
||||
//2-d plot stuff
|
||||
static int last_plot_number = 0;
|
||||
if(GetLastImageArray()){
|
||||
if(GetLastImageNumber()&&last_plot_number!=GetLastImageNumber() && //there is a new plot
|
||||
GetNPixelsX()>0&&GetNPixelsY()>0){
|
||||
plot2D->GetPlot()->SetData(GetNPixelsX(),-0.5,GetNPixelsX()-0.5,GetNPixelsY(),-0.5,GetNPixelsY()-0.5,GetLastImageArray());
|
||||
//as it inherits a widget
|
||||
boxPlot->setTitle(GetImageTitle());
|
||||
plot2D->SetXTitle(GetImageXAxisTitle());
|
||||
plot2D->SetYTitle(GetImageYAxisTitle());
|
||||
plot2D->SetZTitle(GetImageZAxisTitle());
|
||||
plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
|
||||
}
|
||||
}
|
||||
last_plot_number=GetLastImageNumber();
|
||||
UnlockLastImageArray();
|
||||
|
||||
if(PlotInScope()==1) SelectPlot(1);
|
||||
else if(PlotInScope()==2) SelectPlot(2);
|
||||
|
||||
if(number_of_exposures==last_plot_number){
|
||||
StartStopDaqToggle(1);
|
||||
emit UpdatingPlotFinished();
|
||||
}else{
|
||||
plot_update_timer->start(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::StopUpdatePlot(){
|
||||
plot_update_timer->stop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::ClonePlot(){
|
||||
int i=0;
|
||||
bool found = false;
|
||||
for(i=0;i<MAXCloneWindows;i++)
|
||||
if(!winClone[i]){
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
if(!found){
|
||||
cout<<"Too many clones"<<endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
winClone[i] = new qCloneWidget(this,i,boxPlot->size(),(int)PlotInScope(),plot1D,plot2D);
|
||||
if(PlotInScope()==1)
|
||||
plot1D = new SlsQt1DPlot(boxPlot);
|
||||
else
|
||||
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
||||
plotLayout->addWidget(plot1D,1,1,1,1);
|
||||
plotLayout->addWidget(plot2D,1,1,1,1);
|
||||
UpdatePlot();
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
||||
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
||||
winClone[i]->show();
|
||||
connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int)));
|
||||
|
||||
}
|
||||
|
||||
void qDrawPlot::CloseClones(){
|
||||
for(int i=0;i<MAXCloneWindows;i++)
|
||||
if(winClone[i])
|
||||
winClone[i]->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void qDrawPlot::CloneCloseEvent(int id){
|
||||
winClone[id]=0;
|
||||
#ifdef VERBOSE
|
||||
cout<<"Closing Clone Window id:"<<id<<endl;
|
||||
#endif
|
||||
}
|
||||
|
58
slsDetectorGui/src/qTabActions.cpp
Normal file
58
slsDetectorGui/src/qTabActions.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* qTabActions.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
/** Qt Project Class Headers */
|
||||
#include "qTabActions.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabActions::~qTabActions(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabActions::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabActions::Initialization(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabActions::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
84
slsDetectorGui/src/qTabAdvanced.cpp
Normal file
84
slsDetectorGui/src/qTabAdvanced.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* qTabAdvanced.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
myDetType = (int)myDet->getDetectorsType();
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabAdvanced::~qTabAdvanced(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabAdvanced::SetupWidgetWindow(){
|
||||
/** Temperature */
|
||||
if(myDetType==slsDetectorDefs::GOTTHARD)
|
||||
getTemperature(); //check if gotthard???
|
||||
else{
|
||||
btnTemp->setEnabled(false);
|
||||
dispTempAdc->setEnabled(false);
|
||||
dispTempFpga->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabAdvanced::Initialization(){
|
||||
/** Temperature */
|
||||
connect(btnTemp,SIGNAL(clicked()),this,SLOT(getTemperature()));//check if gotthard???
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabAdvanced::Enable(bool enable){
|
||||
btnTemp->setEnabled(enable);
|
||||
dispTempAdc->setEnabled(enable);
|
||||
dispTempFpga->setEnabled(enable);
|
||||
pushButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
void qTabAdvanced::getTemperature(){
|
||||
char ctemp[200];
|
||||
/** adc */
|
||||
float tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC);
|
||||
sprintf(ctemp,"%f%cC",tempadc,0x00B0);
|
||||
dispTempAdc->setText(QString(ctemp));
|
||||
/** fpga */
|
||||
float tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA);
|
||||
sprintf(ctemp,"%f%cC",tempfpga,0x00B0);
|
||||
dispTempFpga->setText(QString(ctemp));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Temperature of ADC: "<<tempadc<<"°C and FPGA: "<<tempfpga<<"°C"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
55
slsDetectorGui/src/qTabDataOutput.cpp
Normal file
55
slsDetectorGui/src/qTabDataOutput.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* qTabDataOutput.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabDataOutput::~qTabDataOutput(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::Initialization(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
55
slsDetectorGui/src/qTabDebugging.cpp
Normal file
55
slsDetectorGui/src/qTabDebugging.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* qTabDebugging.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabDebugging.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabDebugging::~qTabDebugging(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDebugging::Initialization(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDebugging::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
55
slsDetectorGui/src/qTabDeveloper.cpp
Normal file
55
slsDetectorGui/src/qTabDeveloper.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* qTabDeveloper.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabDeveloper::~qTabDeveloper(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabDeveloper::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDeveloper::Initialization(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDeveloper::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
195
slsDetectorGui/src/qTabMeasurement.cpp
Normal file
195
slsDetectorGui/src/qTabMeasurement.cpp
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
* qTabMeasurement.cpp
|
||||
*
|
||||
* Created on: May 2, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
#define UndefinedSettings 7
|
||||
|
||||
|
||||
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabMeasurement::~qTabMeasurement(){
|
||||
delete myDet;
|
||||
delete myPlot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow(){
|
||||
/** all set initially to reflect the detector's actual parameter values*/
|
||||
|
||||
/** Settings */
|
||||
comboSettings->setCurrentIndex(myDet->getSettings(Detector_Index)); //set it to default acc to detector???
|
||||
/** Number of Measurements/Frames*/
|
||||
setNumFrames(2000);
|
||||
/** Acquisition Time */
|
||||
setAcquisitionTime();
|
||||
/** Frame Period between exposures*/
|
||||
setFramePeriod();
|
||||
/** File Name*/
|
||||
setFileName("run");
|
||||
/** File Index*/
|
||||
setRunIndex(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::Initialization(){
|
||||
/** Settings */
|
||||
connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int)));
|
||||
/** Number of Measurements/Frames*/
|
||||
connect(spinNumMeasurements,SIGNAL(valueChanged(int)),this,SLOT(setNumFrames(int)));
|
||||
/** Acquisition Time */
|
||||
connect(spinExpTime,SIGNAL(valueChanged(double)),this,SLOT(setAcquisitionTime()));
|
||||
connect(comboExpUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setAcquisitionTime()));
|
||||
/** Frame Period between exposures*/
|
||||
connect(spinPeriod,SIGNAL(valueChanged(double)),this,SLOT(setFramePeriod()));
|
||||
connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setFramePeriod()));
|
||||
/** File Name*/
|
||||
connect(dispFileName,SIGNAL(textChanged(const QString&)),this,SLOT(setFileName(const QString&)));
|
||||
/** File Index*/
|
||||
connect(spinIndex,SIGNAL(valueChanged(int)),this,SLOT(setRunIndex(int)));
|
||||
/** Start/Stop Acquisition*/
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//enabled other tabs as well??
|
||||
void qTabMeasurement::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
comboSettings->setEnabled(enable);
|
||||
spinNumMeasurements->setEnabled(enable);
|
||||
spinExpTime->setEnabled(enable);
|
||||
comboExpUnit->setEnabled(enable);
|
||||
spinPeriod->setEnabled(enable);
|
||||
comboPeriodUnit->setEnabled(enable);
|
||||
dispFileName->setEnabled(enable);
|
||||
spinIndex->setEnabled(enable);
|
||||
if(!enable) btnStartStop->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::startStopAcquisition(){
|
||||
if(!btnStartStop->text().compare("Start")){
|
||||
#ifdef VERBOSE
|
||||
cout<<endl<<endl<<"Starting Acquisition"<<endl;
|
||||
#endif
|
||||
btnStartStop->setText("Stop");
|
||||
Enable(0);
|
||||
}else{
|
||||
#ifdef VERBOSE
|
||||
cout<<"Stopping Acquisition"<<endl;
|
||||
#endif
|
||||
btnStartStop->setText("Start");
|
||||
Enable(1);
|
||||
}
|
||||
myPlot->StartStopDaqToggle();
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->setText("Start");
|
||||
Enable(1);
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::setSettings(int index){
|
||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett)<<endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::setNumFrames(int val){
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Frame number to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::setAcquisitionTime(){
|
||||
int64_t exptime64;
|
||||
/** Get the 64 bit value of timer*/
|
||||
exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting acquisition time to " << exptime64 << " clocks" << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptime64);
|
||||
|
||||
//float t=exptime64;
|
||||
//emit acquisitionTimeChanged(t/(100E+6)); ??????????????????????
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setFramePeriod(){
|
||||
int64_t exptime64;
|
||||
/** Get the 64 bit value of timer*/
|
||||
exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting frame period between exposures to " << exptime64 << " clocks" << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,exptime64);
|
||||
|
||||
//float t=exptime64;
|
||||
//emit acquisitionTimeChanged(t/(100E+6)); ??????????????????????
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setFileName(const QString& fName){
|
||||
// emit fileNameChanged(fName);
|
||||
// thred-->fileName=s;myDet->setFileName(fName.ascii());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting File name to " << myDet->getFileName()<<endl;
|
||||
#endif
|
||||
myDet->setFileName(fName.toAscii().data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setRunIndex(int index){
|
||||
myDet->setFileIndex(index);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting File Index to " << myDet->getFileIndex()<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
68
slsDetectorGui/src/qTabPlot.cpp
Normal file
68
slsDetectorGui/src/qTabPlot.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* qTabPlot.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#include "qTabPlot.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabPlot::~qTabPlot(){
|
||||
delete myDet;
|
||||
delete myPlot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabPlot::SetupWidgetWindow(){
|
||||
box1D->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::Initialization(){
|
||||
/** Plot box*/
|
||||
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
|
||||
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
|
||||
/** 2D Plot box*/
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::Enable(bool enable){
|
||||
boxPlot->setEnabled(enable);
|
||||
box1D->setEnabled(enable);
|
||||
box2D->setEnabled(enable);
|
||||
boxPlotAxis->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
56
slsDetectorGui/src/qTabSettings.cpp
Normal file
56
slsDetectorGui/src/qTabSettings.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* qTabSettings.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#include "qTabSettings.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define Detector_Index 0
|
||||
|
||||
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
qTabSettings::~qTabSettings(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabSettings::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabSettings::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user