merging refactor (replacing)

This commit is contained in:
2019-04-12 10:53:09 +02:00
parent 0bb800cc8a
commit 89a06f099c
1176 changed files with 82698 additions and 159058 deletions

View File

@ -1,6 +0,0 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4101
#define GITDATE 0x20190207
#define GITBRANCH "developer"

View File

@ -1,6 +0,0 @@
#define GITURL ""
#define GITREPUUID ""
#define GITAUTH ""
#define GITREV ""
#define GITDATE ""
#define GITBRANCH ""

0
slsDetectorGui/include/icons.qrc Normal file → Executable file
View File

View File

@ -1,85 +0,0 @@
/*
* qActionsWidget.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QACTIONSWIDGET_H_
#define QACTIONSWIDGET_H_
#include "qDefs.h"
/** Form Header */
#include "ui_form_action.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
/** C++ Include Headers */
#include <string>
using namespace std;
class qActionsWidget : public QWidget,private Ui::ActionsObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qActionsWidget(QWidget *parent, multiSlsDetector*& detector);
~qActionsWidget();
/**to update the widgets*/
void Refresh();
/**number of action widgets*/
static int NUM_ACTION_WIDGETS;
private:
/** The sls detector object */
multiSlsDetector *myDet;
/**id of the action widget*/
int id;
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals
* */
void Initialization();
private slots:
/** Sets the scan or script. Accordingly enables, disables other widgets
* @param mode value chosen
* */
void SetMode(int mode);
/** Browse for the script
* */
void BrowsePath();
/** Sets the script file
* */
void SetScriptFile();
/** Set Parameter
* */
void SetParameter();
};
#endif /* QACTIONSWIDGET_H_ */

167
slsDetectorGui/include/qCloneWidget.h Normal file → Executable file
View File

@ -1,71 +1,59 @@
/*
* qCloneWidget.h
*
* Created on: May 18, 2012
* Author: l_maliakal_d
*/
#pragma once
#ifndef QCLONEWIDGET_H_
#define QCLONEWIDGET_H_
#include "qDefs.h"
/** Qt Project Class Headers */
class SlsQtH1D;
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
/** Qt Include Headers */
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QGridLayout>
#include <QCheckBox>
#include <QCloseEvent>
#include <QComboBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QCheckBox>
#include <QString>
#include <QSpacerItem>
#include <QString>
#include <QWidget>
/** C++ Include Headers */
#include <string>
#include <iostream>
using namespace std;
#include <string>
/**
*@short Sets up the clone plot widget
*/
class qCloneWidget:public QMainWindow{
Q_OBJECT
class qCloneWidget : public QMainWindow {
Q_OBJECT
public:
/** \short The constructor
public:
/**
* The constructor
*/
qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle, int numDim,string FilePath,
bool displayStats, QString min, QString max, QString sum);
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim, std::string FilePath,
bool displayStats, QString min, QString max, QString sum);
/** Destructor
/**
* Destructor
*/
~qCloneWidget();
~qCloneWidget();
/** Sets up the widget window
/**
* Sets up the widget window
* @param title title of the image with frame number
* @param xTitle title of x axis
* @param yTitle title of y axis
* @param zTitle title of z axis
* @param numDim 1D or 2D
* */
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
/** Get the 1D hist values to plot
/**
* Get the 1D hist values to plot
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
@ -73,10 +61,11 @@ public:
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
* */
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers);
*/
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis[], std::string histTitle[], bool lines, bool markers);
/** Get the 1D hist values to plot for angle plotting
/**
* Get the 1D hist values to plot for angle plotting
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
@ -84,10 +73,11 @@ public:
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
* */
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers);
*/
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis, std::string histTitle[], bool lines, bool markers);
/** Get the 1D hist values to plot for angle plotting
/**
* Get the 1D hist values to plot for angle plotting
* @param nbinsx number of bins in x axis
* @param xmin minimum in x axis
* @param xmax maximum in x axis
@ -95,70 +85,63 @@ public:
* @param ymin minimum in y axis
* @param ymax maximum in y axis
* @param d data
* */
void SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d);
*/
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d);
/**Set the range of the 1d plot
/**
* Set the range of the 1d plot
* @param IsXYRange array of x,y,min,max if these values are set
* @param XYRangeValues array of set values of x,y, min, max
*/
void SetRange(bool IsXYRange[], double XYRangeValues[]);
void SetRange(bool IsXYRange[], double XYRangeValues[]);
/** Returns the 1d plot
/**
* Returns the 1d plot
*/
SlsQt1DPlot* Get1dPlot(){return cloneplot1D;};
SlsQt1DPlot *Get1dPlot();
public slots:
/** Save Plots automatically by save all clones
* returns -1 if fail*/
int SavePlotAutomatic();
private:
/** clone window id*/
int id;
/** Default Save file path */
string filePath;
/** clone 1D Plot */
SlsQt1DPlot* cloneplot1D;
/** clone 2D Plot */
SlsQt2DPlotLayout* cloneplot2D;
/** vector of 1D hist values */
QVector<SlsQtH1D*> cloneplot1D_hists;
/** markers for the plot*/
QwtSymbol *marker;
QwtSymbol *nomarker;
QMenuBar *menubar;
QAction *actionSave;
QGridLayout *mainLayout;
QGroupBox *cloneBox;
QGridLayout *gridClone;
QLabel *lblHistTitle;
public slots:
/**
* Save Plots automatically by save all clones
* returns -1 if fail
*/
int SavePlotAutomatic();
private:
/** Gets the current time stamp for the window title*/
char* GetCurrentTimeStamp();
char *GetCurrentTimeStamp();
/** Display Statistics */
void DisplayStats(bool enable, QString min, QString max, QString sum);
/** clone window id*/
int id;
/** Default Save file path */
std::string filePath;
/** clone 1D Plot */
SlsQt1DPlot *cloneplot1D;
/** clone 2D Plot */
SlsQt2DPlotLayout *cloneplot2D;
/** vector of 1D hist values */
QVector<SlsQtH1D *> cloneplot1D_hists;
private slots:
/** Save Plot */
void SavePlot();
/** markers for the plot*/
QwtSymbol *marker;
QwtSymbol *nomarker;
protected:
void closeEvent(QCloseEvent* event);
QGridLayout *mainLayout;
QGroupBox *cloneBox;
signals:
void CloneClosedSignal(int);
QLabel *lblHistTitle;
private slots:
/** Save Plot */
void SavePlot();
protected:
void closeEvent(QCloseEvent *event);
signals:
void CloneClosedSignal(int);
};
#endif /* QCLONEWIDGET_H_ */

74
slsDetectorGui/include/qDebugStream.h Normal file → Executable file
View File

