Merge remote branch 'slsDetectorGui/2.1.1' into 2.1.1
5
slsDetectorGui/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Makefile.gui
|
||||
forms/include/
|
||||
mocs/
|
||||
objs/
|
||||
qrc_icons.cpp
|
59
slsDetectorGui/Makefile
Normal file
@ -0,0 +1,59 @@
|
||||
# LEO: Won't compile without libSlsDetector
|
||||
|
||||
include ../Makefile.include
|
||||
|
||||
$(info )
|
||||
$(info ##################################)
|
||||
$(info # Compiling slsDetectorGui #)
|
||||
$(info ##################################)
|
||||
$(info )
|
||||
|
||||
|
||||
|
||||
PROG = $(DESTDIR)/slsDetectorGui
|
||||
|
||||
DESTDIR ?= ../bin
|
||||
LIBDIR ?= $(DESTDIR)
|
||||
DOCDIR ?= docs
|
||||
|
||||
LIBRARYDIR ?= ../slsDetectorSoftware
|
||||
LIBRARYRXRDIR ?= ../slsReceiverSoftware
|
||||
INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYRXRDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYRXRDIR)/includes
|
||||
|
||||
#ifeq ( $(EIGERSLS), yes)
|
||||
# LDFLAG += $(EIGERFLAGS)
|
||||
#else ifeq ( $(ROOTSLS), yes)
|
||||
# LDFLAG += $(ROOTFLAGS)
|
||||
#endif
|
||||
|
||||
.PHONY: all lib clean mm doc htmldoc guiclient
|
||||
|
||||
|
||||
all: lib $(PROG) Makefile.gui guiclient
|
||||
|
||||
lib:
|
||||
cd ../ && $(MAKE) lib
|
||||
|
||||
clean:
|
||||
if test -e Makefile.gui; then $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm Makefile.gui; else $(MAKE) Makefile.gui; $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; fi
|
||||
cd client && $(MAKE) clean
|
||||
# cd manual && make clean
|
||||
|
||||
|
||||
Makefile.gui: mm
|
||||
|
||||
mm:
|
||||
qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAGDET)'
|
||||
|
||||
doc:
|
||||
cd manual && $(MAKE) DESTDIR=$(DOCDIR)
|
||||
|
||||
htmldoc:
|
||||
cd manual && $(MAKE) html DESTDIR=$(DOCDIR)
|
||||
|
||||
$(PROG): Makefile.gui $(DIR)
|
||||
$(MAKE) -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)'
|
||||
|
||||
guiclient:
|
||||
echo $(WD)
|
||||
cd client && $(MAKE) DESTDIR=$(DESTDIR)
|
36
slsDetectorGui/client/Makefile
Normal file
@ -0,0 +1,36 @@
|
||||
CC = g++
|
||||
CLAGS += -DVERBOSE #VERYBOSE
|
||||
LDLIBS += -lm -lstdc++ -lpthread
|
||||
|
||||
LDIR = ../../slsDetectorSoftware
|
||||
RDIR = ../../slsReceiverSoftware
|
||||
|
||||
INCLUDES = -I $(LDIR)/commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include
|
||||
SRC_CLNT = qClient.cpp $(RDIR)/src/MySocketTCP.cpp
|
||||
|
||||
PROGS = gui_client
|
||||
DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
FINALDIR = ../../bin
|
||||
|
||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
$(PROGS):
|
||||
echo $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
gcc $(SRC_CLNT) $(INCLUDES) $(FLAGS) $(LDLIBS) -o $@
|
||||
mv $(PROGS) $(FINALDIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/$(PROGS) *.o $(FINALDIR)/$(PROGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
234
slsDetectorGui/client/qClient.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
/*
|
||||
* qClient.cpp
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
// Qt Project Class Headers
|
||||
#include "qClient.h"
|
||||
// Project Class Headers
|
||||
#include "MySocketTCP.h"
|
||||
#include "slsDetectorBase.h"
|
||||
|
||||
// C++ Include Headers
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
qClient *cl =new qClient(argv[1]);
|
||||
cl->executeLine(argc-2, argv+2);
|
||||
|
||||
delete cl;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qClient::qClient(char* hostname){
|
||||
//create socket
|
||||
mySocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO);
|
||||
if (mySocket->getErrorStatus()){
|
||||
cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO << endl;
|
||||
delete mySocket;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//create socket to connect to stop server
|
||||
myStopSocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO+1);
|
||||
if (myStopSocket->getErrorStatus()){
|
||||
cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO + 1 << endl;
|
||||
delete myStopSocket;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qClient::~qClient() {
|
||||
if(mySocket) delete mySocket;
|
||||
if(myStopSocket) delete myStopSocket;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qClient::executeLine(int narg, char *args[]){
|
||||
|
||||
char arg[MAX_STR_LENGTH] = "";
|
||||
int iarg = -1;
|
||||
char answer[100];
|
||||
string retval = "";
|
||||
string cmd = args[0];
|
||||
string argument;
|
||||
|
||||
|
||||
//validate command structure
|
||||
if(narg<1){
|
||||
cout << "Error: no command parsed" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
//help
|
||||
if (cmd == "help"){
|
||||
retval = printCommands();
|
||||
}
|
||||
|
||||
//file name
|
||||
else if (cmd == "status"){
|
||||
|
||||
if(narg>1){
|
||||
argument = args[1];
|
||||
//start acquisition
|
||||
if(argument == "start")
|
||||
startAcquisition();
|
||||
else if (argument == "stop")
|
||||
stopAcquisition();
|
||||
else{
|
||||
cout << "Error: could not parse arguments: " << argument << endl;
|
||||
printCommands();
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
retval = getStatus();
|
||||
}
|
||||
|
||||
|
||||
else if (cmd == "acquire"){
|
||||
startAcquisition(true);
|
||||
retval = getStatus();
|
||||
}
|
||||
|
||||
|
||||
else if (cmd == "exit"){
|
||||
return exitServer();
|
||||
}
|
||||
|
||||
|
||||
//unrecognized command
|
||||
else{
|
||||
cout << "Error: unrecognized command" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
//print result
|
||||
cout << cmd << ": " << retval << endl;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
string qClient::printCommands(){
|
||||
ostringstream os;
|
||||
os << "\nexit \t exits servers in gui" << std::endl;
|
||||
os << "status \t gets status of acquisition in gui. - can be running or idle" << std::endl;
|
||||
os << "status i starts/stops acquistion in gui-non blocking. i is start or stop" << std::endl;
|
||||
os << "acquire starts acquistion in gui-blocking" << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
string qClient::getStatus(){
|
||||
int fnum = F_GET_RUN_STATUS;
|
||||
int ret = FAIL;
|
||||
runStatus retval=ERROR;
|
||||
int progress = 0;
|
||||
char answer[100];
|
||||
|
||||
if (myStopSocket->Connect() >= 0) {
|
||||
myStopSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
myStopSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
myStopSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
myStopSocket->ReceiveDataOnly(&progress,sizeof(progress));
|
||||
myStopSocket->Disconnect();
|
||||
}else
|
||||
exit(-1);
|
||||
|
||||
|
||||
sprintf(answer,"%d%% ",progress);
|
||||
strcat(answer,slsDetectorBase::runStatusType((runStatus)retval).c_str());
|
||||
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qClient::startAcquisition(bool blocking){
|
||||
int fnum = F_START_ACQUISITION;
|
||||
if(blocking) fnum = F_START_AND_READ_ALL;
|
||||
int ret = FAIL;
|
||||
|
||||
if (mySocket->Connect() >= 0) {
|
||||
mySocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
mySocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL){
|
||||
mySocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Gui returned error: " << mess << std::endl;
|
||||
}
|
||||
mySocket->Disconnect();
|
||||
}else
|
||||
exit(-1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qClient::stopAcquisition(){
|
||||
int fnum = F_STOP_ACQUISITION;
|
||||
int ret = FAIL;
|
||||
|
||||
if (myStopSocket->Connect() >= 0) {
|
||||
myStopSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
myStopSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL){
|
||||
myStopSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Gui returned error: " << mess << std::endl;
|
||||
}
|
||||
myStopSocket->Disconnect();
|
||||
}else
|
||||
exit(-1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qClient::exitServer(){
|
||||
int fnum = F_EXIT_SERVER;
|
||||
int ret = FAIL;
|
||||
|
||||
if (myStopSocket->Connect() >= 0) {
|
||||
myStopSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
myStopSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
myStopSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cout << mess << endl;
|
||||
myStopSocket->Disconnect();
|
||||
}else
|
||||
exit(-1);
|
||||
|
||||
return ret;
|
||||
}
|
65
slsDetectorGui/client/qClient.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* qClient.h
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
#ifndef QCLIENT_H
|
||||
#define QCLIENT_H
|
||||
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
/** Project Class Headers */
|
||||
class MySocketTCP;
|
||||
#include "sls_detector_defs.h"
|
||||
/** C++ Include Headers */
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
*@short Sets up the gui server
|
||||
*/
|
||||
class qClient: public virtual slsDetectorDefs{
|
||||
|
||||
|
||||
public:
|
||||
/** \short The constructor*/
|
||||
qClient(char* hostname);
|
||||
/** Destructor */
|
||||
virtual ~qClient();
|
||||
|
||||
/**Execute command*/
|
||||
int executeLine(int narg, char *args[]);
|
||||
|
||||
private:
|
||||
/** Print list of commands */
|
||||
string printCommands();
|
||||
|
||||
/** Start Acquisition
|
||||
* @param blocking true if its a blocking acquistion
|
||||
*/
|
||||
int startAcquisition(bool blocking = false);
|
||||
|
||||
/** Stops Acquisition */
|
||||
int stopAcquisition();
|
||||
|
||||
/** Gets run status */
|
||||
string getStatus();
|
||||
|
||||
/** Exits Server */
|
||||
int exitServer();
|
||||
|
||||
/** client socket */
|
||||
MySocketTCP *mySocket;
|
||||
|
||||
/** client socket */
|
||||
MySocketTCP *myStopSocket;
|
||||
|
||||
char mess[MAX_STR_LENGTH];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QCLIENT_H */
|
106
slsDetectorGui/doxy.config
Normal file
@ -0,0 +1,106 @@
|
||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||
# documentation are documented, even if no documentation was available.
|
||||
# Private class members and static file members will be hidden unless
|
||||
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
|
||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_PRIVATE = YES
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_STATIC = YES
|
||||
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
||||
# defined locally in source files will be included in the documentation.
|
||||
# If set to NO only classes defined in header files are included.
|
||||
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
|
||||
# This flag is only useful for Objective-C code. When set to YES local
|
||||
# methods, which are defined in the implementation section but not in
|
||||
# the interface are included in the documentation.
|
||||
# If set to NO (the default) only methods in the interface are included.
|
||||
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
|
||||
# If this flag is set to YES, the members of anonymous namespaces will be
|
||||
# extracted and appear in the documentation as a namespace called
|
||||
# 'anonymous_namespace{file}', where file will be replaced with the base
|
||||
# name of the file that contains the anonymous namespace. By default
|
||||
# anonymous namespace are hidden.
|
||||
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
|
||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
||||
# undocumented members of documented classes, files or namespaces.
|
||||
# If set to NO (the default) these members will be included in the
|
||||
# various overviews, but no documentation section is generated.
|
||||
# This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy.
|
||||
# If set to NO (the default) these classes will be included in the various
|
||||
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
|
||||
# friend (class|struct|union) declarations.
|
||||
# If set to NO (the default) these declarations will be included in the
|
||||
# documentation.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
|
||||
INPUT = \
|
||||
slsDetectorPlotting/include/SlsQt1DPlot.h\
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||
slsDetectorPlotting/include/SlsQt1DZoomer.h\
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx\
|
||||
slsDetectorPlotting/include/SlsQt2DHist.h\
|
||||
slsDetectorPlotting/src/SlsQt2DHist.cxx\
|
||||
slsDetectorPlotting/include/SlsQt2DPlot.h\
|
||||
slsDetectorPlotting/src/SlsQt2DPlot.cxx\
|
||||
slsDetectorPlotting/include/SlsQt2DPlotLayout.h\
|
||||
slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\
|
||||
slsDetectorPlotting/include/SlsQtNumberEntry.h\
|
||||
slsDetectorPlotting/src/SlsQtNumberEntry.cxx\
|
||||
slsDetectorPlotting/include/SlsQt2DZoomer.h\
|
||||
slsDetectorPlotting/include/SlsQtValidators.h\
|
||||
include/qDetectorMain.h\
|
||||
src/qDetectorMain.cpp\
|
||||
include/qDrawPlot.h\
|
||||
src/qDrawPlot.cpp\
|
||||
include/qCloneWidget.h\
|
||||
src/qCloneWidget.cpp\
|
||||
include/qTabMeasurement.h\
|
||||
src/qTabMeasurement.cpp\
|
||||
include/qTabDataOutput.h\
|
||||
src/qTabDataOutput.cpp\
|
||||
include/qTabPlot.h\
|
||||
src/qTabPlot.cpp\
|
||||
include/qTabActions.h\
|
||||
src/qTabActions.cpp\
|
||||
include/qActionsWidget.h\
|
||||
src/qActionsWidget.cpp\
|
||||
include/qScanWidget.h\
|
||||
src/qScanWidget.cpp\
|
||||
include/qTabAdvanced.h\
|
||||
src/qTabAdvanced.cpp\
|
||||
include/qTabSettings.h\
|
||||
src/qTabSettings.cpp\
|
||||
include/qTabDebugging.h\
|
||||
src/qTabDebugging.cpp\
|
||||
include/qTabDeveloper.h\
|
||||
src/qTabDeveloper.cpp\
|
||||
include/qDefs.h
|
||||
|
||||
|
||||
OUTPUT_DIRECTORY = docs
|
||||
|
169
slsDetectorGui/forms/form_action.ui
Normal file
@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ActionsObject</class>
|
||||
<widget class="QWidget" name="ActionsObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>680</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboScript">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom Script</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="dispScript">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="lblParameter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Additional Parameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="btnBrowse">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/browse.png</normaloff>:/icons/images/browse.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLineEdit" name="dispParameter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
521
slsDetectorGui/forms/form_detectormain.ui
Normal file
@ -0,0 +1,521 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DetectorMainObject</class>
|
||||
<widget class="QMainWindow" name="DetectorMainObject">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>848</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>185</red>
|
||||
<green>185</green>
|
||||
<blue>185</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>185</red>
|
||||
<green>185</green>
|
||||
<blue>185</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>185</red>
|
||||
<green>185</green>
|
||||
<blue>185</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>89</red>
|
||||
<green>89</green>
|
||||
<blue>89</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SLS Detector GUI</string>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNone</set>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="dockNestingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>395</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>524287</width>
|
||||
<height>395</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="defaultUp">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="nativeMenuBar">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuUtilities">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Utilities</string>
|
||||
</property>
|
||||
<addaction name="actionOpenSetup"/>
|
||||
<addaction name="actionSaveSetup"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpenConfiguration"/>
|
||||
<addaction name="actionSaveConfiguration"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadTrimbits"/>
|
||||
<addaction name="actionSaveTrimbits"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadCalibration"/>
|
||||
<addaction name="actionSaveCalibration"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuModes">
|
||||
<property name="title">
|
||||
<string>&Modes</string>
|
||||
</property>
|
||||
<addaction name="actionDebug"/>
|
||||
<addaction name="actionExpert"/>
|
||||
<addaction name="actionDockable"/>
|
||||
<addaction name="actionListenGuiClient"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<addaction name="menuUtilities"/>
|
||||
<addaction name="menuModes"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dockWidgetPlot">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>36</width>
|
||||
<height>422</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>524287</width>
|
||||
<height>524287</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||
<tr>
|
||||
<td style="border: none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Left Click :zoom in</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Righ</span><span style=" color:#00007f;">t Click </span><span style=" color:#00007f;">: zoom out by 1</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Middle Click : panning</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Ctrl+Right Click : zoom out to full size</span></p></td></tr></table></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::BottomDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SLS Detector Plot</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContentsPlot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>119</red>
|
||||
<green>119</green>
|
||||
<blue>119</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpenSetup">
|
||||
<property name="text">
|
||||
<string>&Load &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveSetup">
|
||||
<property name="text">
|
||||
<string>&Save &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMeasurementWizard">
|
||||
<property name="text">
|
||||
<string>&Measurement Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenConfiguration">
|
||||
<property name="text">
|
||||
<string>&Load &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveConfiguration">
|
||||
<property name="text">
|
||||
<string>&Save &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnergyCalibration">
|
||||
<property name="text">
|
||||
<string>&Energy Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAngularCalibration">
|
||||
<property name="text">
|
||||
<string>&Angular Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBeamline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Beamline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpert">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Expert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfiguration">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVersion">
|
||||
<property name="text">
|
||||
<string>&Version</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDockable">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D&ockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadTrimbits">
|
||||
<property name="text">
|
||||
<string>&Load &Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveTrimbits">
|
||||
<property name="text">
|
||||
<string>&Save &Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadCalibration">
|
||||
<property name="text">
|
||||
<string>&Load C&alibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveCalibration">
|
||||
<property name="text">
|
||||
<string>&Save C&alibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionListenGuiClient">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Listen to Gui Client</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
488
slsDetectorGui/forms/form_scan.ui
Normal file
@ -0,0 +1,488 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScanObject</class>
|
||||
<widget class="QWidget" name="ScanObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>724</width>
|
||||
<height>125</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="2" rowspan="3" colspan="3">
|
||||
<widget class="QGroupBox" name="group">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioRange">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Defines scan range for a <b>Constant Step Size</b> with the following constraints:
|
||||
</nobr><br><nobr>
|
||||
1. <b>Number of Steps</b> >=2.
|
||||
</nobr><br><nobr>
|
||||
2. <b>Size</b> not equal to 0.
|
||||
</nobr><br><nobr>
|
||||
3. <b>From</b> not equal to <b>To</b>.
|
||||
</nobr><br></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Constant Step Size</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCustom">
|
||||
<property name="toolTip">
|
||||
<string><nobr>Measures only at specific values listed by the user.</nobr><br>
|
||||
<nobr>Number of entries is restricted to <b>Number of Steps</b> field.</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Specific Values</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>Measures only at the specific values listed in a file.</nobr><br>
|
||||
<nobr>Select the file, where these values are listed.</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Values from File</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QWidget" name="stackedWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblPrecision">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Precision:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinPrecision">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblParameter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Additional Parameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dispParameter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblSteps">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Steps:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinSteps">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboScript">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Energy Scan (eV)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Threshold Scan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trimbits Scan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Position Scan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom Script</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dispScript">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnBrowse">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/browse.png</normaloff>:/icons/images/browse.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboScript</tabstop>
|
||||
<tabstop>dispScript</tabstop>
|
||||
<tabstop>btnBrowse</tabstop>
|
||||
<tabstop>dispParameter</tabstop>
|
||||
<tabstop>spinSteps</tabstop>
|
||||
<tabstop>spinPrecision</tabstop>
|
||||
<tabstop>radioRange</tabstop>
|
||||
<tabstop>radioCustom</tabstop>
|
||||
<tabstop>radioFile</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
1606
slsDetectorGui/forms/form_tab_advanced.ui
Normal file
718
slsDetectorGui/forms/form_tab_dataoutput.ui
Normal file
@ -0,0 +1,718 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TabDataOutputObject</class>
|
||||
<widget class="QWidget" name="TabDataOutputObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="boxOutDir">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>30</y>
|
||||
<width>747</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Output Directory</string>
|
||||
</property>
|
||||
<widget class="QFrame" name="frameOutput">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>731</width>
|
||||
<height>96</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>716</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="dispReadOutputDir">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDetector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>2</red>
|
||||
<green>2</green>
|
||||
<blue>2</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>119</red>
|
||||
<green>119</green>
|
||||
<blue>119</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="dispOutputDir">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboDetector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="btnOutputBrowse">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/browse.png</normaloff>:/icons/images/browse.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxCorrection_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>160</y>
|
||||
<width>746</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>17</x>
|
||||
<y>21</y>
|
||||
<width>192</width>
|
||||
<height>137</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="chkTenGiga">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</nobr><br><nobr>
|
||||
#r_compression#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>10GbE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkCompression">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</nobr><br><nobr>
|
||||
#r_compression#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compression</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkAngular">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular Conversion</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkDiscardBad">
|
||||
<property name="text">
|
||||
<string>Discard Bad Channels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>255</x>
|
||||
<y>21</y>
|
||||
<width>476</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkRate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QPushButton" name="btnFlatField">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/browse.png</normaloff>:/icons/images/browse.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="6">
|
||||
<widget class="QLineEdit" name="dispFlatField">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkFlatField">
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flat Field File:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QLabel" name="lblDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>2</red>
|
||||
<green>2</green>
|
||||
<blue>2</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>119</red>
|
||||
<green>119</green>
|
||||
<blue>119</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6" colspan="3">
|
||||
<widget class="QSpinBox" name="spinDeadTime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>200000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="btnDefaultRate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>21</y>
|
||||
<width>20</width>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widgetEiger" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>244</x>
|
||||
<y>92</y>
|
||||
<width>491</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>4</y>
|
||||
<width>475</width>
|
||||
<height>62</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridEiger">
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboEigerFlags1">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Continous</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Store in RAM</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblClkDivider">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clock Divider:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboEigerClkDivider">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Full Speed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Half Speed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Quarter Speed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Super Slow Speed</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblEigerFlags">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QComboBox" name="comboEigerFlags2">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parallel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Non Parallel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Safe</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<zorder>boxOutDir</zorder>
|
||||
<zorder>boxCorrection_2</zorder>
|
||||
<zorder>btnOutputBrowse</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>dispReadOutputDir</tabstop>
|
||||
<tabstop>chkFlatField</tabstop>
|
||||
<tabstop>dispFlatField</tabstop>
|
||||
<tabstop>btnFlatField</tabstop>
|
||||
<tabstop>chkRate</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
471
slsDetectorGui/forms/form_tab_debugging.ui
Normal file
@ -0,0 +1,471 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TabDebuggingObject</class>
|
||||
<widget class="QWidget" name="TabDebuggingObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>45</x>
|
||||
<y>75</y>
|
||||
<width>686</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Tests</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>110</y>
|
||||
<width>141</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkDetectorFirmware">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkDetectorSoftware">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Software</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>185</y>
|
||||
<width>656</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnTest">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Run Test </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>415</x>
|
||||
<y>30</y>
|
||||
<width>256</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblModule">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Module:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboModule">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All Modules</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>110</y>
|
||||
<width>141</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkDetectorBus">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Bus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkDetectorMemory">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Memory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>110</y>
|
||||
<width>141</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkChip">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chip</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>30</y>
|
||||
<width>276</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDetector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboDetector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>60</y>
|
||||
<width>276</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblStatusLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblStatus">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IDLE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>135</y>
|
||||
<width>141</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkModuleFirmware">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Module Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>95</y>
|
||||
<width>676</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>165</y>
|
||||
<width>676</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>45</x>
|
||||
<y>25</y>
|
||||
<width>686</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnGetInfo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get ID Information </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/download.png</normaloff>:/icons/images/download.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>btnGetInfo</tabstop>
|
||||
<tabstop>comboDetector</tabstop>
|
||||
<tabstop>comboModule</tabstop>
|
||||
<tabstop>btnTest</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
1018
slsDetectorGui/forms/form_tab_measurement.ui
Normal file
82
slsDetectorGui/forms/form_tab_messages.ui
Normal file
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TabMessagesObject</class>
|
||||
<widget class="QWidget" name="TabMessagesObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
2941
slsDetectorGui/forms/form_tab_plot.ui
Normal file
248
slsDetectorGui/forms/form_tab_settings.ui
Normal file
@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TabSettingsObject</class>
|
||||
<widget class="QWidget" name="TabSettingsObject">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>20</y>
|
||||
<width>316</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboSettings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Settings of the detector.
|
||||
#settings#</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>High Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dynamic Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Low Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Medium Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very High Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Low Noise</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dynamic HG0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fix Gain 1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fix Gain 2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Force Switch G1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Force Switch G2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Very Low Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Undefined</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Uninitialized</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinThreshold">
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> eV</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-100000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Number of Modules:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Dynamic Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboDynamicRange">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1.67772e+07</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>65535</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>255</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumModules">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblThreshold">
|
||||
<property name="text">
|
||||
<string>Threshold:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboSettings</tabstop>
|
||||
<tabstop>spinThreshold</tabstop>
|
||||
<tabstop>spinNumModules</tabstop>
|
||||
<tabstop>comboDynamicRange</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
9
slsDetectorGui/gitInfo.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorGui
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
||||
Repsitory UUID: 2ad70c5041e2e2f6cdfa949639bb6250083eebec
|
||||
Revision: 336
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 336
|
||||
Last Changed Date: 2016-08-24 17:10:07 +0200
|
BIN
slsDetectorGui/images/add.png
Normal file
After Width: | Height: | Size: 702 B |
BIN
slsDetectorGui/images/browse.png
Normal file
After Width: | Height: | Size: 884 B |
BIN
slsDetectorGui/images/calculate.png
Normal file
After Width: | Height: | Size: 833 B |
BIN
slsDetectorGui/images/close.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
slsDetectorGui/images/download.png
Normal file
After Width: | Height: | Size: 757 B |
BIN
slsDetectorGui/images/erase.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
slsDetectorGui/images/leftArrow.png
Normal file
After Width: | Height: | Size: 575 B |
BIN
slsDetectorGui/images/mountain.png
Normal file
After Width: | Height: | Size: 757 B |
BIN
slsDetectorGui/images/new.png
Normal file
After Width: | Height: | Size: 644 B |
BIN
slsDetectorGui/images/refresh.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
slsDetectorGui/images/refresher.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
slsDetectorGui/images/remove.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
slsDetectorGui/images/rightArrow.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
slsDetectorGui/images/save.png
Normal file
After Width: | Height: | Size: 674 B |
BIN
slsDetectorGui/images/saveAll.png
Normal file
After Width: | Height: | Size: 755 B |
BIN
slsDetectorGui/images/setup.png
Normal file
After Width: | Height: | Size: 605 B |
BIN
slsDetectorGui/images/start.png
Normal file
After Width: | Height: | Size: 499 B |
BIN
slsDetectorGui/images/stop.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
slsDetectorGui/images/upload.png
Normal file
After Width: | Height: | Size: 721 B |
11
slsDetectorGui/include/gitInfoGui.h
Normal file
@ -0,0 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "2ad70c5041e2e2f6cdfa949639bb6250083eebec"
|
||||
//#define SVNREV 0x336
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x336
|
||||
#define SVNDATE 0x20160824
|
||||
//
|
11
slsDetectorGui/include/gitInfoGuiTmp.h
Normal file
@ -0,0 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL ""
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID ""
|
||||
//#define SVNREV ""
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH ""
|
||||
#define SVNREV ""
|
||||
#define SVNDATE ""
|
||||
//
|
22
slsDetectorGui/include/icons.qrc
Normal file
@ -0,0 +1,22 @@
|
||||
<RCC version="1.0">
|
||||
<qresource prefix="/icons">
|
||||
<file>../images/mountain.png</file>
|
||||
<file>../images/refresh.png</file>
|
||||
<file>../images/save.png</file>
|
||||
<file>../images/saveAll.png</file>
|
||||
<file>../images/close.png</file>
|
||||
<file>../images/add.png</file>
|
||||
<file>../images/new.png</file>
|
||||
<file>../images/download.png</file>
|
||||
<file>../images/browse.png</file>
|
||||
<file>../images/start.png</file>
|
||||
<file>../images/erase.png</file>
|
||||
<file>../images/remove.png</file>
|
||||
<file>../images/stop.png</file>
|
||||
<file>../images/leftArrow.png</file>
|
||||
<file>../images/rightArrow.png</file>
|
||||
<file>../images/upload.png</file>
|
||||
<file>../images/setup.png</file>
|
||||
<file>../images/calculate.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
85
slsDetectorGui/include/qActionsWidget.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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_ */
|
||||
|
165
slsDetectorGui/include/qCloneWidget.h
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* qCloneWidget.h
|
||||
*
|
||||
* Created on: May 18, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#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 <QCloseEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QString>
|
||||
#include <QSpacerItem>
|
||||
#include <QWidget>
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
*@short Sets up the clone plot widget
|
||||
*/
|
||||
class qCloneWidget:public QMainWindow{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short 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);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qCloneWidget();
|
||||
|
||||
/** 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);
|
||||
|
||||
|
||||
|
||||
/** 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
|
||||
* @param histYAxis Y Axis value in 1D
|
||||
* @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);
|
||||
|
||||
/** 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
|
||||
* @param histYAxis Y Axis value in 1D
|
||||
* @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);
|
||||
|
||||
/** 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
|
||||
* @param nbinsy number of bins in y axis
|
||||
* @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);
|
||||
|
||||
/**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[]);
|
||||
|
||||
/** Returns the 1d plot
|
||||
*/
|
||||
SlsQt1DPlot* Get1dPlot(){return cloneplot1D;};
|
||||
|
||||
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 2D Plot */
|
||||
SlsQt2DPlotLayout* cloneplot2D;
|
||||
/** clone 1D Plot */
|
||||
SlsQt1DPlot* cloneplot1D;
|
||||
/** 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;
|
||||
|
||||
/** Gets the current time stamp for the window title*/
|
||||
char* GetCurrentTimeStamp();
|
||||
|
||||
/** Display Statistics */
|
||||
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
||||
|
||||
|
||||
private slots:
|
||||
/** Save Plot */
|
||||
void SavePlot();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
signals:
|
||||
void CloneClosedSignal(int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* QCLONEWIDGET_H_ */
|
105
slsDetectorGui/include/qDebugStream.h
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* qDebugStream.h
|
||||
*
|
||||
* Created on: Jun 28, 2012
|
||||
* Author: Anna Bergamaschi
|
||||
*/
|
||||
|
||||
#ifndef QDEBUGSTREAM_H_
|
||||
#define QDEBUGSTREAM_H_
|
||||
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QCustomEvent>
|
||||
|
||||
#include <iostream>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#define STREAMEVENT 60001
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class qStreamEvent:public QEvent{
|
||||
public:
|
||||
qStreamEvent(QString s):QEvent(static_cast<QEvent::Type>(STREAMEVENT)),str(s){
|
||||
#ifdef PRINT_LOG
|
||||
printf("%s\n",str.toAscii().constData());
|
||||
#endif
|
||||
}
|
||||
/** \returns the progress index */
|
||||
QString getString() {return str;}
|
||||
private:
|
||||
QString str;
|
||||
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class qDebugStream : public basic_streambuf<char> {
|
||||
|
||||
public:
|
||||
qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) {
|
||||
m_old_buf = stream.rdbuf();
|
||||
stream.rdbuf(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
~qDebugStream(){
|
||||
// output anything that is left
|
||||
if (!m_string.empty())
|
||||
QApplication::postEvent(log_window, new qStreamEvent(m_string.c_str()));
|
||||
m_stream.rdbuf(m_old_buf);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
protected:
|
||||
virtual int_type overflow(int_type v){
|
||||
if (v == '\n'){
|
||||
QApplication::postEvent(log_window, new qStreamEvent(m_string.c_str()));
|
||||
m_string.erase(m_string.begin(), m_string.end());
|
||||
}
|
||||
else
|
||||
m_string += v;
|
||||
return v;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
virtual streamsize xsputn(const char *p, streamsize n) {
|
||||
m_string.append(p, p + n);
|
||||
//changed from uint because of 64 bit
|
||||
int pos = 0;
|
||||
|
||||
while (pos != string::npos){
|
||||
pos = m_string.find('\n');
|
||||
if (pos != string::npos){
|
||||
string tmp(m_string.begin(), m_string.begin() + pos);
|
||||
QApplication::postEvent(log_window, new qStreamEvent(tmp.c_str()));
|
||||
m_string.erase(m_string.begin(), m_string.begin() + pos + 1);
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
ostream &m_stream;
|
||||
streambuf *m_old_buf;
|
||||
string m_string;
|
||||
QWidget* log_window;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif /* QDEBUGSTREAM_H_ */
|
301
slsDetectorGui/include/qDefs.h
Normal file
@ -0,0 +1,301 @@
|
||||
/*
|
||||
* qDefs.h
|
||||
*
|
||||
* Created on: May 4, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QDEFS_H
|
||||
#define QDEFS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
#include <QAbstractButton>
|
||||
using namespace std;
|
||||
|
||||
class qDefs:public QWidget{
|
||||
public:
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** Empty Constructor
|
||||
*/
|
||||
qDefs(){};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
static const int64_t GUI_VERSION=0x20121213;
|
||||
|
||||
#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: ") + 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
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* QDEFS_H */
|
201
slsDetectorGui/include/qDetectorMain.h
Normal file
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* qDetectorMain.h
|
||||
* Main Window of the GUI
|
||||
* Created on: Apr 30, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#ifndef QDETECTORMAIN_H
|
||||
#define QDETECTORMAIN_H
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_detectormain.h"
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.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 <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);}
|
||||
/** Overridden method from QTabWidget */
|
||||
QTabBar* tabBar(){return QTabWidget::tabBar();}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*@short Main window of the GUI.
|
||||
*/
|
||||
class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
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 qapplication
|
||||
* @param parent makes the parent window 0 by default
|
||||
* */
|
||||
qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0);
|
||||
|
||||
/**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);
|
||||
|
||||
/** Returns if plot is running
|
||||
*/
|
||||
bool isPlotRunning(){return myPlot->isRunning();};
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return tab_measurement->GetProgress();};
|
||||
|
||||
/** Returns file path */
|
||||
QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;};
|
||||
|
||||
/** Verifies if output directories for all the receivers exist */
|
||||
int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();};
|
||||
|
||||
bool isCurrentlyTabDeveloper();
|
||||
|
||||
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;
|
||||
|
||||
/** 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;
|
||||
|
||||
/** server object*/
|
||||
qServer *myServer;
|
||||
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
|
||||
/**Sets up the layout of the widget
|
||||
* */
|
||||
void SetUpWidgetWindow();
|
||||
|
||||
/**Sets up detector
|
||||
* @param fName file name of the config file at start up
|
||||
* */
|
||||
void SetUpDetector(const string fName);
|
||||
|
||||
/**Sets up the signals and the slots
|
||||
* */
|
||||
void Initialization();
|
||||
|
||||
/** Loads config file at start up
|
||||
* */
|
||||
void LoadConfigFile(const string fName);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* QDETECTORMAIN_H */
|
593
slsDetectorGui/include/qDrawPlot.h
Normal file
@ -0,0 +1,593 @@
|
||||
/*
|
||||
* qDrawPlot.h
|
||||
*
|
||||
* Created on: May 7, 2012
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
#ifndef QDRAWPLOT_H
|
||||
#define QDRAWPLOT_H
|
||||
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
#include "detectorData.h"
|
||||
/** Qt Project Class Headers */
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
class qCloneWidget;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
|
||||
#include <QVector>
|
||||
#include <qwt_series_data.h>
|
||||
#include <qwt_plot_histogram.h>
|
||||
#include <qwt_plot_grid.h>
|
||||
#include <qwt_column_symbol.h>
|
||||
#include <qpen.h>
|
||||
|
||||
/** C++ Include Headers */
|
||||
|
||||
|
||||
#define MAX_1DPLOTS 10
|
||||
|
||||
|
||||
/**
|
||||
*@short Sets up the plot widget
|
||||
*/
|
||||
class qDrawPlot:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
/** \short The constructor */
|
||||
qDrawPlot(QWidget *parent,multiSlsDetector*& detector);
|
||||
/** Destructor */
|
||||
~qDrawPlot();
|
||||
|
||||
/**is an acquisition running , need it to prevent measurement tab
|
||||
* from being refreshed when switching tabs during acquisition */
|
||||
bool isRunning(){return running;};
|
||||
/** gets the progress of acquisition to the measurement tab*/
|
||||
int GetProgress(){return progress;};
|
||||
/** gets the file index to the measurement tab*/
|
||||
int GetFileIndex(){return currentFileIndex;};
|
||||
/** gets the frame index to the measurement tab*/
|
||||
int GetFrameIndex(){return currentFrameIndex;};
|
||||
/** sets file write enable , if not enabled,
|
||||
* file index wont increase and so you need secondary titles to differentitate between plots*/
|
||||
void SetEnableFileWrite(bool enable){fileSaveEnable = enable;};
|
||||
|
||||
/** sets plot Title prefix*/
|
||||
void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;}
|
||||
/** sets 1D X Axis Title */
|
||||
void SetHistXAxisTitle(QString title) {histXAxisTitle = title;}
|
||||
/** sets 1D Y Axis Title */
|
||||
void SetHistYAxisTitle(QString title) {histYAxisTitle = title;}
|
||||
/** sets 2D X Axis Title */
|
||||
void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;}
|
||||
/** sets 2D Y Axis Title */
|
||||
void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;}
|
||||
/** sets 2D Z Axis Title */
|
||||
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;}
|
||||
/** Disables zoom if any of the axes range are checked and fixed with a value */
|
||||
void DisableZoom(bool disable);
|
||||
/** Enables plot from the plot tab*/
|
||||
void EnablePlot(bool enable);
|
||||
/** Enable angle plot */
|
||||
void EnableAnglePlot(bool enable){anglePlot = enable;};
|
||||
|
||||
/** Its a reminder to update plot to set the xy range
|
||||
* This is done only when there is a plot to update */
|
||||
void SetXYRange(bool changed){XYRangeChanged = changed;};
|
||||
/**Sets the min/max for x/y
|
||||
* @param val is the value to be set
|
||||
* @param xy is xmin,xmax,ymin or ymax */
|
||||
void SetXYRangeValues(double val,qDefs::range xy){XYRangeValues[xy]=val;};
|
||||
/**Sets if min/max for x/y is enabled
|
||||
* @param changed is if this has been changed
|
||||
* @param xy is xmin,xmax,ymin or ymax */
|
||||
void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;};
|
||||
|
||||
/** Get minimum Plot timer - between plots */
|
||||
double GetMinimumPlotTimer(){return PLOT_TIMER_MS;};
|
||||
/** Set Plot timer - between plots in ms*/
|
||||
void SetPlotTimer(double time){timerValue = time;};
|
||||
/** Set Plot frame factor - between plots, also for receiver if exists */
|
||||
void SetFrameFactor(int frame);
|
||||
|
||||
/** Starts or stop acquisition
|
||||
* Calls startDaq() function
|
||||
* @param stop_if_running is 0 to stop acquisition and 1 to start acquisition
|
||||
*/
|
||||
void StartStopDaqToggle(bool stop_if_running=0);
|
||||
/** Set frame enabled
|
||||
* @param enable enable*/
|
||||
void setFrameEnabled(bool enable){isFrameEnabled = enable;};
|
||||
/** Set trigger enabled
|
||||
* @param enable enable */
|
||||
void setTriggerEnabled(bool enable){isTriggerEnabled = enable;};
|
||||
|
||||
/** Updates the trimbit plot
|
||||
* @param fromDetector is true if the trimbits should be loaded from detector
|
||||
* @param Histogram true if histogram, else data graph
|
||||
* returns ok/fail
|
||||
* */
|
||||
int UpdateTrimbitPlot(bool fromDetector,bool Histogram);
|
||||
|
||||
/** This is set once client initiates start/stop acquisition
|
||||
* and this is reset when the gui really starts/stops- to know when to return
|
||||
*/
|
||||
void SetClientInitiated(){clientInitiated = true;};
|
||||
|
||||
/** Get client intiated variable. This is set once client initiates start/stop acquisition
|
||||
* and this is reset when the gui really starts/stops- to know when to return
|
||||
*/
|
||||
bool GetClientInitiated(){return clientInitiated;};
|
||||
|
||||
/** Update all ranges, interpolate etc after cloning
|
||||
* parameters are if they are checked or not
|
||||
*/
|
||||
void UpdateAfterCloning(bool points, bool logy, bool interpolate, bool contour, bool logz);
|
||||
|
||||
/** set binary range */
|
||||
void SetBinary(bool enable, int from=0, int to=0);
|
||||
|
||||
/** Enable/Disable Histogram */
|
||||
void SetHistogram(bool enable,int histArg, int min=0, int max=0, double size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
||||
|
||||
public slots:
|
||||
/** To select 1D or 2D plot
|
||||
@param i is 1 for 1D, else 2D plot */
|
||||
void SelectPlot(int i=2);
|
||||
/** To select 1D plot */
|
||||
void Select1DPlot() {SelectPlot(1);}
|
||||
/** To select 2D plot */
|
||||
void Select2DPlot() {SelectPlot(2);}
|
||||
/** To clear plot */
|
||||
void Clear1DPlot();
|
||||
/** Creates a clone of the plot */
|
||||
void ClonePlot();
|
||||
/** Closes all the clone plots */
|
||||
void CloseClones();
|
||||
/** Saves all the clone plots */
|
||||
void SaveClones();
|
||||
/** To Save plot */
|
||||
void SavePlot();
|
||||
/** Save all plots **/
|
||||
void SaveAll(bool enable){saveAll = enable;};
|
||||
/** Sets persistency from plot tab */
|
||||
void SetPersistency(int val);
|
||||
/** sets style of plot to lines*/
|
||||
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);
|
||||
/** sets stop_signal to true */
|
||||
void StopAcquisition(){ stop_signal = true; };
|
||||
/** Set/unset pedestal */
|
||||
void SetPedestal(bool enable);
|
||||
/** Recalculate Pedestal */
|
||||
void RecalculatePedestal();
|
||||
/** Set/unset accumulate */
|
||||
void SetAccumulate(bool enable);
|
||||
/** Reset accumulation */
|
||||
void ResetAccumulate();
|
||||
/** Display Statistics */
|
||||
void DisplayStatistics(bool enable);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/** Initializes all its members and the thread */
|
||||
void Initialization();
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
||||
|
||||
/** Gets the image title */
|
||||
const char* GetImageTitle() {return imageTitle.c_str();}
|
||||
/** Gets the hist title for a 1D plot */
|
||||
const char* GetHistTitle(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histTitle[i].c_str():0;} //int for hist number
|
||||
/** Gets the y axis value for the hist in 1D plot */
|
||||
double* GetHistYAxis(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histYAxis[i]:0;} //int for hist number
|
||||
|
||||
|
||||
/** Locks the image to update plot */
|
||||
int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); }
|
||||
/** Unocks the image to update plot */
|
||||
int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);}
|
||||
/** Starts the acquisition */
|
||||
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
|
||||
/** Stops the acquisition */
|
||||
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
||||
|
||||
/** Starts/stops Acquisition Thread */
|
||||
bool StartOrStopThread(bool start);
|
||||
|
||||
/** Sets up measurement each time
|
||||
* */
|
||||
void SetupMeasurement();
|
||||
|
||||
/** Resets the acquisition parameter like lastimagenumber */
|
||||
int ResetDaqForGui();
|
||||
|
||||
/** The function which is called when start acquisition thread is created */
|
||||
static void* DataStartAcquireThread(void *this_pointer);
|
||||
|
||||
/** This is called by the detector class to copy the data it jus acquired */
|
||||
static int GetDataCallBack(detectorData *data, int fIndex, int subIndex, void *this_pointer);
|
||||
|
||||
/** This is called by the GetDataCallBack function to copy the data */
|
||||
int GetData(detectorData *data, int fIndex, int subIndex);
|
||||
|
||||
/** This is called by detector class when acquisition is finished
|
||||
* @param currentProgress current progress of measurement
|
||||
* @param detectorStatus current status of the detector
|
||||
* @param this_pointer is the pointer pointing to this object
|
||||
* */
|
||||
static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer);
|
||||
|
||||
/** This is called by static function when acquisition is finished
|
||||
* @param currentProgress current progress of measurement
|
||||
* @param detectorStatus current status of the detector
|
||||
* */
|
||||
int AcquisitionFinished(double currentProgress,int detectorStatus);
|
||||
|
||||
/** This is called by detector class when a measurement is finished
|
||||
* @param currentMeasurementIndex current measurement index
|
||||
* @param fileIndex current file index
|
||||
* @param this_pointer is the pointer pointing to this object
|
||||
* */
|
||||
static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer);
|
||||
|
||||
/** This is called by the static function when meausrement is finished
|
||||
* @param currentMeasurementIndex current measurement index
|
||||
* @param fileIndex current file index
|
||||
* */
|
||||
int MeasurementFinished(int currentMeasurementIndex, int fileIndex);
|
||||
|
||||
/** This is called by the detector class to send progress if receiver is online */
|
||||
static int GetProgressCallBack(double currentProgress, void *this_pointer);
|
||||
|
||||
|
||||
/** Saves all the plots. All sets saveError to true if not saved.*/
|
||||
void SavePlotAutomatic();
|
||||
/** Sets the style of the 1d plot */
|
||||
void SetStyle(SlsQtH1D* h){
|
||||
if(lines) h->setStyle(QwtPlotCurve::Lines); else h->setStyle(QwtPlotCurve::Dots);
|
||||
#if QWT_VERSION<0x060000
|
||||
if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker);
|
||||
#else
|
||||
if(markers) h->setSymbol(marker); else h->setSymbol(noMarker);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/** Find Statistics
|
||||
* @param min is the minimum value
|
||||
* @param max is the maximum value
|
||||
* @param sum is the sum of all values
|
||||
* @param array is the array to get statistics from
|
||||
* @param size is the size of the array */
|
||||
void GetStatistics(double &min, double &max, double &sum, double* array, int size);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** To update plot
|
||||
* */
|
||||
void UpdatePlot();
|
||||
/** To stop updating plot
|
||||
* */
|
||||
void StopUpdatePlot();
|
||||
/** To start or stop acquisition
|
||||
* @param start is 1 to start and 0 to stop acquisition
|
||||
* */
|
||||
void StartDaq(bool start);
|
||||
/** To set the reference to zero after closing a clone
|
||||
* @param id is the id of the clone
|
||||
* */
|
||||
void CloneCloseEvent(int id);
|
||||
/**After a pause, the gui is allowed to collect the data
|
||||
* this is called when it is over
|
||||
* */
|
||||
void UpdatePause(){data_pause_over=true;};
|
||||
/** Shows the first save error message while automatic saving
|
||||
* @param fileName file name of the first file that it tried to save.
|
||||
* */
|
||||
void ShowSaveErrorMessage(QString fileName);
|
||||
/**Shows an error message when acquisition stopped unexpectedly
|
||||
* @param status is the status of the detector
|
||||
* */
|
||||
void ShowAcquisitionErrorMessage(QString status);
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
|
||||
|
||||
/** Widgets needed to plot the clone */
|
||||
/** Max Number of Clone Windows */
|
||||
static const int MAXCloneWindows = 50;
|
||||
/** Array of clone window widget pointers */
|
||||
qCloneWidget *winClone[MAXCloneWindows];
|
||||
|
||||
/** Widgets needed to set up plot*/
|
||||
QGroupBox *boxPlot;
|
||||
QGridLayout *layout;
|
||||
QGridLayout *plotLayout;
|
||||
/** Timer to update plot */
|
||||
QTimer* plot_update_timer;
|
||||
|
||||
/** Timer to pause getting data from client */
|
||||
QTimer* data_pause_timer;
|
||||
bool data_pause_over;
|
||||
|
||||
|
||||
/** 1D object */
|
||||
SlsQt1DPlot* plot1D;
|
||||
/** 2D object */
|
||||
SlsQt2DPlotLayout* plot2D;
|
||||
/** vector of 1D hist values */
|
||||
QVector<SlsQtH1D*> plot1D_hists;
|
||||
|
||||
|
||||
/**label with frame index for those with many frames per file*/
|
||||
QLabel *histFrameIndexTitle;
|
||||
|
||||
|
||||
/** Current Measurement */
|
||||
int currentMeasurement;
|
||||
/** currentFrame */
|
||||
int currentFrame;
|
||||
/** variable to check if its the nth frame */
|
||||
int numFactor;
|
||||
/** current Scan Division Level */
|
||||
int currentScanDivLevel;
|
||||
/** current scan Value */
|
||||
double currentScanValue;
|
||||
/** Number of Exposures */
|
||||
int number_of_exposures;
|
||||
/** Number of Frames Per Measurement */
|
||||
int number_of_frames;
|
||||
/** Duration between Exposures */
|
||||
double acquisitionPeriod;
|
||||
/** Acquisition Time */
|
||||
double exposureTime;
|
||||
/** Current file index*/
|
||||
int currentFileIndex;
|
||||
/** Current frame index*/
|
||||
int currentFrameIndex;
|
||||
|
||||
/**variables for threads */
|
||||
/** */
|
||||
volatile bool stop_signal;
|
||||
/** */
|
||||
pthread_mutex_t last_image_complete_mutex;
|
||||
|
||||
/**variables for histograms */
|
||||
/** X Axis Title in 2D */
|
||||
QString imageXAxisTitle;
|
||||
/** Y Axis Title in 2D */
|
||||
QString imageYAxisTitle;
|
||||
/** Z Axis Title in 2D */
|
||||
QString imageZAxisTitle;
|
||||
/** X Axis Title in 1D */
|
||||
QString histXAxisTitle;
|
||||
/** Y Axis Title in 1D */
|
||||
QString histYAxisTitle;
|
||||
/** Title for all the graphs in 1D */
|
||||
std::string histTitle[MAX_1DPLOTS];
|
||||
/** Title in 2D */
|
||||
std::string imageTitle;
|
||||
/** plot Title */
|
||||
QString plotTitle;
|
||||
/** plot Title prefix */
|
||||
QString plotTitle_prefix;
|
||||
/** 1D or 2D */
|
||||
unsigned int plot_in_scope;
|
||||
/** Number of Pixels in X Axis */
|
||||
unsigned int nPixelsX;
|
||||
/** Number of angle Pixels in X Axis */
|
||||
int nAnglePixelsX;
|
||||
/** Number of pixel bins in Y Axis */
|
||||
int nPixelsY;
|
||||
/** Min Pixel number for Y Axis*/
|
||||
double minPixelsY;
|
||||
/** Max Pixel number for Y Axis*/
|
||||
double maxPixelsY;
|
||||
/** starting pixel */
|
||||
double startPixel;
|
||||
/** end Pixel*/
|
||||
double endPixel;
|
||||
/** pixel width */
|
||||
double pixelWidth;
|
||||
|
||||
/** Current Image Number */
|
||||
unsigned int lastImageNumber;
|
||||
int last_plot_number;
|
||||
|
||||
/** Number of graphs in 1D */
|
||||
unsigned int nHists;
|
||||
/** Total Number of X axis values/channels in 1D */
|
||||
int histNBins;
|
||||
/** X Axis value in 1D */
|
||||
double* histXAxis;
|
||||
/** Y Axis value in 1D */
|
||||
double* histYAxis[MAX_1DPLOTS];
|
||||
/** X Axis for angles in 1D */
|
||||
double* histXAngleAxis;
|
||||
/** Y Axis for angles in 1D (no persistency) */
|
||||
double* histYAngleAxis;
|
||||
/** X Axis for trimbits in 1D */
|
||||
double* histTrimbits;
|
||||
|
||||
|
||||
/** Current Image Values in 2D */
|
||||
double* lastImageArray;
|
||||
|
||||
/**persistency to be reached*/
|
||||
int persistency;
|
||||
/** persistency takes time to reach as it increases per frame
|
||||
* this is the current one */
|
||||
int currentPersistency;
|
||||
/** to update the progress for each getData() so that
|
||||
* measurement tab can request on a timer basis*/
|
||||
int progress;
|
||||
/**If plot is enabled from plot tab*/
|
||||
bool plotEnable;
|
||||
/**If plot is dotted */
|
||||
bool lines;
|
||||
bool markers;
|
||||
/** Plot marker */
|
||||
QwtSymbol *marker;
|
||||
QwtSymbol *noMarker;
|
||||
/** Save all plots */
|
||||
bool saveAll;
|
||||
/** If error, while automatically saving plots, checks this at the end of an acquistion */
|
||||
bool saveError;
|
||||
/** index of last saved image for automatic saving*/
|
||||
int lastSavedFrame;
|
||||
/** index of measurement number of last saved image for automatic saving*/
|
||||
int lastSavedMeasurement;
|
||||
/**if an acquisition is running, so as not to refresh tab
|
||||
* and also to update plot only if running (while creating clones)*/
|
||||
bool running;
|
||||
|
||||
/** if the min/max of x and y has been changed,
|
||||
* to notify while plotting */
|
||||
bool XYRangeChanged;
|
||||
/**the specific min/max of x/y*/
|
||||
double XYRangeValues[4];
|
||||
/**if the specific min/max of x/y is enabled */
|
||||
bool IsXYRange[4];
|
||||
|
||||
/** Default timer between plots*/
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
|
||||
static constexpr double PLOT_TIMER_MS = 200;
|
||||
#else
|
||||
static const double PLOT_TIMER_MS = 200;
|
||||
#endif
|
||||
/** Specific timer value between plots */
|
||||
double timerValue;
|
||||
/** every nth frame when to plot */
|
||||
int frameFactor;
|
||||
/**if frame is enabled in measurement tab */
|
||||
bool isFrameEnabled;
|
||||
/**if trigger is enabled in measurement tab */
|
||||
bool isTriggerEnabled;
|
||||
|
||||
/** scan arguments*/
|
||||
int scanArgument;
|
||||
|
||||
/** histogram arguments*/
|
||||
int histogramArgument;
|
||||
|
||||
/** enable angle plot */
|
||||
bool anglePlot;
|
||||
/** prevents err msg displaying twice when detector stopped, "transmitting" */
|
||||
bool alreadyDisplayed;
|
||||
|
||||
/**saves the file path and file name, not to access shared memory while running*/
|
||||
QString filePath;
|
||||
QString fileName;
|
||||
|
||||
/** Max Number of Clone Windows */
|
||||
static const int TRIM_HISTOGRAM_XMAX = 63;
|
||||
|
||||
/**if the values increment backwards*/
|
||||
bool backwardScanPlot;
|
||||
|
||||
/**if files will be saved and index increased*/
|
||||
bool fileSaveEnable;
|
||||
|
||||
|
||||
/** true of originally 2d */
|
||||
bool originally2D;
|
||||
|
||||
|
||||
//pedstal
|
||||
/** Number of pedestal frames*/
|
||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||
/** set/unset pedestal*/
|
||||
bool pedestal;
|
||||
/** pedestal values */
|
||||
double* pedestalVals;
|
||||
/** temporary pedestal values to hide while recalculating*/
|
||||
double* tempPedestalVals;
|
||||
/** count for 20 frames to calculate the pedestal */
|
||||
int pedestalCount;
|
||||
/** start pedestal calculation */
|
||||
bool startPedestalCal;
|
||||
|
||||
//accumulation
|
||||
/** set/unset accumulation */
|
||||
bool accumulate;
|
||||
/** to reset accumulation */
|
||||
bool resetAccumulate;
|
||||
|
||||
/** range for binary plot output */
|
||||
bool binary;
|
||||
int binaryFrom;
|
||||
int binaryTo;
|
||||
|
||||
/** this is set when client starts/stops acquisition
|
||||
* and is reset once the gui really starts/stops */
|
||||
bool clientInitiated;
|
||||
|
||||
|
||||
/** display statistics widgets */
|
||||
QWidget *widgetStatistics;
|
||||
QLabel *lblMinDisp;
|
||||
QLabel *lblMaxDisp;
|
||||
QLabel *lblSumDisp;
|
||||
|
||||
bool displayStatistics;
|
||||
|
||||
|
||||
/* histogram */
|
||||
bool histogram;
|
||||
int histFrom;
|
||||
int histTo;
|
||||
double histSize;
|
||||
QwtPlotGrid *grid;
|
||||
QwtPlotHistogram *plotHistogram;
|
||||
QVector<QwtIntervalSample> histogramSamples;
|
||||
|
||||
|
||||
bool firstPlot;
|
||||
|
||||
signals:
|
||||
void UpdatingPlotFinished();
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
void LogzSignal(bool);
|
||||
void LogySignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||
void SetCurrentMeasurementSignal(int);
|
||||
void saveErrorSignal(QString);
|
||||
void AcquisitionErrorSignal(QString);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QDRAWPLOT_H */
|
193
slsDetectorGui/include/qScanWidget.h
Normal file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* 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_ */
|
||||
|
137
slsDetectorGui/include/qServer.h
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* qServer.h.h
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
#ifndef QSERVER_H
|
||||
#define QSERVER_H
|
||||
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "sls_detector_defs.h"
|
||||
#include "qDefs.h"
|
||||
class qDetectorMain;
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
class MySocketTCP;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
/** C++ Include Headers */
|
||||
|
||||
|
||||
/**
|
||||
*@short Sets up the gui server
|
||||
*/
|
||||
class qServer: public QWidget, public virtual slsDetectorDefs{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
/** \short The constructor */
|
||||
qServer(qDetectorMain *t);
|
||||
/** Destructor */
|
||||
~qServer();
|
||||
|
||||
/** Start or Stop Gui Server
|
||||
* @param start is 1 to start and 0 to stop
|
||||
*/
|
||||
int StartStopServer(int start);
|
||||
|
||||
private:
|
||||
/** assigns functions to the fnum enum */
|
||||
int FunctionTable();
|
||||
|
||||
/** Decodes Function */
|
||||
int DecodeFunction(MySocketTCP* sock);
|
||||
|
||||
/** Exit Server */
|
||||
int ExitServer();
|
||||
|
||||
|
||||
/**
|
||||
* 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 started which listens to client gui.
|
||||
* Called by startServerThread()
|
||||
*
|
||||
*/
|
||||
int StartServer();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Thread started which listens to client gui to stop acquisition.
|
||||
* Called by startServerThread()
|
||||
*
|
||||
*/
|
||||
int StopServer();
|
||||
|
||||
|
||||
|
||||
/** Get Detector Status */
|
||||
int GetStatus();
|
||||
|
||||
/** Starts Acquisition */
|
||||
int StartAcquisition();
|
||||
|
||||
/** Stops Acquisition */
|
||||
int StopsAcquisition();
|
||||
|
||||
/** Acquire - blocking */
|
||||
int Acquire();
|
||||
|
||||
|
||||
|
||||
/**The measurement tab object*/
|
||||
qDetectorMain *myMainTab;
|
||||
|
||||
/** 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();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QSERVER_H */
|
150
slsDetectorGui/include/qTabActions.h
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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_ */
|
||||
|
234
slsDetectorGui/include/qTabAdvanced.h
Normal file
@ -0,0 +1,234 @@
|
||||
/*
|
||||
* qTabAdvanced.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABADVANCED_H_
|
||||
#define QTABADVANCED_H_
|
||||
|
||||
#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>
|
||||
/**
|
||||
*@short sets up the advanced parameters
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabAdvanced();
|
||||
|
||||
public slots:
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** 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
|
||||
*/
|
||||
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
|
||||
* @param port control port
|
||||
*/
|
||||
void SetControlPort(int port);
|
||||
|
||||
/** Sets stop port
|
||||
* @param port stop port
|
||||
*/
|
||||
void SetStopPort(int port);
|
||||
|
||||
/** Sets receiver tcp port
|
||||
* @param port receiver tcp port
|
||||
*/
|
||||
void SetRxrTCPPort(int port);
|
||||
|
||||
/** Sets receiver udp port
|
||||
* @param port receiver udp port
|
||||
*/
|
||||
void SetRxrUDPPort(int port);
|
||||
|
||||
/** Sets receiver online
|
||||
* @param index 1 for online and 0 for offline
|
||||
*/
|
||||
void SetReceiverOnline(int index);
|
||||
|
||||
/** Sets detector online
|
||||
* @param index 1 for online and 0 for offline
|
||||
*/
|
||||
void SetOnline(int index);
|
||||
|
||||
/** Sets network parameters like receiver udp ip,
|
||||
* receiver udp mac, detector ip and detector mac
|
||||
*/
|
||||
void SetNetworkParameters();
|
||||
|
||||
/** Sets the receiver. which also sets the receiver parameters
|
||||
*/
|
||||
void SetReceiver();
|
||||
|
||||
/** Add ROI Input if the value changed in the last slot
|
||||
*/
|
||||
void AddROIInputSlot(){AddROIInput(1);};
|
||||
|
||||
/** Clears all the ROI inputs
|
||||
*/
|
||||
void clearROI();
|
||||
|
||||
/** Gets ROIs from detector and updates it
|
||||
*/
|
||||
void updateROIList();
|
||||
|
||||
/** Sets ROI in detector
|
||||
*/
|
||||
void setROI();
|
||||
|
||||
/** Clears ROI in detector
|
||||
*/
|
||||
void clearROIinDetector();
|
||||
|
||||
/** Clears ROI in detector
|
||||
*/
|
||||
void SetDetector(int index);
|
||||
|
||||
/** Set all trimbits to a value
|
||||
*/
|
||||
void SetAllTrimbits();
|
||||
|
||||
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;
|
||||
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;
|
||||
int numRois;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABADVANCED_H_ */
|
152
slsDetectorGui/include/qTabDataOutput.h
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* qTabDataOutput.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDATAOUTPUT_H_
|
||||
#define QTABDATAOUTPUT_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_dataoutput.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QString>
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the DataOutput parameters
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabDataOutput(QWidget *parent,multiSlsDetector*& detector);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabDataOutput();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
/** verify output directories
|
||||
* /returns success or fail
|
||||
*/
|
||||
int VerifyOutputDirectory();
|
||||
|
||||
/** To enable expert mode
|
||||
* @param enable to enable if true
|
||||
*/
|
||||
void SetExpertMode(bool enable);
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
|
||||
QString flatFieldTip;
|
||||
QString errFlatFieldTip;
|
||||
QString outDirTip;
|
||||
QPalette red;
|
||||
QPalette black;
|
||||
QPalette *red1;
|
||||
QPalette *black1;
|
||||
|
||||
/** enum for the Eiger clock divider */
|
||||
enum {FullSpeed, HalfSpeed, QuarterSpeed, SuperSlowSpeed, NumberofSpeeds};
|
||||
/** enum for the Eiger readout flags1 */
|
||||
enum {Continous, Storeinram};
|
||||
/** enum for the Eiger readout flags2 */
|
||||
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();
|
||||
|
||||
/** Get Compression */
|
||||
void GetCompression();
|
||||
|
||||
/** update speed */
|
||||
void updateSpeedFromServer();
|
||||
|
||||
/** update flags */
|
||||
void updateFlagsFromServer();
|
||||
|
||||
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();
|
||||
|
||||
/** set compression */
|
||||
void SetCompression(bool enable);
|
||||
|
||||
/** enable 10GbE */
|
||||
void EnableTenGigabitEthernet(bool enable, int get=0);
|
||||
|
||||
/** set speed */
|
||||
void setSpeed();
|
||||
|
||||
/** set flags */
|
||||
void setFlags();
|
||||
|
||||
signals:
|
||||
/**signal to enable/disable positions in Actions*/
|
||||
void AngularConversionSignal(bool);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABDATAOUTPUT_H_ */
|
103
slsDetectorGui/include/qTabDebugging.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* qTabDebugging.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDEBUGGING_H_
|
||||
#define QTABDEBUGGING_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_debugging.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
class slsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the Debugging parameters
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabDebugging(QWidget *parent,multiSlsDetector*& detector);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabDebugging();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** 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_ */
|
159
slsDetectorGui/include/qTabDeveloper.h
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* qTabDeveloper.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDEVELOPER_H_
|
||||
#define QTABDEVELOPER_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QScrollArea>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#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*/
|
||||
class MyDoubleSpinBox:public QDoubleSpinBox{
|
||||
Q_OBJECT
|
||||
private:
|
||||
int myId;
|
||||
private slots:
|
||||
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()));
|
||||
}
|
||||
signals:
|
||||
void editingFinished(int myId);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the Developer parameters
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector);
|
||||
|
||||
/** 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];
|
||||
QDoubleSpinBox *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
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
/** Refreshes the adcs
|
||||
*/
|
||||
void RefreshAdcs();
|
||||
|
||||
/** Set Dac values
|
||||
* @param id id of dac
|
||||
*/
|
||||
void SetDacValues(int id);
|
||||
|
||||
/** Set High Voltage
|
||||
*/
|
||||
void SetHighVoltage();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABDEVELOPER_H_ */
|
205
slsDetectorGui/include/qTabMeasurement.h
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* qTabMeasurement.h
|
||||
*
|
||||
* Created on: May 2, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#ifndef QTABMEASUREMENT
|
||||
#define QTABMEASUREMENT
|
||||
|
||||
#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;
|
||||
|
||||
/**
|
||||
*@short sets up the measurement parameters
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabMeasurement();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
/** To enable expert mode
|
||||
* @param enable to enable if true
|
||||
*/
|
||||
void SetExpertMode(bool enable);
|
||||
|
||||
/** Returns the status of the Start/Stop Acquisition button
|
||||
*/
|
||||
bool GetStartStatus(){return btnStartStop->isChecked();};
|
||||
|
||||
/** Click the Start/Stop Acquisition button
|
||||
* This is used if this command came from gui client
|
||||
*/
|
||||
void ClickStartStop(){btnStartStop->click();myPlot->SetClientInitiated();};
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return progressBar->value();};
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
/** update plot is finished,
|
||||
* changes start/stop text and enables/disables all widgets
|
||||
*/
|
||||
void UpdateFinished();
|
||||
|
||||
/** 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 */
|
||||
void setNumMeasurements(int num);
|
||||
|
||||
/** Set file name
|
||||
*/
|
||||
void setFileName();
|
||||
|
||||
/** Set index of file name
|
||||
* @param index index of selection
|
||||
*/
|
||||
void setRunIndex(int index);
|
||||
|
||||
/** starts/stops Acquisition
|
||||
*/
|
||||
void startStopAcquisition();
|
||||
|
||||
/** Set number of frames
|
||||
* @param val number of frames to be set
|
||||
*/
|
||||
void setNumFrames(int val);
|
||||
|
||||
/** Set acquisition time
|
||||
*/
|
||||
void setExposureTime();
|
||||
|
||||
/** Set frame period between exposures
|
||||
*/
|
||||
void setAcquisitionPeriod();
|
||||
|
||||
/** Set number of triggers
|
||||
* @param val number of triggers to be set
|
||||
*/
|
||||
void setNumTriggers(int val);
|
||||
|
||||
/** Set delay
|
||||
*/
|
||||
void setDelay();
|
||||
|
||||
/** Set number of gates
|
||||
* @param val number of gates to be set
|
||||
*/
|
||||
void setNumGates(int val);
|
||||
|
||||
/** Set number of probes
|
||||
* @param val number of probes to be set
|
||||
*/
|
||||
void setNumProbes(int val);
|
||||
|
||||
/** Update progress*/
|
||||
void UpdateProgress();
|
||||
|
||||
/** Enable write to file */
|
||||
void EnableFileWrite(bool enable);
|
||||
|
||||
|
||||
private:
|
||||
/** parent widget */
|
||||
qDetectorMain *thisParent;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/** enum for the timing mode */
|
||||
enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, Burst_Trigger, NumTimingModes};
|
||||
/** timer to update the progress*/
|
||||
QTimer *progressTimer;
|
||||
/** tool tip variables*/
|
||||
QString acqPeriodTip;
|
||||
QString errPeriodTip;
|
||||
QPalette red;
|
||||
/** expert mode */
|
||||
bool expertMode;
|
||||
QIcon *iconStart;
|
||||
QIcon *iconStop;
|
||||
/** to access items in settings combobox */
|
||||
QStandardItemModel* model;
|
||||
|
||||
signals:
|
||||
void StartSignal();
|
||||
void StopSignal();
|
||||
void CheckPlotIntervalSignal();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABMEASUREMENT */
|
86
slsDetectorGui/include/qTabMessages.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* qTabMessages.h
|
||||
*
|
||||
* Created on: Jun 26, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABMESSAGES_H_
|
||||
#define QTABMESSAGES_H_
|
||||
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
|
||||
/** Project Class Headers */
|
||||
class qDetectorMain;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QEvent>
|
||||
#include <QPushButton>
|
||||
#include "qDebugStream.h"
|
||||
|
||||
/**
|
||||
*@short sets up the Messages parameters
|
||||
*/
|
||||
class qTabMessages:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param det the qDetectorMain class reference
|
||||
*/
|
||||
qTabMessages(qDetectorMain* m);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabMessages();
|
||||
|
||||
|
||||
private:
|
||||
/** The qDetectorMain object */
|
||||
qDetectorMain *myMainTab;
|
||||
|
||||
/** Log of executed commands */
|
||||
QTextEdit *dispLog;
|
||||
|
||||
/** To save the log to file */
|
||||
QPushButton *btnSave;
|
||||
|
||||
/** 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_ */
|
166
slsDetectorGui/include/qTabPlot.h
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* qTabPlot.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABPLOT_H_
|
||||
#define QTABPLOT_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_plot.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Project Class Headers */
|
||||
class qDrawPlot;
|
||||
/** Qt Include Headers */
|
||||
#include <QStackedLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QAbstractButton>
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the Plot parameters
|
||||
*/
|
||||
class qTabPlot:public QWidget, private Ui::TabPlotObject{
|
||||
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
|
||||
*/
|
||||
qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabPlot();
|
||||
|
||||
/** Sets the scan argument of the plot
|
||||
*/
|
||||
void SetScanArgument();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
|
||||
|
||||
/** 1d/2d plot */
|
||||
bool isOneD;
|
||||
bool isOriginallyOneD;
|
||||
|
||||
/**is set if its a possible wrong interval between plots*/
|
||||
bool wrongInterval;
|
||||
|
||||
QStackedLayout *stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
QDoubleSpinBox *spinTimeGap;
|
||||
QComboBox *comboTimeGapUnit;
|
||||
QButtonGroup *btnGroupScan;
|
||||
QButtonGroup *btnGroupPlotType;
|
||||
QButtonGroup *btnGroupHistogram;
|
||||
|
||||
/** some Default Values */
|
||||
static QString defaultPlotTitle;
|
||||
static QString defaultHistXAxisTitle;
|
||||
static QString defaultHistYAxisTitle;
|
||||
static QString defaultImageXAxisTitle;
|
||||
static QString defaultImageYAxisTitle;
|
||||
static QString defaultImageZAxisTitle;
|
||||
|
||||
/** scans */
|
||||
static const QString modeNames[5];
|
||||
|
||||
/** error palette*/
|
||||
QPalette *red;
|
||||
QString intervalTip;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set frequency between plots*/
|
||||
void SetFrequency();
|
||||
|
||||
/** Enable Scan box
|
||||
*/
|
||||
void EnableScanBox();
|
||||
|
||||
|
||||
private slots:
|
||||
/** Selects the plot to display, enables/disables widgets
|
||||
* @param b true to select plot dimension 1, else false to select 2D
|
||||
*/
|
||||
void Select1DPlot(bool b);
|
||||
|
||||
/**Enables Persistency depending on Superimpose checkbox */
|
||||
void EnablePersistency(bool enable);
|
||||
|
||||
/**Sets the titles in plot axis */
|
||||
void SetTitles();
|
||||
|
||||
/** Enables/Sets default Titles to default */
|
||||
void EnableTitles();
|
||||
|
||||
/** Enables range of the axes */
|
||||
void EnableRange();
|
||||
|
||||
/** Sets the range of the x and y axes */
|
||||
void SetAxesRange();
|
||||
|
||||
/** Sets the range of the z axis */
|
||||
void SetZRange();
|
||||
|
||||
/** Enables the range of the z axis */
|
||||
void EnableZRange();
|
||||
|
||||
/** Return true if valid */
|
||||
bool CheckZRange(QString value);
|
||||
|
||||
/** Set Plot to none, data graph, histogram*/
|
||||
void SetPlot();
|
||||
|
||||
/** Change pages in plot options box to the right*/
|
||||
void SetPlotOptionsRightPage();
|
||||
|
||||
/** Change pages in plot options box to the left*/
|
||||
void SetPlotOptionsLeftPage();
|
||||
|
||||
/** Plot binary plot */
|
||||
void SetBinary();
|
||||
|
||||
/** Set histogram options */
|
||||
void SetHistogramOptions();
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABPLOT_H_ */
|
116
slsDetectorGui/include/qTabSettings.h
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* qTabSettings.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABSETTINGS_H_
|
||||
#define QTABSETTINGS_H_
|
||||
|
||||
#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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
qTabSettings(QWidget *parent,multiSlsDetector*& detector);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabSettings();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
/** To enable expert mode
|
||||
* @param enable to enable if true
|
||||
*/
|
||||
void SetExpertMode(bool enable){expertMode = enable;};
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/** 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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABSETTINGS_H_ */
|
146
slsDetectorGui/slsDetectorGui.pro
Normal file
@ -0,0 +1,146 @@
|
||||
#When using yum for qt, comment out all lines with $(QTDIR) or $(QWTDIR), but export QWTDIR = /usr/include/qwt/
|
||||
#and leave "$(QWTDIR) \"uncommented in the INCLUDEPATH
|
||||
|
||||
#When using epics, uncomment epics defines, libs and a line in INCLUDEPATH
|
||||
|
||||
|
||||
QT_INSTALL_PREFIX = $(QTDIR)
|
||||
QMAKE_UIC = $(QTDIR)/bin/uic
|
||||
QMAKE_MOC = $(QTDIR)/bin/moc
|
||||
QMAKE_RCC = $(QTDIR)/bin/rcc
|
||||
QMAKE_INCDIR_QT = $(QTDIR)/include/
|
||||
QMAKE_LIBS_QT = -L$(QTDIR)/lib
|
||||
QMAKE_LIBS = -L$(QTDIR)/lib
|
||||
|
||||
|
||||
|
||||
|
||||
#epics
|
||||
#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG #VERYVERBOSE
|
||||
#LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
|
||||
|
||||
#default
|
||||
DEFINES += VERBOSE DACS_INT PRINT_LOG #VERYVERBOSE CHECKINFERROR
|
||||
LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib
|
||||
|
||||
CXXFLAGS += -g
|
||||
|
||||
|
||||
QMAKE_CXXFLAGS_WARN_ON = -w
|
||||
QMAKE_CFLAGS_WARN_ON = -w
|
||||
|
||||
|
||||
DESTDIR ?= bin
|
||||
MOC_DIR = mocs
|
||||
OBJECTS_DIR = objs
|
||||
UI_HEADERS_DIR = forms/include
|
||||
SLSDETLIB ?= ../slsDetectorSoftware
|
||||
RESOURCES += icons.qrc
|
||||
CONFIG += debug no_include_pwd
|
||||
|
||||
|
||||
|
||||
target.path += $(DESTDIR)
|
||||
documentation.path = /$(DOCPATH)
|
||||
documentation.files = docs/*
|
||||
INSTALLS += target
|
||||
INSTALLS += documentation
|
||||
QMAKE_CLEAN += docs/*/*
|
||||
|
||||
|
||||
|
||||
|
||||
DEPENDPATH += \
|
||||
slsDetectorPlotting/include\
|
||||
include\
|
||||
forms/include
|
||||
|
||||
|
||||
INCLUDEPATH = \
|
||||
$(QWTDIR)/include\
|
||||
$(QWTDIR) \
|
||||
$(QWTDIR)/src\
|
||||
$(QWT3D)/include\
|
||||
slsDetectorPlotting/include\
|
||||
include\
|
||||
forms/include\
|
||||
/usr/include/qwt\ #these are not included for standard installations, also bin path should include qt4 bin, not qt3 bin
|
||||
/usr/include/qt4\
|
||||
/usr/include/Qt\
|
||||
/usr/include/QtCore\
|
||||
/usr/include/QtGui\
|
||||
$(INCLUDES)
|
||||
#epics
|
||||
# $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SOURCES = \
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx\
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx\
|
||||
slsDetectorPlotting/src/SlsQt2DHist.cxx\
|
||||
slsDetectorPlotting/src/SlsQt2DPlot.cxx\
|
||||
slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\
|
||||
slsDetectorPlotting/src/SlsQtNumberEntry.cxx\
|
||||
src/qDetectorMain.cpp\
|
||||
src/qDrawPlot.cpp\
|
||||
src/qCloneWidget.cpp\
|
||||
src/qTabMeasurement.cpp\
|
||||
src/qTabDataOutput.cpp\
|
||||
src/qTabPlot.cpp\
|
||||
src/qTabActions.cpp\
|
||||
src/qActionsWidget.cpp\
|
||||
src/qScanWidget.cpp\
|
||||
src/qTabAdvanced.cpp\
|
||||
src/qTabSettings.cpp\
|
||||
src/qTabDebugging.cpp\
|
||||
src/qTabDeveloper.cpp\
|
||||
src/qTabMessages.cpp\
|
||||
src/qServer.cpp
|
||||
|
||||
HEADERS = \
|
||||
slsDetectorPlotting/include/SlsQt1DPlot.h\
|
||||
slsDetectorPlotting/include/SlsQt1DZoomer.h\
|
||||
slsDetectorPlotting/include/SlsQt2DHist.h\
|
||||
slsDetectorPlotting/include/SlsQt2DPlot.h\
|
||||
slsDetectorPlotting/include/SlsQt2DPlotLayout.h\
|
||||
slsDetectorPlotting/include/SlsQt2DZoomer.h\
|
||||
slsDetectorPlotting/include/SlsQtValidators.h\
|
||||
slsDetectorPlotting/include/SlsQtNumberEntry.h\
|
||||
include/qDefs.h\
|
||||
include/qDebugStream.h\
|
||||
include/qDetectorMain.h\
|
||||
include/qDrawPlot.h\
|
||||
include/qCloneWidget.h\
|
||||
include/qTabMeasurement.h\
|
||||
include/qTabDataOutput.h\
|
||||
include/qTabPlot.h\
|
||||
include/qTabActions.h\
|
||||
include/qActionsWidget.h\
|
||||
include/qScanWidget.h\
|
||||
include/qTabAdvanced.h\
|
||||
include/qTabSettings.h\
|
||||
include/qTabDebugging.h\
|
||||
include/qTabDeveloper.h\
|
||||
include/qTabMessages.h\
|
||||
include/gitInfoGui.h\
|
||||
../slsDetectorSoftware/commonFiles/sls_detector_defs.h\
|
||||
include/qServer.h
|
||||
|
||||
|
||||
FORMS = \
|
||||
forms/form_detectormain.ui\
|
||||
forms/form_tab_measurement.ui\
|
||||
forms/form_tab_dataoutput.ui\
|
||||
forms/form_tab_plot.ui\
|
||||
# forms/form_tab_actions.ui\
|
||||
forms/form_tab_advanced.ui\
|
||||
forms/form_tab_settings.ui\
|
||||
forms/form_tab_debugging.ui\
|
||||
# forms/form_tab_developer.ui\
|
||||
# forms/form_tab_messages.ui
|
||||
forms/form_action.ui\
|
||||
forms/form_scan.ui
|
174
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Normal file
@ -0,0 +1,174 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
* */
|
||||
|
||||
#ifndef SLSQT1DPLOT_H
|
||||
#define SLSQT1DPLOT_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class QPen;
|
||||
class SlsQt1DPlot;
|
||||
|
||||
class SlsQtH1D:public QwtPlotCurve{
|
||||
|
||||
public:
|
||||
SlsQtH1D(QString title, int n, double xmin, double xmax, double* data=0);
|
||||
SlsQtH1D(QString title, int n, double* data_x, double* data_y);
|
||||
~SlsQtH1D();
|
||||
|
||||
void Attach(SlsQt1DPlot* p);
|
||||
void Detach(SlsQt1DPlot* p);
|
||||
|
||||
int SetLineColor(int c=-1);
|
||||
int SetLineWidth(int w=1);
|
||||
void SetLineStyle(int s=0);
|
||||
|
||||
void SetData(int n, double xmin, double xmax, double* d=0);
|
||||
void SetData(int n, double* dx, double* dy);
|
||||
|
||||
double* GetX() {return x;}
|
||||
double* GetY() {return y;}
|
||||
int GetNBinsX() {return ndata;}
|
||||
|
||||
double FillBin(int bx, double v=1);
|
||||
double Fill(double x, double v=1);
|
||||
double SetBinContent(int bx,double v);
|
||||
double SetContent(double x,double v);
|
||||
int FindBinIndex(double px);
|
||||
|
||||
double GetXMin() {return x[0];}
|
||||
double GetFirstXgtZero() {return firstXgt0;}
|
||||
double GetXMax() {return x[ndata-1];}
|
||||
double GetYMin() {return ymin;}
|
||||
double GetFirstYgtZero() {return firstYgt0;}
|
||||
double GetYMax() {return ymax;}
|
||||
|
||||
SlsQtH1D* Add(double v);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int ndata;
|
||||
int n_array;
|
||||
double dx;
|
||||
double *x,*y;
|
||||
double ymin,ymax;
|
||||
double firstXgt0,firstYgt0;
|
||||
|
||||
void Initailize();
|
||||
int SetUpArrays(int n);
|
||||
int CheckIndex(int bx);
|
||||
|
||||
QPen* pen_ptr;
|
||||
};
|
||||
|
||||
|
||||
class SlsQtH1DList{
|
||||
public:
|
||||
SlsQtH1DList(SlsQtH1D* hist=0);
|
||||
~SlsQtH1DList();
|
||||
|
||||
SlsQtH1D* Add(SlsQtH1D* h);
|
||||
void Remove(SlsQtH1D* h);
|
||||
void Print();
|
||||
|
||||
SlsQtH1D* Hist() {return the_hist;} //if no hist returns 0
|
||||
SlsQtH1DList* Next() {return the_next;}
|
||||
|
||||
|
||||
private:
|
||||
SlsQtH1DList* the_next;
|
||||
SlsQtH1D* the_hist;
|
||||
};
|
||||
|
||||
|
||||
class SlsQt1DPlot:public QwtPlot{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SlsQt1DPlot(QWidget* = NULL);
|
||||
~SlsQt1DPlot();
|
||||
|
||||
void SetTitle(const char *t);
|
||||
void SetXTitle(const char* title);
|
||||
void SetYTitle(const char* title);
|
||||
|
||||
void InsertHLine(double y);
|
||||
void RemoveHLine();
|
||||
void InsertVLine(double v);
|
||||
void RemoveVLine();
|
||||
|
||||
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disableZoom);
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
double GetXMaximum(){return hist_list->Hist()->GetXMax();};
|
||||
double GetYMinimum(){return hist_list->Hist()->GetYMin();};
|
||||
double GetYMaximum(){return hist_list->Hist()->GetYMax();};
|
||||
/**---*/
|
||||
|
||||
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||
|
||||
void alignScales();
|
||||
private:
|
||||
|
||||
SlsQtH1DList* hist_list;
|
||||
SlsQt1DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
|
||||
QwtPlotMarker *hline;
|
||||
QwtPlotMarker *vline;
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
//void alignScales();
|
||||
|
||||
void CalculateNResetZoomBase();
|
||||
void NewHistogramAttached(SlsQtH1D* h);
|
||||
void HistogramDetached(SlsQtH1D* h);
|
||||
|
||||
void SetLog(int axisId, bool yes);
|
||||
|
||||
friend void SlsQtH1D::Attach(SlsQt1DPlot* p);
|
||||
friend void SlsQtH1D::Detach(SlsQt1DPlot* p);
|
||||
|
||||
|
||||
public slots:
|
||||
void UnZoom();
|
||||
void Update();
|
||||
|
||||
void SetLogX(bool yes=1);
|
||||
void SetLogY(bool yes=1);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
77
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef SLSQT1DZOOMER_H
|
||||
#define SLSQT1DZOOMER_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_global.h>
|
||||
|
||||
class SlsQtH1D;
|
||||
|
||||
class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
private:
|
||||
double x0,x1,y0,y1;
|
||||
double firstXgt0,firstYgt0;
|
||||
bool xIsLog,yIsLog;
|
||||
|
||||
public:
|
||||
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
setTrackerMode(AlwaysOn);
|
||||
xIsLog=yIsLog=0;
|
||||
}
|
||||
|
||||
double x() {return x0;}
|
||||
double x_firstGreaterThan0() {return firstXgt0;}
|
||||
double w() {return x1-x0;}
|
||||
|
||||
double y() {return y0;}
|
||||
double y_firstGreaterThan0() {return firstYgt0;}
|
||||
double h() {return y1-y0;}
|
||||
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width);
|
||||
void SetZoomBase(SlsQtH1D* h);
|
||||
void ExtendZoomBase(SlsQtH1D* h);
|
||||
void ResetZoomBase();
|
||||
|
||||
bool IsLogX(){ return xIsLog;}
|
||||
bool IsLogY(){ return yIsLog;}
|
||||
bool SetLogX(bool yes) { return xIsLog=yes;}
|
||||
bool SetLogY(bool yes) { return yIsLog=yes;}
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
virtual QwtText trackerText(const QPointF &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
QPoint p=pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
#endif
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
145
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Normal file
@ -0,0 +1,145 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DHIST_H
|
||||
#define SLSQT2DHIST_H
|
||||
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <qprintdialog.h>
|
||||
#endif
|
||||
#include <qwt_color_map.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
|
||||
|
||||
class SlsQt2DHist: public QwtRasterData{
|
||||
|
||||
private:
|
||||
|
||||
double x_min,x_max,y_min,y_max;
|
||||
double x_width,y_width;
|
||||
|
||||
int nx,ny,nb;
|
||||
double *data;
|
||||
double z_min,z_mean,z_max;
|
||||
bool z_mean_has_been_calculated;
|
||||
|
||||
int nx_array,ny_array;
|
||||
|
||||
bool interp;
|
||||
|
||||
static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap
|
||||
return (v2-v1)/(p2-p1)*(p-p1)+v1;
|
||||
}
|
||||
|
||||
public:
|
||||
SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1);
|
||||
virtual ~SlsQt2DHist();
|
||||
|
||||
double GetXMin() {return x_min;}
|
||||
double GetXMax() {return x_max;}
|
||||
double GetXBinWidth() {return x_width;}
|
||||
double GetYMin() {return y_min;}
|
||||
double GetYMax() {return y_max;}
|
||||
double GetYBinWidth() {return y_width;}
|
||||
double GetMinimum() {return z_min;}
|
||||
double GetMaximum() {return z_max;}
|
||||
double GetMean();
|
||||
|
||||
int GetNBinsX(){return nx;}
|
||||
int GetNBinsY(){return ny;}
|
||||
double GetBinValue(int bx,int by);
|
||||
int GetBinIndex(int bx,int by);
|
||||
double* GetDataPtr(){return data;}
|
||||
|
||||
void Interpolate(bool on=1) {interp=on;}
|
||||
void SetBinValue(int bx,int by,double v);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1);
|
||||
|
||||
double SetMinimumToFirstGreaterThanZero();
|
||||
void SetMinimum(double zmin) {z_min=zmin;}
|
||||
void SetMaximum(double zmax) {z_max=zmax;}
|
||||
void SetMinMax(double zmin=0,double zmax=-1);
|
||||
|
||||
int FindBinIndex(double x, double y);
|
||||
|
||||
|
||||
|
||||
virtual QwtRasterData *copy() const{
|
||||
//this function does not create a new SlsQt2DHistData instance,
|
||||
//just passes a pointer so that data is common to both the copy and the original instance
|
||||
return (QwtRasterData*) this;
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);}
|
||||
#else
|
||||
virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);}
|
||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||
switch (axis){
|
||||
case Qt::ZAxis:
|
||||
return QwtInterval(z_min,z_max);
|
||||
case Qt::XAxis:
|
||||
return QwtInterval(x_min,x_max);
|
||||
case Qt::YAxis:
|
||||
return QwtInterval(y_min,y_max);
|
||||
default:
|
||||
return QwtInterval(z_min,z_max);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
virtual double value(double x, double y) const{
|
||||
//if(!interp){ //default is box like plot
|
||||
int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx;
|
||||
if(index<0||index>nb) index = nb;
|
||||
if(!interp) return data[index];
|
||||
//}
|
||||
|
||||
|
||||
int x_int = int((x-x_min)/x_width-0.5);
|
||||
if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2;
|
||||
int y_int = int((y-y_min)/y_width-0.5);
|
||||
if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2;
|
||||
|
||||
int b00 = x_int*ny + y_int;
|
||||
int b01 = x_int*ny + y_int+1;
|
||||
int b10 = (x_int+1)*ny + y_int;
|
||||
int b11 = (x_int+1)*ny + y_int+1;
|
||||
|
||||
//vertical extrap
|
||||
double y0 = y_min+(y_int+0.5)*y_width;
|
||||
double y1 = y_min+(y_int+1.5)*y_width;
|
||||
double left_v = value_between_points(y0,data[b00],y1,data[b01],y);
|
||||
double right_v = value_between_points(y0,data[b10],y1,data[b11],y);
|
||||
//horazontal extrap
|
||||
|
||||
|
||||
|
||||
return 0.5;
|
||||
|
||||
|
||||
return value_between_points(x_min+(x_int+0.5)*x_width,left_v,
|
||||
x_min+(x_int+1.5)*x_width,right_v,x);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
118
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Normal file
@ -0,0 +1,118 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DPLOT_H
|
||||
#define SLSQT2DPLOT_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qlist.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
|
||||
#include "SlsQt2DZoomer.h"
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
|
||||
class QwtPlotPanner;
|
||||
class QwtScaleWidget;
|
||||
class QwtLinearColorMap;
|
||||
|
||||
|
||||
class SlsQt2DPlot: public QwtPlot{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QwtPlotSpectrogram *d_spectrogram;
|
||||
SlsQt2DHist* hist;
|
||||
SlsQt2DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
QwtScaleWidget *rightAxis;
|
||||
|
||||
QwtLinearColorMap* colorMapLinearScale;
|
||||
QwtLinearColorMap* colorMapLogScale;
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtValueList* contourLevelsLinear;
|
||||
QwtValueList* contourLevelsLog;
|
||||
#else
|
||||
QList<double> contourLevelsLinear;
|
||||
QList<double> contourLevelsLog;
|
||||
#endif
|
||||
|
||||
void SetupZoom();
|
||||
void SetupColorMap();
|
||||
|
||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap* myColourMap(int log=0);
|
||||
|
||||
int isLog;
|
||||
|
||||
|
||||
public:
|
||||
SlsQt2DPlot(QWidget * = NULL);
|
||||
|
||||
// SlsQt2DHist *GetHistogram(){ return hist; }
|
||||
void UnZoom();
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
|
||||
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disableZoom);
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist->GetXMin();};
|
||||
double GetXMaximum(){return hist->GetXMax();};
|
||||
double GetYMinimum(){return hist->GetYMin();};
|
||||
double GetYMaximum(){return hist->GetYMax();};
|
||||
/**---*/
|
||||
|
||||
|
||||
double GetZMinimum(){ return hist->GetMinimum();}
|
||||
double GetZMaximum(){ return hist->GetMaximum();}
|
||||
void SetZMinMax(double zmin=0,double zmax=-1);
|
||||
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
|
||||
double GetZMean() { return hist->GetMean();}
|
||||
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
|
||||
hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
double* GetDataPtr() {return hist->GetDataPtr();}
|
||||
int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);}
|
||||
int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);}
|
||||
void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);}
|
||||
double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);}
|
||||
|
||||
|
||||
void FillTestPlot(int i=0);
|
||||
void Update();
|
||||
|
||||
public slots:
|
||||
void LogZ(bool on=1);
|
||||
void InterpolatedPlot(bool on);
|
||||
void showContour(bool on);
|
||||
void showSpectrogram(bool on);
|
||||
// void printPlot();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* @comments
|
||||
* 19.06.2012 All modifications with the Ian flag has been made since
|
||||
* z_range_ne and the buttons are defined in another class.
|
||||
* Logz button and z_range_ne have wrappers to connect them
|
||||
* 05.05.2013 Added ResetZMinZMax
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DPLOTLAYOUT_H
|
||||
#define SLSQT2DPLOTLAYOUT_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
#include "SlsQtNumberEntry.h"
|
||||
#include "SlsQt2DPlot.h"
|
||||
|
||||
class QGridLayout;
|
||||
class QString;
|
||||
class QToolButton;
|
||||
|
||||
|
||||
class SlsQt2DPlotLayout: public QGroupBox{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
SlsQt2DPlotLayout(QWidget * = NULL);
|
||||
~SlsQt2DPlotLayout();
|
||||
|
||||
SlsQt2DPlot* GetPlot(){return the_plot;}
|
||||
void SetXTitle(QString st);
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void UpdateNKeepSetRangeIfSet();
|
||||
|
||||
|
||||
private:
|
||||
QGridLayout* the_layout;
|
||||
QToolButton* btnInterpolate;
|
||||
QToolButton* btnContour;
|
||||
QToolButton* btnLogz;
|
||||
SlsQt2DPlot* the_plot;
|
||||
SlsQtNumberEntry* z_range_ne;
|
||||
|
||||
#ifndef IAN
|
||||
bool zRangeChecked;
|
||||
#endif
|
||||
|
||||
void CreateTheButtons();
|
||||
void ConnectSignalsAndSlots();
|
||||
void Layout();
|
||||
|
||||
public slots:
|
||||
void SetZScaleToLog(bool yes);
|
||||
void ResetRange();
|
||||
|
||||
#ifndef IAN
|
||||
void SetZRange(double,double);
|
||||
void EnableZRange(bool enable);
|
||||
void ResetZMinZMax(bool zmin, bool zmax, double min, double max);
|
||||
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
74
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Dhanya-05.12.2012- included an additional header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DZOOMER_H
|
||||
#define SLSQT2DZOOMER_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/
|
||||
#include <cstdio>
|
||||
/**end of Change by Dhanya*/
|
||||
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
private:
|
||||
SlsQt2DHist* hist;
|
||||
|
||||
public:
|
||||
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
setTrackerMode(AlwaysOn);
|
||||
}
|
||||
|
||||
void SetHist(SlsQt2DHist* h){
|
||||
hist=h;
|
||||
}
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
virtual QwtText trackerTextF(const QPointF &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
|
||||
//QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
|
||||
static QwtText text;
|
||||
if(hist){
|
||||
static char t[200];
|
||||
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
|
||||
text.setText(t);
|
||||
}else {
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
QPoint p=pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
#endif
|
||||
|
||||
}
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
147
slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h
Normal file
@ -0,0 +1,147 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef SLSQTNUMBERENTRY_H
|
||||
#define SLSQTNUMBERENTRY_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
class QGridLayout;
|
||||
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QIntValidator;
|
||||
class QDoubleValidator;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
|
||||
#include "SlsQtValidators.h"
|
||||
|
||||
class SlsQtNumberEntry:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//type=0->units only, type=1->int,type=2->double, type=3->spinbox
|
||||
//adding middle text will automatically add a second number field
|
||||
SlsQtNumberEntry(QWidget *parent,int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0);
|
||||
//without unit box
|
||||
SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_strin, int num_type, char *middle_string, int num2_type, char* end_string);
|
||||
|
||||
|
||||
~SlsQtNumberEntry();
|
||||
|
||||
void Enable(bool en_flag=1);
|
||||
void Disable();
|
||||
void EnableNumberField(int which_number_field,bool en_flag=1); //which_number_field is 0 or 1
|
||||
void DisableNumberField(int which_number_field);
|
||||
|
||||
void AddCheckBox();
|
||||
void SetFrontText(char* s);
|
||||
void SetMiddleText(char* s);
|
||||
void SetBackText(char* s);
|
||||
void SetupNumberField(int type,int which_number_field=0);
|
||||
void SetUnits(int n_units,char** units,double* unit_factors);
|
||||
|
||||
void SetMinimumNumberWidth(int nchar_width,int which_number_field=0);
|
||||
void SetNDecimalsOfDoubleValidators(int ndecimals);
|
||||
void SetNDecimalsOfDoubleValidator(int ndecimals,int which_number_field=0);
|
||||
void SetMinimumUnitWidth(int nchar_width);
|
||||
|
||||
bool Enabled();
|
||||
bool CheckBoxState();
|
||||
bool IsValueOk(int which_number_field=0);
|
||||
|
||||
const char* GetFrontText();
|
||||
const char* GetMiddleText();
|
||||
const char* GetBackText();
|
||||
|
||||
int GetNumberInt(int which_number_field=0,bool* ok=0);
|
||||
double GetNumber(int which_number_field=0,bool *ok=0);
|
||||
|
||||
int GetValueInt(int which_number_field=0,bool* ok=0);
|
||||
double GetValue(int which_number_field=0,bool *ok=0);
|
||||
|
||||
int GetComboBoxIndex();
|
||||
double GetComboBoxValue();
|
||||
|
||||
private:
|
||||
void SetupNumberEntry(int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0);
|
||||
|
||||
QGridLayout* layout; //default layout
|
||||
|
||||
QCheckBox* check_box;
|
||||
QLabel* front_text;
|
||||
QLabel* middle_text;
|
||||
QLineEdit* num_field[2];
|
||||
QSpinBox* spin_box[2];
|
||||
bool num_field_enabled[2];
|
||||
|
||||
SlsQtIntValidator* validator_int[2];
|
||||
SlsQtDoubleValidator* validator_double[2];
|
||||
QComboBox* unit_cbb;
|
||||
double* factors;
|
||||
QLabel* back_text;
|
||||
|
||||
void SetText(char* s, QLabel** pp);
|
||||
void SetLayout();
|
||||
|
||||
|
||||
public slots:
|
||||
void FirstValueEntered();
|
||||
void SecondValueEntered();
|
||||
void UnitSelected();
|
||||
|
||||
void SetRange(int min, int max, int which_number_field=0);
|
||||
void SetRange(double min, double max, int which_number_field=0);
|
||||
void SetFirstRange(int min, int max) {SetRange(min,max,0);}
|
||||
void SetSecondRange(int min, int max) {SetRange(min,max,1);}
|
||||
|
||||
double SetValue(double v, int which_number_field=0);
|
||||
void SetFirstValue(int v) {SetValue(v,0);}
|
||||
void SetSecondValue(int v) {SetValue(v,1);}
|
||||
void SetFirstValue(double v) {SetValue(v,0);}
|
||||
void SetSecondValue(double v) {SetValue(v,1);}
|
||||
|
||||
// double SetNumber(int v, int which_number_field=0);
|
||||
double SetNumber(double v, int which_number_field=0);
|
||||
void SetFirstNumber(int v) {SetNumber(v,0);}
|
||||
void SetSecondNumber(int v) {SetNumber(v,1);}
|
||||
void SetFirstNumber(double v) {SetNumber(v,0);}
|
||||
void SetSecondNumber(double v) {SetNumber(v,1);}
|
||||
|
||||
int SetComboBoxIndex(int index);
|
||||
|
||||
void CheckBoxClicked();
|
||||
void PrintTheValue();
|
||||
|
||||
void RefreshFirstNumberEntry();
|
||||
void RefreshSecondNumberEntry();
|
||||
void RefreshNumberEntery(int number_field=0);
|
||||
|
||||
signals:
|
||||
void CheckBoxChanged(bool state);
|
||||
void CheckBoxChanged(SlsQtNumberEntry* ptr);
|
||||
void AValueChanged(SlsQtNumberEntry* ptr);
|
||||
void FirstValueChanged(int value);
|
||||
void FirstValueChanged(double value);
|
||||
void FirstValueChanged(SlsQtNumberEntry* ptr);
|
||||
void SecondValueChanged(int value);
|
||||
void SecondValueChanged(double value);
|
||||
void SecondValueChanged(SlsQtNumberEntry* ptr);
|
||||
void UnitChanged(double);
|
||||
void UnitChanged(SlsQtNumberEntry* ptr);
|
||||
};
|
||||
|
||||
#endif
|
79
slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef SLSQTVALIDATORS_H
|
||||
#define SLSQTVALIDATORS_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qvalidator.h>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
class SlsQtIntValidator:public QIntValidator{
|
||||
|
||||
public:
|
||||
SlsQtIntValidator(QWidget *parent):QIntValidator(parent){}
|
||||
|
||||
virtual void fixup (QString& text) const {
|
||||
bool ok = 1;
|
||||
int v = text.toInt(&ok);
|
||||
|
||||
if(!ok){
|
||||
v = text.toDouble(&ok);
|
||||
if(ok) text = QString::number(v);
|
||||
else text = QString::number(0);
|
||||
fixup(text);
|
||||
}
|
||||
|
||||
if(v<bottom()) text = QString::number(bottom());
|
||||
else if(v>top()) text = QString::number(top());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class SlsQtDoubleValidator:public QDoubleValidator{
|
||||
|
||||
public:
|
||||
SlsQtDoubleValidator(QWidget *parent):QDoubleValidator(parent){}
|
||||
|
||||
virtual void fixup (QString& text) const {
|
||||
|
||||
bool ok = 1;
|
||||
double v = text.toDouble(&ok);
|
||||
|
||||
if(!ok){
|
||||
text = QString::number(0);
|
||||
fixup(text);
|
||||
}
|
||||
|
||||
int nd = this->decimals(); //ndigest behind zero
|
||||
if(v<bottom()){
|
||||
text = QString::number(bottom(),'g',nd);
|
||||
}else{
|
||||
if(nd<0) nd=0;
|
||||
if(v>top()){
|
||||
v = floor(top()*pow(10,nd))/pow(10,nd);
|
||||
text = QString::number(v,'g');
|
||||
}else{
|
||||
v = round(v*pow(10,nd))/pow(10,nd);
|
||||
text = QString::number(v,'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
513
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Normal file
@ -0,0 +1,513 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <qwt_painter.h>
|
||||
#include <qwt_plot_canvas.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <qwt_legend.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_math.h>
|
||||
#include "SlsQt1DPlot.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){
|
||||
Initailize();
|
||||
SetData(n,min,max,data);
|
||||
}
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title,int n, double* data_x, double* data_y):QwtPlotCurve(title){
|
||||
Initailize();
|
||||
SetData(n,data_x,data_y);
|
||||
}
|
||||
|
||||
void SlsQtH1D::Initailize(){
|
||||
ndata=n_array=0;
|
||||
x=y=0;
|
||||
pen_ptr = new QPen();
|
||||
SetLineColor();
|
||||
}
|
||||
|
||||
SlsQtH1D::~SlsQtH1D(){delete x;delete y;delete pen_ptr;}
|
||||
|
||||
void SlsQtH1D::Attach(SlsQt1DPlot* p){
|
||||
attach((QwtPlot*) p);
|
||||
p->NewHistogramAttached(this);
|
||||
}
|
||||
|
||||
void SlsQtH1D::Detach(SlsQt1DPlot* p){
|
||||
detach();
|
||||
p->HistogramDetached(this);
|
||||
}
|
||||
|
||||
|
||||
int SlsQtH1D::SetLineColor(int c){
|
||||
static int last_color = 1;
|
||||
if(c<0) c=(last_color+1)%3;
|
||||
|
||||
switch(c){
|
||||
case 0: pen_ptr->setColor(Qt::black); break;
|
||||
case 1: pen_ptr->setColor(Qt::red); break;
|
||||
case 2: pen_ptr->setColor(Qt::blue); break;
|
||||
case 3: pen_ptr->setColor(Qt::green); break;
|
||||
case 4: pen_ptr->setColor(Qt::magenta); break;
|
||||
case 5: pen_ptr->setColor(Qt::cyan); break;
|
||||
case 6: pen_ptr->setColor(Qt::darkYellow); break;
|
||||
case 7: pen_ptr->setColor(Qt::gray); break;
|
||||
case 8: pen_ptr->setColor(Qt::darkBlue); break;
|
||||
case 9: pen_ptr->setColor(Qt::darkGreen); break;
|
||||
case 10: pen_ptr->setColor(Qt::darkMagenta); break;
|
||||
}
|
||||
/* if(c==0) pen_ptr->setColor(Qt::black);
|
||||
else if(c==1) pen_ptr->setColor(Qt::red);
|
||||
else pen_ptr->setColor(Qt::blue);*/
|
||||
|
||||
setPen(*pen_ptr);
|
||||
|
||||
return last_color=c;
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetLineWidth(int w){
|
||||
pen_ptr->setWidth(w);
|
||||
setPen(*pen_ptr);
|
||||
return w;
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetLineStyle(int s){
|
||||
if(s==1) pen_ptr->setStyle(Qt::DashLine);
|
||||
else if(s==2) pen_ptr->setStyle(Qt::DotLine);
|
||||
else if(s==3) pen_ptr->setStyle(Qt::DashDotLine);
|
||||
else if(s==4) pen_ptr->setStyle(Qt::DashDotDotLine);
|
||||
else if(s==5) pen_ptr->setStyle(Qt::CustomDashLine);
|
||||
else pen_ptr->setStyle(Qt::SolidLine);
|
||||
setPen(*pen_ptr);
|
||||
}
|
||||
|
||||
|
||||
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data){
|
||||
n = SetUpArrays(n);
|
||||
|
||||
ndata=n;
|
||||
if(xmin>xmax){
|
||||
double t=xmin;
|
||||
xmin=xmax;
|
||||
xmax=t;
|
||||
}
|
||||
|
||||
dx = (xmax-xmin)/n;
|
||||
ymin=ymax= data ? data[0]:0;
|
||||
firstXgt0=-1;
|
||||
firstYgt0=-1;
|
||||
|
||||
for(int i=0;i<ndata;i++){
|
||||
x[i] = i ? x[i-1]+dx:xmin;
|
||||
y[i] = data ? data[i]:0;
|
||||
if(data&&ymin>y[i]) ymin = y[i];
|
||||
if(data&&ymax<y[i]) ymax = y[i];
|
||||
if(x[i]>0&&(firstXgt0<0||firstXgt0>x[i])) firstXgt0=x[i];
|
||||
if(y[i]>0&&(firstYgt0<0||firstYgt0>y[i])) firstYgt0=y[i];
|
||||
}
|
||||
|
||||
// cout<<endl<<endl<<"one can think about correcting negative values in the data and recalling the setRawData function in setRawData when plotting on log scales"<<endl;
|
||||
|
||||
// if(firstXgt0<0)firstXgt0=0.001;
|
||||
// if(firstYgt0<0)firstYgt0=0.001;
|
||||
#if QWT_VERSION<0x060000
|
||||
setRawData(x,y,ndata);
|
||||
#else
|
||||
setRawSamples(x,y,ndata);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double* data_x, double *data_y){
|
||||
|
||||
int reverse = (data_x&&n>0&&data_x[0]>data_x[n-1]) ? 1:0;
|
||||
n = SetUpArrays(n);
|
||||
|
||||
ndata=n;
|
||||
dx=-1; //signifies not regular intervals
|
||||
|
||||
ymin=ymax= data_y ? data_y[0]:0;
|
||||
|
||||
firstXgt0=-1;
|
||||
firstYgt0=-1;
|
||||
|
||||
for(int i=0;i<ndata;i++){
|
||||
int b = reverse ? n-i-1:i;
|
||||
x[b] = data_x ? data_x[i]:0;
|
||||
y[b] = data_y ? data_y[i]:0;
|
||||
if(data_y&&ymin>y[b]) ymin = y[b];
|
||||
if(data_y&&ymax<y[b]) ymax = y[b];
|
||||
if(x[b]>0&&(firstXgt0<0||firstXgt0>x[b])) firstXgt0=x[b];
|
||||
if(y[b]>0&&(firstYgt0<0||firstYgt0>y[b])) firstYgt0=y[b];
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setRawData(x,y,ndata);
|
||||
#else
|
||||
setRawSamples(x,y,ndata);
|
||||
#endif
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetUpArrays(int n){
|
||||
n = n<1 ? 1 : n; //overflow bin
|
||||
|
||||
if(n+1>n_array){
|
||||
n_array = n+1;
|
||||
if(x) delete x;
|
||||
if(y) delete y;
|
||||
x = new double [n_array];
|
||||
y = new double [n_array];
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
double SlsQtH1D::FillBin(int bx, double v) {
|
||||
bx = CheckIndex(bx);
|
||||
return SetBinContent(bx,y[bx]+v);
|
||||
}
|
||||
double SlsQtH1D::Fill(double x, double v){return FillBin(FindBinIndex(x),v);}
|
||||
|
||||
double SlsQtH1D::SetBinContent(int bx,double v){
|
||||
bx = CheckIndex(bx);
|
||||
y[bx]=v;
|
||||
if(bx<ndata){
|
||||
if(y[bx]<ymin) ymin = y[bx];
|
||||
if(y[bx]>0&&(firstYgt0<=0||y[bx]<firstYgt0)) firstYgt0 = y[bx];
|
||||
if(y[bx]>ymax) ymax = y[bx];
|
||||
}
|
||||
return y[bx];
|
||||
}
|
||||
|
||||
double SlsQtH1D::SetContent(double x,double v) {return SetBinContent(FindBinIndex(x),v); }
|
||||
|
||||
int SlsQtH1D::FindBinIndex(double px){
|
||||
if(dx>0) CheckIndex(int((px-x[0])/dx));
|
||||
|
||||
//find closest bin
|
||||
int b=0; for(;b<ndata;b++) if(x[b]>px) break;
|
||||
|
||||
if(b==0) return 0;
|
||||
else if(fabs(px-x[b-1])<fabs(px-x[b])) return b-1;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQtH1D::CheckIndex(int bx){return (bx<0||bx>ndata) ? ndata : bx;}//ndata is the overflow bin
|
||||
|
||||
SlsQtH1D* SlsQtH1D::Add(double v){ for(int bx=0;bx<ndata;bx++) FillBin(bx,v); return this;}
|
||||
|
||||
|
||||
//1d hist list stuff
|
||||
SlsQtH1DList::SlsQtH1DList(SlsQtH1D* hist){
|
||||
the_hist = hist;
|
||||
the_next = 0;
|
||||
}
|
||||
|
||||
SlsQtH1DList::~SlsQtH1DList(){
|
||||
if(the_next) delete the_next;
|
||||
}
|
||||
|
||||
SlsQtH1D* SlsQtH1DList::Add(SlsQtH1D* hist){
|
||||
// cout<<"Adding: "<<hist<<endl;
|
||||
SlsQtH1DList* hl=this;
|
||||
|
||||
while(hl){
|
||||
if(hist==hl->the_hist) return hist; //already added
|
||||
if(!hl->the_next) break;
|
||||
hl=hl->the_next;
|
||||
}
|
||||
if(hl->the_hist) hl->the_next = new SlsQtH1DList(hist);
|
||||
else hl->the_hist = hist;
|
||||
|
||||
// Print();
|
||||
|
||||
return hist;
|
||||
}
|
||||
|
||||
void SlsQtH1DList::Print(){
|
||||
// cout<<"Printing List"<<endl;
|
||||
SlsQtH1DList* hl=this;
|
||||
int i=0;
|
||||
while(hl){
|
||||
cout<<" "<<i++<<") "<<hl<<" "<<hl->the_hist<<" "<<hl->the_next<<endl;
|
||||
hl=hl->the_next;
|
||||
if(i>10) break;
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQtH1DList::Remove(SlsQtH1D* hist){
|
||||
// cout<<"Removing: "<<hist<<endl;
|
||||
SlsQtH1DList* hl=this;
|
||||
while(hl){ //every match will be removed
|
||||
if(hl->the_hist!=hist) hl = hl->the_next;
|
||||
else{ //match
|
||||
if(!hl->the_next) hl->the_hist=0; // first the_hist is zero when there's no next
|
||||
else{
|
||||
SlsQtH1DList* t = hl->the_next;
|
||||
hl->the_hist = t->the_hist;
|
||||
hl->the_next = t->the_next;
|
||||
t->the_next = 0;
|
||||
delete t;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Print();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//1d plot stuff
|
||||
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){
|
||||
// n_histograms_attached=0;
|
||||
hline=vline=0;
|
||||
hist_list = new SlsQtH1DList();
|
||||
|
||||
UnknownStuff();
|
||||
alignScales();
|
||||
SetupZoom();
|
||||
|
||||
// Assign a title
|
||||
#ifndef IAN
|
||||
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
||||
#else
|
||||
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
|
||||
#endif
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
}
|
||||
|
||||
SlsQt1DPlot::~SlsQt1DPlot(){
|
||||
delete hist_list;
|
||||
|
||||
if(hline) delete hline;
|
||||
if(vline) delete vline;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::CalculateNResetZoomBase(){
|
||||
if(hist_list->Hist()) zoomer->SetZoomBase(hist_list->Hist());
|
||||
SlsQtH1DList* hl = hist_list->Next();
|
||||
while(hl){
|
||||
if(hl->Hist()) zoomer->ExtendZoomBase(hl->Hist());
|
||||
hl=hl->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){
|
||||
hist_list->Add(h);
|
||||
CalculateNResetZoomBase();
|
||||
//commented out by dhanya to take off zooming every hist in 1d plots
|
||||
//if(!hist_list->Next()) UnZoom();
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::HistogramDetached(SlsQtH1D* h){
|
||||
hist_list->Remove(h);
|
||||
CalculateNResetZoomBase();
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::Update(){
|
||||
replot();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetTitle(const char* title){
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetXTitle(const char* title){
|
||||
QwtText t(title);
|
||||
t.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
setAxisTitle(QwtPlot::xBottom,t);
|
||||
}
|
||||
void SlsQt1DPlot::SetYTitle(const char* title){
|
||||
QwtText t(title);
|
||||
t.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
setAxisTitle(QwtPlot::yLeft,t);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);}
|
||||
void SlsQt1DPlot::SetLogY(bool yes){ SetLog(QwtPlot::yLeft,yes);}
|
||||
void SlsQt1DPlot::SetLog(int axisId, bool yes){
|
||||
if(axisId==QwtPlot::xBottom) zoomer->SetLogX(yes);
|
||||
if(axisId==QwtPlot::yLeft) zoomer->SetLogY(yes);
|
||||
|
||||
zoomer->ResetZoomBase(); //needs to be done before setting Engine
|
||||
|
||||
//the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp
|
||||
if(yes) setAxisScaleEngine(axisId,new QwtLog10ScaleEngine());
|
||||
else setAxisScaleEngine(axisId,new QwtLinearScaleEngine());
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::UnZoom(){
|
||||
setAxisScale(QwtPlot::xBottom,zoomer->x(),zoomer->x()+zoomer->w());
|
||||
setAxisScale(QwtPlot::yLeft,zoomer->y(),zoomer->y()+zoomer->h());
|
||||
|
||||
zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){
|
||||
setAxisScale(QwtPlot::xBottom,xmin,xmin+x_width);
|
||||
setAxisScale(QwtPlot::yLeft ,ymin,ymin+y_width);
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::RemoveHLine(){
|
||||
if(hline) hline->detach();
|
||||
delete hline;
|
||||
hline=0;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::InsertHLine(double y){
|
||||
if(!hline){
|
||||
hline = new QwtPlotMarker();
|
||||
hline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
|
||||
hline->setLineStyle(QwtPlotMarker::HLine);
|
||||
hline->attach(this);
|
||||
}
|
||||
hline->setYValue(y);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::RemoveVLine(){
|
||||
if(vline) vline->detach();
|
||||
delete vline;
|
||||
vline=0;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::InsertVLine(double x){
|
||||
if(!vline){
|
||||
vline = new QwtPlotMarker();
|
||||
vline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
|
||||
vline->setLineStyle(QwtPlotMarker::VLine);
|
||||
vline->attach(this);
|
||||
}
|
||||
vline->setXValue(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SlsQt1DPlot::SetupZoom(){
|
||||
// LeftButton for the zooming
|
||||
// MidButton for the panning
|
||||
// RightButton: zoom out by 1
|
||||
// Ctrl+RighButton: zoom out to full size
|
||||
|
||||
zoomer = new SlsQt1DZoomer(canvas());
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
|
||||
panner = new QwtPlotPanner(canvas());
|
||||
panner->setAxisEnabled(QwtPlot::yRight, false);
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
|
||||
// Avoid jumping when labels with more/less digits
|
||||
// appear/disappear when scrolling vertically
|
||||
|
||||
const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
|
||||
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
|
||||
sd->setMinimumExtent( fm.width("100.00") );
|
||||
|
||||
const QColor c(Qt::darkBlue);
|
||||
zoomer->setRubberBandPen(c);
|
||||
zoomer->setTrackerPen(c);
|
||||
}
|
||||
|
||||
|
||||
// Set a plain canvas frame and align the scales to it
|
||||
void SlsQt1DPlot::alignScales(){
|
||||
// The code below shows how to align the scales to
|
||||
// the canvas frame, but is also a good example demonstrating
|
||||
// why the spreaded API needs polishing.
|
||||
|
||||
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
|
||||
canvas()->setLineWidth(1);
|
||||
|
||||
for(int i = 0; i < QwtPlot::axisCnt; i++ ){
|
||||
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
|
||||
if(scaleWidget) scaleWidget->setMargin(0);
|
||||
QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
|
||||
if(scaleDraw) scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::UnknownStuff(){
|
||||
#if QWT_VERSION<0x060000
|
||||
// Disable polygon clipping
|
||||
//not supported for version 6
|
||||
QwtPainter::setDeviceClipping(false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
|
||||
#else
|
||||
// We don't need the cache here
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#ifdef Q_WS_X11
|
||||
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
||||
// to substantial bugs with Qt 4.2.x/Windows
|
||||
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt1DPlot::DisableZoom(bool disableZoom){
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
else cout<<"Enabling zoom"<<endl;
|
||||
#endif
|
||||
if(disableZoom){
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::NoButton);
|
||||
}else {
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
103
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Normal file
@ -0,0 +1,103 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_scale_div.h>
|
||||
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt1DZoomer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void SlsQt1DZoomer::ResetZoomBase(){
|
||||
SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){
|
||||
if(xIsLog&&xmin<=0){
|
||||
double xmax = xmin+x_width;
|
||||
xmin = firstXgt0*0.98;
|
||||
if(xmax<=xmin) x_width=firstXgt0;
|
||||
else x_width=xmax-xmin;
|
||||
}
|
||||
if(yIsLog&&ymin<=0){
|
||||
double ymax = ymin+y_width;
|
||||
ymin = firstYgt0*0.98;
|
||||
if(ymax<=ymin) y_width=firstYgt0;
|
||||
else y_width=ymax-ymin;
|
||||
}
|
||||
|
||||
if(plot()){
|
||||
if(xIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
|
||||
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
|
||||
#else
|
||||
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
|
||||
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound();
|
||||
#endif
|
||||
if(xmin_curr<xmin) xmin_curr=xmin;
|
||||
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width;
|
||||
plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr);
|
||||
}
|
||||
if(yIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
|
||||
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
|
||||
#else
|
||||
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
|
||||
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound();
|
||||
#endif
|
||||
if(ymin_curr<ymin) ymin_curr=ymin;
|
||||
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;
|
||||
plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr);
|
||||
}
|
||||
plot()->replot();
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width));
|
||||
#else
|
||||
setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){
|
||||
x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
||||
x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
||||
y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
||||
y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
||||
|
||||
firstXgt0 = h->GetFirstXgtZero(); //for log plots
|
||||
firstYgt0 = h->GetFirstYgtZero(); //for log plots
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){
|
||||
double h_x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
||||
double h_x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
||||
double h_y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
||||
double h_y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
||||
|
||||
if(h_x0<x0) x0 = h_x0;
|
||||
if(h_x1>x1) x1 = h_x1;
|
||||
if(h_y0<y0) y0 = h_y0;
|
||||
if(h_y1>y1) y1 = h_y1;
|
||||
|
||||
if(h->GetFirstXgtZero()<firstXgt0) firstXgt0 = h->GetFirstXgtZero();
|
||||
if(h->GetFirstYgtZero()<firstYgt0) firstYgt0 = h->GetFirstYgtZero();
|
||||
|
||||
// cout<<"extend "<<h_x0<<" "<<h_y0<<" "<<h_x1<<" "<<h_y1<<endl;
|
||||
// cout<<"extend "<<x0<<" "<<y0<<" "<<x1-x0<<" "<<y1-y0<<endl;
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
|
||||
|
142
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){
|
||||
interp=0;
|
||||
nx_array=ny_array=0;data=0;
|
||||
SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DHist::~SlsQt2DHist(){if(data) delete data;}
|
||||
|
||||
int SlsQt2DHist::GetBinIndex(int bx, int by){
|
||||
int b = bx*ny+by;
|
||||
if(b<0 || b>=nb){
|
||||
cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<<endl;
|
||||
return nb;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQt2DHist::FindBinIndex(double x, double y){
|
||||
return GetBinIndex(int((x-x_min)/x_width),int((y-y_min)/y_width));
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetBinValue(int bx,int by){
|
||||
return data[GetBinIndex(bx,by)];
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DHist::SetBinValue(int bx,int by,double v){
|
||||
z_mean_has_been_calculated = 0;
|
||||
data[GetBinIndex(bx,by)] = v;
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax, double *d,double zmin,double zmax){
|
||||
z_mean_has_been_calculated = 0;
|
||||
if(xmax<xmin||ymax<ymin) cout<<"Warning input range invalid."<<endl;
|
||||
|
||||
x_width = (xmax - xmin)/nbinsx;
|
||||
y_width = (ymax - ymin)/nbinsy;
|
||||
|
||||
if(x_min!=xmin||x_max!=xmax||y_min!=ymin||y_max!=ymax){
|
||||
x_min=xmin;x_max=xmax;
|
||||
y_min=ymin;y_max=ymax;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setBoundingRect(QRectF(xmin,ymin,x_max-x_min,y_max-y_min));
|
||||
#else
|
||||
setInterval( Qt::XAxis,QwtInterval(xmin,xmax));
|
||||
setInterval( Qt::YAxis,QwtInterval(ymin,ymax));
|
||||
// setInterval( Qt::ZAxis,QwtInterval(zmin,zmax));
|
||||
//setInterval( Qt::ZAxis,QwtInterval(0.,1.));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if(nbinsx*nbinsy<1){
|
||||
cout<<"Exitting: SlsQt2DHist::SetData() number of bins must be greater than zero."<<endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(nbinsx*nbinsy>nx_array*ny_array){
|
||||
if(data) delete data;
|
||||
data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin
|
||||
nx_array = nbinsx;
|
||||
ny_array = nbinsy;
|
||||
}
|
||||
nx=nbinsx;
|
||||
ny=nbinsy;
|
||||
nb=nx*ny;
|
||||
data[nb]=0;//set over flow to zero
|
||||
if(d){
|
||||
memcpy(data,d,nb*sizeof(double));
|
||||
SetMinMax(zmin,zmax);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetMinMax(double zmin,double zmax){
|
||||
if(zmin<zmax){
|
||||
z_min=zmin;
|
||||
z_max=zmax;
|
||||
}else{
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_min=data[0];
|
||||
z_mean=0;
|
||||
z_max=data[0];
|
||||
for(int i=0;i<nb;i++){
|
||||
if(data[i]<z_min) z_min=data[i];
|
||||
if(data[i]>z_max) z_max=data[i];
|
||||
z_mean+=data[i];
|
||||
}
|
||||
z_mean/=nb;
|
||||
if(z_min>0) z_min/=1.02; else z_min*=1.02;
|
||||
if(z_max>0) z_max*=1.02; else z_max/=1.02;
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetMean(){
|
||||
if(!z_mean_has_been_calculated){
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_mean=0;
|
||||
for(int i=0;i<nb;i++) z_mean+=data[i];
|
||||
z_mean/=nb;
|
||||
}
|
||||
|
||||
return z_mean;
|
||||
}
|
||||
|
||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
||||
z_min=fabs(z_max)+1;
|
||||
for(int i=0;i<nb;i++){
|
||||
if(data[i]>0 && data[i]<z_min) z_min=data[i];
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
return z_min;
|
||||
}
|
||||
|
||||
|
||||
|
385
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Normal file
@ -0,0 +1,385 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <qprinter.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qlist.h>
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <qprintdialog.h>
|
||||
#endif
|
||||
#include <qwt_color_map.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_plot_layout.h>
|
||||
#include <qwt_scale_engine.h>
|
||||
|
||||
#include "SlsQt2DPlot.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
||||
isLog=0;
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
d_spectrogram = new QwtPlotSpectrogram();
|
||||
|
||||
hist = new SlsQt2DHist();
|
||||
SetupZoom();
|
||||
SetupColorMap();
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setData(*hist);
|
||||
#else
|
||||
d_spectrogram->setData(hist);
|
||||
#endif
|
||||
|
||||
|
||||
d_spectrogram->attach(this);
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
|
||||
FillTestPlot();
|
||||
Update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap(){
|
||||
|
||||
|
||||
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale );
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLinearScale );
|
||||
#endif
|
||||
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION<0x060000
|
||||
contourLevelsLinear = new QwtValueList();
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
;
|
||||
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
#if QWT_VERSION<0x060000
|
||||
contourLevelsLog = new QwtValueList();
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10;
|
||||
|
||||
#else
|
||||
;
|
||||
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10;
|
||||
#endif
|
||||
|
||||
|
||||
// A color bar on the right axis
|
||||
rightAxis = axisWidget(QwtPlot::yRight);
|
||||
|
||||
rightAxis->setTitle("Intensity");
|
||||
rightAxis->setColorBarEnabled(true);
|
||||
enableAxis(QwtPlot::yRight);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::FillTestPlot(int mode){
|
||||
static int nx = 50;
|
||||
static int ny = 50;
|
||||
static double *the_data=0;
|
||||
if(the_data==0) the_data = new double [nx*ny];
|
||||
|
||||
double dmax = sqrt(pow(nx/2.0-0.5,2) + pow(ny/2.0-0.5,2));
|
||||
for(int i=0;i<nx;i++){
|
||||
for(int j=0;j<ny;j++){
|
||||
double d = sqrt(pow(nx/2.0-(i+0.5),2) + pow(ny/2.0-(j+0.5),2));
|
||||
|
||||
if(mode%3) the_data[i+j*nx] = 10*d/dmax;
|
||||
else the_data[i+j*nx] = 10*(1-d/dmax);
|
||||
}
|
||||
}
|
||||
|
||||
hist->SetData(nx,200,822,ny,-0.5,ny-0.5,the_data);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetupZoom(){
|
||||
// LeftButton for the zooming
|
||||
// MidButton for the panning
|
||||
// RightButton: zoom out by 1
|
||||
// Ctrl+RighButton: zoom out to full size
|
||||
|
||||
zoomer = new SlsQt2DZoomer(canvas());
|
||||
zoomer->SetHist(hist);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
|
||||
panner = new QwtPlotPanner(canvas());
|
||||
panner->setAxisEnabled(QwtPlot::yRight, false);
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
|
||||
// Avoid jumping when labels with more/less digits
|
||||
// appear/disappear when scrolling vertically
|
||||
|
||||
const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
|
||||
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
|
||||
sd->setMinimumExtent( fm.width("100.00") );
|
||||
|
||||
const QColor c(Qt::darkBlue);
|
||||
zoomer->setRubberBandPen(c);
|
||||
zoomer->setTrackerPen(c);
|
||||
}
|
||||
|
||||
/*void SlsQt2DPlot::CompletelyUnZoom(){
|
||||
setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin()));
|
||||
setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin()));
|
||||
zoomer->setZoomBase();
|
||||
//replot();
|
||||
}*/
|
||||
|
||||
void SlsQt2DPlot::UnZoom(){
|
||||
#if QWT_VERSION<0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||
#endif
|
||||
zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
// zoomer->zoom(0);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width));
|
||||
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){
|
||||
hist->SetMinMax(zmin,zmax);
|
||||
}
|
||||
|
||||
|
||||
QwtLinearColorMap* SlsQt2DPlot::myColourMap(QVector<double> colourStops) {
|
||||
|
||||
int ns=5;
|
||||
|
||||
double r[]={0.00, 0.00, 0.87, 1.00, 0.51};
|
||||
double g[]={0.00, 0.81, 1.00, 0.20, 0.00};
|
||||
double b[] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
|
||||
|
||||
QColor c1,c2,c;
|
||||
c1.setRgbF(r[0],g[0],b[0],0);
|
||||
c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]);
|
||||
QwtLinearColorMap* copyMap = new QwtLinearColorMap(Qt::lightGray, c2);
|
||||
|
||||
for (int is=0; is<ns-1; is++) {
|
||||
c.setRgbF(r[is],g[is],b[is]);
|
||||
copyMap->addColorStop(colourStops.value(is),c );
|
||||
}
|
||||
|
||||
return copyMap;
|
||||
|
||||
|
||||
}
|
||||
QwtLinearColorMap* SlsQt2DPlot::myColourMap(int log) {
|
||||
|
||||
int ns=5;
|
||||
|
||||
|
||||
QVector<double> cs1(0);
|
||||
QVector<double> lcs1(0);
|
||||
|
||||
|
||||
cs1.append(0.);
|
||||
cs1.append(0.34);
|
||||
cs1.append(0.61);
|
||||
cs1.append(0.84);
|
||||
cs1.append(1.);
|
||||
if (log) {
|
||||
for (int is=0; is<ns; is++) {
|
||||
lcs1.append((pow(10,2*cs1.value(is))-1)/99.0);
|
||||
}
|
||||
return myColourMap(lcs1);
|
||||
}
|
||||
|
||||
return myColourMap(cs1);
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::Update(){
|
||||
#if QWT_VERSION<0x060000
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
||||
#else
|
||||
if (isLog)
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
||||
|
||||
rightAxis->setColorMap(zInterval,myColourMap(isLog));
|
||||
|
||||
#endif
|
||||
|
||||
if(!zoomer->zoomRectIndex()) UnZoom();
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
|
||||
|
||||
setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(),
|
||||
d_spectrogram->data().range().maxValue());
|
||||
#else
|
||||
|
||||
|
||||
setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue());
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "axis scale set" << endl;
|
||||
#endif
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "layout" << endl;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "going to replot" << endl;
|
||||
#endif
|
||||
replot();
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "done" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SlsQt2DPlot::showContour(bool on){
|
||||
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode,on);
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::showSpectrogram(bool on){
|
||||
// static int io=0;
|
||||
// FillTestPlot(io++);
|
||||
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, on);
|
||||
d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen));
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::InterpolatedPlot(bool on){
|
||||
hist->Interpolate(on);
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::LogZ(bool on){
|
||||
if(on){
|
||||
isLog=1;
|
||||
//if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero();
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLogScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLog);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
#endif
|
||||
}else{
|
||||
isLog=0;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
}
|
||||
Update();
|
||||
|
||||
}
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt2DPlot::DisableZoom(bool disableZoom){
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
else cout<<"Enabling zoom"<<endl;
|
||||
#endif
|
||||
if(disableZoom){
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::NoButton);
|
||||
}else {
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void SlsQt2DPlot::printPlot(){
|
||||
QPrinter printer;
|
||||
printer.setOrientation(QPrinter::Landscape);
|
||||
#if QT_VERSION < 0x040000
|
||||
printer.setColorMode(QPrinter::Color);
|
||||
printer.setOutputFileName("spectrogram.ps");
|
||||
if (printer.setup())
|
||||
#else
|
||||
printer.setOutputFileName("spectrogram.pdf");
|
||||
QPrintDialog dialog(&printer);
|
||||
if ( dialog.exec() )
|
||||
#endif
|
||||
{
|
||||
print(printer);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
239
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
Normal file
@ -0,0 +1,239 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qtoolbutton.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qgridlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <QString>
|
||||
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
the_layout=0;
|
||||
the_plot = new SlsQt2DPlot(this);
|
||||
|
||||
z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2);
|
||||
z_range_ne->setFixedWidth(402);
|
||||
#ifndef IAN
|
||||
zRangeChecked = false;
|
||||
z_range_ne->hide();
|
||||
#endif
|
||||
|
||||
CreateTheButtons();
|
||||
Layout();
|
||||
ConnectSignalsAndSlots();
|
||||
}
|
||||
|
||||
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
|
||||
if(the_layout) delete the_layout;
|
||||
|
||||
|
||||
delete the_plot;
|
||||
delete z_range_ne;
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::CreateTheButtons(){
|
||||
/** Dhanya: All these buttons are already in another class, logz is used and a wrapper around it*/
|
||||
#ifdef IAN
|
||||
btnInterpolate = new QToolButton(this);
|
||||
btnInterpolate->setText("Interpolate");
|
||||
btnInterpolate->setCheckable(true);
|
||||
btnInterpolate->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
|
||||
btnContour = new QToolButton(this);
|
||||
btnContour->setText("Contour");
|
||||
btnContour->setCheckable(true);
|
||||
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif
|
||||
btnLogz = new QToolButton(this);
|
||||
btnLogz->setText("Log Scale (Z)");
|
||||
btnLogz->setCheckable(true);
|
||||
btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#ifndef IAN
|
||||
btnLogz->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::Layout(){
|
||||
if(the_layout) delete the_layout;
|
||||
the_layout = new QGridLayout(this);
|
||||
#ifdef IAN
|
||||
the_layout->addWidget(btnInterpolate,1,1);
|
||||
the_layout->addWidget(btnContour,1,2);
|
||||
the_layout->addWidget(btnLogz,1,3);
|
||||
the_layout->addWidget(the_plot,2,1,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,1,1,3);
|
||||
the_layout->setMargin(12);
|
||||
#else
|
||||
the_layout->addWidget(the_plot,2,0,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,0,1,3);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
#ifndef IAN
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
|
||||
#else
|
||||
connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool)));
|
||||
connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool)));
|
||||
btnInterpolate->setChecked(false);
|
||||
btnContour->setChecked(false);
|
||||
#endif
|
||||
connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange()));
|
||||
connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange()));
|
||||
btnLogz->setChecked(false);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#endif
|
||||
//just reset histogram range before update
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
#ifdef IAN
|
||||
}
|
||||
#endif
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ResetRange(){
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#else
|
||||
if(zRangeChecked){
|
||||
#endif
|
||||
//first time check validity
|
||||
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
|
||||
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
|
||||
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
|
||||
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
|
||||
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
|
||||
|
||||
//set histogram range
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double max){
|
||||
|
||||
if(zmin || zmax) zRangeChecked = true;
|
||||
else zRangeChecked = false;
|
||||
|
||||
if(zmin) z_range_ne->SetNumber(min,0);
|
||||
if(zmax) z_range_ne->SetNumber(max,1);
|
||||
|
||||
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
//finds zmin value from hist
|
||||
if(btnLogz->isChecked())
|
||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
|
||||
if(zRangeChecked){
|
||||
|
||||
//if value not given, take max or min of plot
|
||||
if(zmax) z_range_ne->SetValue(max,0);
|
||||
else z_range_ne->SetValue(the_plot->GetZMaximum(),1);
|
||||
|
||||
if(zmin) z_range_ne->SetValue(min,0);
|
||||
else z_range_ne->SetValue(the_plot->GetZMinimum(),0);
|
||||
|
||||
//check if zmin and zmax is same or not a proper double value
|
||||
//if(zmin && zmax){
|
||||
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
|
||||
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
|
||||
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
|
||||
//}
|
||||
|
||||
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
|
||||
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
|
||||
|
||||
//set histogram range
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
|
||||
}
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
|
||||
#ifndef IAN
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting ZScale to log:"<<yes<<endl;
|
||||
#endif
|
||||
btnLogz->setChecked(yes);
|
||||
#endif
|
||||
the_plot->LogZ(yes);
|
||||
ResetRange();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef IAN
|
||||
void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){
|
||||
#ifdef VERBOSE
|
||||
cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl;
|
||||
#endif
|
||||
z_range_ne->SetNumber(zmin,0);
|
||||
z_range_ne->SetNumber(zmax,1);
|
||||
ResetRange();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::EnableZRange(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Z Range Enable to "<<enable<<endl;
|
||||
#endif
|
||||
zRangeChecked = enable;
|
||||
ResetRange();
|
||||
|
||||
}
|
||||
#endif
|
506
slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx
Normal file
@ -0,0 +1,506 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qinputdialog.h>
|
||||
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <qvalidator.h>
|
||||
|
||||
#include "SlsQtNumberEntry.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent, int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string):QWidget(parent){
|
||||
SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,n_units,units,unit_factors,end_string);
|
||||
}
|
||||
|
||||
//without unit drop box
|
||||
SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type,char* end_string):QWidget(parent){
|
||||
SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,0,0,0,end_string);
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetupNumberEntry(int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string){
|
||||
|
||||
layout = 0;
|
||||
|
||||
check_box = 0;
|
||||
front_text = 0;
|
||||
num_field[0] = 0;
|
||||
spin_box[0] = 0;
|
||||
validator_int[0] = 0;
|
||||
validator_double[0] = 0;
|
||||
middle_text = 0;
|
||||
num_field[1] = 0;
|
||||
spin_box[1] = 0;
|
||||
validator_int[1] = 0;
|
||||
validator_double[1] = 0;
|
||||
unit_cbb = 0;
|
||||
factors = 0;
|
||||
back_text = 0;
|
||||
if(with_checkbox) AddCheckBox();
|
||||
SetFrontText(start_string);
|
||||
|
||||
SetupNumberField(num_type,0);
|
||||
SetMiddleText(middle_string);
|
||||
SetupNumberField(num2_type,1);
|
||||
SetUnits(n_units,units,unit_factors);
|
||||
SetBackText(end_string);
|
||||
|
||||
SetLayout();
|
||||
|
||||
}
|
||||
|
||||
|
||||
SlsQtNumberEntry::~SlsQtNumberEntry(){
|
||||
|
||||
if(check_box) delete check_box;
|
||||
if(front_text) delete front_text;
|
||||
if(middle_text) delete middle_text;
|
||||
if(validator_int[0]) delete validator_int[0];
|
||||
if(validator_double[0]) delete validator_double[0];
|
||||
if(num_field[0]) delete num_field[0];
|
||||
if(spin_box[0]) delete spin_box[0];
|
||||
if(validator_int[1]) delete validator_int[1];
|
||||
if(validator_double[1]) delete validator_double[1];
|
||||
if(num_field[1]) delete num_field[1];
|
||||
if(spin_box[1]) delete spin_box[1];
|
||||
if(unit_cbb) delete unit_cbb;
|
||||
if(factors) delete factors;
|
||||
if(back_text) delete back_text;
|
||||
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::AddCheckBox(){
|
||||
if(check_box) delete check_box;
|
||||
check_box = new QCheckBox(this);
|
||||
connect(check_box,SIGNAL(clicked()),this,SLOT(CheckBoxClicked()));
|
||||
SetLayout();
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetFrontText(char* s) {SetText(s,&front_text); SetLayout();}
|
||||
void SlsQtNumberEntry::SetMiddleText(char* s) {SetText(s,&middle_text); SetLayout();}
|
||||
void SlsQtNumberEntry::SetBackText(char* s) {SetText(s,&back_text); SetLayout();};
|
||||
void SlsQtNumberEntry::SetText(char* s, QLabel** pp){
|
||||
if(*pp){delete *pp; *pp=0;}
|
||||
if(s){
|
||||
*pp = new QLabel(this);
|
||||
(*pp)->setText(s);
|
||||
}
|
||||
SetLayout();
|
||||
}
|
||||
|
||||
|
||||
void SlsQtNumberEntry::SetupNumberField(int type, int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
num_field_enabled[i]=1;
|
||||
if(spin_box[i]) { delete spin_box[i]; spin_box[i]=0;}
|
||||
if(validator_int[i]) { delete validator_int[i]; validator_int[i]=0;}
|
||||
if(validator_double[i]) { delete validator_double[i]; validator_double[i]=0;}
|
||||
if(num_field[i]) { delete num_field[i]; num_field[i]=0;}
|
||||
|
||||
if(type>0&&type<3){
|
||||
num_field[i] = new QLineEdit(this);
|
||||
num_field[i]->setAlignment(Qt::AlignRight);
|
||||
SetMinimumNumberWidth(3,i);
|
||||
if(type==1){
|
||||
validator_int[i] = new SlsQtIntValidator(num_field[i]);
|
||||
num_field[i]->setValidator(validator_int[i]);
|
||||
SetNumber(0,i);
|
||||
}else{
|
||||
validator_double[i] = new SlsQtDoubleValidator(num_field[i]);
|
||||
num_field[i]->setValidator(validator_double[i]);
|
||||
//default settings
|
||||
SetNDecimalsOfDoubleValidator(3,i); //defalut value
|
||||
SetNumber(0,i);
|
||||
}
|
||||
|
||||
num_field[i]->setAlignment(Qt::AlignRight);
|
||||
|
||||
if(i==0){
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshFirstNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(FirstValueEntered()));
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered()));
|
||||
}else{
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshSecondNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(SecondValueEntered()));
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(SecondValueEntered()));
|
||||
}
|
||||
}else if(type==3){
|
||||
spin_box[i] = new QSpinBox();
|
||||
if(i==0) connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(FirstValueEntered()));
|
||||
else connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(SecondValueEntered()));
|
||||
spin_box[i]->setAlignment(Qt::AlignRight);
|
||||
}
|
||||
|
||||
SetLayout();
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetUnits(int n_units, char** units, double* unit_factors){
|
||||
if(unit_cbb){ delete unit_cbb; unit_cbb=0;}
|
||||
if(factors) { delete factors; factors=0;}
|
||||
|
||||
if(n_units>0&&units&&unit_factors){
|
||||
unit_cbb = new QComboBox(this);
|
||||
factors = new double [n_units];
|
||||
|
||||
for(int i=0;i<n_units;i++){
|
||||
unit_cbb->insertItem(i,units[i]);
|
||||
factors[i] = unit_factors[i];
|
||||
}
|
||||
|
||||
connect(unit_cbb,SIGNAL(activated(int)),this,SLOT(UnitSelected()));
|
||||
}
|
||||
|
||||
SetLayout();
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetLayout(){
|
||||
if(layout) delete layout;
|
||||
layout = new QGridLayout(this);
|
||||
|
||||
int i = 0;
|
||||
if(check_box) layout->addWidget(check_box,1,i++);
|
||||
if(front_text) layout->addWidget(front_text,1,i++);
|
||||
if(num_field[0]) layout->addWidget(num_field[0],1,i++);
|
||||
if(spin_box[0]) layout->addWidget(spin_box[0],1,i++);
|
||||
if(middle_text) layout->addWidget(middle_text,1,i++);
|
||||
if(num_field[1]) layout->addWidget(num_field[1],1,i++);
|
||||
if(spin_box[1]) layout->addWidget(spin_box[1],1,i++);
|
||||
if(unit_cbb) layout->addWidget(unit_cbb,1,i++);
|
||||
if(back_text) layout->addWidget(back_text,1,i++);
|
||||
|
||||
CheckBoxClicked();
|
||||
}
|
||||
|
||||
|
||||
void SlsQtNumberEntry::SetMinimumNumberWidth(int nchar_width,int which_number_field){
|
||||
if(num_field[which_number_field]) num_field[which_number_field]
|
||||
->setMinimumWidth(nchar_width*num_field[which_number_field]->minimumSizeHint().width());
|
||||
if(spin_box[which_number_field]) spin_box[which_number_field]
|
||||
->setMinimumWidth(nchar_width*spin_box[which_number_field]->minimumSizeHint().width());
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetNDecimalsOfDoubleValidators(int ndecimals){
|
||||
SetNDecimalsOfDoubleValidator(ndecimals,0);
|
||||
SetNDecimalsOfDoubleValidator(ndecimals,1);
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetNDecimalsOfDoubleValidator(int ndecimals, int which_number_field){
|
||||
//0 -> standard, 1->scientific
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
if(validator_double[i]){
|
||||
validator_double[i]->setDecimals(ndecimals);
|
||||
SetNumber(GetNumber(i),i);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SetMinimumUnitWidth(int nchar_width){
|
||||
if(unit_cbb) unit_cbb->setMinimumWidth(nchar_width*unit_cbb->minimumSizeHint().width());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
double SlsQtNumberEntry::SetNumber(int v,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
if(num_field[i]){
|
||||
if(validator_int[i]){
|
||||
QString s = QString::number(v);
|
||||
validator_int[i]->fixup(s);
|
||||
num_field[i]->setText(s);
|
||||
}
|
||||
if(validator_double[i]){
|
||||
QString s = QString::number(v);
|
||||
validator_double[i]->fixup(s);
|
||||
num_field[i]->setText(s);
|
||||
}
|
||||
}else if(spin_box[i]){
|
||||
spin_box[i]->setValue(v);
|
||||
}else return 0;
|
||||
|
||||
return GetNumber(i);
|
||||
}
|
||||
*/
|
||||
|
||||
double SlsQtNumberEntry::SetNumber(double v,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
if(num_field[i]){
|
||||
if(validator_int[i]){
|
||||
QString s = QString::number(v);
|
||||
validator_int[i]->fixup(s);
|
||||
num_field[i]->setText(s);
|
||||
}
|
||||
if(validator_double[i]){
|
||||
QString s = QString::number(v);
|
||||
//validator_double[i]->fixup(s);//commented out as it ignores the zmax values
|
||||
num_field[i]->setText(s);
|
||||
}
|
||||
}else if(spin_box[i]){
|
||||
spin_box[i]->setValue(round(v));
|
||||
}else return 0;
|
||||
|
||||
return GetNumber(i);
|
||||
}
|
||||
|
||||
|
||||
void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
if(min>max){
|
||||
cout<<"Warning: SetRange(int,int) no effect min > max"<<endl;
|
||||
}else{
|
||||
if(validator_int[i]) validator_int[i]->setRange(min,max);
|
||||
if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals());
|
||||
if(spin_box[i]) spin_box[i]->setRange(min,max);
|
||||
SetNumber(GetNumber(i),i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
if(min>max){
|
||||
cout<<"Warning: SetRange(double,double) no effect min("<<min<<") >= max("<<max<<")"<<endl;
|
||||
}else{
|
||||
if(validator_int[i]) cout<<"Waring can not call SetRange(double,double) with \"int\" type Validator"<<endl;
|
||||
if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals());
|
||||
if(spin_box[i]) spin_box[i]->setRange(min,max);
|
||||
SetNumber(GetNumber(i),i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool SlsQtNumberEntry::CheckBoxState(){
|
||||
if(check_box&&check_box->checkState()) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::CheckBoxClicked(){
|
||||
if(check_box){
|
||||
if(check_box->checkState()) Enable();
|
||||
else Disable();
|
||||
|
||||
emit CheckBoxChanged(check_box->checkState());
|
||||
emit CheckBoxChanged(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::Disable(){ Enable(0); }
|
||||
void SlsQtNumberEntry::Enable(bool en_flag){
|
||||
if(check_box) check_box->setChecked(en_flag);
|
||||
if(front_text) front_text->setEnabled(en_flag);
|
||||
if(num_field[0]) num_field[0]->setEnabled(en_flag&&num_field_enabled[0]);
|
||||
if(spin_box[0]) spin_box[0]->setEnabled(en_flag&&num_field_enabled[0]);
|
||||
if(middle_text) middle_text->setEnabled(en_flag);
|
||||
if(num_field[1]) num_field[1]->setEnabled(en_flag&&num_field_enabled[1]);
|
||||
if(spin_box[1]) spin_box[1]->setEnabled(en_flag&&num_field_enabled[1]);
|
||||
if(unit_cbb) unit_cbb->setEnabled(en_flag);
|
||||
if(back_text) back_text->setEnabled(en_flag);
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::DisableNumberField(int which_number_field){ EnableNumberField(which_number_field,0); }
|
||||
void SlsQtNumberEntry::EnableNumberField(int which_number_field,bool en_flag){
|
||||
if(which_number_field>=0||which_number_field<=1){
|
||||
num_field_enabled[which_number_field]=en_flag;
|
||||
if(num_field[which_number_field]) num_field[which_number_field]->setEnabled(num_field_enabled[which_number_field]);
|
||||
if(spin_box[which_number_field]) spin_box[which_number_field]->setEnabled(num_field_enabled[which_number_field]);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::UnitSelected(){
|
||||
emit UnitChanged(GetComboBoxValue());
|
||||
emit UnitChanged(this);
|
||||
emit AValueChanged(this);
|
||||
emit FirstValueChanged(GetValueInt(0));
|
||||
emit FirstValueChanged(GetValue(0));
|
||||
emit FirstValueChanged(this);
|
||||
emit SecondValueChanged(GetValueInt(1));
|
||||
emit SecondValueChanged(GetValue(1));
|
||||
emit SecondValueChanged(this);
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::RefreshFirstNumberEntry() { RefreshNumberEntery(0);}
|
||||
void SlsQtNumberEntry::RefreshSecondNumberEntry() { RefreshNumberEntery(1);}
|
||||
void SlsQtNumberEntry::RefreshNumberEntery(int which_number_field){
|
||||
//does not apply to spin boxes
|
||||
if(num_field[which_number_field]){
|
||||
SetNumber(GetNumber(which_number_field),which_number_field);
|
||||
}
|
||||
//refreshes the entery in a general format for ints and fixes doubles,
|
||||
//for example removes leading zeros
|
||||
//However, also moves curser position
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::FirstValueEntered(){
|
||||
emit AValueChanged(this);
|
||||
emit FirstValueChanged(GetValue(0));
|
||||
emit FirstValueChanged(GetValueInt(0));
|
||||
emit FirstValueChanged(this);
|
||||
}
|
||||
|
||||
void SlsQtNumberEntry::SecondValueEntered(){
|
||||
emit AValueChanged(this);
|
||||
emit SecondValueChanged(GetValue(1));
|
||||
emit SecondValueChanged(GetValueInt(1));
|
||||
emit SecondValueChanged(this);
|
||||
}
|
||||
|
||||
|
||||
bool SlsQtNumberEntry::Enabled(){
|
||||
if(check_box && !check_box->checkState()) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool SlsQtNumberEntry::IsValueOk(int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
bool ok=0;
|
||||
if(validator_int[i]) num_field[i]->text().toInt(&ok);
|
||||
if(validator_double[i]) num_field[i]->text().toDouble(&ok);
|
||||
if(spin_box[i]) ok=true;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
const char* SlsQtNumberEntry::GetFrontText(){
|
||||
if(front_text) return front_text->text().toStdString().c_str();
|
||||
return 0;
|
||||
}
|
||||
const char* SlsQtNumberEntry::GetMiddleText(){
|
||||
if(middle_text) return middle_text->text().toStdString().c_str();
|
||||
return 0;
|
||||
}
|
||||
const char* SlsQtNumberEntry::GetBackText(){
|
||||
if(back_text) back_text->text().toStdString().c_str();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SlsQtNumberEntry::GetNumberInt(int which_number_field,bool* ok){
|
||||
return round(GetNumber(which_number_field,ok));
|
||||
}
|
||||
|
||||
double SlsQtNumberEntry::GetNumber(int which_number_field,bool* ok){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
if(ok) *ok = 1;
|
||||
|
||||
if(num_field[i]){
|
||||
if(validator_int[i]) return num_field[i]->text().toInt(ok);
|
||||
else return num_field[i]->text().toDouble(ok);
|
||||
}
|
||||
else if(spin_box[i]) return spin_box[i]->value();
|
||||
else {if(ok) *ok=0;}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double SlsQtNumberEntry::SetValue(double v,int which_number_field){
|
||||
if(unit_cbb) SetNumber(round(v/GetComboBoxValue()),which_number_field);
|
||||
else SetNumber(v,which_number_field);
|
||||
|
||||
return GetValue(which_number_field);
|
||||
}
|
||||
|
||||
|
||||
int SlsQtNumberEntry::GetValueInt(int which_number_field,bool* ok){
|
||||
return round(GetValue(which_number_field,ok));
|
||||
}
|
||||
|
||||
double SlsQtNumberEntry::GetValue(int which_number_field,bool* ok){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
|
||||
double v;
|
||||
if(ok) *ok = 1;
|
||||
|
||||
if(num_field[i]){
|
||||
if(validator_int[i]) v = num_field[i]->text().toInt(ok);
|
||||
else v = num_field[i]->text().toDouble(ok);
|
||||
}
|
||||
else if(spin_box[i]) v = spin_box[i]->value();
|
||||
else v = 1; //incase there is only a unit pulldown
|
||||
|
||||
|
||||
if(unit_cbb) v *= GetComboBoxValue();
|
||||
|
||||
if(!num_field[i]&&!spin_box[i]&&!unit_cbb){v=0; if(ok) *ok=0;}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
int SlsQtNumberEntry::SetComboBoxIndex(int index){
|
||||
if(unit_cbb){
|
||||
if(index<0||index>=unit_cbb->count()){
|
||||
cout<<"usage error : can not set combo box index, index out of range."<<endl;
|
||||
}else{
|
||||
unit_cbb->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
else cout<<"usage error : can not set combo box index, no combo box."<<endl;
|
||||
|
||||
return GetComboBoxIndex();
|
||||
}
|
||||
|
||||
int SlsQtNumberEntry::GetComboBoxIndex(){
|
||||
if(unit_cbb) return unit_cbb->currentIndex();
|
||||
|
||||
cout<<"usage error : can not get combo box index, no combo box."<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double SlsQtNumberEntry::GetComboBoxValue(){
|
||||
if(unit_cbb) return factors[unit_cbb->currentIndex()];
|
||||
|
||||
cout<<"usage error : can not get combo box value, no combo box."<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SlsQtNumberEntry::PrintTheValue(){
|
||||
|
||||
cout<<endl<<endl<<"Printing value:"<<endl;
|
||||
|
||||
int n_not_printed = 0;
|
||||
if(validator_int[0])
|
||||
cout<<"The interger value has been changed to: "<<GetValue(0)<<endl;
|
||||
else if(validator_double[0])
|
||||
cout<<"The double value has been changed to: "<<GetValue(0)<<endl;
|
||||
else n_not_printed++;
|
||||
|
||||
if(validator_int[1])
|
||||
cout<<"and the integer value of the second field is: "<<GetValue(1)<<endl;
|
||||
else if(validator_double[1])
|
||||
cout<<"and the double value of the second field is: "<<GetValue(1)<<endl;
|
||||
else n_not_printed++;
|
||||
|
||||
if(unit_cbb){
|
||||
cout<<"ComboBox Status: "<<"Index: index = "<<GetComboBoxIndex()<<", v = "<<GetComboBoxValue()<<endl;
|
||||
}
|
||||
|
||||
|
||||
if(n_not_printed==2) cout<<"The value of the unit box is: "<<GetValue()<<endl;
|
||||
|
||||
}
|
219
slsDetectorGui/src/qActionsWidget.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
/*
|
||||
* qActionsWidget.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
// Qt Project Class Headers
|
||||
#include "qActionsWidget.h"
|
||||
// Qt Include Headers
|
||||
#include <QFileDialog>
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
int qActionsWidget::NUM_ACTION_WIDGETS(0);
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qActionsWidget::qActionsWidget(QWidget *parent,multiSlsDetector*& detector):
|
||||
QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qActionsWidget::~qActionsWidget(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::SetupWidgetWindow(){
|
||||
id = NUM_ACTION_WIDGETS;
|
||||
NUM_ACTION_WIDGETS++;
|
||||
|
||||
setFixedHeight(25);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::Initialization(){
|
||||
//mode
|
||||
connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetMode(int)));
|
||||
//file
|
||||
connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath()));
|
||||
//parameter
|
||||
connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter()));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::SetMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\taction:" << id << "\tmode:" << mode << endl;
|
||||
#endif
|
||||
//enabling/disabling
|
||||
dispScript->setEnabled(mode);
|
||||
btnBrowse->setEnabled(mode);
|
||||
lblParameter->setEnabled(mode);
|
||||
dispParameter->setEnabled(mode);
|
||||
|
||||
QString fName = dispScript->text();
|
||||
//set the mode
|
||||
if(mode) myDet->setActionScript(id,fName.toAscii().constData());
|
||||
else myDet->setActionScript(id,"");
|
||||
//mode is not set when fname is blank
|
||||
|
||||
if(!fName.isEmpty()){
|
||||
//check if mode didnt get set
|
||||
if(mode!=myDet->getActionMode(id)){
|
||||
qDefs::Message(qDefs::WARNING,"The mode could not be changed.","qActionsWidget::SetMode");
|
||||
comboScript->setCurrentIndex(myDet->getActionMode(id));
|
||||
}//if mode got set and its custom script
|
||||
else if(mode){
|
||||
//when the file name did not get set correctly
|
||||
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
|
||||
qDefs::Message(qDefs::WARNING,"The file path could not be set.","qActionsWidget::SetMode");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
SetScriptFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet,"qActionsWidget::SetMode");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qActionsWidget::BrowsePath(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Browsing Script File Path" << endl;
|
||||
#endif
|
||||
QString fName = dispScript->text();
|
||||
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
|
||||
if(dir.isEmpty()) dir = "/home";
|
||||
//dialog
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Script File"),dir,
|
||||
tr("Script Files(*.awk);;All Files(*)"));
|
||||
//if empty, set the file name and it calls setscriptfile, else ignore
|
||||
if (!fName.isEmpty()){
|
||||
dispScript->setText(fName);
|
||||
SetScriptFile();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qActionsWidget::SetScriptFile(){
|
||||
QString fName = dispScript->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\taction:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
bool set = false;
|
||||
struct stat st_buf;
|
||||
|
||||
//blank
|
||||
if(fName.isEmpty())
|
||||
set = true;
|
||||
else if(!fName.compare("none"))
|
||||
set = true;
|
||||
//not blank
|
||||
else{
|
||||
//path doesnt exist
|
||||
if(stat(fName.toAscii().constData(),&st_buf)){
|
||||
qDefs::Message(qDefs::WARNING,"The script file entered does not exist","qActionsWidget::SetScriptFile");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
//if its not a file
|
||||
else if (!S_ISREG (st_buf.st_mode)) {
|
||||
qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","qActionsWidget::SetScriptFile");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
else
|
||||
set=true;
|
||||
}
|
||||
|
||||
|
||||
//if blank or valid file
|
||||
if(set){
|
||||
//scan and positions wouldnt get here
|
||||
myDet->setActionScript(id,fName.toAscii().constData());
|
||||
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
|
||||
//did not get set, write what is was before
|
||||
if(!fName.isEmpty())
|
||||
qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","qActionsWidget::SetScriptFile");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//dont display if theres a none
|
||||
if(!dispScript->text().compare("none")) dispScript->setText("");
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qActionsWidget::SetScriptFile");
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::SetParameter(){
|
||||
QString parameter = dispParameter->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\taction:" << id << "\tparameter:" << parameter.toAscii().constData() << endl;
|
||||
#endif
|
||||
myDet->setActionParameter(id,parameter.toAscii().constData());
|
||||
//dont display if theres a none
|
||||
if(!dispParameter->text().compare("none")) dispParameter->setText("");
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qActionsWidget::SetParameter");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::Refresh(){
|
||||
int mode = (myDet->getActionMode(id)>0?1:0);
|
||||
string script = myDet->getActionScript(id);
|
||||
string parameter = myDet->getActionParameter(id);
|
||||
|
||||
|
||||
//settings values and checking for none
|
||||
if(QString(script.c_str()).compare("none"))
|
||||
dispScript->setText(QString(script.c_str()));
|
||||
if(mode)SetScriptFile();
|
||||
dispParameter->setText(QString(parameter.c_str()));
|
||||
SetParameter();
|
||||
//set mode which also checks everything
|
||||
comboScript->setCurrentIndex(mode);
|
||||
#ifdef VERBOSE
|
||||
cout << "Updated\taction:" << id << "\t"
|
||||
"mode:"<<mode<<"\t"
|
||||
"script:" << script << "\t"
|
||||
"parameter:" << parameter << "\t***" << endl;
|
||||
#endif
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qActionsWidget::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
358
slsDetectorGui/src/qCloneWidget.cpp
Normal file
@ -0,0 +1,358 @@
|
||||
/*
|
||||
* qCloneWidget.cpp
|
||||
*
|
||||
* Created on: May 18, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "qCloneWidget.h"
|
||||
/** Qt Include Headers */
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QFileDialog>
|
||||
#include "qwt_symbol.h"
|
||||
/** C++ Include Headers */
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qCloneWidget::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):
|
||||
QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath)
|
||||
{
|
||||
// Window title
|
||||
char winTitle[300],currTime[50];
|
||||
strcpy(currTime,GetCurrentTimeStamp());
|
||||
sprintf(winTitle,"Snapshot:%d - %s",id,currTime);
|
||||
setWindowTitle(QString(winTitle));
|
||||
|
||||
marker = new QwtSymbol();
|
||||
nomarker = new QwtSymbol();
|
||||
marker->setStyle(QwtSymbol::Cross);
|
||||
marker->setSize(5,5);
|
||||
|
||||
// Set up widget
|
||||
SetupWidgetWindow(title,xTitle, yTitle, zTitle, numDim);
|
||||
DisplayStats(displayStats,min,max,sum);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qCloneWidget::~qCloneWidget(){
|
||||
delete cloneplot1D;
|
||||
delete cloneplot2D;
|
||||
delete cloneBox;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim){
|
||||
|
||||
menubar = new QMenuBar(this);
|
||||
actionSave = new QAction("&Save",this);
|
||||
menubar->addAction(actionSave);
|
||||
setMenuBar(menubar);
|
||||
|
||||
|
||||
//Main Window Layout
|
||||
QWidget *centralWidget = new QWidget(this);
|
||||
mainLayout = new QGridLayout(centralWidget);
|
||||
centralWidget->setLayout(mainLayout);
|
||||
|
||||
//plot group box
|
||||
cloneBox = new QGroupBox(this);
|
||||
gridClone = new QGridLayout(cloneBox);
|
||||
cloneBox->setLayout(gridClone);
|
||||
cloneBox->setContentsMargins(0,0,0,0);
|
||||
cloneBox->setAlignment(Qt::AlignHCenter);
|
||||
cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
cloneBox->setTitle(title);
|
||||
// According to dimensions, create appropriate 1D or 2Dplot
|
||||
if(numDim==1){
|
||||
cloneplot1D = new SlsQt1DPlot(cloneBox);
|
||||
|
||||
cloneplot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
cloneplot1D->SetXTitle(xTitle.toAscii().constData());
|
||||
cloneplot1D->SetYTitle(yTitle.toAscii().constData());
|
||||
|
||||
|
||||
cloneBox->setFlat(false);
|
||||
cloneBox->setContentsMargins(0,30,0,0);
|
||||
gridClone->addWidget(cloneplot1D,0,0);
|
||||
|
||||
lblHistTitle = new QLabel("");
|
||||
mainLayout->addWidget(lblHistTitle,0,0);
|
||||
|
||||
}else{
|
||||
cloneplot2D = new SlsQt2DPlotLayout(cloneBox);
|
||||
cloneplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
cloneplot2D->SetXTitle(xTitle);
|
||||
cloneplot2D->SetYTitle(yTitle);
|
||||
cloneplot2D->SetZTitle(zTitle);
|
||||
cloneplot2D->setAlignment(Qt::AlignLeft);
|
||||
|
||||
cloneBox->setFlat(true);
|
||||
cloneBox->setContentsMargins(0,20,0,0);
|
||||
gridClone->addWidget(cloneplot2D,0,0);
|
||||
}
|
||||
|
||||
// main window widgets
|
||||
mainLayout->addWidget(cloneBox,1,0);
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
// Save
|
||||
connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot()));
|
||||
|
||||
setMinimumHeight(300);
|
||||
resize(500,350);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){
|
||||
//for each plot, create hists
|
||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||
SlsQtH1D* k;
|
||||
if(hist_num+1>cloneplot1D_hists.size()){
|
||||
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num]));
|
||||
k->SetLineColor(0);
|
||||
}else{
|
||||
k=cloneplot1D_hists.at(hist_num);
|
||||
k->SetData(histNBins,histXAxis,histYAxis[hist_num]);
|
||||
}
|
||||
|
||||
|
||||
//style of plot
|
||||
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
||||
else k->setStyle(QwtPlotCurve::Dots);
|
||||
#if QWT_VERSION<0x060000
|
||||
if(markers) k->setSymbol(*marker);
|
||||
else k->setSymbol(*nomarker);
|
||||
#else
|
||||
if(markers) k->setSymbol(marker);
|
||||
else k->setSymbol(nomarker);
|
||||
#endif
|
||||
|
||||
//set title and attach plot
|
||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||
|
||||
k->Attach(cloneplot1D);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){
|
||||
// for each plot create hists
|
||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||
SlsQtH1D* k;
|
||||
if(hist_num+1>cloneplot1D_hists.size()){
|
||||
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis));
|
||||
k->SetLineColor(hist_num+1);
|
||||
}else{
|
||||
k=cloneplot1D_hists.at(hist_num);
|
||||
k->SetData(histNBins,histXAxis,histYAxis);
|
||||
}
|
||||
//style of plot
|
||||
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
||||
else k->setStyle(QwtPlotCurve::Dots);
|
||||
if(markers) {
|
||||
QwtSymbol *marker = new QwtSymbol();
|
||||
marker->setStyle(QwtSymbol::Cross);
|
||||
marker->setSize(5,5);
|
||||
#if QWT_VERSION<0x060000
|
||||
k->setSymbol(*marker);
|
||||
#else
|
||||
k->setSymbol(marker);
|
||||
#endif
|
||||
}else {
|
||||
QwtSymbol *noMarker = new QwtSymbol();
|
||||
#if QWT_VERSION<0x060000
|
||||
k->setSymbol(*noMarker);
|
||||
#else
|
||||
k->setSymbol(noMarker);
|
||||
#endif
|
||||
}
|
||||
//set title and attach plot
|
||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||
k->Attach(cloneplot1D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qCloneWidget::SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d){
|
||||
cloneplot2D->GetPlot()->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d);
|
||||
cloneplot2D->UpdateNKeepSetRangeIfSet();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){
|
||||
double XYCloneRangeValues[4];
|
||||
|
||||
if(!IsXYRange[qDefs::XMINIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMinimum();
|
||||
}else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
|
||||
|
||||
if(!IsXYRange[qDefs::XMAXIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMaximum();
|
||||
}else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM];
|
||||
|
||||
if(!IsXYRange[qDefs::YMINIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMinimum();
|
||||
}else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM];
|
||||
|
||||
if(!IsXYRange[qDefs::YMAXIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMaximum();
|
||||
}else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM];
|
||||
|
||||
if(cloneplot1D){
|
||||
cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]);
|
||||
cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]);
|
||||
}else{
|
||||
cloneplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||
cloneplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||
cloneplot2D->GetPlot()->Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
char* qCloneWidget::GetCurrentTimeStamp(){
|
||||
char output[30];
|
||||
char *result;
|
||||
|
||||
//using sys cmds to get output or str
|
||||
FILE* sysFile = popen("date", "r");
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
|
||||
result = output + 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qCloneWidget::SavePlot(){
|
||||
char cID[10];
|
||||
sprintf(cID,"%d",id);
|
||||
//title
|
||||
QString fName = QString(filePath.c_str());
|
||||
if(cloneBox->title().contains('.')){
|
||||
fName.append(QString('/')+cloneBox->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
//save
|
||||
QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
cloneBox->render(&painter);
|
||||
|
||||
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly);
|
||||
if (!fName.isEmpty())
|
||||
if((img.save(fName)))
|
||||
qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","qCloneWidget::SavePlot");
|
||||
else
|
||||
qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n"
|
||||
"Formats: .png, .jpg, .xpm.","qCloneWidget::SavePlot");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qCloneWidget::SavePlotAutomatic(){
|
||||
char cID[10];
|
||||
sprintf(cID,"%d",id);
|
||||
//title
|
||||
QString fName = QString(filePath.c_str());
|
||||
if(cloneBox->title().contains('.')){
|
||||
fName.append(QString('/')+cloneBox->title());
|
||||
fName.replace(".dat",".png");
|
||||
fName.replace(".raw",".png");
|
||||
}else fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
cout<<"fname:"<<fName.toAscii().constData()<<endl;
|
||||
//save
|
||||
QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
cloneBox->render(&painter);
|
||||
if(img.save(fName))
|
||||
return 0;
|
||||
else return -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qCloneWidget::closeEvent(QCloseEvent* event){
|
||||
emit CloneClosedSignal(id);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum){
|
||||
if(enable){
|
||||
QWidget *widgetStatistics = new QWidget(this);
|
||||
widgetStatistics->setFixedHeight(15);
|
||||
QHBoxLayout *hl1 = new QHBoxLayout;
|
||||
hl1->setSpacing(0);
|
||||
hl1->setContentsMargins(0, 0, 0, 0);
|
||||
QLabel *lblMin = new QLabel("Min: ");
|
||||
lblMin->setFixedWidth(40);
|
||||
lblMin->setAlignment(Qt::AlignRight);
|
||||
QLabel *lblMax = new QLabel("Max: ");
|
||||
lblMax->setFixedWidth(40);
|
||||
lblMax->setAlignment(Qt::AlignRight);
|
||||
QLabel *lblSum = new QLabel("Sum: ");
|
||||
lblSum->setFixedWidth(40);
|
||||
lblSum->setAlignment(Qt::AlignRight);
|
||||
QLabel *lblMinDisp = new QLabel(min);
|
||||
lblMinDisp->setAlignment(Qt::AlignLeft);
|
||||
QLabel *lblMaxDisp = new QLabel(max);
|
||||
lblMaxDisp->setAlignment(Qt::AlignLeft);
|
||||
QLabel *lblSumDisp = new QLabel(sum);
|
||||
lblSumDisp->setAlignment(Qt::AlignLeft);
|
||||
hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
hl1->addWidget(lblMin);
|
||||
hl1->addWidget(lblMinDisp);
|
||||
hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed));
|
||||
hl1->addWidget(lblMax);
|
||||
hl1->addWidget(lblMaxDisp);
|
||||
hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed));
|
||||
hl1->addWidget(lblSum);
|
||||
hl1->addWidget(lblSumDisp);
|
||||
hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
widgetStatistics->setLayout(hl1);
|
||||
mainLayout->addWidget(widgetStatistics,2,0);
|
||||
widgetStatistics->show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
889
slsDetectorGui/src/qDetectorMain.cpp
Normal file
@ -0,0 +1,889 @@
|
||||
/**********************************************************************
|
||||
* TO DO
|
||||
* 1. settcpsocket is done with slsdetector.maybe do for all detectors connected: mythen
|
||||
* ********************************************************************/
|
||||
// Qt Project Class Headers
|
||||
#include "qDetectorMain.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabActions.h"
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qTabSettings.h"
|
||||
#include "qTabDebugging.h"
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qTabMessages.h"
|
||||
#include "qServer.h"
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "gitInfoGui.h"
|
||||
// Qt Include Headers
|
||||
#include <QSizePolicy>
|
||||
#include <QFileDialog>
|
||||
#include <QPlastiqueStyle>
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
#include <string>
|
||||
#include <getopt.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
// QApplication *theApp = new QApplication(argc, argv);
|
||||
theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows
|
||||
theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" ));
|
||||
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),myDet(0),detID(0),myPlot(0),tabs(0),isDeveloper(0){
|
||||
// bool found;
|
||||
int c;
|
||||
string configFName = "";
|
||||
optind=1;
|
||||
// Getting all the command line arguments
|
||||
while(1) {
|
||||
static struct option long_options[] = {
|
||||
{ "developer", no_argument, 0, 'd' },
|
||||
{ "config", required_argument, 0, 'f' },
|
||||
{ "id", required_argument, 0, 'i' },
|
||||
{ "f", required_argument, 0, 'f' },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
c = getopt_long (argc, argv, "hdf:i:", long_options, NULL);
|
||||
if (c == -1) break;
|
||||
|
||||
switch (c) {
|
||||
case 'd' :
|
||||
isDeveloper=1;
|
||||
break;
|
||||
case 'f' :
|
||||
configFName=string(optarg);
|
||||
break;
|
||||
case 'i' :
|
||||
detID=atoi(optarg);
|
||||
break;
|
||||
case 'h' :
|
||||
default:
|
||||
cout << endl;
|
||||
cout << "\t" << argv[0] << " [ARGUMENT]..." << endl;
|
||||
cout << endl;
|
||||
cout << "Possible Arguments are:" << endl;
|
||||
cout << "\t-d, --developer \t\t : \t Enables the developer tab" << endl;
|
||||
cout << "\t-f, --f, --config fname\t\t : \t Loads config file fname" << endl;
|
||||
cout << "\t-i, --id NUMBER \t\t : \t Sets the multi detector id to NUMBER (the default is 0). "
|
||||
"Required only when more than one multi detector object is needed." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if (optind < argc) {
|
||||
cout << "invalid option, try --help" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
/*
|
||||
for(int iarg=1; iarg<argc; iarg++){
|
||||
found = false;
|
||||
if(!strcasecmp(argv[iarg],"--developer")) {isDeveloper=1;found = true;}
|
||||
if((!strcasecmp(argv[iarg],"--id")) && (iarg+1 < argc)) {detID=atoi(argv[iarg+1]);iarg++;found = true;}
|
||||
if((!strcasecmp(argv[iarg],"--config")) && (iarg+1 < argc)) {configFName=string(argv[iarg+1]);iarg++;found = true;}
|
||||
if((!strcasecmp(argv[iarg],"--f")) && (iarg+1 < argc)) {configFName=string(argv[iarg+1]);iarg++;found = true;}
|
||||
if(!found){
|
||||
cout << "Possible Arguments are:" << endl;
|
||||
cout << "--developer \t\t : \t Enables the developer tab" << endl;
|
||||
cout << "--f [fname]\t\t : \t Loads config file fname" << endl;
|
||||
cout << "--config [fname]\t : \t Loads config file fname" << endl;
|
||||
cout << "--id [i] \t\t : \t Sets the multi detector id to i (the default is 0). "
|
||||
"Required only when more than one multi detector object is needed." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
setupUi(this);
|
||||
SetUpDetector(configFName);
|
||||
SetUpWidgetWindow();
|
||||
Initialization();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qDetectorMain::~qDetectorMain(){
|
||||
if(myDet) delete myDet;
|
||||
if (menubar) delete menubar;
|
||||
if (centralwidget) delete centralwidget;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow(){
|
||||
|
||||
// Layout
|
||||
layoutTabs= new QGridLayout;
|
||||
centralwidget->setLayout(layoutTabs);
|
||||
|
||||
//plot setup
|
||||
myPlot = new qDrawPlot(dockWidgetPlot,myDet); cout<<"DockPlot ready"<<endl;
|
||||
dockWidgetPlot->setWidget(myPlot);
|
||||
|
||||
//tabs setup
|
||||
tabs = new MyTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
|
||||
|
||||
// creating all the other tab widgets
|
||||
tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<<endl;
|
||||
tab_dataoutput = new qTabDataOutput (this, myDet); cout<<"DataOutput ready"<<endl;
|
||||
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
|
||||
tab_actions = new qTabActions (this, myDet); cout<<"Actions ready"<<endl;
|
||||
tab_settings = new qTabSettings (this, myDet); cout<<"Settings ready"<<endl;
|
||||
tab_advanced = new qTabAdvanced (this, myDet,myPlot); cout<<"Advanced ready"<<endl;
|
||||
tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<<endl;
|
||||
tab_developer = new qTabDeveloper (this, myDet); cout<<"Developer ready"<<endl;
|
||||
|
||||
myServer = new qServer(this); cout<<"Client Server ready"<<endl;
|
||||
|
||||
// creating the scroll area widgets for the tabs
|
||||
for(int i=0;i<NumberOfTabs;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[Settings] ->setWidget(tab_settings);
|
||||
scroll[Advanced] ->setWidget(tab_advanced);
|
||||
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(Settings, scroll[Settings], "Settings");
|
||||
tabs->insertTab(Advanced, scroll[Advanced], "Advanced");
|
||||
tabs->insertTab(Debugging, scroll[Debugging], "Debugging");
|
||||
tabs->insertTab(Developer, scroll[Developer], "Developer");
|
||||
//no scroll buttons this way
|
||||
tabs->insertTab(Messages, tab_messages, "Messages");
|
||||
|
||||
//swap tabs so that messages is last tab
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_measurement), Measurement);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_settings), Settings);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_dataoutput), DataOutput);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_plot), Plot);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_actions), Actions);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_advanced), Advanced);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_debugging), Debugging);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_developer), Developer);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tab_messages), Messages);
|
||||
tabs->setCurrentIndex(Measurement);
|
||||
|
||||
//other tab properties
|
||||
// Default tab color
|
||||
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
|
||||
//Set the current tab(measurement) to blue as it is the current one
|
||||
tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255));
|
||||
// increase the width so it uses all the empty space for the tab titles
|
||||
tabs->tabBar()->setFixedWidth(width()+61);
|
||||
|
||||
// mode setup - to set up the tabs initially as disabled, not in form so done here
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Debug Mode to 0\nSetting Expert Mode to 0\nSetting Developer Mode to " << isDeveloper << "\nSetting Dockable Mode to false\n" << endl;
|
||||
#endif
|
||||
tabs->setTabEnabled(Debugging,false);
|
||||
tabs->setTabEnabled(Advanced,false);
|
||||
tabs->setTabEnabled(Developer,isDeveloper);
|
||||
actionLoadTrimbits->setVisible(false);
|
||||
actionSaveTrimbits->setVisible(false);
|
||||
actionLoadCalibration->setVisible(false);
|
||||
actionSaveCalibration->setVisible(false);
|
||||
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
|
||||
// Other setup
|
||||
//Height of plot and central widget
|
||||
heightPlotWindow = dockWidgetPlot->size().height();
|
||||
heightCentralWidget = centralwidget->size().height();
|
||||
// Default zoom Tool Tip
|
||||
zoomToolTip = dockWidgetPlot->toolTip();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::SetUpDetector(const string fName){
|
||||
|
||||
|
||||
//instantiate detector and set window title
|
||||
myDet = new multiSlsDetector(detID);
|
||||
|
||||
//create messages tab to capture config file loading logs
|
||||
tab_messages = new qTabMessages (this); cout<<"Messages ready"<<endl;
|
||||
|
||||
//loads the config file at startup
|
||||
if(!fName.empty()) LoadConfigFile(fName);
|
||||
|
||||
//gets the hostname if it worked
|
||||
string host = myDet->getHostname();
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
|
||||
|
||||
//if hostname doesnt exist even in shared memory
|
||||
if(!host.length()){
|
||||
cout << endl << "No Detector Connected." << endl;
|
||||
qDefs::Message(qDefs::CRITICAL,"No Detectors Connected. ","qDetectorMain::SetUpDetector");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//check if the detector is not even connected
|
||||
string offline = myDet->checkOnline();
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
|
||||
|
||||
if(!offline.empty()){
|
||||
qDefs::Message(qDefs::CRITICAL,string("<nobr>The detector(s) <b>")+offline+string(" </b> is/are not connected. Exiting GUI.</nobr>"),"qDetectorMain::SetUpDetector");
|
||||
cout << "The detector(s) " << host << " is/are not connected. Exiting GUI." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Check if type valid. If not, exit
|
||||
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
|
||||
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN: break;
|
||||
case slsDetectorDefs::EIGER: break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::AGIPD:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings");
|
||||
break;
|
||||
default:
|
||||
string detName = myDet->slsDetectorBase::getDetectorType(detType);
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
|
||||
cout << "ERROR: " + host + " has unknown detector type \"" + detName + "\". Exiting GUI." << endl;
|
||||
string errorMess = host+string(" has unknown detector type \"")+
|
||||
detName+string("\". Exiting GUI.");
|
||||
qDefs::Message(qDefs::CRITICAL,errorMess,"qDetectorMain::SetUpDetector");
|
||||
exit(-1);
|
||||
}
|
||||
setWindowTitle("SLS Detector GUI : "+
|
||||
QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str()));
|
||||
//#ifdef VERBOSE
|
||||
cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl;
|
||||
//#endif
|
||||
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::Initialization(){
|
||||
// Dockable Plot
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
|
||||
// tabs
|
||||
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
||||
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
|
||||
// Data Output Tab
|
||||
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
|
||||
//enable scanbox( for angles)
|
||||
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_plot,SLOT(EnableScanBox()));
|
||||
// Plot tab
|
||||
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||
// Actions tab (only for scan)
|
||||
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
|
||||
//settings to advanced tab(int is always 0 to only refresh)
|
||||
connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int)));
|
||||
// Plotting
|
||||
// When the acquisition is finished, must update the meas tab
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
||||
//This should not be called as it will change file name to measurement when run finished
|
||||
//connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
|
||||
|
||||
|
||||
// menubar
|
||||
// Modes Menu
|
||||
connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
|
||||
// Utilities Menu
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*)));
|
||||
// Help Menu
|
||||
connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*)));
|
||||
|
||||
|
||||
//server
|
||||
connect(myServer, SIGNAL(ServerStoppedSignal()), this,SLOT(UncheckServer()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::LoadConfigFile(const string fName){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading config file at start up:" << fName << endl;
|
||||
#endif
|
||||
struct stat st_buf;
|
||||
QString file = QString(fName.c_str());
|
||||
|
||||
//path doesnt exist
|
||||
if(stat(fName.c_str(),&st_buf))
|
||||
qDefs::Message(qDefs::WARNING,string("<nobr>Start up configuration failed to load. The following file does not exist:</nobr><br><nobr>")+fName,"qDetectorMain::LoadConfigFile");
|
||||
|
||||
//not a file
|
||||
else if (!S_ISREG (st_buf.st_mode))
|
||||
qDefs::Message(qDefs::WARNING,string("<nobr>Start up configuration failed to load. The following file is not a recognized file format:</nobr><br><nobr>")+fName,"qDetectorMain::LoadConfigFile");
|
||||
|
||||
else{
|
||||
//could not load config file
|
||||
if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::WARNING,string("<nobr>Could not load all the Configuration Parameters from file:<br>")+fName,"qDetectorMain::LoadConfigFile");
|
||||
//successful
|
||||
else
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","qDetectorMain::LoadConfigFile");
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::LoadConfigFile");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::EnableModes(QAction *action){
|
||||
bool enable;
|
||||
|
||||
//listen to gui client
|
||||
if(action==actionListenGuiClient){
|
||||
|
||||
myServer->StartStopServer(actionListenGuiClient->isChecked());
|
||||
|
||||
//disconnect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
|
||||
//actionListenGuiClient->setChecked(myServer->StartStopServer(actionListenGuiClient->isChecked()));
|
||||
//connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
|
||||
}
|
||||
//Set DebugMode
|
||||
else if(action==actionDebug){
|
||||
enable = actionDebug->isChecked();
|
||||
tabs->setTabEnabled(Debugging,enable);
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Debug Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//Set ExpertMode(comes here only if its a digital detector)
|
||||
else if(action==actionExpert){
|
||||
enable = actionExpert->isChecked();
|
||||
|
||||
tabs->setTabEnabled(Advanced,enable);
|
||||
actionLoadTrimbits->setVisible(enable);
|
||||
actionSaveTrimbits->setVisible(enable);
|
||||
actionLoadCalibration->setVisible(enable);
|
||||
actionSaveCalibration->setVisible(enable);
|
||||
tab_measurement->SetExpertMode(enable);
|
||||
tab_settings->SetExpertMode(enable);
|
||||
tab_dataoutput->SetExpertMode(enable);
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Expert Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//Set DockableMode
|
||||
else{
|
||||
enable = actionDockable->isChecked();
|
||||
if(enable)
|
||||
dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable);
|
||||
else{
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Dockable Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
bool refreshTabs = false;
|
||||
if(action==actionOpenSetup){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Setup" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Detector Setup"),fName,
|
||||
tr("Detector Setup files (*.det);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||
qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","qDetectorMain::ExecuteUtilities");
|
||||
refreshTabs=true;
|
||||
}else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
else if(action==actionSaveSetup){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Setup" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Setup"),fName,
|
||||
tr("Detector Setup files (*.det);;All Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
else if(action==actionOpenConfiguration){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Configuration" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Detector Configuration"),fName,
|
||||
tr("Configuration files (*.config);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||
qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","qDetectorMain::ExecuteUtilities");
|
||||
refreshTabs=true;
|
||||
}else qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
else if(action==actionSaveConfiguration){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Configuration" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Configuration"),fName,
|
||||
tr("Configuration files (*.config) ;;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
else if(action==actionLoadTrimbits){
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
//gotthard
|
||||
if(actionLoadTrimbits->text().contains("Settings")){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Settings" << endl;
|
||||
#endif
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Detector Settings"),fName,
|
||||
tr("Settings files (*.settings settings.sn*);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
|
||||
}//mythen and eiger
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Trimbits" << endl;
|
||||
#endif
|
||||
//so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(this,
|
||||
tr("Load Detector Trimbits"),fName,
|
||||
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||
fileDialog->setFileMode(QFileDialog::AnyFile );
|
||||
if ( fileDialog->exec() == QDialog::Accepted )
|
||||
fName = fileDialog->selectedFiles()[0];
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(action==actionSaveTrimbits){
|
||||
//gotthard
|
||||
if(actionLoadTrimbits->text().contains("Settings")){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Settings" << endl;
|
||||
#endif
|
||||
//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Settings"),fName,
|
||||
tr("Settings files (*.settings settings.sn*);;All Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}//mythen and eiger
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Trimbits" << endl;
|
||||
#endif//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Trimbits"),fName,
|
||||
tr("Trimbit files (*.trim noise.sn*) ;;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(action==actionLoadCalibration){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Calibration Data" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getCalDir());
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
|
||||
//so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(this,
|
||||
tr("Load Detector Calibration Data"),fName,
|
||||
tr("Calibration files (*.cal calibration.sn*);;All Files(*)"));
|
||||
fileDialog->setFileMode(QFileDialog::AnyFile );
|
||||
if ( fileDialog->exec() == QDialog::Accepted )
|
||||
fName = fileDialog->selectedFiles()[0];
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
else if(action==actionSaveCalibration){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Calibration Data" << endl;
|
||||
#endif//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getCalDir());
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Calibration Data"),fName,
|
||||
tr("Calibration files (*.cal calibration.sn*);;All Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","qDetectorMain::ExecuteUtilities");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities");
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
}
|
||||
}
|
||||
|
||||
Refresh(tabs->currentIndex());
|
||||
if(refreshTabs){
|
||||
tab_actions->Refresh();
|
||||
tab_measurement->Refresh();
|
||||
tab_settings->Refresh();
|
||||
tab_dataoutput->Refresh();
|
||||
if(tab_advanced->isEnabled()) tab_advanced->Refresh();
|
||||
if(tab_debugging->isEnabled()) tab_debugging->Refresh();
|
||||
if(tab_developer->isEnabled()) tab_developer->Refresh();
|
||||
|
||||
tab_plot->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::ExecuteHelp(QAction *action){
|
||||
if(action==actionAbout){
|
||||
#ifdef VERBOSE
|
||||
cout << "About: Common GUI for Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix detectors" << endl;
|
||||
#endif
|
||||
char version[200];
|
||||
int64_t retval= SVNREV;
|
||||
retval= (retval <<32) | SVNDATE;
|
||||
sprintf(version,"%llx",retval);
|
||||
string thisGUIVersion = string(version);
|
||||
|
||||
sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteHelp");
|
||||
string thisClientVersion = string(version);
|
||||
|
||||
//<h1 style="font-family:verdana;">A heading</h1>
|
||||
qDefs::Message(qDefs::INFORMATION,"<p style=\"font-family:verdana;\">"
|
||||
"SLS Detector GUI version: " + thisGUIVersion+"<br>"
|
||||
"SLS Detector Client version: "+thisClientVersion+"<br><br>"
|
||||
"Common GUI to control the SLS Detectors: "
|
||||
"Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix.<br><br>"
|
||||
"It can be operated in parallel with the command line interface:<br>"
|
||||
"sls_detector_put,<br>sls_detector_get,<br>sls_detector_acquire and<br>sls_detector_help.<br><br>"
|
||||
"The GUI Software is still in progress. "
|
||||
"Please report bugs to dhanya.maliakal@psi.ch or anna.bergamaschi@psi.ch.<\\p>","qDetectorMain::ExecuteHelp");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::Refresh(int index){
|
||||
if(!tabs->isTabEnabled(index))
|
||||
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
|
||||
else{
|
||||
switch(tabs->currentIndex()){
|
||||
case Measurement: tab_measurement->Refresh(); break;
|
||||
case Settings: tab_settings->Refresh(); break;
|
||||
case DataOutput: tab_dataoutput->Refresh(); break;
|
||||
case Plot: tab_plot->Refresh(); break;
|
||||
case Actions: tab_actions->Refresh(); break;
|
||||
case Advanced: tab_advanced->Refresh(); break;
|
||||
case Debugging: tab_debugging->Refresh(); break;
|
||||
case Developer: tab_developer->Refresh(); break;
|
||||
case Messages: break;
|
||||
}
|
||||
}
|
||||
for(int i=0;i<NumberOfTabs;i++)
|
||||
tabs->tabBar()->setTabTextColor(i,defaultTabColor);
|
||||
tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::ResizeMainWindow(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout << "Resizing Main Window: height:" << height() << endl;
|
||||
#endif
|
||||
// undocked from the main window
|
||||
if(b){
|
||||
// sets the main window height to a smaller maximum to get rid of space
|
||||
setMaximumHeight(height()-heightPlotWindow-9);
|
||||
dockWidgetPlot->setMinimumHeight(0);
|
||||
cout << "undocking it from main window" << endl;
|
||||
}
|
||||
else{
|
||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
// the minimum for plot will be set when the widget gets resized automatically
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::resizeEvent(QResizeEvent* event){
|
||||
if(!dockWidgetPlot->isFloating()){
|
||||
if(tabs->currentIndex()== Actions){
|
||||
dockWidgetPlot->setMinimumHeight(heightPlotWindow-100);
|
||||
centralwidget->setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
|
||||
}
|
||||
else{
|
||||
dockWidgetPlot->setMinimumHeight(height()-centralwidget->height()-50);
|
||||
centralwidget->setMaximumHeight(heightCentralWidget);
|
||||
}
|
||||
}
|
||||
|
||||
//adjusting tab width
|
||||
if(width()>=800){ tabs->tabBar()->setFixedWidth(width()+61);}
|
||||
else { tabs->tabBar()->setMinimumWidth(0);
|
||||
tabs->tabBar()->setExpanding(true);
|
||||
tabs->tabBar()->setUsesScrollButtons(true);
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::EnableTabs(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering EnableTabs function" << endl;
|
||||
#endif
|
||||
bool enable;
|
||||
enable=!(tabs->isTabEnabled(DataOutput));
|
||||
|
||||
// or use the Enable/Disable button
|
||||
// normal tabs
|
||||
tabs->setTabEnabled(DataOutput,enable);
|
||||
tabs->setTabEnabled(Actions,enable);
|
||||
tabs->setTabEnabled(Settings,enable);
|
||||
tabs->setTabEnabled(Messages,enable);
|
||||
|
||||
//actions check
|
||||
actionOpenSetup->setEnabled(enable);
|
||||
actionSaveSetup->setEnabled(enable);
|
||||
actionOpenConfiguration->setEnabled(enable);
|
||||
actionSaveConfiguration->setEnabled(enable);
|
||||
actionMeasurementWizard->setEnabled(enable);
|
||||
actionDebug->setEnabled(enable);
|
||||
actionExpert->setEnabled(enable);
|
||||
|
||||
|
||||
// special tabs
|
||||
tabs->setTabEnabled(Debugging,enable && (actionDebug->isChecked()));
|
||||
tabs->setTabEnabled(Developer,enable && isDeveloper);
|
||||
//expert
|
||||
bool expertTab = enable && (actionExpert->isChecked());
|
||||
tabs->setTabEnabled(Advanced,expertTab);
|
||||
actionLoadTrimbits->setVisible(expertTab);
|
||||
actionSaveTrimbits->setVisible(expertTab);
|
||||
actionLoadCalibration->setVisible(expertTab);
|
||||
actionSaveCalibration->setVisible(expertTab);
|
||||
|
||||
|
||||
//moved to here, so that its all in order, instead of signals and different threads
|
||||
if(!enable) {
|
||||
//refresh all the required tabs
|
||||
tab_actions->Refresh();// angular, positions,
|
||||
|
||||
//too slow to refresh
|
||||
/*tab_measurement->Refresh();*/
|
||||
|
||||
tab_settings->Refresh();
|
||||
tab_dataoutput->Refresh();
|
||||
if(tab_advanced->isEnabled()) tab_advanced->Refresh();
|
||||
if(tab_debugging->isEnabled()) tab_debugging->Refresh();
|
||||
if(tab_developer->isEnabled()) tab_developer->Refresh();
|
||||
|
||||
tab_plot->Refresh();
|
||||
|
||||
//stop the adc timer in gotthard
|
||||
if(isDeveloper)
|
||||
tab_developer->StopADCTimer();
|
||||
//set the plot type first(acccss shared memory)
|
||||
tab_plot->SetScanArgument();
|
||||
//sets running to true
|
||||
myPlot->StartStopDaqToggle();
|
||||
}
|
||||
else{//to enable scan box
|
||||
tab_plot->Refresh();
|
||||
//to start adc timer
|
||||
if(tab_developer->isEnabled())
|
||||
tab_developer->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::SetZoomToolTip(bool disable){
|
||||
if(disable)
|
||||
dockWidgetPlot->setToolTip("<span style=\" color:#00007f;\">To Enable mouse-controlled zooming capabilities,\ndisable min and max for all axes.<span> ");
|
||||
else
|
||||
dockWidgetPlot->setToolTip(zoomToolTip);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qDetectorMain::StartStopAcquisitionFromClient(bool start){
|
||||
#ifdef VERBOSE
|
||||
cout << "Start/Stop Acquisition From Client:" << start << endl;
|
||||
#endif
|
||||
|
||||
if (tab_measurement->GetStartStatus() != start){
|
||||
if(start){
|
||||
if(!myPlot->isRunning()){
|
||||
//refresh all the required tabs - all these are done in button click anyway
|
||||
/* tab_actions->Refresh();
|
||||
//too slow to refresh
|
||||
//tab_measurement->Refresh();
|
||||
tab_settings->Refresh();
|
||||
tab_dataoutput->Refresh();
|
||||
if(tab_advanced->isEnabled()) tab_advanced->Refresh();
|
||||
if(tab_debugging->isEnabled()) tab_debugging->Refresh();
|
||||
if(tab_developer->isEnabled()) tab_developer->Refresh();
|
||||
|
||||
tab_plot->Refresh();*/
|
||||
}
|
||||
}
|
||||
//click start/stop
|
||||
tab_measurement->ClickStartStop();
|
||||
while(myPlot->GetClientInitiated());
|
||||
}
|
||||
|
||||
return slsDetectorDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDetectorMain::UncheckServer(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Unchecking Mode : Listen to Gui Client" << endl;
|
||||
#endif
|
||||
disconnect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
|
||||
actionListenGuiClient->setChecked(false);
|
||||
connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool qDetectorMain::isCurrentlyTabDeveloper(){
|
||||
return (tabs->currentIndex()==Developer);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
2037
slsDetectorGui/src/qDrawPlot.cpp
Normal file
1247
slsDetectorGui/src/qScanWidget.cpp
Normal file
427
slsDetectorGui/src/qServer.cpp
Normal file
@ -0,0 +1,427 @@
|
||||
/*
|
||||
* qServer.cpp
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
// Qt Project Class Headers
|
||||
#include "qServer.h"
|
||||
#include "qDetectorMain.h"
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "MySocketTCP.h"
|
||||
// C++ Include Headers
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::gui_server_thread_running(0);
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qServer::qServer(qDetectorMain *t):
|
||||
myMainTab(t), mySocket(NULL),myStopSocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0),checkStarted(0),checkStopStarted(0){
|
||||
strcpy(mess,"");
|
||||
FunctionTable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qServer::~qServer(){
|
||||
delete myMainTab;
|
||||
if(mySocket) delete mySocket;
|
||||
if(myStopSocket) delete myStopSocket;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::FunctionTable(){
|
||||
|
||||
flist[F_GET_RUN_STATUS] = &qServer::GetStatus;
|
||||
flist[F_START_ACQUISITION] = &qServer::StartAcquisition;
|
||||
flist[F_STOP_ACQUISITION] = &qServer::StopsAcquisition;
|
||||
flist[F_START_AND_READ_ALL] = &qServer::Acquire;
|
||||
flist[F_EXIT_SERVER] = &qServer::ExitServer;
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::DecodeFunction(MySocketTCP* sock){
|
||||
int ret = qDefs::FAIL;
|
||||
int n,fnum;
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "receive data" << endl;
|
||||
#endif
|
||||
n = sock->ReceiveDataOnly(&fnum,sizeof(fnum));
|
||||
if (n <= 0) {
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "ERROR reading from socket " << n << ", " << fnum << endl;
|
||||
#endif
|
||||
return qDefs::FAIL;
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
cout << "size of data received " << n <<endl;
|
||||
#endif
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "calling function fnum = "<< fnum << hex << ":"<< flist[fnum] << endl;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (((sock == myStopSocket) && ((fnum == F_GET_RUN_STATUS) || (fnum == F_STOP_ACQUISITION) || (fnum == F_EXIT_SERVER))) ||
|
||||
((sock == mySocket) && ((fnum == F_START_ACQUISITION) || (fnum == F_START_AND_READ_ALL))))
|
||||
;
|
||||
//unrecognized functions exit guis
|
||||
else{
|
||||
ret = qDefs::FAIL;
|
||||
sprintf(mess,"Unrecognized Function\n");
|
||||
cout << mess << endl;
|
||||
|
||||
if (mySocket)
|
||||
mySocket->ShutDownSocket();
|
||||
|
||||
myStopSocket->SendDataOnly(&ret,sizeof(ret));
|
||||
myStopSocket->SendDataOnly(mess,sizeof(mess));
|
||||
return GOODBYE;
|
||||
}
|
||||
|
||||
|
||||
//calling function
|
||||
ret = (this->*flist[fnum])();
|
||||
if (ret==qDefs::FAIL)
|
||||
cout << "Error executing the function = " << fnum << endl;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::ExitServer(){
|
||||
|
||||
int ret = OK;
|
||||
strcpy(mess," Gui Server closed successfully\n");
|
||||
|
||||
if(mySocket)
|
||||
mySocket->ShutDownSocket();
|
||||
|
||||
myStopSocket->SendDataOnly(&ret,sizeof(ret));
|
||||
myStopSocket->SendDataOnly(mess,sizeof(mess));
|
||||
cout << mess << endl;
|
||||
|
||||
return GOODBYE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int qServer::StartStopServer(int start){
|
||||
|
||||
//start server
|
||||
if(start){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "Starting Gui Server" << endl;
|
||||
#endif
|
||||
|
||||
if(!gui_server_thread_running){
|
||||
gui_server_thread_running=1;
|
||||
|
||||
|
||||
//error creating thread
|
||||
checkStarted=1;
|
||||
if (pthread_create(&gui_server_thread, NULL,StartServerThread, (void*) this)){
|
||||
gui_server_thread_running=0;
|
||||
qDefs::Message(qDefs::WARNING,"Can't create gui server thread", "qServer::StartStopServer");
|
||||
cout << "ERROR: Can't create gui server thread" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
while(checkStarted);
|
||||
checkStarted = 0;
|
||||
#ifdef VERBOSE
|
||||
if(gui_server_thread_running)
|
||||
cout << "Server thread created successfully." << endl;
|
||||
#endif
|
||||
|
||||
|
||||
//error creating thread
|
||||
checkStopStarted=1;
|
||||
if (pthread_create(&gui_stop_server_thread, NULL,StopServerThread, (void*) this)){
|
||||
gui_server_thread_running=0;
|
||||
qDefs::Message(qDefs::WARNING,"Can't create gui stop server thread", "qServer::StartStopServer");
|
||||
cout << "ERROR: Can't create gui stop server thread" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
while(checkStopStarted);
|
||||
checkStopStarted=0;
|
||||
#ifdef VERBOSE
|
||||
if(gui_server_thread_running)
|
||||
cout << "Server Stop thread created successfully." << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//stop server
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopping Gui Server" << endl;
|
||||
#endif
|
||||
|
||||
if(gui_server_thread_running){
|
||||
gui_server_thread_running=0;
|
||||
|
||||
if(mySocket)
|
||||
mySocket->ShutDownSocket();
|
||||
pthread_join(gui_server_thread,NULL);
|
||||
if(mySocket){
|
||||
delete mySocket;
|
||||
mySocket = NULL;
|
||||
}
|
||||
|
||||
if(myStopSocket)
|
||||
myStopSocket->ShutDownSocket();
|
||||
pthread_join(gui_stop_server_thread,NULL);
|
||||
if(myStopSocket){
|
||||
delete myStopSocket;
|
||||
myStopSocket = NULL;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Server threads stopped successfully." << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
return gui_server_thread_running;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void* qServer::StopServerThread(void* this_pointer){
|
||||
((qServer*)this_pointer)->StopServer();
|
||||
return this_pointer;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int qServer::StopServer(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "In StopServer()" << endl;
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
myStopSocket = new MySocketTCP(port_no+1);
|
||||
if (myStopSocket->getErrorStatus()){
|
||||
gui_server_thread_running = 0;
|
||||
qDefs::Message(qDefs::WARNING,"Could not start gui stop server socket","qServer::StopServer");
|
||||
}
|
||||
checkStopStarted = 0;
|
||||
|
||||
while ((gui_server_thread_running) && (ret!=GOODBYE)) {
|
||||
#ifdef VERBOSE
|
||||
cout<< endl;
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Waiting for client call" << endl;
|
||||
#endif
|
||||
if(myStopSocket->Connect()>=0){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Conenction accepted" << endl;
|
||||
#endif
|
||||
ret = DecodeFunction(myStopSocket);
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "function executed" << endl;
|
||||
#endif
|
||||
myStopSocket->Disconnect();
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "connection closed" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopped gui stop server thread" << endl;
|
||||
#endif
|
||||
gui_server_thread_running = 0;
|
||||
//delete socket(via exit server)
|
||||
if(myStopSocket){
|
||||
delete myStopSocket;
|
||||
myStopSocket = NULL;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
emit ServerStoppedSignal();
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void* qServer::StartServerThread(void* this_pointer){
|
||||
((qServer*)this_pointer)->StartServer();
|
||||
return this_pointer;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int qServer::StartServer(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "In StartServer()" << endl;
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
mySocket = new MySocketTCP(port_no);
|
||||
if (mySocket->getErrorStatus()){
|
||||
gui_server_thread_running = 0;
|
||||
qDefs::Message(qDefs::WARNING,"Could not start gui server socket","qServer::StartServer");
|
||||
}
|
||||
checkStarted = 0;
|
||||
|
||||
while ((gui_server_thread_running) && (ret!=GOODBYE)) {
|
||||
#ifdef VERBOSE
|
||||
cout<< endl;
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Waiting for client call" << endl;
|
||||
#endif
|
||||
if(mySocket->Connect()>=0){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Conenction accepted" << endl;
|
||||
#endif
|
||||
ret = DecodeFunction(mySocket);
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "function executed" << endl;
|
||||
#endif
|
||||
mySocket->Disconnect();
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "connection closed" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopped gui server thread" << endl;
|
||||
#endif
|
||||
gui_server_thread_running = 0;
|
||||
//delete socket(via exit server)
|
||||
if(mySocket){
|
||||
delete mySocket;
|
||||
mySocket = NULL;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
emit ServerStoppedSignal();
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::GetStatus(){
|
||||
|
||||
int ret = qDefs::OK;
|
||||
enum slsDetectorDefs::runStatus retval;
|
||||
int progress = 0;
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
if(myMainTab->isPlotRunning())
|
||||
retval = slsDetectorDefs::RUNNING;
|
||||
else
|
||||
retval = slsDetectorDefs::IDLE;
|
||||
|
||||
progress = myMainTab->GetProgress();
|
||||
|
||||
// send answer
|
||||
myStopSocket->SendDataOnly(&ret,sizeof(ret));
|
||||
myStopSocket->SendDataOnly(&retval,sizeof(retval));
|
||||
myStopSocket->SendDataOnly(&progress,sizeof(progress));
|
||||
//return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::StartAcquisition(){
|
||||
|
||||
strcpy(mess,"Could not start acquisition in gui. \n");
|
||||
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(true);
|
||||
mySocket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
mySocket->SendDataOnly(mess,sizeof(mess));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::StopsAcquisition(){
|
||||
|
||||
strcpy(mess,"Could not stop acquisition in gui. \n");
|
||||
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(false);
|
||||
myStopSocket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
myStopSocket->SendDataOnly(mess,sizeof(mess));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::Acquire(){
|
||||
|
||||
strcpy(mess,"Could not start blocking acquisition in gui. \n");
|
||||
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(true);
|
||||
|
||||
usleep(5000);
|
||||
while(myMainTab->isPlotRunning());
|
||||
|
||||
mySocket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
mySocket->SendDataOnly(mess,sizeof(mess));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
583
slsDetectorGui/src/qTabActions.cpp
Normal file
@ -0,0 +1,583 @@
|
||||
/*
|
||||
* qTabActions.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
// Qt Project Class Headers
|
||||
#include "qTabActions.h"
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
// Qt Include Headers
|
||||
#include <QButtonGroup>
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector):
|
||||
QWidget(parent),myDet(detector),
|
||||
positionWidget(0),
|
||||
lblNumPos(0),
|
||||
lblPosList(0),
|
||||
spinNumPos(0),
|
||||
comboPos(0),
|
||||
btnDelete(0),
|
||||
chkInvert(0),
|
||||
chkSeparate(0),
|
||||
chkReturn(0),
|
||||
positions(0),
|
||||
iconPlus(0),
|
||||
iconMinus(0){
|
||||
for(int i=0;i<6;i++)
|
||||
actionWidget[i]=0;
|
||||
for(int i=0;i<2;i++)
|
||||
scanWidget[i]=0;
|
||||
for(int i=0;i<NumTotalActions;i++){
|
||||
btnExpand[i]=0;
|
||||
lblName[i]=0;
|
||||
}
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabActions::~qTabActions(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::SetupWidgetWindow(){
|
||||
// Window Settings
|
||||
setFixedHeight(350);
|
||||
//setFixedSize(710,350);
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
// Scroll Area Settings
|
||||
QScrollArea *scroll = new QScrollArea;
|
||||
scroll->setWidget(this);
|
||||
scroll->setWidgetResizable(true);
|
||||
|
||||
// Layout Settings
|
||||
gridLayout = new QGridLayout(scroll);
|
||||
setLayout(gridLayout);
|
||||
gridLayout->setContentsMargins(10,5,0,0);
|
||||
gridLayout->setVerticalSpacing(2);
|
||||
|
||||
// Buttongroup to know which +/- button was clicked
|
||||
group = new QButtonGroup(this);
|
||||
group->setExclusive(false);
|
||||
palette = new QPalette();
|
||||
|
||||
QPalette p;
|
||||
p.setColor(QPalette::Shadow,QColor(0,0,0,0));
|
||||
p.setColor(QPalette::Button,QColor(0,0,0,0));
|
||||
/*get rid of this vector*/
|
||||
char names[NumTotalActions][200] = {
|
||||
"Action at Start",
|
||||
"Scan Level 0",
|
||||
"Scan Level 1",
|
||||
"Action before each Frame",
|
||||
"Positions",
|
||||
"Header before Frame",
|
||||
"Header after Frame",
|
||||
"Action after each Frame",
|
||||
"Action at Stop"
|
||||
};
|
||||
|
||||
//creating the icons for the buttons
|
||||
iconPlus = new QIcon(":/icons/images/add.png");
|
||||
iconMinus = new QIcon(":/icons/images/remove.png");
|
||||
|
||||
QString tip = "<nobr>Click on the \"+\" to Expand or \"-\" to Collapse.</nobr>";
|
||||
|
||||
|
||||
|
||||
int hIndent=0, vIndent=0, colspan=6, posVal=0;
|
||||
QLabel *lblReal;
|
||||
// For each level of Actions
|
||||
for(int i=0;i<NumTotalActions;i++){
|
||||
//common widgets
|
||||
lblName[i] = new QLabel(QString(names[i]));
|
||||
btnExpand[i] = new QPushButton();
|
||||
|
||||
lblName[i]->setToolTip(tip);
|
||||
btnExpand[i]->setCheckable(true);
|
||||
btnExpand[i]->setChecked(false);
|
||||
btnExpand[i]->setFixedSize(16,16);
|
||||
btnExpand[i]->setToolTip(tip);
|
||||
btnExpand[i]->setIcon(*iconPlus);
|
||||
btnExpand[i]->setFocusPolicy(Qt::NoFocus);
|
||||
btnExpand[i]->setFlat(true);
|
||||
btnExpand[i]->setIconSize(QSize(16,16));
|
||||
btnExpand[i]->setPalette(p);
|
||||
group->addButton(btnExpand[i],i);
|
||||
|
||||
|
||||
//add label and button to expand or collapse
|
||||
gridLayout->addWidget(btnExpand[i],vIndent,hIndent,1,1);
|
||||
gridLayout->addWidget(lblName[i],vIndent,hIndent+1,1,colspan);
|
||||
|
||||
//creating the action/scan/position widgets and adding them
|
||||
switch(i){
|
||||
case NumPositions:
|
||||
CreatePositionsWidget();
|
||||
gridLayout->addWidget(positionWidget,vIndent+1,hIndent+1,1,colspan);
|
||||
positionWidget->hide();
|
||||
break;
|
||||
case Scan0:
|
||||
case Scan1:
|
||||
posVal = qScanWidget::NUM_SCAN_WIDGETS;
|
||||
scanWidget[posVal] = new qScanWidget(this,myDet);
|
||||
gridLayout->addWidget(scanWidget[posVal],vIndent+1,hIndent+1,1,colspan);
|
||||
scanWidget[posVal]->hide();
|
||||
break;
|
||||
default:
|
||||
posVal = qActionsWidget::NUM_ACTION_WIDGETS;
|
||||
actionWidget[posVal] = new qActionsWidget(this,myDet);
|
||||
gridLayout->addWidget(actionWidget[posVal],vIndent+1,hIndent+1,1,colspan);
|
||||
actionWidget[posVal]->hide();
|
||||
break;
|
||||
}
|
||||
|
||||
//incrementing the vertical and horizontal indent
|
||||
vIndent+=2;
|
||||
switch(i){
|
||||
case HeaderBefore:
|
||||
//real time acquisition
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,QColor(0,0,200,255));
|
||||
lblReal = new QLabel(" <b>Real Time Acquisition</b>");
|
||||
lblReal->setFixedHeight(25);
|
||||
//lblReal->setPalette(*palette);
|
||||
gridLayout->addWidget(lblReal,vIndent,hIndent+1,1,colspan);
|
||||
vIndent++;
|
||||
break;
|
||||
case HeaderAfter:
|
||||
hIndent-=2;
|
||||
colspan+=2;
|
||||
break;
|
||||
case ActionAfter:
|
||||
hIndent=0;
|
||||
colspan=6;
|
||||
break;
|
||||
default:
|
||||
hIndent++;
|
||||
colspan--;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Number of positions is only for mythen or gotthard
|
||||
detType = myDet->getDetectorsType();
|
||||
if((detType == slsDetectorDefs::EIGER) ||
|
||||
(detType == slsDetectorDefs::AGIPD) ||
|
||||
(detType == slsDetectorDefs::PROPIX) ||
|
||||
(detType == slsDetectorDefs::JUNGFRAU) ||
|
||||
(detType == slsDetectorDefs::MOENCH)) {
|
||||
lblName[NumPositions]->setEnabled(false);
|
||||
btnExpand[NumPositions]->setEnabled(false);
|
||||
}else{
|
||||
//disable positions if angular conversion is enabled
|
||||
int ang;
|
||||
if(!myDet->getAngularConversion(ang)){
|
||||
lblName[NumPositions]->setEnabled(false);
|
||||
btnExpand[NumPositions]->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//load positions
|
||||
if(lblName[NumPositions]->isEnabled()){
|
||||
//delete existing positions
|
||||
if (positions) {delete [] positions; positions = NULL;}
|
||||
//get number of positions
|
||||
int numPos=myDet->getPositions();
|
||||
comboPos->setMaxCount(numPos);
|
||||
|
||||
//set the number of positions in the gui
|
||||
spinNumPos->setValue(numPos);
|
||||
|
||||
positions=new double[numPos];
|
||||
//load the positions
|
||||
myDet->getPositions(positions);
|
||||
|
||||
//delete the combolist and reload it
|
||||
comboPos->setEnabled(numPos);
|
||||
lblPosList->setEnabled(numPos);
|
||||
btnDelete->setEnabled(numPos);
|
||||
lblPosList->setText("List of Positions: ");
|
||||
lblPosList->setPalette(normal);
|
||||
for(int i=0;i<comboPos->count();i++) comboPos->removeItem(i);
|
||||
for(int i=0;i<numPos;i++) comboPos->insertItem(i,QString("%1").arg(positions[i]));
|
||||
}
|
||||
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabActions::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::CreatePositionsWidget(){
|
||||
positionWidget = new QWidget;
|
||||
positionWidget->setFixedHeight(25);
|
||||
positionWidget->setFixedWidth(680);
|
||||
|
||||
QGridLayout *layout = new QGridLayout(positionWidget);
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
layout->setHorizontalSpacing(0);
|
||||
layout->setVerticalSpacing(5);
|
||||
|
||||
lblNumPos = new QLabel("Number of Positions: ");
|
||||
lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(lblNumPos,0,0);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
spinNumPos = new QSpinBox(this);
|
||||
layout->addWidget(spinNumPos,0,2);
|
||||
layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,3);
|
||||
lblPosList = new QLabel("List of Positions: ");
|
||||
lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
lblPosList->setFixedWidth(108);
|
||||
lblPosList->setEnabled(false);
|
||||
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</tnobr>");
|
||||
layout->addWidget(lblPosList,0,4);
|
||||
comboPos = new QComboBox(this);
|
||||
comboPos->setEditable(true);
|
||||
// comboPos->setCompleter(false);
|
||||
comboPos->setCompleter(NULL);
|
||||
normal = comboPos->palette();
|
||||
comboPos->setEnabled(false);
|
||||
QDoubleValidator *validate = new QDoubleValidator(comboPos);
|
||||
comboPos->setValidator(validate);
|
||||
layout->addWidget(comboPos,0,5);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,6);
|
||||
btnDelete = new QPushButton("Delete ");
|
||||
btnDelete->setEnabled(false);
|
||||
btnDelete->setIcon(QIcon( ":/icons/images/close.png" ));
|
||||
btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btnDelete,0,7);
|
||||
|
||||
//might be included at some point
|
||||
/* QGroupBox *w = new QGroupBox;
|
||||
layout->addWidget(w,1,0,1,9);
|
||||
QHBoxLayout *l1 = new QHBoxLayout(w);
|
||||
l1->setContentsMargins(0,0,0,0);
|
||||
l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
chkInvert = new QCheckBox("Invert Angles");
|
||||
l1->addWidget(chkInvert);
|
||||
chkSeparate = new QCheckBox("Separate Two Halves");
|
||||
l1->addWidget(chkSeparate);
|
||||
chkReturn = new QCheckBox("Return to Start Position");
|
||||
chkReturn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
l1->addWidget(chkReturn);
|
||||
l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
w->setLayout(l1);*/
|
||||
|
||||
positionWidget->setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::Initialization(){
|
||||
//expand
|
||||
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||
//enable scan box in plot tab
|
||||
for(int i=0;i<qScanWidget::NUM_SCAN_WIDGETS;i++)
|
||||
connect(scanWidget[i], SIGNAL(EnableScanBox()), this,SIGNAL(EnableScanBox()));
|
||||
//positions
|
||||
connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
|
||||
connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
|
||||
connect(btnDelete, SIGNAL(clicked()), this, SLOT(DeletePosition()));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::Expand(QAbstractButton *button ){
|
||||
int index = group->id(button);
|
||||
|
||||
// Collapse
|
||||
if(!button->isChecked()){
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black);
|
||||
|
||||
|
||||
lblName[index]->setPalette(*palette);
|
||||
button->setIcon(*iconPlus);
|
||||
|
||||
if(index==NumPositions) {
|
||||
positionWidget->hide();
|
||||
setFixedHeight(height()-30);//-80 if the checkboxes are included
|
||||
if(myDet->getPositions()) {
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
lblName[index]->setPalette(*palette);
|
||||
}
|
||||
}
|
||||
else if((index==Scan0)||(index==Scan1)) {
|
||||
scanWidget[GetActualIndex(index)]->hide();
|
||||
setFixedHeight(height()-130);
|
||||
if(myDet->getScanMode(GetActualIndex(index))){
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
lblName[index]->setPalette(*palette);
|
||||
}
|
||||
}
|
||||
else {
|
||||
actionWidget[GetActualIndex(index)]->hide();
|
||||
setFixedHeight(height()-30);
|
||||
if(myDet->getActionMode(GetActualIndex(index))){
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
lblName[index]->setPalette(*palette);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// Expand
|
||||
//always set title color to blue for expan\d
|
||||
|
||||
palette->setColor(QPalette::Active,QPalette::WindowText,QColor(0,0,200,255));
|
||||
|
||||
|
||||
lblName[index]->setPalette(*palette);
|
||||
button->setIcon(*iconMinus);
|
||||
|
||||
if(index==NumPositions){
|
||||
positionWidget->show();
|
||||
setFixedHeight(height()+30);//+80 if the checkboxes are included
|
||||
}
|
||||
else if((index==Scan0)||(index==Scan1)){
|
||||
scanWidget[GetActualIndex(index)]->show();
|
||||
setFixedHeight(height()+130);
|
||||
}
|
||||
else{
|
||||
actionWidget[GetActualIndex(index)]->show();
|
||||
setFixedHeight(height()+30);
|
||||
}
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabActions::Expand");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::SetPosition(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering SetPosition\tnum Pos:" << spinNumPos->value() << "\tlist count:" << comboPos->count() << endl;
|
||||
#endif
|
||||
//get number of positions
|
||||
int numPos = spinNumPos->value();
|
||||
comboPos->setMaxCount(numPos);
|
||||
comboPos->setEnabled(numPos);
|
||||
lblPosList->setEnabled(numPos);
|
||||
btnDelete->setEnabled(numPos);
|
||||
|
||||
//deleting too many or not entering enough
|
||||
if(numPos>comboPos->count()){
|
||||
|
||||
QPalette red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
lblPosList->setPalette(red);
|
||||
QString tip = QString("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr><br><br>")+
|
||||
QString("<font color=\"red\"><nobr>Add ")+
|
||||
(QString("%1").arg(((numPos)-(comboPos->count()))))+
|
||||
QString(" more positions to the list to match <b>Number of Positions</b>.</nobr><br>"
|
||||
"<nobr><nobr>Or reduce <b>Number of Positions</b>.</nobr></font>");
|
||||
lblPosList->setToolTip(tip);
|
||||
lblPosList->setText("List of Positions:*");
|
||||
}else{
|
||||
lblPosList->setText("List of Positions: ");
|
||||
lblPosList->setPalette(normal);
|
||||
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr>");
|
||||
}
|
||||
|
||||
//delete existing positions
|
||||
if (positions) {delete [] positions; positions = NULL;}
|
||||
positions=new double[comboPos->count()];
|
||||
//copying the list
|
||||
for(int i=0;i<comboPos->count();i++)
|
||||
positions[i] = comboPos->itemText(i).toDouble();
|
||||
//setting the list and catching error
|
||||
if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count())
|
||||
qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","qTabActions::SetPosition");
|
||||
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabActions::SetPosition");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::DeletePosition(){
|
||||
QString pos = comboPos->currentText();
|
||||
bool found = false;
|
||||
//loops through to find the index and to make sure its in the list
|
||||
for(int i=0;i<comboPos->count();i++){
|
||||
if(!comboPos->itemText(i).compare(pos)){
|
||||
found = true;
|
||||
comboPos->removeItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found){
|
||||
#ifdef VERBOSE
|
||||
cout << "Deleting Position " << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabActions::EnablePositions(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout << "Enable Positions: " << enable << endl;
|
||||
#endif
|
||||
if(enable){
|
||||
lblName[NumPositions]->setEnabled(true);
|
||||
btnExpand[NumPositions]->setEnabled(true);
|
||||
}else{
|
||||
//deletes all positions
|
||||
for(int i=0;i<comboPos->count();i++)
|
||||
comboPos->removeItem(i);
|
||||
cout<<"Number of Positions set to :"<<myDet->getPositions()<<endl;
|
||||
|
||||
//to collapse if it was expanded
|
||||
if(btnExpand[NumPositions]->isChecked()){
|
||||
disconnect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||
btnExpand[NumPositions]->setChecked(false);
|
||||
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||
Expand(group->button(NumPositions));
|
||||
}
|
||||
lblName[NumPositions]->setEnabled(false);
|
||||
btnExpand[NumPositions]->setEnabled(false);
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabActions::EnablePositions");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl <<"**Updating all action widgets: " << endl;
|
||||
#endif
|
||||
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){
|
||||
//positions is enabled only if angular conversion is enabled
|
||||
int ang; if(!myDet->getAngularConversion(ang)) EnablePositions(false);
|
||||
|
||||
if(lblName[NumPositions]->isEnabled()){
|
||||
//delete existing positions
|
||||
if (positions) {delete [] positions; positions = NULL;}
|
||||
//get number of positions
|
||||
int numPos=myDet->getPositions();
|
||||
comboPos->setMaxCount(numPos);
|
||||
|
||||
//set the number of positions in the gui
|
||||
disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
|
||||
spinNumPos->setValue(numPos);
|
||||
connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
|
||||
|
||||
positions=new double[numPos];
|
||||
//load the positions
|
||||
myDet->getPositions(positions);
|
||||
|
||||
//delete the combolist and reload it
|
||||
disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
|
||||
comboPos->setEnabled(numPos);
|
||||
lblPosList->setEnabled(numPos);
|
||||
btnDelete->setEnabled(numPos);
|
||||
lblPosList->setText("List of Positions: ");
|
||||
lblPosList->setPalette(normal);
|
||||
for(int i=0;i<comboPos->count();i++)
|
||||
comboPos->removeItem(i);
|
||||
for(int i=0;i<numPos;i++)
|
||||
comboPos->insertItem(i,QString("%1").arg(positions[i]));
|
||||
connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Updated position widget\tnum:" << numPos << "\t***" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for(int i=0;i<qScanWidget::NUM_SCAN_WIDGETS;i++)
|
||||
scanWidget[i]->Refresh();
|
||||
for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++)
|
||||
actionWidget[i]->Refresh();
|
||||
UpdateCollapseColors();
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated all action widgets: " << endl << endl;
|
||||
#endif
|
||||
qDefs::checkErrorMessage(myDet,"qTabActions::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qTabActions::GetActualIndex(int index){
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::startScript;
|
||||
case Scan0: return 0;
|
||||
case Scan1: return 1;
|
||||
case 3: return slsDetectorDefs::scriptBefore;
|
||||
case 5: return slsDetectorDefs::headerBefore;
|
||||
case 6: return slsDetectorDefs::headerAfter;
|
||||
case 7: return slsDetectorDefs::scriptAfter;
|
||||
case 8: return slsDetectorDefs::stopScript;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabActions::UpdateCollapseColors(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Updating Collapse Colors" << endl;
|
||||
#endif
|
||||
for(int i=0;i<NumTotalActions;i++){
|
||||
//num positions
|
||||
if(i==NumPositions){
|
||||
if(myDet->getPositions()) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black);
|
||||
lblName[i]->setPalette(*palette);
|
||||
}
|
||||
//scans
|
||||
else if((i==Scan0)||(i==Scan1)){
|
||||
if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black);
|
||||
lblName[i]->setPalette(*palette);
|
||||
}
|
||||
//actions
|
||||
else{
|
||||
if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen);
|
||||
else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black);
|
||||
lblName[i]->setPalette(*palette);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
1335
slsDetectorGui/src/qTabAdvanced.cpp
Normal file
1011
slsDetectorGui/src/qTabDataOutput.cpp
Normal file
613
slsDetectorGui/src/qTabDebugging.cpp
Normal file
@ -0,0 +1,613 @@
|
||||
/*
|
||||
* qTabDebugging.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabDebugging.h"
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
// Qt Include Headers
|
||||
#include <QDesktopWidget>
|
||||
#include <QGridLayout>
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):
|
||||
QWidget(parent),
|
||||
myDet(detector),
|
||||
det(0),
|
||||
treeDet(0),
|
||||
dispFrame(0),
|
||||
lblDetectorId(0),
|
||||
lblDetectorSerial(0),
|
||||
lblDetectorFirmware(0),
|
||||
lblDetectorSoftware(0),
|
||||
lblModuleId(0),
|
||||
lblModuleFirmware(0),
|
||||
lblModuleSerial(0){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDebugging::~qTabDebugging(){
|
||||
delete myDet;
|
||||
if(det) delete det;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow(){
|
||||
|
||||
blue = new QPalette();
|
||||
blue->setColor(QPalette::Active,QPalette::WindowText,Qt::darkBlue);
|
||||
|
||||
|
||||
// Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
///change module label
|
||||
switch(detType){
|
||||
case slsDetectorDefs::EIGER:
|
||||
lblDetector->setText("Half Module:");
|
||||
chkDetectorFirmware->setText("Half Module Firmware:");
|
||||
chkDetectorSoftware->setText("Half Module Software:");
|
||||
chkDetectorMemory->setText("Half Module Memory:");
|
||||
chkDetectorBus->setText("Half Module Bus:");
|
||||
lblModule->hide();
|
||||
comboModule->hide();
|
||||
chkModuleFirmware->hide();
|
||||
chkChip->setEnabled(false);
|
||||
chkModuleFirmware->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
lblDetector->setText("Module:");
|
||||
chkDetectorFirmware->setText("Module Firmware:");
|
||||
chkDetectorSoftware->setText("Module Software:");
|
||||
chkDetectorMemory->setText("Module Memory:");
|
||||
chkDetectorBus->setText("Module Bus:");
|
||||
lblModule->hide();
|
||||
comboModule->hide();
|
||||
chkModuleFirmware->hide();
|
||||
chkChip->setEnabled(false);
|
||||
chkModuleFirmware->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblDetector->setText("Module:");
|
||||
chkDetectorFirmware->setText("Module Firmware:");
|
||||
chkDetectorSoftware->setText("Module Software:");
|
||||
chkDetectorMemory->setText("Module Memory:");
|
||||
chkDetectorBus->setText("Module Bus:");
|
||||
lblModule->hide();
|
||||
comboModule->hide();
|
||||
chkModuleFirmware->hide();
|
||||
chkChip->setEnabled(false);
|
||||
chkModuleFirmware->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
break;
|
||||
default:
|
||||
//leave everything as it is(mythen is default)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//add detectors
|
||||
for(int i=0;i<myDet->getNumberOfDetectors();i++){
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
}
|
||||
|
||||
|
||||
//add modules and status for current detector
|
||||
if(detType==slsDetectorDefs::MYTHEN) UpdateModuleList();
|
||||
UpdateStatus();
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::Initialization(){
|
||||
if(detType==slsDetectorDefs::MYTHEN)
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateModuleList()));
|
||||
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateStatus()));
|
||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::UpdateModuleList(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting Module List" << endl;
|
||||
#endif
|
||||
det = myDet->getSlsDetector(comboDetector->currentIndex());
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::UpdateModuleList");
|
||||
//deletes all modules except "all modules"
|
||||
for(int i=0;i<comboModule->count()-1;i++)
|
||||
comboModule->removeItem(i);
|
||||
for(int i=0;i<det->getNMods();i++){
|
||||
comboModule->addItem(QString("Module %1").arg(i));
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::UpdateModuleList");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::UpdateStatus(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting Status" << endl;
|
||||
#endif
|
||||
det = myDet->getSlsDetector(comboDetector->currentIndex());
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::UpdateStatus");
|
||||
int detStatus = (int)det->getRunStatus();
|
||||
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::UpdateStatus");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::GetInfo(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting Info" << endl;
|
||||
#endif
|
||||
//window
|
||||
QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow );
|
||||
QList<QTreeWidgetItem *> items;
|
||||
|
||||
|
||||
|
||||
//layout
|
||||
QGridLayout *layout = new QGridLayout(popup1);
|
||||
//treewidget
|
||||
treeDet = new QTreeWidget(popup1);
|
||||
layout->addWidget(treeDet,0,0);
|
||||
//display the details
|
||||
dispFrame = new QFrame(popup1);
|
||||
QGridLayout *formLayout = new QGridLayout(dispFrame);
|
||||
lblDetectorId = new QLabel(""); lblDetectorId->setPalette(*blue);
|
||||
lblDetectorSerial = new QLabel(""); lblDetectorSerial->setPalette(*blue);
|
||||
lblDetectorFirmware = new QLabel(""); lblDetectorFirmware->setPalette(*blue);
|
||||
lblDetectorSoftware = new QLabel(""); lblDetectorSoftware->setPalette(*blue);
|
||||
lblModuleId = new QLabel(""); lblModuleId->setPalette(*blue);
|
||||
lblModuleSerial = new QLabel(""); lblModuleSerial->setPalette(*blue);
|
||||
lblModuleFirmware = new QLabel(""); lblModuleFirmware->setPalette(*blue);
|
||||
//to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame,0,1);
|
||||
|
||||
switch(detType){
|
||||
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Readout:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Readout MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Readout Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Readout Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
formLayout->addWidget(new QLabel("Module:"),4,0);
|
||||
formLayout->addWidget(lblModuleId,4,2);
|
||||
formLayout->addWidget(new QLabel("Module Serial Number:"),5,0);
|
||||
formLayout->addWidget(lblModuleSerial,5,2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"),6,0);
|
||||
formLayout->addWidget(lblModuleFirmware,6,2);
|
||||
|
||||
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("Mythen Detector");
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Readout (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
//gets module names
|
||||
for (int i=0;i<comboDetector->count();i++){
|
||||
QList<QTreeWidgetItem *> childItems;
|
||||
det = myDet->getSlsDetector(i);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::GetInfo");
|
||||
for(int j=0;j<det->getNMods();j++)
|
||||
childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(j))));
|
||||
treeDet->topLevelItem(i)->insertChildren(0,childItems);
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::GetInfo");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Half Module:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Half Module MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("Eiger Detector");
|
||||
//get num modules
|
||||
for (int i=0;i<comboDetector->count()/2;i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(i))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++){
|
||||
QList<QTreeWidgetItem *> childItems;
|
||||
childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->topLevelItem(i*2)->insertChildren(0,childItems);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case slsDetectorDefs::MOENCH:
|
||||
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Module:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Module MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("Moench Detector");
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case slsDetectorDefs::PROPIX:
|
||||
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Module:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Module MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("Propix Detector");
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Module:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Module MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("Gotthard Detector");
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
|
||||
//display widget
|
||||
formLayout->addWidget(new QLabel("Module:"),0,0);
|
||||
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
formLayout->addWidget(lblDetectorId,0,2);
|
||||
formLayout->addWidget(new QLabel("Module MAC Address:"),1,0);
|
||||
formLayout->addWidget(lblDetectorSerial,1,2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0);
|
||||
formLayout->addWidget(lblDetectorFirmware,2,2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"),3,0);
|
||||
formLayout->addWidget(lblDetectorSoftware,3,2);
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel("JungFrau Detector");
|
||||
//gets det names
|
||||
for (int i=0;i<comboDetector->count();i++)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//show and center widget
|
||||
|
||||
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
||||
int y = ((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int screen = desktop->screenNumber(this);
|
||||
popup1->setWindowModality(Qt::WindowModal);
|
||||
popup1->move( (desktop->screenGeometry(screen).x())+x, (desktop->screenGeometry(screen).y())+y );
|
||||
popup1->show();
|
||||
|
||||
//put the first parameters
|
||||
SetParameters(treeDet->topLevelItem(0));
|
||||
|
||||
//initializations
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)) , this, SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item){
|
||||
char value[200];
|
||||
int i;
|
||||
|
||||
|
||||
switch(detType){
|
||||
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
if(item->text(0).contains("Readout")){
|
||||
//find index
|
||||
for(i=0;i<comboDetector->count();i++)
|
||||
if(item== treeDet->topLevelItem(i))
|
||||
break;
|
||||
|
||||
det = myDet->getSlsDetector(i);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
|
||||
lblDetectorId->setText(comboDetector->itemText(i));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
|
||||
lblModuleId->setText("");
|
||||
lblModuleSerial->setText("");
|
||||
lblModuleFirmware->setText("");
|
||||
}else{
|
||||
//find index
|
||||
for(i=0;i<comboDetector->count();i++)
|
||||
if(item->parent() == treeDet->topLevelItem(i))
|
||||
break;
|
||||
int im = item->parent()->indexOfChild(item);
|
||||
|
||||
det = myDet->getSlsDetector(i);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
|
||||
lblDetectorId->setText(comboDetector->itemText(i));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
lblModuleId->setText(QString("%1").arg(im));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im));
|
||||
lblModuleSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im));
|
||||
lblModuleFirmware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
//only if half module clicked
|
||||
if(item->text(0).contains("Half Module")){
|
||||
//find index
|
||||
for(i=0;i<comboDetector->count();i++)
|
||||
if(item== treeDet->topLevelItem(i))
|
||||
break;
|
||||
|
||||
det = myDet->getSlsDetector(i);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
|
||||
lblDetectorId->setText(comboDetector->itemText(i));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
//find index
|
||||
for(i=0;i<comboDetector->count();i++)
|
||||
if(item== treeDet->topLevelItem(i))
|
||||
break;
|
||||
|
||||
det = myDet->getSlsDetector(i);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
|
||||
lblDetectorId->setText(comboDetector->itemText(i));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::TestDetector(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Testing" << endl;
|
||||
#endif
|
||||
|
||||
int retval=slsDetectorDefs::FAIL;
|
||||
QString message;
|
||||
QString Detector = "Detector";
|
||||
|
||||
//main messagebox title
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
message = QString("<nobr>Test Results for %1 and %2:</nobr><br><br>").arg(comboDetector->currentText(),comboModule->currentText());
|
||||
break;
|
||||
case slsDetectorDefs::EIGER: Detector = "Half Module"; break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD: Detector = "Module"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
if(detType==slsDetectorDefs::MYTHEN)
|
||||
message = QString("<nobr>Test Results for %1 and %2:</nobr><br><br>").arg(comboDetector->currentText(),comboModule->currentText());
|
||||
else message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
|
||||
|
||||
//get sls det object
|
||||
det = myDet->getSlsDetector(comboDetector->currentIndex());
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::TestDetector");
|
||||
|
||||
//detector firmware
|
||||
if(chkDetectorFirmware->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::DETECTOR_FIRMWARE_TEST);
|
||||
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Firmware: FAIL</nobr><br>").arg(Detector));
|
||||
else message.append(QString("<nobr>%1 Firmware: %2</nobr><br>").arg(Detector,QString::number(retval)));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Detector Firmware: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//detector software
|
||||
if(chkDetectorSoftware->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::DETECTOR_SOFTWARE_TEST);
|
||||
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Software: FAIL</nobr><br>").arg(Detector));
|
||||
else message.append(QString("<nobr>%1 Software: %2</nobr><br>").arg(Detector,QString::number(retval)));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Detector Software: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//detector CPU-FPGA bus
|
||||
if(chkDetectorBus->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::DETECTOR_BUS_TEST);
|
||||
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Bus: FAIL</nobr><br>").arg(Detector));
|
||||
else message.append(QString("<nobr>%1 Bus: %2</nobr><br>").arg(Detector,QString::number(retval)));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Detector Bus: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//detector Memory
|
||||
if(chkDetectorMemory->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::DETECTOR_MEMORY_TEST);
|
||||
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Memory: FAIL</nobr><br>").arg(Detector));
|
||||
else message.append(QString("<nobr>%1 Memory: %2</nobr><br>").arg(Detector,QString::number(retval)));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Detector Memory: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//chip
|
||||
if(chkChip->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::CHIP_TEST,comboModule->currentIndex());
|
||||
if(retval== slsDetectorDefs::FAIL) message.append("<br><nobr>Chip: FAIL</nobr><br>");
|
||||
else message.append(QString("<nobr>Chip: %1</nobr><br>").arg(retval));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Chip: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//module firmware
|
||||
if(chkModuleFirmware->isChecked()){
|
||||
retval = det->digitalTest(slsDetectorDefs::MODULE_FIRMWARE_TEST,comboModule->currentIndex());
|
||||
if(retval== slsDetectorDefs::FAIL) message.append("<nobr>Module Firmware: FAIL</nobr><br>");
|
||||
else message.append(QString("<nobr>Module Firmware: %1</nobr><br>").arg(retval));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Module Firmware: "<<retval<<endl;
|
||||
#endif
|
||||
}
|
||||
//display message
|
||||
qDefs::Message(qDefs::INFORMATION,message.toAscii().constData(),"qTabDebugging::TestDetector");
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::TestDetector");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Debugging Tab" << endl;
|
||||
#endif
|
||||
UpdateStatus();
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Debugging Tab" << endl << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
651
slsDetectorGui/src/qTabDeveloper.cpp
Normal file
@ -0,0 +1,651 @@
|
||||
/*
|
||||
* qTabDeveloper.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qDetectorMain.h"
|
||||
//Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
//Qt Include Headers
|
||||
#include <QSpacerItem>
|
||||
#include <QString>
|
||||
#include <QDoubleValidator>
|
||||
//C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
int qTabDeveloper::NUM_DAC_WIDGETS(0);
|
||||
int qTabDeveloper::NUM_ADC_WIDGETS(0);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDeveloper::qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector):
|
||||
thisParent(parent),
|
||||
myDet(detector),
|
||||
det(0),
|
||||
boxDacs(0),
|
||||
boxAdcs(0),
|
||||
lblHV(0),
|
||||
comboHV(0),
|
||||
adcTimer(0),
|
||||
dacLayout(0){
|
||||
for(int i=0;i<20;i++){
|
||||
lblDacs[i]=0;
|
||||
lblAdcs[i]=0;
|
||||
spinDacs[i]=0;
|
||||
spinAdcs[i]=0;
|
||||
lblDacsmV[i]=0;
|
||||
}
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDeveloper::~qTabDeveloper(){
|
||||
delete myDet;
|
||||
if(det) delete det;
|
||||
if(thisParent) delete thisParent;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::SetupWidgetWindow(){
|
||||
//Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
|
||||
//palette
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
|
||||
|
||||
//the number of dacs and adcs
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
NUM_DAC_WIDGETS = 6;
|
||||
NUM_ADC_WIDGETS = 0;
|
||||
dacNames.push_back("v Trimbit:");
|
||||
dacNames.push_back("v Threshold:");
|
||||
dacNames.push_back("v Shaper1:");
|
||||
dacNames.push_back("v Shaper2:");
|
||||
dacNames.push_back("v Calibration:");
|
||||
dacNames.push_back("v Preamp:");
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
NUM_DAC_WIDGETS = 17;
|
||||
NUM_ADC_WIDGETS = 6;
|
||||
|
||||
dacNames.push_back("v SvP:");
|
||||
dacNames.push_back("v SvN");
|
||||
dacNames.push_back("v Vrf:");
|
||||
dacNames.push_back("v Vrs:");
|
||||
dacNames.push_back("v Vtr:");
|
||||
dacNames.push_back("v Vtgstv:");
|
||||
dacNames.push_back("v cal:");
|
||||
dacNames.push_back("v Vcp");
|
||||
dacNames.push_back("v Vcn:");
|
||||
dacNames.push_back("v Vis:");
|
||||
dacNames.push_back("v rxb_lb:");
|
||||
dacNames.push_back("v rxb_rb:");
|
||||
dacNames.push_back("v Vcmp_ll:");
|
||||
dacNames.push_back("v Vcmp_lr:");
|
||||
dacNames.push_back("v Vcmp_rl:");
|
||||
dacNames.push_back("v Vcmp_rr:");
|
||||
dacNames.push_back("v threshold:");
|
||||
|
||||
adcNames.push_back("Temperature FPGA Ext:");
|
||||
adcNames.push_back("Temperature 10GE:");
|
||||
adcNames.push_back("Temperature DCDC:");
|
||||
adcNames.push_back("Temperature SODL:");
|
||||
adcNames.push_back("Temperature SODR:");
|
||||
adcNames.push_back("Temperature FPGA:");
|
||||
|
||||
break;
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
NUM_DAC_WIDGETS = 8;
|
||||
NUM_ADC_WIDGETS = 2;
|
||||
dacNames.push_back("v Reference:");
|
||||
dacNames.push_back("v Cascode n:");
|
||||
dacNames.push_back("v Cascode p:");
|
||||
dacNames.push_back("v Comp. Output:");
|
||||
dacNames.push_back("v Cascode out");
|
||||
dacNames.push_back("v Comp. Input:");
|
||||
dacNames.push_back("v Comp. Ref:");
|
||||
dacNames.push_back("i Base Test:");
|
||||
|
||||
adcNames.push_back("Temperature ADC:");
|
||||
adcNames.push_back("Temperature FPGA:");
|
||||
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
NUM_DAC_WIDGETS = 8;
|
||||
NUM_ADC_WIDGETS = 2;
|
||||
dacNames.push_back("v Dac 0:");
|
||||
dacNames.push_back("v Dac 1:");
|
||||
dacNames.push_back("v Dac 2:");
|
||||
dacNames.push_back("v Dac 3:");
|
||||
dacNames.push_back("v Dac 4:");
|
||||
dacNames.push_back("v Dac 5:");
|
||||
dacNames.push_back("v Dac 6:");
|
||||
dacNames.push_back("i Dac 7:");
|
||||
|
||||
adcNames.push_back("Temperature ADC:");
|
||||
adcNames.push_back("Temperature FPGA:");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
NUM_DAC_WIDGETS = 16;
|
||||
NUM_ADC_WIDGETS = 0;
|
||||
dacNames.push_back("v Dac 0:");
|
||||
dacNames.push_back("v Dac 1:");
|
||||
dacNames.push_back("v Dac 2:");
|
||||
dacNames.push_back("v Dac 3:");
|
||||
dacNames.push_back("v Dac 4:");
|
||||
dacNames.push_back("v Dac 5:");
|
||||
dacNames.push_back("v Dac 6:");
|
||||
dacNames.push_back("i Dac 7:");
|
||||
dacNames.push_back("v Dac 8:");
|
||||
dacNames.push_back("v Dac 9:");
|
||||
dacNames.push_back("v Dac 10:");
|
||||
dacNames.push_back("v Dac 11:");
|
||||
dacNames.push_back("v Dac 12:");
|
||||
dacNames.push_back("v Dac 13:");
|
||||
dacNames.push_back("v Dac 14:");
|
||||
dacNames.push_back("i Dac 15:");
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
cout << "ERROR: Unknown detector type: " + myDet->slsDetectorBase::getDetectorType(detType) << endl;
|
||||
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//layout
|
||||
setFixedWidth(765);
|
||||
setFixedHeight(20+50+(NUM_DAC_WIDGETS/2)*35);
|
||||
//setHeight(340);
|
||||
|
||||
scroll = new QScrollArea;
|
||||
//scroll->setFrameShape(QFrame::NoFrame);
|
||||
scroll->setWidget(this);
|
||||
scroll->setWidgetResizable(true);
|
||||
|
||||
layout = new QGridLayout(scroll);
|
||||
layout->setContentsMargins(20,10,10,5);
|
||||
setLayout(layout);
|
||||
|
||||
//readout
|
||||
comboDetector = new QComboBox(this);
|
||||
//comboDetector->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
comboDetector->addItem("All");
|
||||
//add detectors
|
||||
for(int i=1;i<myDet->getNumberOfDetectors()+1;i++)
|
||||
comboDetector->addItem(QString(myDet->getHostname(i-1).c_str()));
|
||||
comboDetector->setCurrentIndex(0);
|
||||
|
||||
|
||||
//dacs
|
||||
boxDacs = new QGroupBox("Dacs",this);
|
||||
boxDacs->setFixedHeight(25+(NUM_DAC_WIDGETS/2)*35);
|
||||
CreateDACWidgets();
|
||||
|
||||
//HV for gotthard
|
||||
if ((detType==slsDetectorDefs::GOTTHARD) ||
|
||||
(detType==slsDetectorDefs::PROPIX) ||
|
||||
(detType==slsDetectorDefs::MOENCH)){
|
||||
boxDacs->setFixedHeight(boxDacs->height()+35);
|
||||
|
||||
lblHV = new QLabel("High Voltage",boxDacs);
|
||||
comboHV = new QComboBox(boxDacs);
|
||||
comboHV->addItem("0");
|
||||
comboHV->addItem("90");
|
||||
comboHV->addItem("110");
|
||||
comboHV->addItem("120");
|
||||
comboHV->addItem("150");
|
||||
comboHV->addItem("180");
|
||||
comboHV->addItem("200");
|
||||
tipHV = "<nobr>Set high voltage to 0, 90, 110, 120, 150 or 200V.</nobr>";
|
||||
lblHV->setToolTip(tipHV);
|
||||
comboHV->setToolTip(tipHV);
|
||||
dacLayout->addWidget(lblHV,(int)(NUM_DAC_WIDGETS/2),1);
|
||||
dacLayout->addWidget(comboHV,(int)(NUM_DAC_WIDGETS/2),2);
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
layout->addWidget(comboDetector,0,0);
|
||||
layout->addWidget(boxDacs,1,0);
|
||||
|
||||
|
||||
//adcs
|
||||
if((detType==slsDetectorDefs::GOTTHARD) ||
|
||||
(detType==slsDetectorDefs::PROPIX) ||
|
||||
(detType==slsDetectorDefs::MOENCH)||
|
||||
(detType==slsDetectorDefs::EIGER)) {
|
||||
setFixedHeight(20+(50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35));
|
||||
boxAdcs = new QGroupBox("ADCs",this);
|
||||
boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35);
|
||||
layout->addWidget(boxAdcs,2,0);
|
||||
CreateADCWidgets();
|
||||
//to make the adcs at the bottom most
|
||||
if(detType!=slsDetectorDefs::EIGER) {
|
||||
int diff = 340-height();
|
||||
setFixedHeight(340);
|
||||
layout->setVerticalSpacing(diff/2);
|
||||
}
|
||||
//timer to check adcs
|
||||
adcTimer = new QTimer(this);
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::Initialization(){
|
||||
if(NUM_ADC_WIDGETS) connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs()));
|
||||
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++)
|
||||
connect(spinDacs[i], SIGNAL(editingFinished(int)), this, SLOT(SetDacValues(int)));
|
||||
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(Refresh()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::CreateDACWidgets(){
|
||||
dacLayout = new QGridLayout(boxDacs);
|
||||
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++){
|
||||
lblDacs[i] = new QLabel(QString(dacNames[i].c_str()),boxDacs);
|
||||
spinDacs[i] = new MyDoubleSpinBox(i,boxDacs);
|
||||
spinDacs[i]->setMinimum(-1);
|
||||
spinDacs[i]->setMaximum(10000);
|
||||
lblDacsmV[i]= new QLabel("",boxDacs);
|
||||
|
||||
|
||||
dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:5);
|
||||
dacLayout->addWidget(spinDacs[i],(int)(i/2),((i%2)==0)?2:6);
|
||||
dacLayout->addWidget(lblDacsmV[i],(int)(i/2),((i%2)==0)?3:7);
|
||||
if(!(i%2)){
|
||||
dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0);
|
||||
dacLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),4);
|
||||
dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::CreateADCWidgets(){
|
||||
QGridLayout *adcLayout = new QGridLayout(boxAdcs);
|
||||
|
||||
for(int i=0;i<NUM_ADC_WIDGETS;i++){
|
||||
lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs);
|
||||
spinAdcs[i] = new QDoubleSpinBox(boxAdcs);
|
||||
spinAdcs[i]->setMaximum(10000);
|
||||
spinAdcs[i]->setMinimum(-1);
|
||||
if((detType==slsDetectorDefs::GOTTHARD) ||
|
||||
(detType==slsDetectorDefs::PROPIX) ||
|
||||
(detType==slsDetectorDefs::MOENCH)||
|
||||
(detType==slsDetectorDefs::EIGER))
|
||||
spinAdcs[i]->setSuffix(0x00b0+QString("C"));
|
||||
|
||||
adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4);
|
||||
adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5);
|
||||
if(!(i%2)){
|
||||
adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0);
|
||||
adcLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3);
|
||||
adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::SetDacValues(int id){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value() << endl;
|
||||
#endif
|
||||
|
||||
int detid = comboDetector->currentIndex();
|
||||
if(detid)
|
||||
det = myDet->getSlsDetector(detid-1);
|
||||
|
||||
//all detectors
|
||||
if(!detid){
|
||||
myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0);
|
||||
lblDacsmV[id]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(id),1),-10));
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues");
|
||||
}
|
||||
//specific detector
|
||||
else{
|
||||
det->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0);
|
||||
lblDacsmV[id]->setText(QString("%1mV").arg(det->setDAC(-1,getSLSIndex(id),1),-10));
|
||||
qDefs::checkErrorMessage(det,"qTabDeveloper::SetDacValues");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::SetHighVoltage(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting high voltage:" << comboHV->currentText().toAscii().constData() << endl;
|
||||
#endif
|
||||
|
||||
int detid = comboDetector->currentIndex();
|
||||
if(detid)
|
||||
det = myDet->getSlsDetector(detid-1);
|
||||
|
||||
int highvoltage = comboHV->currentText().toInt();
|
||||
int ret;
|
||||
|
||||
//all detectors
|
||||
if(!detid){
|
||||
ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT,0);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetHighVoltage");
|
||||
}
|
||||
//specific detector
|
||||
else{
|
||||
ret = det->setDAC(highvoltage,slsDetectorDefs::HV_POT,0);
|
||||
qDefs::checkErrorMessage(det,"qTabDeveloper::SetHighVoltage");
|
||||
}
|
||||
|
||||
|
||||
//error
|
||||
if(ret != highvoltage){
|
||||
qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","qTabDeveloper::SetHighVoltage");
|
||||
lblHV->setPalette(red);
|
||||
lblHV->setText("High Voltage:*");
|
||||
QString errTip = tipHV+QString("<br><br><font color=\"red\"><nobr>High Voltage could not be set. The return value is ")+
|
||||
QString::number(ret)+ QString("</nobr></font>");
|
||||
lblHV->setToolTip(errTip);
|
||||
comboHV->setToolTip(errTip);
|
||||
}else{
|
||||
lblHV->setPalette(lblDacs[0]->palette());
|
||||
lblHV->setText("High Voltage:");
|
||||
lblHV->setToolTip(tipHV);
|
||||
comboHV->setToolTip(tipHV);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::TRIMBIT_SIZE;
|
||||
case 1: return slsDetectorDefs::THRESHOLD;
|
||||
case 2: return slsDetectorDefs::SHAPER1;
|
||||
case 3: return slsDetectorDefs::SHAPER2;
|
||||
case 4: return slsDetectorDefs::CALIBRATION_PULSE;
|
||||
case 5: return slsDetectorDefs::PREAMP;
|
||||
default:
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::E_SvP;
|
||||
case 1: return slsDetectorDefs::E_SvN;
|
||||
case 2: return slsDetectorDefs::E_Vrf;
|
||||
case 3: return slsDetectorDefs::E_Vrs;
|
||||
case 4: return slsDetectorDefs::E_Vtr;
|
||||
case 5: return slsDetectorDefs::E_Vtgstv;
|
||||
case 6: return slsDetectorDefs::E_cal;
|
||||
case 7: return slsDetectorDefs::E_Vcp;
|
||||
case 8: return slsDetectorDefs::E_Vcn;
|
||||
case 9: return slsDetectorDefs::E_Vis;
|
||||
case 10:return slsDetectorDefs::E_rxb_lb;
|
||||
case 11:return slsDetectorDefs::E_rxb_rb;
|
||||
case 12:return slsDetectorDefs::E_Vcmp_ll;
|
||||
case 13:return slsDetectorDefs::E_Vcmp_lr;
|
||||
case 14:return slsDetectorDefs::E_Vcmp_rl;
|
||||
case 15:return slsDetectorDefs::E_Vcmp_rr;
|
||||
case 16:return slsDetectorDefs::THRESHOLD;
|
||||
case 17:return slsDetectorDefs::TEMPERATURE_FPGAEXT;
|
||||
case 18:return slsDetectorDefs::TEMPERATURE_10GE;
|
||||
case 19:return slsDetectorDefs::TEMPERATURE_DCDC;
|
||||
case 20:return slsDetectorDefs::TEMPERATURE_SODL;
|
||||
case 21:return slsDetectorDefs::TEMPERATURE_SODR;
|
||||
case 22:return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::V_DAC0;
|
||||
case 1: return slsDetectorDefs::V_DAC1;
|
||||
case 2: return slsDetectorDefs::V_DAC2;
|
||||
case 3: return slsDetectorDefs::V_DAC3;
|
||||
case 4: return slsDetectorDefs::V_DAC4;
|
||||
case 5: return slsDetectorDefs::V_DAC5;
|
||||
case 6: return slsDetectorDefs::V_DAC6;
|
||||
case 7: return slsDetectorDefs::V_DAC7;
|
||||
case 8: return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
case 9:return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
|
||||
default:
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error. Index:"+ index,"qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::G_VREF_DS;
|
||||
case 1: return slsDetectorDefs::G_VCASCN_PB;
|
||||
case 2: return slsDetectorDefs::G_VCASCP_PB;
|
||||
case 3: return slsDetectorDefs::G_VOUT_CM;
|
||||
case 4: return slsDetectorDefs::G_VCASC_OUT;
|
||||
case 5: return slsDetectorDefs::G_VIN_CM;
|
||||
case 6: return slsDetectorDefs::G_VREF_COMP;
|
||||
case 7: return slsDetectorDefs::G_IB_TESTC;
|
||||
case 8: return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
case 9:return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
switch(index){
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown detector type:" + myDet->slsDetectorBase::getDetectorType(detType) << endl;
|
||||
qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::getSLSIndex");
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::getSLSIndex");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
return slsDetectorDefs::HUMIDITY;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::RefreshAdcs(){
|
||||
if(!thisParent->isCurrentlyTabDeveloper())
|
||||
return;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Updating ADCs" <<endl;
|
||||
#endif
|
||||
adcTimer->stop();
|
||||
|
||||
int detid = comboDetector->currentIndex();
|
||||
if(detid)
|
||||
det = myDet->getSlsDetector(detid-1);
|
||||
|
||||
for(int i=0;i<NUM_ADC_WIDGETS;i++){
|
||||
//all detectors
|
||||
if(!detid){
|
||||
if(detType == slsDetectorDefs::EIGER){
|
||||
double value = (double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS));
|
||||
if(value == -1)
|
||||
spinAdcs[i]->setValue(value);
|
||||
else
|
||||
spinAdcs[i]->setValue(value/1000.00);
|
||||
|
||||
}
|
||||
else
|
||||
spinAdcs[i]->setValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)));
|
||||
}
|
||||
//specific detector
|
||||
else{
|
||||
if(detType == slsDetectorDefs::EIGER)
|
||||
spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))/1000.00);
|
||||
else
|
||||
spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
adcTimer->start(ADC_TIMEOUT);
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::RefreshAdcs");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Developer Tab" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
int detid = comboDetector->currentIndex();
|
||||
if(detid)
|
||||
det = myDet->getSlsDetector(detid-1);
|
||||
|
||||
|
||||
//dacs
|
||||
#ifdef VERBOSE
|
||||
cout << "Gettings DACs" << endl;
|
||||
#endif
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++){
|
||||
//all detectors
|
||||
if(!detid){
|
||||
spinDacs[i]->setValue((double)myDet->setDAC(-1,getSLSIndex(i),0));
|
||||
lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(i),1),-10));
|
||||
}
|
||||
//specific detector
|
||||
else{
|
||||
spinDacs[i]->setValue((double)det->setDAC(-1,getSLSIndex(i),0));
|
||||
lblDacsmV[i]->setText(QString("%1mV").arg(det->setDAC(-1,getSLSIndex(i),1),-10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//adcs
|
||||
if(NUM_ADC_WIDGETS) RefreshAdcs();
|
||||
|
||||
//gotthard -high voltage
|
||||
if((detType == slsDetectorDefs::GOTTHARD) ||
|
||||
(detType == slsDetectorDefs::PROPIX) ||
|
||||
(detType == slsDetectorDefs::MOENCH)){
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
|
||||
//default should be correct
|
||||
lblHV->setPalette(lblDacs[0]->palette());
|
||||
lblHV->setText("High Voltage:");
|
||||
lblHV->setToolTip(tipHV);
|
||||
comboHV->setToolTip(tipHV);
|
||||
//getting hv value
|
||||
int ret;
|
||||
if(!detid) ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT,0);
|
||||
else ret = (int)det->setDAC(-1,slsDetectorDefs::HV_POT,0);
|
||||
|
||||
switch(ret){
|
||||
case 0: comboHV->setCurrentIndex(0);break;
|
||||
case 90: comboHV->setCurrentIndex(1);break;
|
||||
case 110: comboHV->setCurrentIndex(2);break;
|
||||
case 120: comboHV->setCurrentIndex(3);break;
|
||||
case 150: comboHV->setCurrentIndex(4);break;
|
||||
case 180: comboHV->setCurrentIndex(5);break;
|
||||
case 200: comboHV->setCurrentIndex(6);break;
|
||||
default: comboHV->setCurrentIndex(0);//error
|
||||
lblHV->setPalette(red);
|
||||
lblHV->setText("High Voltage:*");
|
||||
QString errTip = tipHV+QString("<br><br><font color=\"red\"><nobr>High Voltage could not be set. The return value is ")+
|
||||
QString::number(ret)+ QString("</nobr></font>");
|
||||
lblHV->setToolTip(errTip);
|
||||
comboHV->setToolTip(errTip);
|
||||
break;
|
||||
}
|
||||
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Developer Tab" << endl << endl;
|
||||
#endif
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
915
slsDetectorGui/src/qTabMeasurement.cpp
Normal file
@ -0,0 +1,915 @@
|
||||
/*
|
||||
* qTabMeasurement.cpp
|
||||
*
|
||||
* Created on: May 2, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
//Qt Project Class Headers
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qDetectorMain.h"
|
||||
//Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
//C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabMeasurement::qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot):
|
||||
thisParent(parent),myDet(detector),myPlot(plot),expertMode(false){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
SetupTimingMode();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabMeasurement::~qTabMeasurement(){
|
||||
delete myDet;
|
||||
delete myPlot;
|
||||
delete thisParent;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow(){
|
||||
|
||||
detType = myDet->getDetectorsType();
|
||||
|
||||
//Number of measurements
|
||||
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
//Number of frames
|
||||
spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
|
||||
//Exp Time
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex((int)unit);
|
||||
//period
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))));
|
||||
spinPeriod->setValue(time);
|
||||
comboPeriodUnit->setCurrentIndex((int)unit);
|
||||
//Number of Triggers
|
||||
spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
|
||||
//delay
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9))));
|
||||
spinDelay->setValue(time);
|
||||
comboDelayUnit->setCurrentIndex((int)unit);
|
||||
//gates
|
||||
spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1));
|
||||
//probes
|
||||
if(detType == slsDetectorDefs::MYTHEN)
|
||||
spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1));
|
||||
//File Name
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
//File Index
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
//only initially
|
||||
lblProgressIndex->setText(QString::number(0));
|
||||
//ly initially
|
||||
progressBar->setValue(0);
|
||||
//file write enabled/disabled
|
||||
chkFile->setChecked(myDet->enableWriteToFile());
|
||||
dispFileName->setEnabled(myDet->enableWriteToFile());
|
||||
|
||||
|
||||
//creating the icons for the buttons
|
||||
iconStart = new QIcon(":/icons/images/start.png");
|
||||
iconStop = new QIcon(":/icons/images/stop.png");
|
||||
|
||||
|
||||
//Timer to update the progress bar
|
||||
progressTimer = new QTimer(this);
|
||||
|
||||
//Hide the error message
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
acqPeriodTip = spinPeriod->toolTip();
|
||||
errPeriodTip = QString("<nobr>Frame period between exposures.</nobr><br>"
|
||||
"<nobr> #period#</nobr><br><br>")+
|
||||
QString("<nobr><font color=\"red\"><b>Acquisition Period</b> should be"
|
||||
" greater than or equal to <b>Exposure Time</b>.</font></nobr>");
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::SetExpertMode(bool enable){
|
||||
expertMode = enable;
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetExpertMode");
|
||||
|
||||
EnableProbes();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::SetupTimingMode(){
|
||||
//To be able to index items on a combo box
|
||||
model = qobject_cast<QStandardItemModel*>(comboTimingMode->model());
|
||||
QModelIndex index[NumTimingModes];
|
||||
QStandardItem* item[NumTimingModes];
|
||||
if (model) {
|
||||
for(int i=0;i<NumTimingModes;i++){
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
//Enabling/Disabling depending on the detector type
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Readout]->setEnabled(true);
|
||||
item[(int)Gated]->setEnabled(true);
|
||||
item[(int)Gated_Start]->setEnabled(true);
|
||||
item[(int)Burst_Trigger]->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
item[(int)Gated]->setEnabled(true);
|
||||
item[(int)Gated_Start]->setEnabled(false);
|
||||
item[(int)Burst_Trigger]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
item[(int)Gated]->setEnabled(false);
|
||||
item[(int)Gated_Start]->setEnabled(false);
|
||||
item[(int)Burst_Trigger]->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown detector type." << endl;
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","qTabMeasurement::SetupTimingMode");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GetModeFromDetector(true);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::GetModeFromDetector(bool startup){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting timing mode" << endl;
|
||||
#endif
|
||||
//Get timing mode from detector
|
||||
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode();
|
||||
|
||||
//Setting the timing mode in gui
|
||||
if(model && model->itemFromIndex(model->index(mode+1,comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()))->isEnabled()){
|
||||
|
||||
//these are things checked in setuptimingmode
|
||||
|
||||
// to let qdrawplot know that triggers or frames are used
|
||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||
if((!startup) && (comboTimingMode->currentIndex() == (mode+1))){
|
||||
if(lblPeriod->isEnabled())
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
else{
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
EnableProbes();
|
||||
emit CheckPlotIntervalSignal();
|
||||
return;
|
||||
}
|
||||
|
||||
//if the timing mode is Auto and
|
||||
// number of Frames and number of triggers is 1,
|
||||
// then the timing mode is 'None'.
|
||||
// This is for the inexperienced user
|
||||
if(mode==slsDetectorDefs::AUTO_TIMING){
|
||||
int frames = spinNumFrames->value();
|
||||
int triggers = spinNumTriggers->value();
|
||||
if((frames==1)&&(triggers==1)){
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
SetTimingMode((int)None);
|
||||
}else{
|
||||
comboTimingMode->setCurrentIndex((int)Auto);
|
||||
SetTimingMode((int)Auto);
|
||||
}
|
||||
}else{
|
||||
//mode +1 since the detector class has no timingmode as "None"
|
||||
comboTimingMode->setCurrentIndex((int)mode+1);
|
||||
SetTimingMode((int)mode+1);
|
||||
}
|
||||
}
|
||||
// Mode NOT ENABLED.
|
||||
// This should not happen -only if the server and gui has a mismatch
|
||||
// on which all modes are allowed in detectors
|
||||
else{
|
||||
//check if the detector is not even connected
|
||||
string offline = myDet->checkOnline();
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::GetModeFromDetector");
|
||||
|
||||
if(!offline.empty()){
|
||||
qDefs::Message(qDefs::CRITICAL,string("<nobr>The detector(s) <b>")+offline+string(" </b> is/are not connected. Exiting GUI.</nobr>"),"Main");
|
||||
cout << "The detector(s) " << offline << " is/are not connected. Exiting GUI." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
cout << "Unknown Timing Mode " << mode << " detected from detector" << endl;
|
||||
qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector."
|
||||
"\n\nSetting the following defaults:\nTiming Mode \t: None\n"
|
||||
"Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::GetModeFromDetector");
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
SetTimingMode((int)None);
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::GetModeFromDetector");
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::Initialization(){
|
||||
//Number of Measurements
|
||||
connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
//File Name
|
||||
connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName()));
|
||||
//File Index
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
//Start/Stop Acquisition
|
||||
connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition()));
|
||||
//Timing Mode
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));//
|
||||
//progress bar
|
||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
//enable write to file
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
//Number of Frames
|
||||
connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
//Exposure Time
|
||||
connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));
|
||||
connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
|
||||
//Frame Period between exposures
|
||||
connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
|
||||
//Number of Triggers
|
||||
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
//Delay After Trigger
|
||||
connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
//Number of Gates
|
||||
connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
//Number of Probes
|
||||
connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::Enable(bool enable){
|
||||
frameTimeResolved->setEnabled(enable);
|
||||
frameNotTimeResolved->setEnabled(enable);
|
||||
|
||||
//shortcut each time, else it doesnt work a second time
|
||||
btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::startStopAcquisition(){
|
||||
if(btnStartStop->isChecked()){
|
||||
|
||||
//if file write enabled and output dir doesnt exist
|
||||
if((chkFile->isChecked())&&(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL)){
|
||||
if(qDefs::Message(qDefs::QUESTION,
|
||||
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>",
|
||||
"qTabMeasurement::startStopAcquisition") == slsDetectorDefs::FAIL){
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->click();
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
return;
|
||||
}else{
|
||||
//done because for receiver it cant save a file with blank file path and returns without acquiring even to the gui
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
chkFile->setChecked(false);
|
||||
EnableFileWrite(false);
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << endl << endl << "Starting Acquisition" << endl;
|
||||
#endif
|
||||
//btnStartStop->setStyleSheet("color:red");
|
||||
btnStartStop->setText("Stop");
|
||||
btnStartStop->setIcon(*iconStop);
|
||||
lblProgressIndex->setText(QString::number(0));
|
||||
Enable(0);
|
||||
progressBar->setValue(0);
|
||||
progressTimer->start(100);
|
||||
|
||||
emit StartSignal();
|
||||
}else{
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopping Acquisition" << endl<< endl;
|
||||
#endif
|
||||
//emit StopSignal(); commented out to prevent undefined state
|
||||
myDet->stopAcquisition();
|
||||
/* commented out to prevent undefined state
|
||||
myDet->waitForReceiverReadToFinish();
|
||||
UpdateProgress();
|
||||
//spin index
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
progressTimer->stop();
|
||||
btnStartStop->setText("Start");
|
||||
btnStartStop->setIcon(*iconStart);
|
||||
btnStartStop->setChecked(false);
|
||||
Enable(1);*/
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::startStopAcquisition");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
UpdateProgress();
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
progressTimer->stop();
|
||||
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->setText("Start");
|
||||
btnStartStop->setIcon(*iconStart);
|
||||
btnStartStop->setChecked(false);
|
||||
Enable(1);
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateFinished");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::SetCurrentMeasurement(int val){
|
||||
if((val)<spinNumMeasurements->value())
|
||||
lblCurrentMeasurement->setText(QString::number(val));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateProgress(){
|
||||
progressBar->setValue((int)myPlot->GetProgress());
|
||||
lblProgressIndex->setText(QString::number(myPlot->GetFrameIndex()));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setFileName(){
|
||||
QString fName = dispFileName->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting File name to " << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
myDet->setFileName(fName.toAscii().data());
|
||||
|
||||
disconnect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName()));
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName()));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setFileName");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMeasurement::setRunIndex(int index){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting File Index to " << index << endl;
|
||||
#endif
|
||||
myDet->setFileIndex(index);
|
||||
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setRunIndex");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setNumMeasurements(int val){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Number of Measurements to " << val << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,val);
|
||||
|
||||
disconnect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumMeasurements");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setNumFrames(int val){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of frames to " << val << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val);
|
||||
|
||||
disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
|
||||
connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumFrames");
|
||||
|
||||
EnableProbes();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::CheckAcqPeriodGreaterThanExp(){
|
||||
double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
if(exptimeNS>acqtimeNS) {
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setPalette(red);
|
||||
lblPeriod->setText("Acquisition Period:*");
|
||||
}
|
||||
else {
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setExposureTime(){
|
||||
//Get the value of timer in ns
|
||||
double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting acquisition time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS);
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setExposureTime");
|
||||
|
||||
if(lblPeriod->isEnabled())
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setAcquisitionPeriod(){
|
||||
//Get the value of timer in ns
|
||||
double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/" << spinPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS);
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setAcquisitionPeriod");
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
//Check if the interval between plots is ok
|
||||
emit CheckPlotIntervalSignal();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setNumTriggers(int val){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of triggers to " << val << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val);
|
||||
|
||||
disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
|
||||
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumTriggers");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setDelay(){
|
||||
//Get the value of timer in ns
|
||||
double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value());
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS);
|
||||
/*
|
||||
//updating value set
|
||||
disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9))));
|
||||
spinDelay->setValue(time);
|
||||
comboDelayUnit->setCurrentIndex((int)unit);
|
||||
connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
*/
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setDelay");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setNumGates(int val){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of gates to " << val << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val);
|
||||
|
||||
disconnect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1));
|
||||
connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumGates");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setNumProbes(int val){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of probes to " << val << endl;
|
||||
#endif
|
||||
disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
|
||||
//set probes
|
||||
int ret = myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val);
|
||||
if(ret != val)
|
||||
ret = myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1);
|
||||
spinNumProbes->setValue(ret);
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes");
|
||||
|
||||
|
||||
//Setting number of probes should reset number of triggers to 1, need to check if enabled, cuz its updated when refresh
|
||||
if((spinNumProbes->isEnabled()) && (ret > 0) && (spinNumTriggers->value() != 1)){
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>Number of Triggers has been reset to 1.</nobr><br>"
|
||||
"<nobr>This is mandatory to use probes.</nobr>","qTabMeasurement::setNumProbes");
|
||||
cout << "Resetting Number of triggers to 1" << endl;
|
||||
spinNumTriggers->setValue(1);
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes");
|
||||
|
||||
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Timing mode to " << comboTimingMode->currentText().toAscii().data() << endl;
|
||||
#endif
|
||||
//Default settings
|
||||
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
|
||||
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
|
||||
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
|
||||
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
|
||||
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
|
||||
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
|
||||
lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false);
|
||||
|
||||
bool success = false;
|
||||
switch(mode){
|
||||
case None://Exposure Time
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
spinNumTriggers->setValue(1);
|
||||
spinNumFrames->setValue(1);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Auto://#Frames, ExpTime, Period
|
||||
spinNumTriggers->setValue(1);
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Exp_Series://#(Frames), #Triggers, ExpTime, Period, (Delay)
|
||||
if(detType == slsDetectorDefs::EIGER) //only 1 frame for each trigger for eiger
|
||||
spinNumFrames->setValue(1);
|
||||
else{
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
}
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Readout://#Frames, ExpTime, Period, (Delay)
|
||||
spinNumTriggers->setValue(1);
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT)
|
||||
success = true;
|
||||
break;
|
||||
case Gated://#Frames, #(Gates)
|
||||
if(detType != slsDetectorDefs::EIGER){
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
}
|
||||
spinNumTriggers->setValue(1);
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
|
||||
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER)
|
||||
success = true;
|
||||
break;
|
||||
case Gated_Start://#Frames, #Triggers, #Gates, ExpTime, Period
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER)
|
||||
success = true;
|
||||
break;
|
||||
case Burst_Trigger://#Frames, ExpTime, Period, (Delay)
|
||||
spinNumTriggers->setValue(1);
|
||||
if(detType != slsDetectorDefs::EIGER){
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
}
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::BURST_TRIGGER)==slsDetectorDefs::BURST_TRIGGER)
|
||||
success = true;
|
||||
break;
|
||||
default:
|
||||
cout << "Timing mode unknown to GUI" << endl;
|
||||
//This should never happen
|
||||
qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","qTabMeasurement::SetTimingMode");
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode");
|
||||
exit(-1);
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode");
|
||||
if(!success){
|
||||
qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n"
|
||||
"Please check the external flags."
|
||||
"\n\nSetting the following defaults:\nTiming Mode \t: None\n"
|
||||
"Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetTimingMode");
|
||||
spinNumFrames->setValue(1);
|
||||
spinNumTriggers->setValue(1);
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Frame Period between exposures
|
||||
qDefs::timeUnit unit;
|
||||
if(lblPeriod->isEnabled())
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
else{
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
|
||||
|
||||
//Check if Number of Probes should be enabled
|
||||
EnableProbes();
|
||||
|
||||
// to let qdrawplot know that triggers or frames are used
|
||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode");
|
||||
|
||||
emit CheckPlotIntervalSignal();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::EnableFileWrite(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout << "Enable File Write:" << enable << endl;
|
||||
#endif
|
||||
myDet->enableWriteToFile(enable);
|
||||
dispFileName->setEnabled(enable);
|
||||
if(enable) setFileName();
|
||||
myPlot->SetEnableFileWrite(enable);
|
||||
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
chkFile->setChecked(myDet->enableWriteToFile());
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableFileWrite");
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Measurement Tab" << endl;
|
||||
#endif
|
||||
|
||||
if(!myPlot->isRunning()){
|
||||
//to prevent it from recalculating forever
|
||||
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
disconnect(dispFileName, SIGNAL(editingFinished()), this, SLOT(setFileName()));
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
disconnect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));
|
||||
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
|
||||
disconnect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));
|
||||
disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
|
||||
disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
disconnect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
disconnect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting number of measurements & frames" << endl;
|
||||
#endif
|
||||
//Number of measurements
|
||||
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
//Number of frames
|
||||
spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting Exposure time and Acquisition Period" << endl;
|
||||
#endif
|
||||
//Exp Time
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex((int)unit);
|
||||
//period
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))));
|
||||
spinPeriod->setValue(time);
|
||||
comboPeriodUnit->setCurrentIndex((int)unit);
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting delay after trigger, number of triggers and number of gates" << endl;
|
||||
#endif
|
||||
//delay
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9))));
|
||||
spinDelay->setValue(time);
|
||||
comboDelayUnit->setCurrentIndex((int)unit);
|
||||
//Number of Triggers
|
||||
spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
|
||||
//gates
|
||||
spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1));
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting file name prefix, file index, file write enable and progress index" << endl;
|
||||
#endif
|
||||
//File Name
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
//File Index
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
//file write enabled/disabled
|
||||
chkFile->setChecked(myDet->enableWriteToFile());
|
||||
|
||||
//progress label index
|
||||
if(myDet->getFrameIndex()==-1)
|
||||
lblProgressIndex->setText("0");
|
||||
else
|
||||
lblProgressIndex->setText(QString::number(myDet->getFrameIndex()));
|
||||
|
||||
connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(setFileName()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
connect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
|
||||
//timing mode - will also check if exptime>acq period and also enableprobes()
|
||||
GetModeFromDetector();
|
||||
|
||||
// to let qdrawplot know that triggers or frames are used
|
||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::Refresh");
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Measurement Tab" << endl << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::EnableProbes(){
|
||||
|
||||
//disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
|
||||
|
||||
//enabled only in expert mode and if #Frames > 1
|
||||
if((expertMode)&&(detType==slsDetectorDefs::MYTHEN)&&(spinNumFrames->value()>1)){
|
||||
lblNumProbes->setEnabled(true);
|
||||
spinNumProbes->setEnabled(true);
|
||||
spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1));
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting number of probes : " << spinNumProbes->value() << endl;
|
||||
#endif
|
||||
|
||||
//Setting number of probes should reset number of triggers to 1, need to check if enabled, cuz its updated when refresh
|
||||
if((spinNumProbes->isEnabled()) && (spinNumProbes->value() > 0) && (spinNumTriggers->value() != 1)){
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>Number of Triggers has been reset to 1.</nobr><br>"
|
||||
"<nobr>This is mandatory to use probes.</nobr>","qTabMeasurement::EnableProbes");
|
||||
cout << "Resetting Number of triggers to 1" << endl;
|
||||
spinNumTriggers->setValue(1);
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableProbes");
|
||||
|
||||
connect(spinNumProbes, SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
return;
|
||||
}
|
||||
cout << "Probes not enabled" << endl;
|
||||
if(detType==slsDetectorDefs::MYTHEN)
|
||||
spinNumProbes->setValue(0);
|
||||
lblNumProbes->setEnabled(false);
|
||||
spinNumProbes->setEnabled(false);
|
||||
|
||||
//connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
122
slsDetectorGui/src/qTabMessages.cpp
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* qTabMessages.cpp
|
||||
*
|
||||
* Created on: Jun 26, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "qTabMessages.h"
|
||||
#include "qDetectorMain.h"
|
||||
/** Project Class Headers */
|
||||
/** Qt Include Headers */
|
||||
#include <QGridLayout>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
/** C++ Include Headers */
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMessages::qTabMessages(qDetectorMain* m):myMainTab(m),qout(0),qerr(0){
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMessages::~qTabMessages(){
|
||||
delete myMainTab;
|
||||
delete dispLog;
|
||||
delete qout;
|
||||
delete qerr;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::SetupWidgetWindow(){
|
||||
/** Layout */
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
|
||||
dispLog = new QTextEdit(this);
|
||||
dispLog->setReadOnly(true);
|
||||
dispLog->setFocusPolicy(Qt::NoFocus);
|
||||
dispLog->setTextColor(Qt::darkBlue);
|
||||
|
||||
|
||||
btnSave = new QPushButton("Save Log ",this);
|
||||
btnSave->setFocusPolicy(Qt::NoFocus);
|
||||
btnSave->setFixedWidth(100);
|
||||
btnSave->setIcon(QIcon( ":/icons/images/save.png" ));
|
||||
|
||||
btnClear = new QPushButton("Clear ",this);
|
||||
btnClear->setFocusPolicy(Qt::NoFocus);
|
||||
btnClear->setFixedWidth(100);
|
||||
btnClear->setIcon(QIcon( ":/icons/images/erase.png" ));
|
||||
|
||||
gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),0,0);
|
||||
gridLayout->addWidget(btnSave,1,0,1,1);
|
||||
gridLayout->addWidget(btnClear,1,4,1,1);
|
||||
gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0);
|
||||
gridLayout->addWidget(dispLog,3,0,1,5);
|
||||
|
||||
errMsg = "<nobr> Please check Messages Tab. Following message was caught:</nobr><br><br><nobr><font color=\"darkBlue\">";
|
||||
qout=new qDebugStream(std::cout,this);
|
||||
qerr=new qDebugStream(std::cerr,this);
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::Initialization(){
|
||||
connect(btnSave,SIGNAL(clicked()),this,SLOT(SaveLog()));
|
||||
connect(btnClear,SIGNAL(clicked()),this,SLOT(ClearLog()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::customEvent(QEvent *e) {
|
||||
if (e->type() == (STREAMEVENT)){
|
||||
QString temp = ((qStreamEvent*)e)->getString();
|
||||
dispLog->append(temp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::SaveLog() {
|
||||
QString fName = QString(myMainTab->GetFilePath());
|
||||
fName = fName+"/LogFile.txt";
|
||||
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
||||
fName,tr("Text files (*.txt);;All Files(*)"));
|
||||
if (!fName.isEmpty()){
|
||||
QFile outfile;
|
||||
outfile.setFileName(fName);
|
||||
if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append
|
||||
QTextStream out(&outfile);
|
||||
out<<dispLog->toPlainText() << endl;
|
||||
qDefs::Message(qDefs::INFORMATION,string("The Log has been successfully saved to "
|
||||
"")+fName.toAscii().constData(),"qTabMessages::SaveLog");
|
||||
}
|
||||
else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","qTabMessages::SaveLog");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::ClearLog() {
|
||||
dispLog->clear();
|
||||
#ifdef VERBOSE
|
||||
cout<<"Log Cleared"<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
1173
slsDetectorGui/src/qTabPlot.cpp
Normal file
377
slsDetectorGui/src/qTabSettings.cpp
Normal file
@ -0,0 +1,377 @@
|
||||
/*
|
||||
* qTabSettings.cpp
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#include "qTabSettings.h"
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector):
|
||||
QWidget(parent),myDet(detector),expertMode(false){
|
||||
|
||||
for(int i=0;i<NumSettings;i++)
|
||||
item[i]=0;
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabSettings::~qTabSettings(){
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::SetupWidgetWindow(){
|
||||
// Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
|
||||
// Settings
|
||||
SetupDetectorSettings();
|
||||
|
||||
//threshold
|
||||
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::EIGER))
|
||||
spinThreshold->setValue(myDet->getThresholdEnergy());
|
||||
|
||||
//expert mode is not enabled initially
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
|
||||
// Number of Modules
|
||||
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
|
||||
Initialization();
|
||||
|
||||
// Dynamic Range
|
||||
GetDynamicRange();
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::GetDynamicRange(int setvalue){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting dynamic range" << endl;
|
||||
#endif
|
||||
int ret = myDet->setDynamicRange(-1);
|
||||
if(detType == slsDetectorDefs::MYTHEN)
|
||||
if(ret==24)
|
||||
ret=32;
|
||||
else if(ret==24)
|
||||
cout<<"ret:"<<ret<<endl;
|
||||
//check if the set value is equal to return value
|
||||
if((setvalue!=-1) && (setvalue!=ret)){
|
||||
qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","qTabSettings::SetDynamicRange");
|
||||
#ifdef VERBOSE
|
||||
cout << "ERROR: Setting dynamic range to "<< ret << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//set the final value on gui
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
switch(ret){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
case 8: comboDynamicRange->setCurrentIndex(2); break;
|
||||
case 4: comboDynamicRange->setCurrentIndex(3); break;
|
||||
default: comboDynamicRange->setCurrentIndex(0); break;
|
||||
}
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::SetupDetectorSettings(){
|
||||
// Get detector settings from detector
|
||||
int sett = (int)myDet->getSettings();cout<<"sett:"<<sett<<endl;
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetupDetectorSettings");
|
||||
if(sett==-1) sett = Undefined;
|
||||
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
|
||||
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
|
||||
// To be able to index items on a combo box
|
||||
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
||||
if (model) {
|
||||
for(int i=0;i<NumSettings;i++){
|
||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
item[(int)Standard]->setEnabled(true);
|
||||
item[(int)Fast]->setEnabled(true);
|
||||
item[(int)HighGain]->setEnabled(true);
|
||||
item[(int)DynamicGain]->setEnabled(false);
|
||||
item[(int)LowGain]->setEnabled(false);
|
||||
item[(int)MediumGain]->setEnabled(false);
|
||||
item[(int)VeryHighGain]->setEnabled(false);
|
||||
item[(int)LowNoise]->setEnabled(false);
|
||||
item[(int)DynamicHG0]->setEnabled(false);
|
||||
item[(int)FixGain1]->setEnabled(false);
|
||||
item[(int)FixGain2]->setEnabled(false);
|
||||
item[(int)ForceSwitchG1]->setEnabled(false);
|
||||
item[(int)ForceSwitchG2]->setEnabled(false);
|
||||
item[(int)VeryLowGain]->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)Standard]->setEnabled(true);
|
||||
item[(int)Fast]->setEnabled(false);
|
||||
item[(int)HighGain]->setEnabled(true);
|
||||
item[(int)DynamicGain]->setEnabled(false);
|
||||
item[(int)LowGain]->setEnabled(true);
|
||||
item[(int)MediumGain]->setEnabled(false);
|
||||
item[(int)VeryHighGain]->setEnabled(true);
|
||||
item[(int)LowNoise]->setEnabled(false);
|
||||
item[(int)DynamicHG0]->setEnabled(false);
|
||||
item[(int)FixGain1]->setEnabled(false);
|
||||
item[(int)FixGain2]->setEnabled(false);
|
||||
item[(int)ForceSwitchG1]->setEnabled(false);
|
||||
item[(int)ForceSwitchG2]->setEnabled(false);
|
||||
item[(int)VeryLowGain]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
item[(int)Standard]->setEnabled(false);
|
||||
item[(int)Fast]->setEnabled(false);
|
||||
item[(int)HighGain]->setEnabled(true);
|
||||
item[(int)DynamicGain]->setEnabled(true);
|
||||
item[(int)LowGain]->setEnabled(true);
|
||||
item[(int)MediumGain]->setEnabled(true);
|
||||
item[(int)VeryHighGain]->setEnabled(true);
|
||||
item[(int)LowNoise]->setEnabled(false);
|
||||
item[(int)DynamicHG0]->setEnabled(false);
|
||||
item[(int)FixGain1]->setEnabled(false);
|
||||
item[(int)FixGain2]->setEnabled(false);
|
||||
item[(int)ForceSwitchG1]->setEnabled(false);
|
||||
item[(int)ForceSwitchG2]->setEnabled(false);
|
||||
item[(int)VeryLowGain]->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
item[(int)Standard]->setEnabled(false);
|
||||
item[(int)Fast]->setEnabled(false);
|
||||
item[(int)HighGain]->setEnabled(false);
|
||||
item[(int)DynamicGain]->setEnabled(true);
|
||||
item[(int)LowGain]->setEnabled(false);
|
||||
item[(int)MediumGain]->setEnabled(false);
|
||||
item[(int)VeryHighGain]->setEnabled(false);
|
||||
item[(int)LowNoise]->setEnabled(false);
|
||||
item[(int)DynamicHG0]->setEnabled(true);
|
||||
item[(int)FixGain1]->setEnabled(true);
|
||||
item[(int)FixGain2]->setEnabled(true);
|
||||
item[(int)ForceSwitchG1]->setEnabled(true);
|
||||
item[(int)ForceSwitchG2]->setEnabled(true);
|
||||
item[(int)VeryLowGain]->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown detector type. Exiting GUI." << endl;
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
// detector settings selected NOT ENABLED.
|
||||
// This should not happen -only if the server and gui has a mismatch
|
||||
// on which all modes are allowed in detectors
|
||||
if(!(item[sett]->isEnabled())){
|
||||
qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","qTabSettings::SetupDetectorSettings");
|
||||
#ifdef VERBOSE
|
||||
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
// Setting the detector settings
|
||||
else comboSettings->setCurrentIndex(sett);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
// Settings
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
// Number of Modules
|
||||
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
|
||||
// Dynamic Range
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
// Threshold
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::setSettings(int index){
|
||||
//dont set it if settings is set to undefined or uninitialized
|
||||
if((index==Undefined)||(index==Uninitialized)){
|
||||
qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","qTabSettings::setSettings");
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = Undefined;
|
||||
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
|
||||
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
}
|
||||
|
||||
else{
|
||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index);
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
||||
#endif
|
||||
|
||||
//threshold
|
||||
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
SetEnergy();
|
||||
//also update trimbits plot
|
||||
if(expertMode) emit UpdateTrimbitSignal(0);
|
||||
}
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::setSettings");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::SetNumberOfModules(int index){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of modules to "<< index << endl;
|
||||
#endif
|
||||
int i = myDet->setNumberOfModules(index);
|
||||
if(index!=i)
|
||||
qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","qTabSettings::SetNumberOfModules");
|
||||
#ifdef VERBOSE
|
||||
cout << "ERROR: Setting number of modules to "<< i << endl;
|
||||
#endif
|
||||
spinNumModules->setValue(i);
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetNumberOfModules");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index){
|
||||
int dr;
|
||||
switch (index) {
|
||||
case 0: dr=32; break;
|
||||
case 1: dr=16; break;
|
||||
case 2: dr=8; break;
|
||||
case 3: dr=4; break;
|
||||
default: dr=32; break;
|
||||
}
|
||||
myDet->setDynamicRange(dr);
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting dynamic range to "<< dr << endl;
|
||||
#endif
|
||||
//check
|
||||
GetDynamicRange(dr);
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetDynamicRange");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::SetEnergy(){
|
||||
int index = spinThreshold->value();
|
||||
#ifdef VERBOSE
|
||||
cout << "Settings threshold energy to "<< index << endl;
|
||||
#endif
|
||||
myDet->setThresholdEnergy(index);
|
||||
int ret = (int)myDet->getThresholdEnergy();
|
||||
if((ret-index)>200){
|
||||
qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","qTabSettings::SetEnergy");
|
||||
}
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
spinThreshold->setValue(ret);
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetEnergy");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Settings Tab" << endl;
|
||||
#endif
|
||||
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
disconnect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
|
||||
|
||||
// Number of Modules
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting number of modules:" ;
|
||||
#endif
|
||||
int numMod = myDet->setNumberOfModules();
|
||||
#ifdef VERBOSE
|
||||
cout << numMod << endl;
|
||||
#endif
|
||||
spinNumModules->setValue(numMod);
|
||||
|
||||
// Dynamic Range
|
||||
GetDynamicRange();
|
||||
|
||||
// Settings
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting settings" << endl;
|
||||
#endif
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = Undefined;//slsDetectorDefs::UNDEFINED;
|
||||
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
|
||||
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
|
||||
|
||||
//threshold
|
||||
sett = comboSettings->currentIndex();
|
||||
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
|
||||
if((sett==Undefined)||(sett==Uninitialized)){
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}else{
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting threshold energy" << endl;
|
||||
#endif
|
||||
spinThreshold->setValue(myDet->getThresholdEnergy());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Settings Tab" << endl << endl;
|
||||
#endif
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|