@ -1,101 +1,80 @@
/*
* qDebugStream.h
*
* Created on: Jun 28, 2012
* Author: Anna Bergamaschi
*/
#ifndef QDEBUGSTREAM_H_
#define QDEBUGSTREAM_H_
#include "qDefs.h"
#pragma once
#include <QApplication>
#include <QWidget>
#include <QString>
#include <QCustomEvent>
#include <QString>
#include <QWidget>
#include <iostream>
#include <streambuf>
#include <string>
using namespace std;
#define STREAMEVENT 60001
//-------------------------------------------------------------------------------------------------------------------------------------------------
class qStreamEvent:public QEvent{
class qStreamEvent : public QEvent {
public:
qStreamEvent(QString s):QEvent(static_cast<QEvent::Type>(STREAMEVENT)),str(s){
qStreamEvent(QString s) : QEvent(static_cast<QEvent::Type>(STREAMEVENT)), str(s) {
#ifdef PRINT_LOG
printf("%s\n",str.toAscii().constData());
printf("%s\n", str.toAscii().constData());
#endif
}
/** \returns the progress index */
QString getString() {return str;}
QString getString() { return str; }
private:
QString str;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
class qDebugStream : public basic_streambuf<char> {
class qDebugStream : public std::basic_streambuf<char> {
public:
qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) {
qDebugStream(std::ostream &stream, QWidget *w) : m_stream(stream), log_window(w) {
pthread_mutex_init(&mutex, NULL);
m_old_buf = stream.rdbuf();
stream.rdbuf(this);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
~qDebugStream(){
~qDebugStream() {
// output anything that is left
if (!m_string.empty()) {
pthread_mutex_lock(&mutex);
const char* c_string = m_string.c_str();
const char *c_string = m_string.c_str();
QApplication::postEvent(log_window, new qStreamEvent(c_string));
pthread_mutex_unlock(&mutex);
}
m_stream.rdbuf(m_old_buf);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
protected:
virtual int_type overflow(int_type v){
if (v == '\n'){
virtual int_type overflow(int_type v) {
if (v == '\n') {
pthread_mutex_lock(&mutex);
const char* c_string = m_string.c_str();
const char *c_string = m_string.c_str();
QApplication::postEvent(log_window, new qStreamEvent(c_string));
m_string.erase(m_string.begin(), m_string.end());
pthread_mutex_unlock(&mutex);
}
else
} else
m_string += v;
return v;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
virtual streamsize xsputn(const char *p, streamsize n) {
virtual std::streamsize xsputn(const char *p, std::streamsize n) {
pthread_mutex_lock(&mutex);
m_string.append(p, p + n);
//changed from uint because of 64 bit
size_t pos = 0;
while (pos != string::npos){
while (pos != std::string::npos) {
pos = m_string.find('\n');
if (pos != string::npos){
string tmp(m_string.begin(), m_string.begin() + pos);
const char* c_tmp = tmp.c_str();
if (pos != std::string::npos) {
std::string tmp(m_string.begin(), m_string.begin() + pos);
const char *c_tmp = tmp.c_str();
QApplication::postEvent(log_window, new qStreamEvent(c_tmp));
m_string.erase(m_string.begin(), m_string.begin() + pos + 1);
}
@ -104,16 +83,13 @@ protected:
return n;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
private:
pthread_mutex_t mutex;
ostream &m_stream;
streambuf *m_old_buf;
string m_string;
QWidget* log_window;
std::ostream &m_stream;
std::streambuf *m_old_buf;
std::string m_string;
QWidget *log_window;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
#endif /* QDEBUGSTREAM_H_ */

537
slsDetectorGui/include/qDefs.h Normal file → Executable file
View File

@ -1,301 +1,252 @@
/*
* qDefs.h
*
* Created on: May 4, 2012
* Author: l_maliakal_d
*/
#pragma once
#ifndef QDEFS_H
#define QDEFS_H
#include "ansi.h"
#include "sls_detector_defs.h"
#include "slsDetector.h"
#include "multiSlsDetector.h"
#include <string>
#include <ostream>
#include <iostream>
#include <QMessageBox>
#include "sls_detector_defs.h"
#include <QAbstractButton>
using namespace std;
#include <QMessageBox>
class qDefs:public QWidget{
public:
//-------------------------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <ostream>
#include <stdint.h>
#include <string>
/** Empty Constructor
*/
qDefs(){};
//-------------------------------------------------------------------------------------------------------------------------------------------------
#define GOODBYE -200
//-------------------------------------------------------------------------------------------------------------------------------------------------
enum{
OK,
FAIL
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
enum MessageIndex{
WARNING,
CRITICAL,
INFORMATION,
QUESTION
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** unit of time
*/
enum timeUnit{
HOURS, /** hr */
MINUTES, /** min */
SECONDS, /** s */
MILLISECONDS, /** ms */
MICROSECONDS, /** us */
NANOSECONDS /** ns */
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** returns the unit in words
* @param unit is the time unit
*/
static string getUnitString(timeUnit unit){
switch(unit){
case HOURS: return string("hrs");
case MINUTES: return string("min");
case SECONDS: return string("sec");
case MILLISECONDS: return string("msec");
case MICROSECONDS: return string("usec");
case NANOSECONDS: return string("nsec");
default: return string("error");
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** returns the value in ns to send to server as the
* server class slsdetector accepts in ns.
* @param unit unit of time
* @param value time
* returns time value in ns
*/
static double getNSTime(timeUnit unit, double value){
double valueNS=value;
switch(unit){
case HOURS: valueNS*=60;
case MINUTES: valueNS*=60;
case SECONDS: valueNS*=1000;
case MILLISECONDS: valueNS*=1000;
case MICROSECONDS: valueNS*=1000;
case NANOSECONDS:
default:;
}
return valueNS;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** returns the time in the appropriate time unit
* @param unit unit of time
* @param value time in seconds
* returns the corresponding time value
*/
static double getCorrectTime(timeUnit& unit, double value){
int intUnit = (int)SECONDS;
/**0 ms*/
if(!value){
unit = MILLISECONDS;
return value;
}
/** hr, min, sec */
if(value>=1){
double newVal = value;
while((newVal>=1)&&(intUnit>=(int)HOURS)){
/** value retains the old value */
value = newVal;
newVal = value/(double)60;
intUnit--;
}
/** returning the previous value*/
unit = (timeUnit)(intUnit+1);
return value;
}
/** ms, us, ns */
else{
while((value<1)&&(intUnit<(int)NANOSECONDS)){
value = value*(double)1000;
intUnit++;
}
unit = (timeUnit)(intUnit);
return value;
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**displays an warning,error,info message
* @param message the message to be displayed
* @param source is the tab or the source of the message
* */
static int Message(MessageIndex index, string message,string source)
{
static QMessageBox* msgBox;
size_t pos;
//replace all \n with <br>
pos = 0;
while((pos = message.find("\n", pos)) != string::npos){
message.replace(pos, 1, "<br>");
pos += 1;
}
message.append(string("<p style=\"font-size:10px;color:grey;\">Source:&nbsp;&nbsp; ") + source + string("</p>"));
switch(index){
case WARNING:
msgBox= new QMessageBox(QMessageBox::Warning,"WARNING",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case CRITICAL:
msgBox= new QMessageBox(QMessageBox::Critical,"CRITICAL",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case INFORMATION:
msgBox= new QMessageBox(QMessageBox::Information,"INFORMATION",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
default:
msgBox= new QMessageBox(QMessageBox::Question,"QUESTION",tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
break;
}
//msgBox->setDetailedText(QString(source.c_str())); //close button doesnt work with this static function and this
if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** range of x and y axes
*/
enum range{
XMINIMUM,
XMAXIMUM,
YMINIMUM,
YMAXIMUM
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**gets error mask and displays the message if it exists
* @param myDet is the multidetector object
/returns error message else an empty string
* */
static string checkErrorMessage(multiSlsDetector*& myDet, string title = "Main"){
int errorLevel= (int)WARNING;
string retval="";
size_t pos;
retval = myDet->getErrorMessage(errorLevel);
if(!retval.empty()){
//replace all \n with <br>
pos = 0;
while((pos = retval.find("\n", pos)) != string::npos){
retval.replace(pos, 1, "<br>");
pos += 1;
}
//get rid of the last \n
if(retval.find_last_of("<br>")==retval.length()-1)
retval.erase((int)retval.find_last_of("<br>")-3,4);
retval.insert(0,"<font color=\"darkBlue\">");
retval.append("</font></nobr>");
//display message
qDefs::Message((MessageIndex)errorLevel,retval,title);
}
myDet->clearAllErrorMask();
return retval;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**gets error mask and displays the message if it exists
* @param myDet is the slsdetector object
* @param show to display the error message
/returns error message else an empty string
* */
static string checkErrorMessage(slsDetector*& myDet, string title = "Main", bool show = true){
int errorLevel= (int)WARNING;
string retval="";
size_t pos;
int64_t emask=0;
emask = myDet->getErrorMask();
retval = myDet->getErrorMessage(emask);
if(!retval.empty()){
//replace all \n with <br>
pos = 0;
while((pos = retval.find("\n", pos)) != string::npos){
retval.replace(pos, 1, "<br>");
pos += 1;
}
//get rid of the last \n
if(retval.find_last_of("<br>")==retval.length()-1)
retval.erase((int)retval.find_last_of("<br>")-3,4);
retval.insert(0,"<font color=\"darkBlue\">");
retval.append("</font></nobr>");
//display message
if(show)
qDefs::Message((MessageIndex)errorLevel,retval,title);
}
myDet->clearErrorMask();
return retval;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** scan arguments*/
enum scanArgumentList{
None,
Level0,
Level1,
FileIndex,
AllFrames
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** histogram arguments*/
enum histogramArgumentList{
Intensity,
histLevel0,
histLevel1
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
class qDefs : public QWidget {
public:
/**
* Empty Constructor
*/
qDefs(){};
#define GOODBYE -200
/** Success or FAIL */
enum { OK, FAIL };
/**
* Message Criticality
*/
enum MessageIndex { WARNING, CRITICAL, INFORMATION, QUESTION };
/**
* unit of time
*/
enum timeUnit {
HOURS, /** hr */
MINUTES, /** min */
SECONDS, /** s */
MILLISECONDS, /** ms */
MICROSECONDS, /** us */
NANOSECONDS /** ns */
};
/**
* range of x and y axes
*/
enum range { XMINIMUM, XMAXIMUM, YMINIMUM, YMAXIMUM };
/**
* function enums for the qServer and qClient
*/
enum guiFuncs {
F_GUI_GET_RUN_STATUS,
F_GUI_START_ACQUISITION,
F_GUI_STOP_ACQUISITION,
F_GUI_START_AND_READ_ALL,
F_GUI_EXIT_SERVER,
NUM_GUI_FUNCS
};
/**
* returns the unit in words
* @param unit is the time unit
*/
static std::string getUnitString(timeUnit unit) {
switch (unit) {
case HOURS:
return std::string("hrs");
case MINUTES:
return std::string("min");
case SECONDS:
return std::string("sec");
case MILLISECONDS:
return std::string("msec");
case MICROSECONDS:
return std::string("usec");
case NANOSECONDS:
return std::string("nsec");
default:
return std::string("error");
}
};
/**
* returns the value in ns to send to server as the
* server class slsdetector accepts in ns.
* @param unit unit of time
* @param value time
* returns time value in ns
*/
static double getNSTime(timeUnit unit, double value) {
double valueNS = value;
switch (unit) {
case HOURS:
valueNS *= 60;
case MINUTES:
valueNS *= 60;
case SECONDS:
valueNS *= 1000;
case MILLISECONDS:
valueNS *= 1000;
case MICROSECONDS:
valueNS *= 1000;
case NANOSECONDS:
default:
break;
}
return valueNS;
};
/**
* returns the time in the appropriate time unit
* @param unit unit of time
* @param value time in seconds
* returns the corresponding time value
*/
static double getCorrectTime(timeUnit &unit, double value) {
int intUnit = (int)SECONDS;
/**0 ms*/
if (!value) {
unit = MILLISECONDS;
return value;
}
/** hr, min, sec */
if (value >= 1) {
double newVal = value;
while ((newVal >= 1) && (intUnit >= (int)HOURS)) {
/** value retains the old value */
value = newVal;
newVal = value / (double)60;
intUnit--;
}
/** returning the previous value*/
unit = (timeUnit)(intUnit + 1);
return value;
}
/** ms, us, ns */
else {
while ((value < 1) && (intUnit < (int)NANOSECONDS)) {
value = value * (double)1000;
intUnit++;
}
unit = (timeUnit)(intUnit);
return value;
}
};
/**
* displays an warning,error,info message
* @param message the message to be displayed
* @param source is the tab or the source of the message
* */
static int Message(MessageIndex index, std::string message,
std::string source) {
static QMessageBox *msgBox;
size_t pos;
// replace all \n with <br>
pos = 0;
while ((pos = message.find("\n", pos)) != std::string::npos) {
message.replace(pos, 1, "<br>");
pos += 1;
}
message.append(
std::string(
"<p "
"style=\"font-size:10px;color:grey;\">Source:&nbsp;&nbsp; ") +
source + std::string("</p>"));
switch (index) {
case WARNING:
msgBox =
new QMessageBox(QMessageBox::Warning, "WARNING",
tr(message.c_str()), QMessageBox::Ok, msgBox);
break;
case CRITICAL:
msgBox =
new QMessageBox(QMessageBox::Critical, "CRITICAL",
tr(message.c_str()), QMessageBox::Ok, msgBox);
break;
case INFORMATION:
msgBox =
new QMessageBox(QMessageBox::Information, "INFORMATION",
tr(message.c_str()), QMessageBox::Ok, msgBox);
break;
default:
msgBox = new QMessageBox(
QMessageBox::Question, "QUESTION", tr(message.c_str()),
QMessageBox::Ok | QMessageBox::Cancel, msgBox);
break;
}
// msgBox->setDetailedText(QString(source.c_str())); //close button
// doesnt work with this static function and this
if (msgBox->exec() == QMessageBox::Ok)
return OK;
else
return FAIL;
}
/**
* Wrap around to ignore non critical exceptions
*/
template <class CT> struct NonDeduced { using type = CT; };
// only executing multiSlsDetector function
template <typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(multiSlsDetector* det, const std::string loc, RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
((det->*somefunc)(Args...));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc);
}
};
// executing multiSlsDetector funtion and using return value to set QWidget function
template <class W, typename WRT, typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(W* wid,
void (W::*someQfunc)(WRT),
multiSlsDetector* det, const std::string loc,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
auto val = ((det->*somefunc)(Args...));
(wid->*someQfunc)(static_cast<RT>(val));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc);
}
};
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
template <typename RT, typename... CT>
static RT IgnoreNonCriticalExceptionsandReturn(
multiSlsDetector* det, const std::string loc,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
return ((det->*somefunc)(Args...));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc);
return static_cast<RT>(-1);
}
};
};
#endif /* QDEFS_H */

310
slsDetectorGui/include/qDetectorMain.h Normal file → Executable file
View File

@ -1,202 +1,200 @@
/*
* qDetectorMain.h
* Main Window of the GUI
* Created on: Apr 30, 2012
* Author: l_maliakal_d
*/
#ifndef QDETECTORMAIN_H
#define QDETECTORMAIN_H
#pragma once
#include "qDefs.h"
/** Form Header */
#include "ui_form_detectormain.h"
/** Qt Project Class Headers */
#include "qDrawPlot.h"
#include "qTabMeasurement.h"
#include "qTabDataOutput.h"
#include "qTabMeasurement.h"
#include "ui_form_detectormain.h"
class qTabPlot;
class qTabActions;
class qTabAdvanced;
class qTabSettings;
class qTabDebugging;
class qTabDeveloper;
class qTabMessages;
class qServer;
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QScrollArea>
#include <QGridLayout>
#include <QResizeEvent>
#include <QScrollArea>
#include <QTabWidget>
#include <iostream>
using namespace std;
/** To Over-ride the QTabWidget class to get the tabBar */
class MyTabWidget:public QTabWidget{
public:
MyTabWidget(QWidget* parent = 0) {setParent(parent);}
class MyTabWidget : public QTabWidget {
public:
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
/** Overridden method from QTabWidget */
QTabBar* tabBar(){return QTabWidget::tabBar();}
QTabBar *tabBar() { return QTabWidget::tabBar(); }
};
/**
*@short Main window of the GUI.
*/
class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{
Q_OBJECT
class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
Q_OBJECT
public:
/**
* Main Window constructor.
* This is mainly used to create detector object and all the tabs
* @param argc number of command line arguments for server options
* @param argv server options
* @param app the qapplication3
* @param parent makes the parent window 0 by default
*/
qDetectorMain(int argc, char **argv, QApplication *app,
QWidget *parent = 0);
public:
/** \short Main Window constructor.
* This is mainly used to create detector object and all the tabs
* @param argc number of command line arguments for server options
* @param argv server options
* @param app the qapplication3
* @param ret OK or FAIL of constructor (from command line arguments)
* @param parent makes the parent window 0 by default
* */
qDetectorMain(int argc, char **argv, QApplication *app, int& ret, QWidget *parent = 0);
/**
* Destructor
*/
~qDetectorMain();
/**Destructor
* */
~qDetectorMain();
/**
* Starts or stops Acquisition From gui client
* @param start 1 for start and 0 to stop
* @returns success or fail
*/
int StartStopAcquisitionFromClient(bool start);
/** Starts or stops Acquisition From gui client
* @param start 1 for start and 0 to stop
/returns success or fail
*/
int StartStopAcquisitionFromClient(bool start);
/**
* Returns if plot is running
*/
bool isPlotRunning();
/** Returns if plot is running
*/
bool isPlotRunning(){return myPlot->isRunning();};
/**
* Returns progress bar value
*/
int GetProgress();
/** Returns progress bar value */
int GetProgress(){return tab_measurement->GetProgress();};
/**
* Verifies if output directories for all the receivers exist
*/
int DoesOutputDirExist();
/** Returns file path */
QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;};
private slots:
/**
* Enables modes as selected -Debug, Expert, Dockable: calls setdockablemode
*/
void EnableModes(QAction *action);
/** Verifies if output directories for all the receivers exist */
int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();};
/**
* Executes actions in the utilities menu as selected
*/
void ExecuteUtilities(QAction *action);
bool isCurrentlyTabDeveloper();
/**
* Executes actions in the utilities menu as selected
*/
void ExecuteHelp(QAction *action);
private:
/** The Qt Application */
QApplication *theApp;
/** The sls detector object */
multiSlsDetector *myDet;
/** sls detector id */
int detID;
/** true for mythen and eiger */
bool digitalDetector;
/** The Plot widget */
qDrawPlot *myPlot;
/**Tab Widget */
MyTabWidget *tabs;
/**Layout of the central Widget */
QGridLayout *layoutTabs;
/** default height of Plot Window when docked */
int heightPlotWindow;
/** default height of central widgetwhen plot Window when docked */
int heightCentralWidget;
/** The default zooming tool tip */
QString zoomToolTip;
/**
* Refreshes the tab each time the tab is changed. Also displays the next
* enabled tab
*/
void Refresh(int index);
/** The default tab heading color */
QColor defaultTabColor;
/** enumeration of the tabs */
enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, Messages, NumberOfTabs };
/* Scroll Area for the tabs**/
QScrollArea *scroll[NumberOfTabs];
/**Measurement tab */
qTabMeasurement *tab_measurement;
/**DataOutput tab */
qTabDataOutput *tab_dataoutput;
/**Plot tab */
qTabPlot *tab_plot;
/**Actions tab */
qTabActions *tab_actions;
/**Settings tab */
qTabSettings *tab_settings;
/**Advanced tab */
qTabAdvanced *tab_advanced;
/**Debugging tab */
qTabDebugging *tab_debugging;
/**Developer tab */
qTabDeveloper *tab_developer;
/**Messages tab */
qTabMessages *tab_messages;
/**
* Resizes the main window if the plot is docked/undocked
* @param b bool TRUE if undocked(outside main window), FALSE docked
*/
void ResizeMainWindow(bool b);
/** server object*/
qServer *myServer;
/**
* Enables/disables tabs depending on if acquisition is currently in
* progress
*/
void EnableTabs();
/**if the developer tab should be enabled,known from command line */
int isDeveloper;
/**
* Set the tool tip of mouse controlled zooming depening on if its
* enabled/disabled
*/
void SetZoomToolTip(bool disable);
/**Sets up the layout of the widget
* */
void SetUpWidgetWindow();
/**
* Uncheck the Listen to gui client mode when the server has exited
*/
void UncheckServer();
/**Sets up detector
* @param fName file name of the config file at start up
* */
void SetUpDetector(const string fName);
protected:
/**
* Adjust the resizing to resize plot
*/
void resizeEvent(QResizeEvent *event);
/**Sets up the signals and the slots
* */
void Initialization();
private:
/**
* Sets up the layout of the widget
*/
void SetUpWidgetWindow();
/** Loads config file at start up
* */
void LoadConfigFile(const string fName);
/**
* Sets up detector
* @param fName file name of the config file at start up
* @param multi detector ID
*/
void SetUpDetector(const std::string fName, int multiID);
/**
* Sets up the signals and the slots
*/
void Initialization();
private slots:
/** Enables modes as selected -Debug, Expert, Dockable(calls setdockablemode())
* */
void EnableModes(QAction *action);
/** Executes actions in the utilities menu as selected
* */
void ExecuteUtilities(QAction *action);
/** Executes actions in the utilities menu as selected
* */
void ExecuteHelp(QAction *action);
/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab
* */
void Refresh(int index);
/** Resizes the main window if the plot is docked/undocked
* @param b bool TRUE if undocked(outside main window), FALSE docked
* */
void ResizeMainWindow(bool b);
/** Enables/disables tabs depending on if acquisition is currently in progress
* */
void EnableTabs();
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled
* */
void SetZoomToolTip(bool disable);
/** Uncheck the Listen to gui client mode when the server has exited
*/
void UncheckServer();
protected:
/** Adjust the resizing to resize plot, except for actions tab
* */
void resizeEvent(QResizeEvent* event);
/**
* Loads config file at start up
*/
void LoadConfigFile(const std::string fName);
/** enumeration of the tabs */
enum {
MEASUREMENT,
SETTINGS,
DATAOUTPUT,
PLOT,
ADVANCED,
DEBUGGING,
DEVELOPER,
MESSAGES,
NumberOfTabs
};
/** Detector Type */
slsDetectorDefs::detectorType detType;
/** The sls detector object */
multiSlsDetector* myDet;
/** The Plot widget */
qDrawPlot* myPlot;
/**Tab Widget */
MyTabWidget* tabs;
/**Measurement tab */
qTabMeasurement* tabMeasurement;
/**DataOutput tab */
qTabDataOutput* tabDataOutput;
/**Plot tab */
qTabPlot* tabPlot;
/**Settings tab */
qTabSettings* tabSettings;
/**Advanced tab */
qTabAdvanced* tabAdvanced;
/**Debugging tab */
qTabDebugging* tabDebugging;
/**Developer tab */
qTabDeveloper* tabDeveloper;
/**Messages tab */
qTabMessages* tabMessages;
/** server object*/
qServer* myServer;
/**if the developer tab should be enabled,known from command line */
int isDeveloper;
/** default height of Plot Window when docked */
int heightPlotWindow;
/** default height of central widgetwhen plot Window when docked */
int heightCentralWidget;
/** The default zooming tool tip */
QString zoomToolTip;
/** The default tab heading color */
QColor defaultTabColor;
};
#endif /* QDETECTORMAIN_H */

4
slsDetectorGui/include/qDrawPlot.h Normal file → Executable file
View File

@ -50,7 +50,7 @@ class qDrawPlot:public QWidget{
public:
/** \short The constructor */
qDrawPlot(QWidget *parent,multiSlsDetector*& detector);
qDrawPlot(QWidget *parent, multiSlsDetector* detector);
/** Destructor */
~qDrawPlot();
@ -181,7 +181,7 @@ void SetLines(bool enable){lines = enable;};
/** sets markers */
void SetMarkers(bool enable){markers = enable;};
/** sets the scan argument to prepare the plot*/
void SetScanArgument(int scanArg);
// void SetScanArgument(int scanArg);
/** sets stop_signal to true */
void StopAcquisition(){ stop_signal = true; };
/** Set/unset pedestal */

View File

@ -1,193 +0,0 @@
/*
* qScanWidget.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QSCANWIDGET_H_
#define QSCANWIDGET_H_
#include "qDefs.h"
/** Form Header */
#include "ui_form_scan.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QStackedLayout>
/** C++ Include Headers */
#include <string>
#include <vector>
using namespace std;
class qScanWidget : public QWidget,private Ui::ScanObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qScanWidget(QWidget *parent, multiSlsDetector*& detector);
~qScanWidget();
/**to update the widgets*/
void Refresh();
/**number of scan widgets*/
static int NUM_SCAN_WIDGETS;
private:
/** The sls detector object */
multiSlsDetector *myDet;
/**id of the scan widget*/
int id;
/**type of steps*/
enum sizeIndex{RangeValues, CustomValues, FileValues};
enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,PositionScan,CustomScript,NumModes};
static const string modeNames[NumModes];
/**values*/
int actualNumSteps;
vector <double> positions;
/**non error font*/
QPalette normal;
QPalette red;
QString customTip;
QString fileTip;
QString rangeTip;
/**widgets needed for diff size types*/
QButtonGroup *btnGroup;
QStackedLayout *stackedLayout;
QLabel *lblFrom;
QDoubleSpinBox *spinFrom;
QLabel *lblTo;
QDoubleSpinBox *spinTo;
QLabel *lblSize;
QDoubleSpinBox *spinSize;
QComboBox *comboCustom;
QPushButton *btnCustom;
QLineEdit *dispFile;
QPushButton *btnFile;
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
/** Sets up all the parameters from server/client */
void LoadPositions();
/** Sets up the scan parameters
* returns if it was set
*/
int SetScan(int mode);
private slots:
/** Enables widgets depending on which size is clicked.
* Options: constant size,specific values,values from file
* */
void EnableSizeWidgets();
/** Sets the scan or script. Accordingly enables, disables other widgets
* @param mode value chosen*/
void SetMode(int mode);
/** Browse for the script
* */
void BrowsePath();
/** Sets the script file
* */
void SetScriptFile();
/** Set Parameter
* */
void SetParameter();
/** Set precision
* @param value value of precision to be set
* */
void SetPrecision(int value);
/** Set number of steps
* */
void SetNSteps();
/**Checks if size is zero and return FAIL if it does
* */
int RangeCheckSizeZero();
/**returns ok and number of steps if valid
* @param number of steps
* */
int RangeCheckNumValid(int &num);
/**returns fail if to is not exact
* */
int RangeCheckToValid();
/** Sets number of steps if from changed
* */
void RangeFromChanged();
/** Sets number of steps if to changed
* */
void RangeToChanged();
/** Sets s of steps if size changed
* */
void RangeSizeChanged();
/** Set range for scan
* */
void SetRangeSteps();
/** Range type: If size is changed,
* the Number of steps is calculated
* */
//void RangeCalculateNumSteps();
/** Range type: If size is changed, the To is calculated
* */
//void RangeCalculateTo();
/** Set custom steps
* returns OK if set properly
* */
int SetCustomSteps();
/** Delete custom steps
* */
void DeleteCustomSteps();
/** Reads the file to get the steps
* */
void SetFileSteps();
/** Browses for the file path for steps
* */
void BrowseFileStepsPath();
signals:
void EnableScanBox();
};
#endif /* QSCANWIDGET_H_ */

201
slsDetectorGui/include/qServer.h Normal file → Executable file
View File

@ -1,137 +1,126 @@
/*
* qServer.h.h
*
* Created on: Feb 27, 2013
* Author: Dhanya Maliakal
*/
#ifndef QSERVER_H
#define QSERVER_H
#pragma once
/** Qt Project Class Headers */
#include "sls_detector_defs.h"
#include "qDefs.h"
#include "sls_detector_defs.h"
class qDetectorMain;
/** Project Class Headers */
class multiSlsDetector;
class MySocketTCP;
/** Qt Include Headers */
#include <QWidget>
/** C++ Include Headers */
class multiSlsDetector;
class ServerSocket;
#include <QWidget>
#include <vector>
/**
*@short Sets up the gui server
*/
class qServer: public QWidget, public virtual slsDetectorDefs{
Q_OBJECT
class qServer : public QWidget, public virtual slsDetectorDefs {
Q_OBJECT
public:
/**
* The constructor
*/
qServer(qDetectorMain *t);
/**
* Destructor
*/
~qServer();
public:
/** \short The constructor */
qServer(qDetectorMain *t);
/** Destructor */
~qServer();
/**
* Create (Control and Stop) Gui Servers
*/
void CreateServers();
/** Start or Stop Gui Server
* @param start is 1 to start and 0 to stop
*/
int StartStopServer(int start);
/**
* Destroy (Control and Stop) Gui Servers
*/
void DestroyServers();
private:
/** assigns functions to the fnum enum */
int FunctionTable();
private:
/**
* Assigns functions to the fnum enum
*/
void FunctionTable();
/** Decodes Function */
int DecodeFunction(MySocketTCP* sock);
/**
* Decodes Function
* @param sock control or stop socket
* @returns OK or FAIL
*/
int DecodeFunction(ServerSocket *sock);
/** Exit Server */
int ExitServer();
/**
* Shut down Sockets
*/
void ShutDownSockets();
/**
* Server thread
* @param pointer to control or stop socket
*/
void ServerThread(ServerSocket* sock);
/**
* Static function - Thread started which listens to client gui.
* Called by StartStopServer()
* @param this_pointer pointer to this object
*/
static void* StartServerThread(void *this_pointer);
/**
* Thread of stop server
*/
void StopServer();
/**
* Thread started which listens to client gui.
* Called by startServerThread()
*
*/
int StartServer();
/**
* Get Detector Status
* @returns success of operation
*/
int GetStatus();
/**
* Static function - Thread started which listens to client gui to stop acquisition
* Called by StartStopServer()
* @param this_pointer pointer to this object
*/
static void* StopServerThread(void *this_pointer);
/**
* Starts Acquisition
* @returns success of operation
*/
int StartAcquisition();
/**
* Thread started which listens to client gui to stop acquisition.
* Called by startServerThread()
*
*/
int StopServer();
/**
* Stops Acquisition
* @returns success of operation
*/
int StopsAcquisition();
/**
* Acquire - blocking
* @returns success of operation
*/
int Acquire();
/**
* Exit Server
* @returns GOODBYE
*/
int ExitServer();
/** Get Detector Status */
int GetStatus();
/** function list */
std::vector<int (*)()> flist;
/** Starts Acquisition */
int StartAcquisition();
/** if the gui server thread is running*/
bool threadRunning;
/** Stops Acquisition */
int StopsAcquisition();
/** if thread started */
bool threadStarted;
/** Acquire - blocking */
int Acquire();
/**The measurement tab object*/
qDetectorMain *mainTab;
/** control port */
int controlPort;
/** stop port */
int stopPort;
/**The measurement tab object*/
qDetectorMain *myMainTab;
/** control socket */
ServerSocket *controlSocket;
/** tcp socket to gui client */
MySocketTCP *mySocket;
/** tcp socket to gui client to stop or get status */
MySocketTCP *myStopSocket;
/** server port number*/
int port_no;
/** Lock Status if server locked to a client */
int lockStatus;
/** Function List */
static const int NUMBER_OF_FUNCTIONS = 256;
int (qServer::*flist[NUMBER_OF_FUNCTIONS])();
/** if the gui server thread is running*/
static int gui_server_thread_running;
/** thread listening to gui client*/
pthread_t gui_server_thread;
/** thread also listening to gui client to stop acquisition*/
pthread_t gui_stop_server_thread;
/** server started */
int checkStarted;
int checkStopStarted;
/** Message */
char mess[MAX_STR_LENGTH];
signals:
void ServerStoppedSignal();
/** stop socket */
ServerSocket *stopSocket;
signals:
// to update the Listening to Gui check box
void ServerStoppedSignal();
};
#endif /* QSERVER_H */

View File

@ -1,150 +0,0 @@
/*
* qTabActions.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABACTIONS_H_
#define QTABACTIONS_H_
#include "qDefs.h"
/* Qt Project Class Headers */
#include "qActionsWidget.h"
#include "qScanWidget.h"
/** C++ Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QWidget>
#include <QPushButton>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QLabel>
#include <QScrollArea>
#include <QGridLayout>
#include <QPalette>
/**
*@short sets up the acions parameters
*/
class qTabActions:public QWidget{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabActions(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
~qTabActions();
/** To refresh and update widgets
*/
void Refresh();
public slots:
/** Disable Positions
* @param enable true if to disable
* */
void EnablePositions(bool enable);
private:
/** The sls detector object */
multiSlsDetector *myDet;
slsDetectorDefs::detectorType detType;
enum actionIndex{
ActionStart,
Scan0,
Scan1,
ActionBefore,
NumPositions,
HeaderBefore,
HeaderAfter,
ActionAfter,
ActionStop,
NumTotalActions};
QGridLayout *gridLayout;
QButtonGroup *group;
QPalette *palette;
/** all action widget objects */
qActionsWidget *actionWidget[6];
qScanWidget *scanWidget[2];
QWidget *positionWidget;
QPushButton *btnExpand[NumTotalActions];
QLabel *lblName[NumTotalActions];
/** NumPositions widget */
QLabel *lblNumPos;
QLabel *lblPosList;
QSpinBox *spinNumPos;
QComboBox *comboPos;
QPushButton *btnDelete;
QCheckBox *chkInvert;
QCheckBox *chkSeparate;
QCheckBox *chkReturn;
double *positions;
QPalette normal;
QIcon *iconPlus;
QIcon *iconMinus;
/** Sets up the widget */
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
/** creates the Num Positions object */
void CreatePositionsWidget();
/** Returns the index in each of the classes
* of actionwidget and scanwidget
* @param index the index in the list of all widgets
* returns actual index of the class
*/
int GetActualIndex(int index);
/** Updates to green color if collapsed and mode not none
*/
void UpdateCollapseColors();
private slots:
/** To Expand the Action Widget
* */
void Expand(QAbstractButton *button);
/** Sets the positions list and the number of positions
* */
void SetPosition();
/** Deletes current position
* */
void DeletePosition();
signals:
void EnableScanBox();
};
#endif /* QTABACTIONS_H_ */

216
slsDetectorGui/include/qTabAdvanced.h Normal file → Executable file
View File

@ -1,24 +1,15 @@
/*
* qTabAdvanced.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABADVANCED_H_
#define QTABADVANCED_H_
#pragma once
#include "qDefs.h"
#include "sls_detector_defs.h"
/** Form Header */
#include "ui_form_tab_advanced.h"
/** Project Class Headers */
class multiSlsDetector;
class slsDetector;
/** Qt Project Class Headers */
class qDrawPlot;
/** Qt Include Header */
#include <QStackedLayout>
#include <QSpacerItem>
/**
@ -28,239 +19,196 @@ class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
/**
* The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
qTabAdvanced(QWidget *parent, multiSlsDetector* detector);
/** Destructor
/**
* Destructor
*/
~qTabAdvanced();
public slots:
/** To refresh and update widgets
/**
* To refresh and update widgets
*/
void Refresh();
private:
/** Sets up the widget
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals
/**
* Sets up all the slots and signals
*/
void Initialization();
/** Add ROI Input
/**
* Add ROI Input
* @param num number of inputs to add
*/
void AddROIInput(int num);
/** Checks for a few conditions before trimming
/returns OK or FAIL
*/
int validateBeforeTrimming();
/** update the setalltrimbits value from server
/**
* Update the setalltrimbits value from server
*/
void updateAllTrimbitsFromServer();
private slots:
/** Enable/Disable Energy and Calibration Logs
*/
void SetLogs();
/** Set acquisition time
*/
void SetExposureTime();
/** Set the Threshold dac value
*/
void SetThreshold();
/** Set output directory for trimming
*/
void SetOutputFile();
/** Browse output directory for trimming
*/
void BrowseOutputFile();
/** Enables trimming method and calls SetTrimmingMethod if enabled
* @param enable to enable trimming
*/
void EnableTrimming(bool enable);
/** Enabling resolution and Counts if this is enabled
* @param enable to enable
*/
void SetOptimize(bool enable);
/** Sets the trimming method
* @param mode trimming method
*/
void SetTrimmingMethod(int mode);
/** Ensures the right trimming mode and Executes Trimming
*/
void StartTrimming();
/** Updates the plot with trimbits from detector/shared memory
*/
void UpdateTrimbitPlot(int id);
/** Sets control port
/**
* Sets control port
* @param port control port
*/
void SetControlPort(int port);
/** Sets stop port
/**
* Sets stop port
* @param port stop port
*/
void SetStopPort(int port);
/** Sets receiver tcp port
/**
* Sets receiver tcp port
* @param port receiver tcp port
*/
void SetRxrTCPPort(int port);
/** Sets receiver udp port
/**
* Sets receiver udp port
* @param port receiver udp port
*/
void SetRxrUDPPort(int port);
/** Sets client zmq receiver port
/**
* Sets client zmq receiver port
* @param port client zmq receiver port
*/
void SetCltZmqPort(int port);
/** Sets receiver zmq transmitting port
/**
* Sets receiver zmq transmitting port
* @param port receiver zmq transmitting port
*/
void SetRxrZmqPort(int port);
/** Sets receiver online
/**
* Sets receiver online
* @param index 1 for online and 0 for offline
*/
void SetReceiverOnline(int index);
/** Sets detector online
/**
* Sets detector online
* @param index 1 for online and 0 for offline
*/
void SetOnline(int index);
/** Sets network parameters like receiver udp ip,
/**
* Sets network parameters like receiver udp ip,
* receiver udp mac, detector ip and detector mac
*/
void SetNetworkParameters();
/** Sets client zmq ip to listen to
/**
* Sets client zmq ip to listen to
*/
void SetClientZMQIP();
/** Sets receiver zmq ip to stream from
/**
* Sets receiver zmq ip to stream from
*/
void SetReceiverZMQIP();
/** Sets the receiver. which also sets the receiver parameters
/**
* Sets the receiver. which also sets the receiver parameters
*/
void SetReceiver();
/** Add ROI Input if the value changed in the last slot
/**
* Add ROI Input if the value changed in the last slot
*/
void AddROIInputSlot(){AddROIInput(1);};
void AddROIInputSlot();
/** Clears all the ROI inputs
/**
* Clears all the ROI inputs
*/
void clearROI();
/** Gets ROIs from detector and updates it
/**
* Gets ROIs from detector and updates it
*/
void updateROIList();
/** Sets ROI in detector
/**
* Sets ROI in detector
*/
void setROI();
/** Clears ROI in detector
/**
* Clears ROI in detector
*/
void clearROIinDetector();
/** Clears ROI in detector
/**
* Select Readout
* @param index position index of readout
*/
void SetDetector(int index);
/** Set all trimbits to a value
/**
* Set all trimbits to a value
*/
void SetAllTrimbits();
/** Set storage cells */
/**
* Set storage cells
* @param value value to set to
*/
void SetNumStoragecells(int value);
/** Set sub frame exposure time */
/**
* Set sub frame exposure time
*/
void SetSubExposureTime();
/** Set sub frame period */
void SetSubPeriod();
/**
* Set sub frame dead time
*/
void SetSubDeadTime();
private:
/** The multi detector object */
multiSlsDetector *myDet;
/** The sls detector object */
slsDetector *det;
/** detector type */
slsDetectorDefs::detectorType detType;
/** The Plot widget */
qDrawPlot *myPlot;
QButtonGroup *btnGroup;
/** Tool Tip for the output dir */
QString outputDirTip;
QString errOutputTip;
/** Tool Tip */
QString errOnlineTip;
QString detOnlineTip;
QString rxrOnlineTip;
QPalette red;
/** Trimming mode */
slsDetectorDefs::trimMode trimmingMode;
static const int TRIMMING_DYNAMIC_RANGE = 32;
static const int TRIMMING_FRAME_NUMBER = 1;
static const int TRIMMING_TRIGGER_NUMBER = 1;
static const int TRIMMING_PROBE_NUMBER = 0;
bool isEnergy;
bool isAngular;
/** ROI */
vector <QLabel*> lblFromX;
vector <QSpinBox*> spinFromX;
vector <QLabel*> lblFromY;
vector <QSpinBox*> spinFromY;
vector <QLabel*> lblToX;
vector <QSpinBox*> spinToX;
vector <QLabel*> lblToY;
vector <QSpinBox*> spinToY;
std::vector <QLabel*> lblFromX;
std::vector <QSpinBox*> spinFromX;
std::vector <QLabel*> lblFromY;
std::vector <QSpinBox*> spinFromY;
std::vector <QLabel*> lblToX;
std::vector <QSpinBox*> spinToX;
std::vector <QLabel*> lblToY;
std::vector <QSpinBox*> spinToY;
int numRois;
/** sub period tool tip variables*/
QString acqSubPeriodTip;
QString errSubPeriodTip;
void CheckAcqPeriodGreaterThanExp();
};
#endif /* QTABADVANCED_H_ */

227
slsDetectorGui/include/qTabDataOutput.h Normal file → Executable file
View File

@ -1,21 +1,11 @@
/*
* qTabDataOutput.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABDATAOUTPUT_H_
#define QTABDATAOUTPUT_H_
#pragma once
#include "qDefs.h"
/** Form Header */
#include "ui_form_tab_dataoutput.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QString>
@ -26,35 +16,132 @@ class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
/**
* The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabDataOutput(QWidget *parent,multiSlsDetector*& detector);
qTabDataOutput(QWidget *parent,multiSlsDetector* detector);
/** Destructor
/**
* Destructor
*/
~qTabDataOutput();
/** To refresh and update widgets
/**
* To refresh and update widgets
*/
void Refresh();
/** verify output directories
* /returns success or fail
/**
* Verify output directories
* @returns success or fail
*/
int VerifyOutputDirectory();
private:
private slots:
/**
* Open dialog to choose the output directory
*/
void BrowseOutputDir();
/**
* Set output directory
*/
void SetOutputDir();
/**
* Get output directory
*/
void GetOutputDir();
/**
* Set rate correction
*/
void SetRateCorrection(int deadtime=0);
/**
* Set default rate correction
*/
void SetDefaultRateCorrection();
/**
* Set update rate correction from server
*/
void UpdateRateCorrectionFromServer();
/**
* Enable/Disable 10GbE
*/
void EnableTenGigabitEthernet(bool enable, int get=0);
/**
* Set speed
*/
void SetSpeed();
/**
* Set flags
*/
void SetFlags();
/**
* Set file format
*/
void SetFileFormat(int format);
/**
* Set overwrite enable
*/
void SetOverwriteEnable(bool enable);
private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Populate the readouts
*/
void PopulateDetectors();
/**
* Update speed
*/
void UpdateSpeedFromServer();
/**
* Update flags
*/
void UpdateFlagsFromServer();
/**
* Update file format
*/
void UpdateFileFormatFromServer();
/**
* Update overwrite enable
*/
void UpdateFileOverwriteFromServer();
/** The sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
QString flatFieldTip;
QString errFlatFieldTip;
QString outDirTip;
QPalette red;
QPalette black;
@ -62,95 +149,11 @@ private:
QPalette *black1;
/** enum for the Eiger clock divider */
enum {FullSpeed, HalfSpeed, QuarterSpeed, SuperSlowSpeed, NumberofSpeeds};
enum {FULLSPEED, HALFSPEED, QUARTERSPEED, SUPERSLOWSPEED, NUMBEROFSPEEDS};
/** enum for the Eiger readout flags1 */
enum {Continous, Storeinram};
enum {CONTINUOUS, STOREINRAM};
/** enum for the Eiger readout flags2 */
enum {Parallel, NonParallel, Safe};
enum {PARALLEL, NONPARALLEL, SAFE};
/** methods */
/** Sets up the widget */
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
/** Populate the readouts
*/
void PopulateDetectors();
/** update speed */
void UpdateSpeedFromServer();
/** update flags */
void UpdateFlagsFromServer();
/** update flags */
void SetupFileFormat();
/** update file format */
void UpdateFileFormatFromServer();
/** update overwrite enable */
void UpdateFileOverwriteFromServer();
private slots:
/** Open dialog to choose the output directory */
void BrowseOutputDir();
/**set flat field file*/
void SetFlatField();
/** update flat field correction from server */
void UpdateFlatFieldFromServer();
/**browse flat field*/
void BrowseFlatFieldPath();
/**rate correction*/
void SetRateCorrection(int deadtime=0);
/** default rate correction */
void SetDefaultRateCorrection();
/** update rate correction from server */
void UpdateRateCorrectionFromServer();
/**angular correction*/
void SetAngularCorrection();
/**discard bad channels*/
void DiscardBadChannels();
/** set output directory*/
void SetOutputDir();
/** set output directory*/
void GetOutputDir();
/** enable 10GbE */
void EnableTenGigabitEthernet(bool enable, int get=0);
/** set speed */
void SetSpeed();
/** set flags */
void SetFlags();
/** set file format */
void SetFileFormat(int format);
/** set overwrite enable */
void SetOverwriteEnable(bool enable);
signals:
/**signal to enable/disable positions in Actions*/
void AngularConversionSignal(bool);
};
#endif /* QTABDATAOUTPUT_H_ */

96
slsDetectorGui/include/qTabDebugging.h Normal file → Executable file
View File

@ -1,24 +1,13 @@
/*
* qTabDebugging.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABDEBUGGING_H_
#define QTABDEBUGGING_H_
#pragma once
#include "qDefs.h"
/** Form Header */
#include "ui_form_tab_debugging.h"
/** Project Class Headers */
class multiSlsDetector;
class slsDetector;
/** Qt Include Headers */
#include <QTreeWidget>
#include <QTreeWidget>
/**
@ -28,76 +17,71 @@ class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
/**
* The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabDebugging(QWidget *parent,multiSlsDetector*& detector);
qTabDebugging(QWidget *parent, multiSlsDetector* detector);
/** Destructor
/**
* Destructor
*/
~qTabDebugging();
/** To refresh and update widgets
/**
* To refresh and update widgets
*/
void Refresh();
private slots:
/**
* Updates the status depending on current detector
*/
void UpdateStatus();
/**
* Gets id and versions etc
*/
void
GetInfo();
/**
* Sets id and versions on the display widget
*/
void SetParameters(QTreeWidgetItem *item);
/**
* Test detector
*/
void TestDetector();
private:
/** Sets up the widget
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals
/**
* Sets up all the slots and signals
*/
void Initialization();
private slots:
/** Updates the module list depending on current detector
*/
void UpdateModuleList();
/** Updates the status depending on current detector
*/
void UpdateStatus();
/** Gets id and versions etc
*/
void GetInfo();
/** Sets id and versions on the display widget
*/
void SetParameters(QTreeWidgetItem *item);
/** Test detector and module
*/
void TestDetector();
private:
/** The multi sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/**sls detecctor object */
slsDetector *det;
/** Tree Widget displaying the detectors, modules */
QTreeWidget *treeDet;
/** Widget displaying the serial numbers, mac addresses etc */
QFrame *dispFrame;
QLabel *lblDetectorId;
QLabel *lblDetectorSerial;
QLabel *lblDetectorFirmware;
QLabel *lblDetectorSoftware;
QLabel *lblModuleId;
QLabel *lblModuleFirmware;
QLabel *lblModuleSerial;
QPalette *blue;
};
#endif /* QTABDEBUGGING_H_ */

176
slsDetectorGui/include/qTabDeveloper.h Normal file → Executable file
View File

@ -1,18 +1,9 @@
/*
* qTabDeveloper.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABDEVELOPER_H_
#define QTABDEVELOPER_H_
#pragma once
#include "qDefs.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QWidget>
#include <QGridLayout>
#include <QGroupBox>
@ -26,10 +17,8 @@ class multiSlsDetector;
#include <QPalette>
class qDetectorMain;
/** C++ Include Headers */
#include <string>
#include <vector>
using namespace std;
/**To override the spin box class to have an id and emit it*/
@ -41,11 +30,8 @@ private:
void valueChangedWithID() {emit editingFinished(myId);};
public:
/** Overridden constructor from QDoubleSpinBox */
MyDoubleSpinBox(int id,QWidget* parent = 0)
:QDoubleSpinBox(parent),myId(id){
//setParent(parent);
connect(this,SIGNAL(editingFinished()),
this,SLOT(valueChangedWithID()));
MyDoubleSpinBox(int id,QWidget* parent = 0) :QDoubleSpinBox(parent), myId(id){
connect(this, SIGNAL(editingFinished()), this, SLOT(valueChangedWithID()));
}
signals:
void editingFinished(int myId);
@ -59,100 +45,104 @@ class qTabDeveloper:public QWidget {
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
/**
* The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector);
qTabDeveloper(QWidget *parent, multiSlsDetector* detector);
/** Destructor
/**
* Destructor
*/
~qTabDeveloper();
/** To stop ADC Timer when starting acquisition
*/
void StopADCTimer(){if(adcTimer) adcTimer->stop();};
private:
/** parent widget */
qDetectorMain *thisParent;
/** The sls detector object */
multiSlsDetector *myDet;
/** The sls detector object */
slsDetector *det;
/** detector type */
slsDetectorDefs::detectorType detType;
/**number of dac widgets*/
static int NUM_DAC_WIDGETS;
/**number of adc widgets*/
static int NUM_ADC_WIDGETS;
static const int ADC_TIMEOUT = 5000;
vector<string>dacNames;
vector<string>adcNames;
/**widgets needed*/
QGridLayout *layout;
QScrollArea *scroll;
QGroupBox *boxDacs;
QGroupBox *boxAdcs;
QLabel *lblDacs[20];
QLabel *lblAdcs[20];
MyDoubleSpinBox *spinDacs[20];
QLabel *lblDacsmV[20];
QLineEdit *spinAdcs[20];
QLabel *lblHV;
QComboBox *comboHV;
QTimer *adcTimer;
QGridLayout *dacLayout;
QString tipHV;
QPalette red;
QComboBox *comboDetector;
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals
*/
void Initialization();
/** Sets up the DAC Widgets
*/
void CreateDACWidgets();
/** Sets up the ADC Widgets
*/
void CreateADCWidgets();
/** Gets the sls index to set/get dac/adc
* @param index is the gui dac/adc index
* returns the sls index
*/
slsDetectorDefs::dacIndex getSLSIndex(int index);
public slots:
/** To refresh and update widgets
/**
* Refresh and update widgets
*/
void Refresh();
private slots:
/** Refreshes the adcs
/**
* Refreshes the adcs
*/
void RefreshAdcs();
/** Set Dac values
/**
* Set Dac values
* @param id id of dac
*/
void SetDacValues(int id);
/** Set High Voltage
/**
* Set High Voltage
*/
void SetHighVoltage();
private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Sets up the DAC Widgets
*/
void CreateDACWidgets();
/**
* Sets up the ADC Widgets
*/
void CreateADCWidgets();
/**
* Sets up HV widget
*/
void CreateHVWidget();
/**
* Gets the sls index to set/get dac/adc
* @param index is the gui dac/adc index
* @returns the sls index
*/
slsDetectorDefs::dacIndex getSLSIndex(int index);
/** The sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/**number of dac widgets*/
int numDACWidgets;
/**number of adc widgets*/
int numADCWidgets;
/** list of dac and adc names */
std::vector<std::string>dacNames;
std::vector<std::string>adcNames;
/**widgets needed*/
QGroupBox *boxDacs;
QGroupBox *boxAdcs;
std::vector<QLabel*>lblDacs;
std::vector<QLabel*>lblAdcs;
std::vector<MyDoubleSpinBox*>spinDacs;
std::vector<QLabel*>lblDacsmV;
std::vector<QLineEdit*>spinAdcs;
QLabel *lblHV;
QComboBox *comboHV;
QSpinBox *spinHV;
QGridLayout *dacLayout;
QString tipHV;
QPalette red;
QComboBox *comboDetector;
};
#endif /* QTABDEVELOPER_H_ */

238
slsDetectorGui/include/qTabMeasurement.h Normal file → Executable file
View File

@ -1,20 +1,11 @@
/*
* qTabMeasurement.h
*
* Created on: May 2, 2012
* Author: l_maliakal_d
*/
#ifndef QTABMEASUREMENT
#define QTABMEASUREMENT
#pragma once
#include "qDefs.h"
/** Form Header */
#include "ui_form_tab_measurement.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Project Class Headers */
#include <QStandardItemModel>
#include "qDrawPlot.h"
class qDetectorMain;
@ -26,157 +17,172 @@ class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{
Q_OBJECT
public:
/** \short The constructor
* This tab allows to change the detector settings, the threshold, the number of (non real time) measurements,
* the acquisition time, the file name, the start run index and shows the current progress of the measurement
* via a progress bar and labels inidicating the current position, scan variable, frame number etc.
* Contains the start and stop acquisition button
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
/**
* The constructor
* This tab allows to change measurement parameters and to start/stop an acquisition
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
*/
qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
qTabMeasurement(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
/** Destructor
/**
* Destructor
*/
~qTabMeasurement();
/** To refresh and update widgets
/**
* Returns the status of the acquisition in gui
*/
void Refresh();
bool GetStartStatus();
/** To enable expert mode
* @param enable to enable if true
*/
void SetExpertMode(bool enable);
/** Returns the status of the acquisition in gui
*/
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
*/
void ClickStartStop(){startAcquisition();myPlot->SetClientInitiated();};
void ClickStartStop();
/** Returns progress bar value */
int GetProgress(){return progressBar->value();};
/**
* Returns progress bar value
*/
int GetProgress();
/**
* Refresh and update widgets
*/
void Refresh();
public slots:
/** update plot is finished,
/**
* Update plot is finished,
* changes start/stop text and enables/disables all widgets
*/
void UpdateFinished();
/** updates the current measurement
/**
* Updates the current measurement
* @param val the value to be updated
*/
void SetCurrentMeasurement(int val);
private:
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up the timing mode
*/
void SetupTimingMode();
/** Sets up all the slots and signals
*/
void Initialization();
/** Enables/Disables all the widgets
*/
void Enable(bool enable);
/** Validates before enabling or disabling probes */
void EnableProbes();
/** Get timing mode from detector
* @param startup is true when gui has just started up*/
void GetModeFromDetector(bool startup = false);
/** Checks if acquisition period is greater than exposure time
* and dsplays in red as a warning */
void CheckAcqPeriodGreaterThanExp();
private slots:
/** Sets the timing mode
* @ param mode cane be None, Auto, Gated, Trigger Exposure Series,
* Trigger Frame, Trigger Readout, External Trigger Window
*/
void SetTimingMode(int mode);
/** Set number of measurements
* @param num number of measurements to be set */
/**
* Set number of measurements
* @param num number of measurements to be set
*/
void setNumMeasurements(int num);
/** Set file name
*/
void setFileName();
/** Set index of file name
* @param index index of selection
*/
void setRunIndex(int index);
/** starts Acquisition
*/
void startAcquisition();
/** stops Acquisition
*/
void stopAcquisition();
/** Set number of frames
/**
* Set number of frames
* @param val number of frames to be set
*/
void setNumFrames(int val);
/** Set acquisition time
/**
* Set acquisition time
*/
void setExposureTime();
/** Set frame period between exposures
/**
* Set frame period between exposures
*/
void setAcquisitionPeriod();
/** Set number of triggers
/**
* Set number of triggers
* @param val number of triggers to be set
*/
void setNumTriggers(int val);
/** Set delay
/**
* Set delay
*/
void setDelay();
/** Set number of gates
* @param val number of gates to be set
/**
* Set number of samples
* @param val number of samples to be set
*/
void setNumGates(int val);
void setNumSamples(int val);
/** Set number of probes
* @param val number of probes to be set
/**
* Set file name
*/
void setNumProbes(int val);
void setFileName();
/** Update progress*/
void UpdateProgress();
/** Enable write to file */
/**
* Enable write to file
*/
void EnableFileWrite(bool enable);
/**
* Set index of file name
* @param index index of selection
*/
void setRunIndex(int index);
/**
* Update progress
*/
void UpdateProgress();
/**
* starts Acquisition
*/
void startAcquisition();
/**
* stops Acquisition
*/
void stopAcquisition();
/**
* Sets the timing mode
* @param mode timing mode
*/
void SetTimingMode(int mode);
private:
/** parent widget */
qDetectorMain *thisParent;
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up the timing mode
*/
void SetupTimingMode();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Get timing mode from detector
* @param startup is true when gui has just started up
*/
void GetTimingModeFromDetector(bool startup = false);
/**
* Enables/Disables widgetframes to avoid setting measurement during an acquisition
*/
void Enable(bool enable);
/**
* Checks if acquisition period is greater than exposure time
*/
void CheckAcqPeriodGreaterThanExp();
/**
* Verify if output directory existing error is set
* @returns OK or FAIL
*/
int VerifyOutputDirectoryError();
/** The sls detector object */
multiSlsDetector *myDet;
/** The Plot widget */
@ -184,15 +190,13 @@ private:
/** detector type */
slsDetectorDefs::detectorType detType;
/** enum for the timing mode */
enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, Burst_Trigger, NumTimingModes};
enum{AUTO, TRIGGER, GATED, BURST_TRIGGER, NUM_TIMING_MODES};
/** timer to update the progress*/
QTimer *progressTimer;
/** tool tip variables*/
QString acqPeriodTip;
QString errPeriodTip;
QPalette red;
/** expert mode */
bool expertMode;
/** to access items in settings combobox */
QStandardItemModel* model;
@ -201,7 +205,3 @@ signals:
void StopSignal();
void CheckPlotIntervalSignal();
};
#endif /* QTABMEASUREMENT */

88
slsDetectorGui/include/qTabMessages.h Normal file → Executable file
View File

@ -1,26 +1,14 @@
/*
* qTabMessages.h
*
* Created on: Jun 26, 2012
* Author: l_maliakal_d
*/
#ifndef QTABMESSAGES_H_
#define QTABMESSAGES_H_
#pragma once
#include "qDefs.h"
/** Project Class Headers */
#include "qDebugStream.h"
class qDetectorMain;
/** Qt Include Headers */
#include <QWidget>
#include <QTextEdit>
#include <QEvent>
#include <QPushButton>
#include "qDebugStream.h"
/**
*@short sets up the Messages parameters
@ -29,17 +17,46 @@ class qTabMessages:public QWidget{
Q_OBJECT
public:
/** \short The constructor
* @param det the qDetectorMain class reference
/**
* The constructor
* @param parent parent widget
*/
qTabMessages(qDetectorMain* m);
qTabMessages(QWidget* parent);
/** Destructor
/**
* Destructor
*/
~qTabMessages();
private slots:
/**
* Stream log to textedit in GUI
*/
void customEvent(QEvent *e);
/**
* Save Log to File
*/
void SaveLog();
/**
* Clear Log to File
*/
void ClearLog();
private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up all the slots and signals
*/
void Initialization();
/** The qDetectorMain object */
qDetectorMain *myMainTab;
@ -51,36 +68,5 @@ private:
/** To clear the log to file */
QPushButton *btnClear;
/** This class creates the log */
qDebugStream *qout;
qDebugStream *qerr;
string errMsg;
/** methods */
/** Sets up the widget */
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
private slots:
/** Stream log to textedit in GUI */
void customEvent(QEvent *e);
/** Save Log to File*/
void SaveLog();
/** Clear Log to File*/
void ClearLog();
};
#endif /* QTABMESSAGES_H_ */

4
slsDetectorGui/include/qTabPlot.h Normal file → Executable file
View File

@ -35,7 +35,7 @@ public:
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
*/
qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
qTabPlot(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
/** Destructor
*/
@ -106,7 +106,7 @@ public slots:
/** Enable Scan box
*/
void EnableScanBox();
void EnableScanBox();
private slots:

137
slsDetectorGui/include/qTabSettings.h Normal file → Executable file
View File

@ -1,22 +1,10 @@
/*
* qTabSettings.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#ifndef QTABSETTINGS_H_
#define QTABSETTINGS_H_
#pragma once
#include "qDefs.h"
/** Form Header */
#include "ui_form_tab_settings.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Include Headers */
#include <QStandardItemModel>
/**
*@short sets up the Settings parameters
@ -25,92 +13,77 @@ class qTabSettings:public QWidget, private Ui::TabSettingsObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
/**
* The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabSettings(QWidget *parent,multiSlsDetector*& detector);
qTabSettings(QWidget *parent, multiSlsDetector* detector);
/** Destructor
/**
* Destructor
*/
~qTabSettings();
/** To refresh and update widgets
/**
* Refresh and update widgets
*/
void Refresh();
/** To enable expert mode
* @param enable to enable if true
private slots:
/**
* Set settings according to selection
* @param index index of selection
*/
void SetExpertMode(bool enable){expertMode = enable;};
void SetSettings(int index);
/**
* Set dynamic range if possible
* @param index selection
*/
void SetDynamicRange(int index);
/**
* Set threshold energy
*/
void SetEnergy();
private:
/**
* Sets up the widget
*/
void SetupWidgetWindow();
/**
* Sets up the detector settings
*/
void SetupDetectorSettings();
/**
* Sets up all the slots and signals
*/
void Initialization();
/**
* Get Settings
*/
void GetSettings();
/**
* Gets the dynamic range and sets it on the gui
*/
void GetDynamicRange();
/** The sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** expert mode */
bool expertMode;
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise,
DynamicHG0,FixGain1,FixGain2,ForceSwitchG1,ForceSwitchG2, VeryLowGain,
Undefined,Uninitialized,NumSettings};
/** To be able to index items on a combo box */
QStandardItemModel* model;
QModelIndex index[NumSettings];
QStandardItem* item[NumSettings];
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up the detector settings
*/
void SetupDetectorSettings();
/** Sets up all the slots and signals
*/
void Initialization();
/** Gets the dynamic range and sets it on the gui
* @param setvalue the value set by the gui when used as a check
*/
void GetDynamicRange(int setvalue = -1);
private slots:
/** Set settings according to selection
* @param index index of selection
*/
void setSettings(int index);
/** Set number of modules if possible
* @param index number of modules
*/
void SetNumberOfModules(int index);
/** Set dynamic range if possible
* @param index selection
*/
void SetDynamicRange(int index);
/** Set threshold energy
*/
void SetEnergy();
signals:
/**Update Trimbits after Set Settings */
void UpdateTrimbitSignal(int);
enum{STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERLOWGAIN,
UNDEFINED, UNINITIALIZED, NUMSETTINGS};
};
#endif /* QTABSETTINGS_H_ */