merging refactor (replacing)
0
slsDetectorGui/.gitignore
vendored
Normal file → Executable file
60
slsDetectorGui/CMakeLists.txt
Normal file → Executable file
@ -1,6 +1,15 @@
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(ENV{QMAKESPEC} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/mkspecs/linux-g++")
|
||||
set(ENV{PATH} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/bin:$PATH")
|
||||
|
||||
link_directories(
|
||||
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/lib
|
||||
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwt-6.0.1/lib
|
||||
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwtplot3d/lib
|
||||
/afs/psi.ch/project/sls_det_software/dhanya_softwareDevelopment/mySoft/slsDetectorPackage/build/bin
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||
@ -14,9 +23,6 @@ set(SOURCES
|
||||
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
|
||||
@ -33,8 +39,6 @@ set(FORMS
|
||||
forms/form_tab_advanced.ui
|
||||
forms/form_tab_settings.ui
|
||||
forms/form_tab_debugging.ui
|
||||
forms/form_action.ui
|
||||
forms/form_scan.ui
|
||||
)
|
||||
|
||||
qt4_wrap_ui(FORMS_H ${FORMS})
|
||||
@ -56,15 +60,12 @@ set(HEADERS
|
||||
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
|
||||
../slsSupportLib/include/versionAPI.h
|
||||
include/qServer.h
|
||||
)
|
||||
set(RESOURCES
|
||||
@ -75,13 +76,7 @@ qt4_add_resources(RESOURCES_SRCS ${RESOURCES})
|
||||
include_directories(
|
||||
include
|
||||
slsDetectorPlotting/include
|
||||
../slsDetectorSoftware/commonFiles
|
||||
../slsDetectorSoftware/slsReceiverInterface
|
||||
../slsDetectorSoftware/slsDetector
|
||||
../slsDetectorSoftware/slsDetectorAnalysis
|
||||
../slsDetectorSoftware/multiSlsDetector
|
||||
../slsDetectorSoftware/usersFunctions
|
||||
../slsReceiverSoftware/include
|
||||
../slsSupportLib/include
|
||||
${QT_INCLUDE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
@ -90,7 +85,7 @@ include_directories(
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DDACS_INT -DVERBOSE -DPRINT_LOG
|
||||
-DPRINT_LOG #-DVERBOSE
|
||||
)
|
||||
|
||||
add_executable(slsDetectorGui
|
||||
@ -100,34 +95,43 @@ add_executable(slsDetectorGui
|
||||
${RESOURCES_SRCS}
|
||||
)
|
||||
|
||||
set_target_properties(slsDetectorGui PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
|
||||
target_link_libraries(slsDetectorGui
|
||||
target_link_libraries(slsDetectorGui PUBLIC
|
||||
slsProjectOptions
|
||||
slsProjectWarnings
|
||||
slsSupportLib
|
||||
slsDetectorShared
|
||||
${QT_QTCORE_LIBRARIES}
|
||||
${QT_QTGUI_LIBRARIES}
|
||||
${QWT_LIBRARIES}
|
||||
pthread
|
||||
zmq
|
||||
${ZeroMQ_LIBRARIES}
|
||||
rt
|
||||
png
|
||||
z
|
||||
Qt4::QtOpenGL
|
||||
Qt4::QtSvg
|
||||
)
|
||||
|
||||
set_target_properties(slsDetectorGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
add_executable(gui_client
|
||||
client/qClient.h
|
||||
client/qClient.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(gui_client PUBLIC
|
||||
slsProjectOptions
|
||||
slsProjectWarnings
|
||||
slsSupportLib
|
||||
slsDetectorShared
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
|
||||
set_target_properties(gui_client PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
install(TARGETS slsDetectorGui gui_client
|
||||
RUNTIME DESTINATION bin)
|
||||
install(TARGETS slsDetectorGui gui_client DESTINATION bin)
|
||||
|
@ -1,68 +0,0 @@
|
||||
# LEO: Won't compile without libSlsDetector
|
||||
|
||||
include ../Makefile.include
|
||||
|
||||
$(info )
|
||||
$(info ##################################)
|
||||
$(info # In slsDetectorGui Makefile #)
|
||||
$(info ##################################)
|
||||
$(info )
|
||||
|
||||
|
||||
DESTDIR ?= ../bin
|
||||
LIBDIR ?= ../bin
|
||||
PROG = $(DESTDIR)/slsDetectorGui
|
||||
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
|
||||
|
||||
LDFLAGDET ?= -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector
|
||||
|
||||
|
||||
|
||||
#ifeq ( $(EIGERSLS), yes)
|
||||
# LDFLAG += $(EIGERFLAGS)
|
||||
#else ifeq ( $(ROOTSLS), yes)
|
||||
# LDFLAG += $(ROOTFLAGS)
|
||||
#endif
|
||||
|
||||
.PHONY: all lib clean mm doc htmldoc guiclient
|
||||
|
||||
|
||||
all: lib Makefile.gui $(PROG) guiclient
|
||||
|
||||
lib:
|
||||
cd $(LIBRARYDIR) && $(MAKE) DESTDIR=$(DESTDIR)
|
||||
@echo ""
|
||||
@echo "#######################################"
|
||||
@echo "# Back in slsDetectorGui Makefile #"
|
||||
@echo "#######################################"
|
||||
@echo ""
|
||||
|
||||
|
||||
clean:
|
||||
if test -e Makefile.gui; then $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm Makefile.gui; rm $(DESTDIR)/slsDetectorGui; else $(MAKE) Makefile.gui; $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm $(DESTDIR)/slsDetectorGui; 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=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' LIBDIR='$(LIBDIR)'
|
||||
|
||||
doc:
|
||||
cd manual && $(MAKE) DESTDIR=$(DOCDIR)
|
||||
|
||||
htmldoc:
|
||||
cd manual && $(MAKE) html DESTDIR=$(DOCDIR)
|
||||
|
||||
$(PROG): Makefile $(DIR) src/*.cpp include/*.h slsDetectorPlotting/include/*.h slsDetectorPlotting/src/*.cxx # forms/include/*.h
|
||||
$(MAKE) -f Makefile.gui SLSDETLIB=$(DESTDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' LIBDIR='$(LIBDIR)'
|
||||
|
||||
guiclient:
|
||||
# echo $(WD)
|
||||
cd client && $(MAKE) DESTDIR=$(DESTDIR)
|
||||
|
@ -1,31 +0,0 @@
|
||||
CC = g++
|
||||
CLAGS += -DVERBOSE #VERYBOSE
|
||||
LDLIBS += -lm -lstdc++ -pthread
|
||||
|
||||
LDIR = ../../slsDetectorSoftware
|
||||
RDIR = ../../slsReceiverSoftware
|
||||
DDIR = ../../bin
|
||||
INCLUDES = -I $(LDIR)/commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include
|
||||
SRC_CLNT = qClient.cpp $(RDIR)/src/MySocketTCP.cpp
|
||||
DEPSINCLUDES= qClient.h $(RDIR)/include/MySocketTCP.h $(LDIR)/slsDetector/slsDetectorBase.h $(LDIR)/commonFiles/sls_detector_defs.h
|
||||
|
||||
|
||||
all: client
|
||||
|
||||
client: $(OBJS) $(DDIR)/gui_client
|
||||
|
||||
OBJS = $(SRC_CLNT:%.cpp=%.o)
|
||||
|
||||
|
||||
$(DDIR)/gui_client : $(SRC_CLNT) $(DEPSINCLUDES) Makefile
|
||||
$(CXX) -o $@ -c $< $(INCLUDES) $(FLAGS) $(LDLIBS)
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(DDIR)/gui_client *.o
|
||||
|
||||
|
||||
|
||||
|
||||
|
311
slsDetectorGui/client/qClient.cpp
Normal file → Executable file
@ -1,237 +1,124 @@
|
||||
/*
|
||||
* 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 "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
qClient* cl = 0;
|
||||
try {
|
||||
cl = new qClient(argv[1]);
|
||||
} catch(...) {
|
||||
return 0;
|
||||
}
|
||||
cl->executeLine(argc-2, argv+2);
|
||||
delete cl;
|
||||
|
||||
return 0;
|
||||
int main(int argc, char *argv[]) {
|
||||
qClient *cl = 0;
|
||||
cl = new qClient(argv[1]);
|
||||
cl->executeLine(argc - 2, argv + 2);
|
||||
delete cl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qClient::qClient(char* hostname):
|
||||
mySocket(0),
|
||||
myStopSocket(0){
|
||||
|
||||
try {
|
||||
// control socket
|
||||
mySocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO);
|
||||
// stop socket
|
||||
myStopSocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO+1);
|
||||
} catch(...) {
|
||||
if (mySocket == 0)
|
||||
cout << "Error: could not connect to control server:" <<
|
||||
hostname << " with port " << DEFAULT_GUI_PORTNO << endl;
|
||||
else
|
||||
cout << "Error: could not connect to stop server:" <<
|
||||
hostname << " with port " << DEFAULT_GUI_PORTNO + 1 << endl;
|
||||
throw;
|
||||
}
|
||||
qClient::qClient(char *h)
|
||||
: controlPort(DEFAULT_GUI_PORTNO), stopPort(DEFAULT_GUI_PORTNO + 1) {
|
||||
hostname.assign(h);
|
||||
}
|
||||
|
||||
qClient::~qClient() {}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qClient::executeLine(int narg, char *args[]) {
|
||||
|
||||
qClient::~qClient() {
|
||||
if(mySocket) delete mySocket;
|
||||
if(myStopSocket) delete myStopSocket;
|
||||
std::string retval = "";
|
||||
std::string cmd = args[0];
|
||||
|
||||
// validate command structure
|
||||
if (narg < 1) {
|
||||
throw sls::RuntimeError("No command parsed. " + printCommands());
|
||||
}
|
||||
|
||||
// help
|
||||
if (cmd == "help") {
|
||||
retval = printCommands();
|
||||
}
|
||||
|
||||
// file name
|
||||
else if (cmd == "status") {
|
||||
|
||||
if (narg > 1) {
|
||||
std::string argument = args[1];
|
||||
// start acquisition
|
||||
if (argument == "start")
|
||||
startAcquisition();
|
||||
else if (argument == "stop")
|
||||
stopAcquisition();
|
||||
else {
|
||||
throw sls::RuntimeError("Could not parse arguments. " +
|
||||
printCommands());
|
||||
}
|
||||
}
|
||||
retval = getStatus();
|
||||
}
|
||||
|
||||
else if (cmd == "acquire") {
|
||||
startAcquisition(true);
|
||||
retval = getStatus();
|
||||
}
|
||||
|
||||
else if (cmd == "exit") {
|
||||
exitServer();
|
||||
retval.assign("Server exited successfully");
|
||||
}
|
||||
|
||||
// unrecognized command
|
||||
else {
|
||||
throw sls::RuntimeError("Unrecognized command. " + printCommands());
|
||||
}
|
||||
|
||||
// print result
|
||||
FILE_LOG(logINFO) << cmd << ": " << retval;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qClient::executeLine(int narg, char *args[]){
|
||||
|
||||
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{
|
||||
cprintf(RED,"Error: could not parse arguments: %s\n", argument.c_str());
|
||||
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;
|
||||
std::string qClient::printCommands() {
|
||||
std::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();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
std::string qClient::getStatus() {
|
||||
int fnum = qDefs::F_GUI_GET_RUN_STATUS;
|
||||
int retvals[2] = {static_cast<int>(ERROR), 0};
|
||||
|
||||
auto client = sls::GuiSocket(hostname, controlPort);
|
||||
client.sendCommandThenRead(fnum, nullptr, 0, retvals, sizeof(retvals));
|
||||
|
||||
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();
|
||||
runStatus status = static_cast<runStatus>(retvals[0]);
|
||||
int progress = retvals[1];
|
||||
return std::to_string(progress) + std::string("% ") +
|
||||
slsDetectorDefs::runStatusType(status);
|
||||
}
|
||||
|
||||
void qClient::startAcquisition(bool blocking) {
|
||||
int fnum = qDefs::F_GUI_START_ACQUISITION;
|
||||
if (blocking)
|
||||
fnum = qDefs::F_GUI_START_AND_READ_ALL;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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);
|
||||
auto client = sls::GuiSocket(hostname.c_str(), controlPort);
|
||||
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
void qClient::stopAcquisition() {
|
||||
int fnum = qDefs::F_GUI_STOP_ACQUISITION;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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;
|
||||
auto client = sls::GuiSocket(hostname, stopPort);
|
||||
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
void qClient::exitServer() {
|
||||
int fnum = qDefs::F_GUI_EXIT_SERVER;
|
||||
// closes both control and stop server
|
||||
auto client = sls::GuiSocket(hostname, controlPort);
|
||||
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
}
|
||||
|
95
slsDetectorGui/client/qClient.h
Normal file → Executable file
@ -1,65 +1,70 @@
|
||||
/*
|
||||
* qClient.h
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
#ifndef QCLIENT_H
|
||||
#define QCLIENT_H
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.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{
|
||||
class qClient : public virtual slsDetectorDefs {
|
||||
|
||||
public:
|
||||
/**
|
||||
* The constructor
|
||||
* @param h hostname
|
||||
*/
|
||||
qClient(char *h);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~qClient();
|
||||
|
||||
public:
|
||||
/** \short The constructor*/
|
||||
qClient(char* hostname);
|
||||
/** Destructor */
|
||||
virtual ~qClient();
|
||||
/**
|
||||
* Execute command
|
||||
* @param narg number of arguments
|
||||
* @param args argument list
|
||||
*/
|
||||
void executeLine(int narg, char *args[]);
|
||||
|
||||
/**Execute command*/
|
||||
int executeLine(int narg, char *args[]);
|
||||
private:
|
||||
/**
|
||||
* Print list of commands
|
||||
* @returns string of result
|
||||
*/
|
||||
std::string printCommands();
|
||||
|
||||
private:
|
||||
/** Print list of commands */
|
||||
string printCommands();
|
||||
/**
|
||||
* Gets run status
|
||||
* @returns status
|
||||
*/
|
||||
std::string getStatus();
|
||||
|
||||
/** Start Acquisition
|
||||
* @param blocking true if its a blocking acquistion
|
||||
*/
|
||||
int startAcquisition(bool blocking = false);
|
||||
/**
|
||||
* Start Acquisition
|
||||
* @param blocking true if its a blocking acquistion
|
||||
*/
|
||||
void startAcquisition(bool blocking = false);
|
||||
|
||||
/** Stops Acquisition */
|
||||
int stopAcquisition();
|
||||
/**
|
||||
* Stops Acquisition
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/** Gets run status */
|
||||
string getStatus();
|
||||
/**
|
||||
* Exits Server
|
||||
*/
|
||||
void exitServer();
|
||||
|
||||
/** Exits Server */
|
||||
int exitServer();
|
||||
/** hostname */
|
||||
std::string hostname;
|
||||
|
||||
/** client socket */
|
||||
MySocketTCP *mySocket;
|
||||
|
||||
/** client socket */
|
||||
MySocketTCP *myStopSocket;
|
||||
|
||||
char mess[MAX_STR_LENGTH];
|
||||
/** control port */
|
||||
int controlPort;
|
||||
|
||||
/** stop port */
|
||||
int stopPort;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QCLIENT_H */
|
||||
|
8
slsDetectorGui/doxy.config
Normal file → Executable file
@ -84,13 +84,7 @@ INPUT = \
|
||||
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\
|
||||
src/qTabPlot.cpp\
|
||||
include/qTabAdvanced.h\
|
||||
src/qTabAdvanced.cpp\
|
||||
include/qTabSettings.h\
|
||||
|
@ -1,169 +0,0 @@
|
||||
<?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>
|
6
slsDetectorGui/forms/form_detectormain.ui
Normal file → Executable file
@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>848</height>
|
||||
<height>851</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -236,8 +236,6 @@
|
||||
<addaction name="actionLoadTrimbits"/>
|
||||
<addaction name="actionSaveTrimbits"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadCalibration"/>
|
||||
<addaction name="actionSaveCalibration"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuModes">
|
||||
<property name="title">
|
||||
@ -271,7 +269,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>36</width>
|
||||
<height>422</height>
|
||||
<height>425</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
|
@ -1,488 +0,0 @@
|
||||
<?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>
|
709
slsDetectorGui/forms/form_tab_advanced.ui
Normal file → Executable file
@ -51,7 +51,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideLeft</enum>
|
||||
@ -60,693 +60,18 @@
|
||||
<attribute name="title">
|
||||
<string>Logs</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="boxLogs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>746</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Calibration Logs</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>345</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>42</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkEnergyLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Energy Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAngularLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Trimming</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="boxPlot">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>495</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Trimbits Plot</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>15</y>
|
||||
<width>259</width>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>17</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRefresh">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Updates plot with Trimbits from Shared Memory, not from Detector.
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/refresh.png</normaloff>:/icons/images/refresh.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnGetTrimbits">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Plots Trimbits from Detector. This will take time.
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get Trimbits </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 class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioDataGraph">
|
||||
<property name="text">
|
||||
<string>Data Graph</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="radioHistogram">
|
||||
<property name="text">
|
||||
<string>Histogram</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxTrimming">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>85</y>
|
||||
<width>746</width>
|
||||
<height>226</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Trimming</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>25</y>
|
||||
<width>696</width>
|
||||
<height>208</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trimming Method:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<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>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblExpTime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exposure Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</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>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Exposure time of each frame.
|
||||
#exptime#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboExpUnit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</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>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<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="3" column="4">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Trimfile to which the resulting trimbits will be written.
|
||||
</nobr><br><nobr>
|
||||
An extension given by the modules serial number will be attached.
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output Trim File: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" colspan="6">
|
||||
<widget class="QLineEdit" name="dispFile">
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Trimfile to which the resulting trimbits will be written.
|
||||
</nobr><br><nobr>
|
||||
An extension given by the modules serial number will be attached.
|
||||
</nobr></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="8">
|
||||
<widget class="QPushButton" name="btnFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Trimfile to which the resulting trimbits will be written.
|
||||
</nobr><br><nobr>
|
||||
An extension given by the modules serial number will be attached.
|
||||
</nobr></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="5" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="btnStart">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Trimming </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="spinThreshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</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>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Exposure time of each frame.
|
||||
#exptime#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>560.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sets the Threshold DAC</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Threshold (DACu):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="chkOptimize">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</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="text">
|
||||
<string>Optimize Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblResolution">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Resolution (a.u.):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinResolution">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of measurements (not in real time) that will be acquired.
|
||||
#frames#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboMethod">
|
||||
<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>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Adjust to Fix Count Level </string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equalize to Median</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QLabel" name="lblCounts">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Counts/ Channel:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7" colspan="2">
|
||||
<widget class="QSpinBox" name="spinCounts">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of measurements (not in real time) that will be acquired.
|
||||
#frames#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxSetAllTrimbits">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>518</x>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>233</width>
|
||||
<height>66</height>
|
||||
@ -761,7 +86,7 @@ An extension given by the modules serial number will be attached.
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="lblSetAllTrimbits">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>12</x>
|
||||
@ -977,7 +302,7 @@ An extension given by the modules serial number will be attached.
|
||||
<x>25</x>
|
||||
<y>21</y>
|
||||
<width>686</width>
|
||||
<height>119</height>
|
||||
<height>148</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
@ -1357,7 +682,7 @@ An extension given by the modules serial number will be attached.
|
||||
<x>35</x>
|
||||
<y>10</y>
|
||||
<width>686</width>
|
||||
<height>123</height>
|
||||
<height>146</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
@ -1943,7 +1268,7 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblSubPeriod">
|
||||
<widget class="QLabel" name="lblSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -1962,7 +1287,7 @@ Default value is 0. A value less than the required minimum is ignored.
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubPeriod">
|
||||
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -2002,7 +1327,7 @@ Default value is 0. A value less than the required minimum is ignored.
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QComboBox" name="comboSubPeriodUnit">
|
||||
<widget class="QComboBox" name="comboSubDeadTimeUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -2066,24 +1391,6 @@ Default value is 0. A value less than the required minimum is ignored.
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabAdvancedSettings</tabstop>
|
||||
<tabstop>chkEnergyLog</tabstop>
|
||||
<tabstop>chkAngularLog</tabstop>
|
||||
<tabstop>boxPlot</tabstop>
|
||||
<tabstop>radioDataGraph</tabstop>
|
||||
<tabstop>radioHistogram</tabstop>
|
||||
<tabstop>btnRefresh</tabstop>
|
||||
<tabstop>btnGetTrimbits</tabstop>
|
||||
<tabstop>boxTrimming</tabstop>
|
||||
<tabstop>comboMethod</tabstop>
|
||||
<tabstop>chkOptimize</tabstop>
|
||||
<tabstop>spinResolution</tabstop>
|
||||
<tabstop>spinCounts</tabstop>
|
||||
<tabstop>spinExpTime</tabstop>
|
||||
<tabstop>comboExpUnit</tabstop>
|
||||
<tabstop>spinThreshold</tabstop>
|
||||
<tabstop>dispFile</tabstop>
|
||||
<tabstop>btnFile</tabstop>
|
||||
<tabstop>btnStart</tabstop>
|
||||
<tabstop>btnGetRoi</tabstop>
|
||||
<tabstop>btnSetRoi</tabstop>
|
||||
<tabstop>btnClearRoi</tabstop>
|
||||
|
185
slsDetectorGui/forms/form_tab_dataoutput.ui
Normal file → Executable file
@ -43,78 +43,12 @@
|
||||
<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="chkUnused">
|
||||
<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>Unused</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>
|
||||
<item row="2" 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>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>255</x>
|
||||
<x>14</x>
|
||||
<y>21</y>
|
||||
<width>476</width>
|
||||
<width>475</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -122,7 +56,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -148,72 +82,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</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">
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="lblDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -274,7 +143,7 @@ Directory where one saves the data.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6" colspan="3">
|
||||
<item row="1" column="5" colspan="2">
|
||||
<widget class="QSpinBox" name="spinDeadTime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -293,7 +162,7 @@ Directory where one saves the data.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="btnDefaultRate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -327,28 +196,29 @@ Directory where one saves the data.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" 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>
|
||||
</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>
|
||||
<x>3</x>
|
||||
<y>92</y>
|
||||
<width>491</width>
|
||||
<height>72</height>
|
||||
@ -360,7 +230,7 @@ Directory where one saves the data.
|
||||
<x>11</x>
|
||||
<y>4</y>
|
||||
<width>475</width>
|
||||
<height>62</height>
|
||||
<height>68</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridEiger">
|
||||
@ -513,7 +383,7 @@ Directory where one saves the data.
|
||||
<x>12</x>
|
||||
<y>20</y>
|
||||
<width>714</width>
|
||||
<height>68</height>
|
||||
<height>70</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -885,9 +755,6 @@ Directory where one saves the data.
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>chkFlatField</tabstop>
|
||||
<tabstop>dispFlatField</tabstop>
|
||||
<tabstop>btnFlatField</tabstop>
|
||||
<tabstop>chkRate</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
183
slsDetectorGui/forms/form_tab_debugging.ui
Normal file → Executable file
@ -51,8 +51,8 @@
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>110</y>
|
||||
<width>141</width>
|
||||
<height>51</height>
|
||||
<width>149</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
@ -62,17 +62,17 @@
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Firmware</string>
|
||||
<string>Module Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkDetectorSoftware">
|
||||
<widget class="QCheckBox" name="chkDetectorBus">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout Software</string>
|
||||
<string>Module Bus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -83,7 +83,7 @@
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>185</y>
|
||||
<width>656</width>
|
||||
<width>147</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -107,144 +107,13 @@
|
||||
</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>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
@ -367,28 +236,6 @@
|
||||
</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>
|
||||
@ -402,19 +249,6 @@
|
||||
<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">
|
||||
@ -422,7 +256,7 @@
|
||||
<x>45</x>
|
||||
<y>25</y>
|
||||
<width>686</width>
|
||||
<height>31</height>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@ -461,7 +295,6 @@
|
||||
<tabstops>
|
||||
<tabstop>btnGetInfo</tabstop>
|
||||
<tabstop>comboDetector</tabstop>
|
||||
<tabstop>comboModule</tabstop>
|
||||
<tabstop>btnTest</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
443
slsDetectorGui/forms/form_tab_measurement.ui
Normal file → Executable file
@ -139,7 +139,7 @@
|
||||
<x>390</x>
|
||||
<y>8</y>
|
||||
<width>362</width>
|
||||
<height>342</height>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
@ -154,10 +154,121 @@
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>357</width>
|
||||
<height>321</height>
|
||||
<height>264</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridTimeResolved">
|
||||
<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>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Frame period between exposures.
|
||||
</nobr><br><nobr>
|
||||
#period#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboTimingMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Timing Mode of the detector.
|
||||
#timing#</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trigger Exposure Series</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> Gated with fixed number</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Burst Trigger</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
@ -315,201 +426,6 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblNumGates">
|
||||
<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="toolTip">
|
||||
<string>Number of Gate Signals per Frame.
|
||||
#gates#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Gates:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumGates">
|
||||
<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="toolTip">
|
||||
<string>Number of Gate Signals per Frame.
|
||||
#gates#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblNumProbes">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
The data are accumulated over several (frames) pump cycles.
|
||||
</nobr>
|
||||
<br>
|
||||
<nobr>
|
||||
Enabled only in <b>Expert Mode</b> and if<b> Number of Frames</b> > 1.
|
||||
</nobr>
|
||||
<br>
|
||||
<nobr>Setting <b>Number of Probes</b> will reset <b>Number of Triggers</b> to 1.
|
||||
</nobr>
|
||||
<br>
|
||||
Maximum value is 3. <br>
|
||||
#probes#
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Probes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumProbes">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
The data are accumulated over several (frames) pump cycles.
|
||||
</nobr>
|
||||
<br>
|
||||
<nobr>
|
||||
Enabled only in <b>Expert Mode</b> and if<b> Number of Frames</b> > 1.
|
||||
</nobr>
|
||||
<br>
|
||||
<nobr>Setting <b>Number of Probes</b> will reset <b>Number of Triggers</b> to 1.
|
||||
</nobr>
|
||||
<br>
|
||||
Maximum value is 3. <br>
|
||||
#probes#
|
||||
</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboTimingMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Timing Mode of the detector.
|
||||
#timing#</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trigger Exposure Series</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trigger Readout</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gated with Fixed Number</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gated with Start Trigger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Burst Trigger</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblNumFrames">
|
||||
<property name="enabled">
|
||||
@ -727,78 +643,6 @@ Frame period between exposures.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Frame period between exposures.
|
||||
</nobr><br><nobr>
|
||||
#period#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</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>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblTimingMode">
|
||||
<property name="text">
|
||||
@ -806,8 +650,65 @@ Frame period between exposures.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblNumSamples">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Samples:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumSamples">
|
||||
<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="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<zorder>gridLayoutWidget</zorder>
|
||||
<zorder>spinNumSamples</zorder>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frameNotTimeResolved">
|
||||
<property name="geometry">
|
||||
@ -967,7 +868,7 @@ Frame period between exposures.
|
||||
<x>30</x>
|
||||
<y>298</y>
|
||||
<width>318</width>
|
||||
<height>31</height>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@ -1074,8 +975,6 @@ Frame period between exposures.
|
||||
<tabstop>spinNumTriggers</tabstop>
|
||||
<tabstop>spinDelay</tabstop>
|
||||
<tabstop>comboDelayUnit</tabstop>
|
||||
<tabstop>spinNumGates</tabstop>
|
||||
<tabstop>spinNumProbes</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
|
0
slsDetectorGui/forms/form_tab_messages.ui
Normal file → Executable file
0
slsDetectorGui/forms/form_tab_plot.ui
Normal file → Executable file
99
slsDetectorGui/forms/form_tab_settings.ui
Normal file → Executable file
@ -37,14 +37,14 @@
|
||||
<x>30</x>
|
||||
<y>20</y>
|
||||
<width>316</width>
|
||||
<height>171</height>
|
||||
<height>135</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblDynamicRange">
|
||||
<property name="text">
|
||||
<string>Settings:</string>
|
||||
<string>Dynamic Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -142,43 +142,30 @@
|
||||
</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">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblThreshold">
|
||||
<property name="text">
|
||||
<string>Number of Modules:</string>
|
||||
<string>Threshold:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Dynamic Range:</string>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<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="3" column="2" colspan="2">
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboDynamicRange">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -202,33 +189,32 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumModules">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblSettings">
|
||||
<property name="text">
|
||||
<string>Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinThreshold">
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<property name="suffix">
|
||||
<string> eV</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="minimum">
|
||||
<number>-100000</number>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblThreshold">
|
||||
<property name="text">
|
||||
<string>Threshold:</string>
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -238,7 +224,6 @@
|
||||
<tabstops>
|
||||
<tabstop>comboSettings</tabstop>
|
||||
<tabstop>spinThreshold</tabstop>
|
||||
<tabstop>spinNumModules</tabstop>
|
||||
<tabstop>comboDynamicRange</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
@ -1,9 +0,0 @@
|
||||
Path: slsDetectorsPackage/slsDetectorGui
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca
|
||||
Revision: 525
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4101
|
||||
Last Changed Date: 2019-02-07 18:05:28.000000002 +0100 ./src/qTabSettings.cpp
|
0
slsDetectorGui/images/add.png
Normal file → Executable file
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 702 B |
0
slsDetectorGui/images/browse.png
Normal file → Executable file
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 884 B |
0
slsDetectorGui/images/calculate.png
Normal file → Executable file
Before Width: | Height: | Size: 833 B After Width: | Height: | Size: 833 B |
0
slsDetectorGui/images/close.png
Normal file → Executable file
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 812 B |
0
slsDetectorGui/images/download.png
Normal file → Executable file
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 757 B |
0
slsDetectorGui/images/erase.png
Normal file → Executable file
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 606 B |
0
slsDetectorGui/images/leftArrow.png
Normal file → Executable file
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
0
slsDetectorGui/images/mountain.png
Normal file → Executable file
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 757 B |
0
slsDetectorGui/images/new.png
Normal file → Executable file
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
0
slsDetectorGui/images/refresh.png
Normal file → Executable file
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
slsDetectorGui/images/refresher.png
Normal file → Executable file
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 692 B |
0
slsDetectorGui/images/remove.png
Normal file → Executable file
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
0
slsDetectorGui/images/rightArrow.png
Normal file → Executable file
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
0
slsDetectorGui/images/save.png
Normal file → Executable file
Before Width: | Height: | Size: 674 B After Width: | Height: | Size: 674 B |
0
slsDetectorGui/images/saveAll.png
Normal file → Executable file
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 755 B |
0
slsDetectorGui/images/setup.png
Normal file → Executable file
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 605 B |
0
slsDetectorGui/images/start.png
Normal file → Executable file
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 499 B |
0
slsDetectorGui/images/stop.png
Normal file → Executable file
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
0
slsDetectorGui/images/upload.png
Normal file → Executable file
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
@ -1,6 +0,0 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4101
|
||||
#define GITDATE 0x20190207
|
||||
#define GITBRANCH "developer"
|
@ -1,6 +0,0 @@
|
||||
#define GITURL ""
|
||||
#define GITREPUUID ""
|
||||
#define GITAUTH ""
|
||||
#define GITREV ""
|
||||
#define GITDATE ""
|
||||
#define GITBRANCH ""
|
0
slsDetectorGui/include/icons.qrc
Normal file → Executable file
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* qActionsWidget.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QACTIONSWIDGET_H_
|
||||
#define QACTIONSWIDGET_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_action.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
class qActionsWidget : public QWidget,private Ui::ActionsObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qActionsWidget(QWidget *parent, multiSlsDetector*& detector);
|
||||
|
||||
~qActionsWidget();
|
||||
|
||||
/**to update the widgets*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
/**number of action widgets*/
|
||||
static int NUM_ACTION_WIDGETS;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/**id of the action widget*/
|
||||
int id;
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
* */
|
||||
void Initialization();
|
||||
|
||||
|
||||
private slots:
|
||||
/** Sets the scan or script. Accordingly enables, disables other widgets
|
||||
* @param mode value chosen
|
||||
* */
|
||||
void SetMode(int mode);
|
||||
|
||||
/** Browse for the script
|
||||
* */
|
||||
void BrowsePath();
|
||||
|
||||
/** Sets the script file
|
||||
* */
|
||||
void SetScriptFile();
|
||||
|
||||
/** Set Parameter
|
||||
* */
|
||||
void SetParameter();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* QACTIONSWIDGET_H_ */
|
||||
|
167
slsDetectorGui/include/qCloneWidget.h
Normal file → Executable file
@ -1,71 +1,59 @@
|
||||
/*
|
||||
* qCloneWidget.h
|
||||
*
|
||||
* Created on: May 18, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef QCLONEWIDGET_H_
|
||||
#define QCLONEWIDGET_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
class SlsQtH1D;
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
/** Qt Include Headers */
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
|
||||
#include <QAction>
|
||||
#include <QGridLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QString>
|
||||
#include <QSpacerItem>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
*@short Sets up the clone plot widget
|
||||
*/
|
||||
class qCloneWidget:public QMainWindow{
|
||||
Q_OBJECT
|
||||
class qCloneWidget : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
public:
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle, int numDim,string FilePath,
|
||||
bool displayStats, QString min, QString max, QString sum);
|
||||
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim, std::string FilePath,
|
||||
bool displayStats, QString min, QString max, QString sum);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qCloneWidget();
|
||||
~qCloneWidget();
|
||||
|
||||
/** Sets up the widget window
|
||||
/**
|
||||
* Sets up the widget window
|
||||
* @param title title of the image with frame number
|
||||
* @param xTitle title of x axis
|
||||
* @param yTitle title of y axis
|
||||
* @param zTitle title of z axis
|
||||
* @param numDim 1D or 2D
|
||||
* */
|
||||
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
||||
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
||||
|
||||
|
||||
|
||||
/** Get the 1D hist values to plot
|
||||
/**
|
||||
* Get the 1D hist values to plot
|
||||
* @param nHists Number of graphs in 1D
|
||||
* @param histNBins Total Number of X axis values/channels in 1D
|
||||
* @param histXAxis X Axis value in 1D
|
||||
@ -73,10 +61,11 @@ public:
|
||||
* @param histTitle Title for all the graphs in 1D
|
||||
* @param lines style of plot if lines or dots
|
||||
* @param markers style of plot markers or not
|
||||
* */
|
||||
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers);
|
||||
*/
|
||||
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis[], std::string histTitle[], bool lines, bool markers);
|
||||
|
||||
/** Get the 1D hist values to plot for angle plotting
|
||||
/**
|
||||
* Get the 1D hist values to plot for angle plotting
|
||||
* @param nHists Number of graphs in 1D
|
||||
* @param histNBins Total Number of X axis values/channels in 1D
|
||||
* @param histXAxis X Axis value in 1D
|
||||
@ -84,10 +73,11 @@ public:
|
||||
* @param histTitle Title for all the graphs in 1D
|
||||
* @param lines style of plot if lines or dots
|
||||
* @param markers style of plot markers or not
|
||||
* */
|
||||
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers);
|
||||
*/
|
||||
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis, std::string histTitle[], bool lines, bool markers);
|
||||
|
||||
/** Get the 1D hist values to plot for angle plotting
|
||||
/**
|
||||
* Get the 1D hist values to plot for angle plotting
|
||||
* @param nbinsx number of bins in x axis
|
||||
* @param xmin minimum in x axis
|
||||
* @param xmax maximum in x axis
|
||||
@ -95,70 +85,63 @@ public:
|
||||
* @param ymin minimum in y axis
|
||||
* @param ymax maximum in y axis
|
||||
* @param d data
|
||||
* */
|
||||
void SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d);
|
||||
*/
|
||||
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d);
|
||||
|
||||
/**Set the range of the 1d plot
|
||||
/**
|
||||
* Set the range of the 1d plot
|
||||
* @param IsXYRange array of x,y,min,max if these values are set
|
||||
* @param XYRangeValues array of set values of x,y, min, max
|
||||
*/
|
||||
void SetRange(bool IsXYRange[], double XYRangeValues[]);
|
||||
void SetRange(bool IsXYRange[], double XYRangeValues[]);
|
||||
|
||||
/** Returns the 1d plot
|
||||
/**
|
||||
* Returns the 1d plot
|
||||
*/
|
||||
SlsQt1DPlot* Get1dPlot(){return cloneplot1D;};
|
||||
SlsQt1DPlot *Get1dPlot();
|
||||
|
||||
public slots:
|
||||
/** Save Plots automatically by save all clones
|
||||
* returns -1 if fail*/
|
||||
int SavePlotAutomatic();
|
||||
|
||||
|
||||
private:
|
||||
/** clone window id*/
|
||||
int id;
|
||||
/** Default Save file path */
|
||||
string filePath;
|
||||
/** clone 1D Plot */
|
||||
SlsQt1DPlot* cloneplot1D;
|
||||
/** clone 2D Plot */
|
||||
SlsQt2DPlotLayout* cloneplot2D;
|
||||
/** vector of 1D hist values */
|
||||
QVector<SlsQtH1D*> cloneplot1D_hists;
|
||||
|
||||
/** markers for the plot*/
|
||||
QwtSymbol *marker;
|
||||
QwtSymbol *nomarker;
|
||||
|
||||
QMenuBar *menubar;
|
||||
QAction *actionSave;
|
||||
|
||||
QGridLayout *mainLayout;
|
||||
QGroupBox *cloneBox;
|
||||
QGridLayout *gridClone;
|
||||
|
||||
QLabel *lblHistTitle;
|
||||
public slots:
|
||||
/**
|
||||
* Save Plots automatically by save all clones
|
||||
* returns -1 if fail
|
||||
*/
|
||||
int SavePlotAutomatic();
|
||||
|
||||
private:
|
||||
/** Gets the current time stamp for the window title*/
|
||||
char* GetCurrentTimeStamp();
|
||||
char *GetCurrentTimeStamp();
|
||||
|
||||
/** Display Statistics */
|
||||
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
||||
|
||||
/** clone window id*/
|
||||
int id;
|
||||
/** Default Save file path */
|
||||
std::string filePath;
|
||||
/** clone 1D Plot */
|
||||
SlsQt1DPlot *cloneplot1D;
|
||||
/** clone 2D Plot */
|
||||
SlsQt2DPlotLayout *cloneplot2D;
|
||||
/** vector of 1D hist values */
|
||||
QVector<SlsQtH1D *> cloneplot1D_hists;
|
||||
|
||||
private slots:
|
||||
/** Save Plot */
|
||||
void SavePlot();
|
||||
/** markers for the plot*/
|
||||
QwtSymbol *marker;
|
||||
QwtSymbol *nomarker;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
QGridLayout *mainLayout;
|
||||
QGroupBox *cloneBox;
|
||||
|
||||
signals:
|
||||
void CloneClosedSignal(int);
|
||||
QLabel *lblHistTitle;
|
||||
|
||||
private slots:
|
||||
/** Save Plot */
|
||||
void SavePlot();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
signals:
|
||||
void CloneClosedSignal(int);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* QCLONEWIDGET_H_ */
|
||||
|
74
slsDetectorGui/include/qDebugStream.h
Normal file → Executable file
@ -1,101 +1,80 @@
|
||||
/*
|
||||
* qDebugStream.h
|
||||
*
|
||||
* Created on: Jun 28, 2012
|
||||
* Author: Anna Bergamaschi
|
||||
*/
|
||||
|
||||
#ifndef QDEBUGSTREAM_H_
|
||||
#define QDEBUGSTREAM_H_
|
||||
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QCustomEvent>
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <iostream>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#define STREAMEVENT 60001
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class qStreamEvent:public QEvent{
|
||||
class qStreamEvent : public QEvent {
|
||||
public:
|
||||
qStreamEvent(QString s):QEvent(static_cast<QEvent::Type>(STREAMEVENT)),str(s){
|
||||
qStreamEvent(QString s) : QEvent(static_cast<QEvent::Type>(STREAMEVENT)), str(s) {
|
||||
#ifdef PRINT_LOG
|
||||
printf("%s\n",str.toAscii().constData());
|
||||
printf("%s\n", str.toAscii().constData());
|
||||
#endif
|
||||
}
|
||||
/** \returns the progress index */
|
||||
QString getString() {return str;}
|
||||
QString getString() { return str; }
|
||||
|
||||
private:
|
||||
QString str;
|
||||
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class qDebugStream : public basic_streambuf<char> {
|
||||
class qDebugStream : public std::basic_streambuf<char> {
|
||||
|
||||
public:
|
||||
qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) {
|
||||
qDebugStream(std::ostream &stream, QWidget *w) : m_stream(stream), log_window(w) {
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
m_old_buf = stream.rdbuf();
|
||||
stream.rdbuf(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
~qDebugStream(){
|
||||
~qDebugStream() {
|
||||
// output anything that is left
|
||||
if (!m_string.empty()) {
|
||||
pthread_mutex_lock(&mutex);
|
||||
const char* c_string = m_string.c_str();
|
||||
const char *c_string = m_string.c_str();
|
||||
QApplication::postEvent(log_window, new qStreamEvent(c_string));
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
m_stream.rdbuf(m_old_buf);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
protected:
|
||||
virtual int_type overflow(int_type v){
|
||||
if (v == '\n'){
|
||||
virtual int_type overflow(int_type v) {
|
||||
if (v == '\n') {
|
||||
pthread_mutex_lock(&mutex);
|
||||
const char* c_string = m_string.c_str();
|
||||
const char *c_string = m_string.c_str();
|
||||
QApplication::postEvent(log_window, new qStreamEvent(c_string));
|
||||
m_string.erase(m_string.begin(), m_string.end());
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
else
|
||||
} else
|
||||
m_string += v;
|
||||
return v;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
virtual streamsize xsputn(const char *p, streamsize n) {
|
||||
virtual std::streamsize xsputn(const char *p, std::streamsize n) {
|
||||
pthread_mutex_lock(&mutex);
|
||||
m_string.append(p, p + n);
|
||||
|
||||
//changed from uint because of 64 bit
|
||||
size_t pos = 0;
|
||||
|
||||
while (pos != string::npos){
|
||||
while (pos != std::string::npos) {
|
||||
pos = m_string.find('\n');
|
||||
if (pos != string::npos){
|
||||
string tmp(m_string.begin(), m_string.begin() + pos);
|
||||
const char* c_tmp = tmp.c_str();
|
||||
if (pos != std::string::npos) {
|
||||
std::string tmp(m_string.begin(), m_string.begin() + pos);
|
||||
const char *c_tmp = tmp.c_str();
|
||||
QApplication::postEvent(log_window, new qStreamEvent(c_tmp));
|
||||
m_string.erase(m_string.begin(), m_string.begin() + pos + 1);
|
||||
}
|
||||
@ -104,16 +83,13 @@ protected:
|
||||
return n;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
pthread_mutex_t mutex;
|
||||
ostream &m_stream;
|
||||
streambuf *m_old_buf;
|
||||
string m_string;
|
||||
QWidget* log_window;
|
||||
std::ostream &m_stream;
|
||||
std::streambuf *m_old_buf;
|
||||
std::string m_string;
|
||||
QWidget *log_window;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif /* QDEBUGSTREAM_H_ */
|
||||
|
537
slsDetectorGui/include/qDefs.h
Normal file → Executable file
@ -1,301 +1,252 @@
|
||||
/*
|
||||
* qDefs.h
|
||||
*
|
||||
* Created on: May 4, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef QDEFS_H
|
||||
#define QDEFS_H
|
||||
|
||||
#include "ansi.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
using namespace std;
|
||||
#include <QMessageBox>
|
||||
|
||||
class qDefs:public QWidget{
|
||||
public:
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
/** Empty Constructor
|
||||
*/
|
||||
qDefs(){};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define GOODBYE -200
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
enum{
|
||||
OK,
|
||||
FAIL
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
enum MessageIndex{
|
||||
WARNING,
|
||||
CRITICAL,
|
||||
INFORMATION,
|
||||
QUESTION
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
/** unit of time
|
||||
*/
|
||||
enum timeUnit{
|
||||
HOURS, /** hr */
|
||||
MINUTES, /** min */
|
||||
SECONDS, /** s */
|
||||
MILLISECONDS, /** ms */
|
||||
MICROSECONDS, /** us */
|
||||
NANOSECONDS /** ns */
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** returns the unit in words
|
||||
* @param unit is the time unit
|
||||
*/
|
||||
static string getUnitString(timeUnit unit){
|
||||
switch(unit){
|
||||
case HOURS: return string("hrs");
|
||||
case MINUTES: return string("min");
|
||||
case SECONDS: return string("sec");
|
||||
case MILLISECONDS: return string("msec");
|
||||
case MICROSECONDS: return string("usec");
|
||||
case NANOSECONDS: return string("nsec");
|
||||
default: return string("error");
|
||||
}
|
||||
};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** returns the value in ns to send to server as the
|
||||
* server class slsdetector accepts in ns.
|
||||
* @param unit unit of time
|
||||
* @param value time
|
||||
* returns time value in ns
|
||||
*/
|
||||
static double getNSTime(timeUnit unit, double value){
|
||||
double valueNS=value;
|
||||
switch(unit){
|
||||
case HOURS: valueNS*=60;
|
||||
case MINUTES: valueNS*=60;
|
||||
case SECONDS: valueNS*=1000;
|
||||
case MILLISECONDS: valueNS*=1000;
|
||||
case MICROSECONDS: valueNS*=1000;
|
||||
case NANOSECONDS:
|
||||
default:;
|
||||
}
|
||||
return valueNS;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** returns the time in the appropriate time unit
|
||||
* @param unit unit of time
|
||||
* @param value time in seconds
|
||||
* returns the corresponding time value
|
||||
*/
|
||||
static double getCorrectTime(timeUnit& unit, double value){
|
||||
int intUnit = (int)SECONDS;
|
||||
|
||||
/**0 ms*/
|
||||
if(!value){
|
||||
unit = MILLISECONDS;
|
||||
return value;
|
||||
}
|
||||
|
||||
/** hr, min, sec */
|
||||
if(value>=1){
|
||||
double newVal = value;
|
||||
while((newVal>=1)&&(intUnit>=(int)HOURS)){
|
||||
/** value retains the old value */
|
||||
value = newVal;
|
||||
newVal = value/(double)60;
|
||||
intUnit--;
|
||||
}
|
||||
/** returning the previous value*/
|
||||
unit = (timeUnit)(intUnit+1);
|
||||
return value;
|
||||
}
|
||||
/** ms, us, ns */
|
||||
else{
|
||||
while((value<1)&&(intUnit<(int)NANOSECONDS)){
|
||||
value = value*(double)1000;
|
||||
intUnit++;
|
||||
}
|
||||
unit = (timeUnit)(intUnit);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**displays an warning,error,info message
|
||||
* @param message the message to be displayed
|
||||
* @param source is the tab or the source of the message
|
||||
* */
|
||||
static int Message(MessageIndex index, string message,string source)
|
||||
{
|
||||
static QMessageBox* msgBox;
|
||||
size_t pos;
|
||||
|
||||
//replace all \n with <br>
|
||||
pos = 0;
|
||||
while((pos = message.find("\n", pos)) != string::npos){
|
||||
message.replace(pos, 1, "<br>");
|
||||
pos += 1;
|
||||
}
|
||||
message.append(string("<p style=\"font-size:10px;color:grey;\">Source: ") + source + string("</p>"));
|
||||
|
||||
switch(index){
|
||||
case WARNING:
|
||||
msgBox= new QMessageBox(QMessageBox::Warning,"WARNING",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
case CRITICAL:
|
||||
msgBox= new QMessageBox(QMessageBox::Critical,"CRITICAL",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
case INFORMATION:
|
||||
msgBox= new QMessageBox(QMessageBox::Information,"INFORMATION",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
default:
|
||||
msgBox= new QMessageBox(QMessageBox::Question,"QUESTION",tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
|
||||
break;
|
||||
}
|
||||
//msgBox->setDetailedText(QString(source.c_str())); //close button doesnt work with this static function and this
|
||||
if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** range of x and y axes
|
||||
*/
|
||||
enum range{
|
||||
XMINIMUM,
|
||||
XMAXIMUM,
|
||||
YMINIMUM,
|
||||
YMAXIMUM
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**gets error mask and displays the message if it exists
|
||||
* @param myDet is the multidetector object
|
||||
/returns error message else an empty string
|
||||
* */
|
||||
static string checkErrorMessage(multiSlsDetector*& myDet, string title = "Main"){
|
||||
|
||||
|
||||
int errorLevel= (int)WARNING;
|
||||
string retval="";
|
||||
size_t pos;
|
||||
|
||||
|
||||
retval = myDet->getErrorMessage(errorLevel);
|
||||
|
||||
if(!retval.empty()){
|
||||
//replace all \n with <br>
|
||||
pos = 0;
|
||||
while((pos = retval.find("\n", pos)) != string::npos){
|
||||
retval.replace(pos, 1, "<br>");
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
//get rid of the last \n
|
||||
if(retval.find_last_of("<br>")==retval.length()-1)
|
||||
retval.erase((int)retval.find_last_of("<br>")-3,4);
|
||||
|
||||
retval.insert(0,"<font color=\"darkBlue\">");
|
||||
retval.append("</font></nobr>");
|
||||
|
||||
//display message
|
||||
qDefs::Message((MessageIndex)errorLevel,retval,title);
|
||||
}
|
||||
|
||||
myDet->clearAllErrorMask();
|
||||
return retval;
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**gets error mask and displays the message if it exists
|
||||
* @param myDet is the slsdetector object
|
||||
* @param show to display the error message
|
||||
/returns error message else an empty string
|
||||
* */
|
||||
static string checkErrorMessage(slsDetector*& myDet, string title = "Main", bool show = true){
|
||||
|
||||
|
||||
int errorLevel= (int)WARNING;
|
||||
string retval="";
|
||||
size_t pos;
|
||||
int64_t emask=0;
|
||||
|
||||
emask = myDet->getErrorMask();
|
||||
retval = myDet->getErrorMessage(emask);
|
||||
|
||||
if(!retval.empty()){
|
||||
//replace all \n with <br>
|
||||
pos = 0;
|
||||
while((pos = retval.find("\n", pos)) != string::npos){
|
||||
retval.replace(pos, 1, "<br>");
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
//get rid of the last \n
|
||||
if(retval.find_last_of("<br>")==retval.length()-1)
|
||||
retval.erase((int)retval.find_last_of("<br>")-3,4);
|
||||
|
||||
retval.insert(0,"<font color=\"darkBlue\">");
|
||||
retval.append("</font></nobr>");
|
||||
|
||||
//display message
|
||||
if(show)
|
||||
qDefs::Message((MessageIndex)errorLevel,retval,title);
|
||||
}
|
||||
|
||||
myDet->clearErrorMask();
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** scan arguments*/
|
||||
enum scanArgumentList{
|
||||
None,
|
||||
Level0,
|
||||
Level1,
|
||||
FileIndex,
|
||||
AllFrames
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** histogram arguments*/
|
||||
enum histogramArgumentList{
|
||||
Intensity,
|
||||
histLevel0,
|
||||
histLevel1
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
class qDefs : public QWidget {
|
||||
public:
|
||||
/**
|
||||
* Empty Constructor
|
||||
*/
|
||||
qDefs(){};
|
||||
|
||||
#define GOODBYE -200
|
||||
|
||||
/** Success or FAIL */
|
||||
enum { OK, FAIL };
|
||||
|
||||
/**
|
||||
* Message Criticality
|
||||
*/
|
||||
enum MessageIndex { WARNING, CRITICAL, INFORMATION, QUESTION };
|
||||
|
||||
/**
|
||||
* unit of time
|
||||
*/
|
||||
enum timeUnit {
|
||||
HOURS, /** hr */
|
||||
MINUTES, /** min */
|
||||
SECONDS, /** s */
|
||||
MILLISECONDS, /** ms */
|
||||
MICROSECONDS, /** us */
|
||||
NANOSECONDS /** ns */
|
||||
};
|
||||
|
||||
/**
|
||||
* range of x and y axes
|
||||
*/
|
||||
enum range { XMINIMUM, XMAXIMUM, YMINIMUM, YMAXIMUM };
|
||||
|
||||
/**
|
||||
* function enums for the qServer and qClient
|
||||
*/
|
||||
enum guiFuncs {
|
||||
F_GUI_GET_RUN_STATUS,
|
||||
F_GUI_START_ACQUISITION,
|
||||
F_GUI_STOP_ACQUISITION,
|
||||
F_GUI_START_AND_READ_ALL,
|
||||
F_GUI_EXIT_SERVER,
|
||||
NUM_GUI_FUNCS
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the unit in words
|
||||
* @param unit is the time unit
|
||||
*/
|
||||
static std::string getUnitString(timeUnit unit) {
|
||||
switch (unit) {
|
||||
case HOURS:
|
||||
return std::string("hrs");
|
||||
case MINUTES:
|
||||
return std::string("min");
|
||||
case SECONDS:
|
||||
return std::string("sec");
|
||||
case MILLISECONDS:
|
||||
return std::string("msec");
|
||||
case MICROSECONDS:
|
||||
return std::string("usec");
|
||||
case NANOSECONDS:
|
||||
return std::string("nsec");
|
||||
default:
|
||||
return std::string("error");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the value in ns to send to server as the
|
||||
* server class slsdetector accepts in ns.
|
||||
* @param unit unit of time
|
||||
* @param value time
|
||||
* returns time value in ns
|
||||
*/
|
||||
static double getNSTime(timeUnit unit, double value) {
|
||||
double valueNS = value;
|
||||
switch (unit) {
|
||||
case HOURS:
|
||||
valueNS *= 60;
|
||||
case MINUTES:
|
||||
valueNS *= 60;
|
||||
case SECONDS:
|
||||
valueNS *= 1000;
|
||||
case MILLISECONDS:
|
||||
valueNS *= 1000;
|
||||
case MICROSECONDS:
|
||||
valueNS *= 1000;
|
||||
case NANOSECONDS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return valueNS;
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the time in the appropriate time unit
|
||||
* @param unit unit of time
|
||||
* @param value time in seconds
|
||||
* returns the corresponding time value
|
||||
*/
|
||||
static double getCorrectTime(timeUnit &unit, double value) {
|
||||
int intUnit = (int)SECONDS;
|
||||
|
||||
/**0 ms*/
|
||||
if (!value) {
|
||||
unit = MILLISECONDS;
|
||||
return value;
|
||||
}
|
||||
|
||||
/** hr, min, sec */
|
||||
if (value >= 1) {
|
||||
double newVal = value;
|
||||
while ((newVal >= 1) && (intUnit >= (int)HOURS)) {
|
||||
/** value retains the old value */
|
||||
value = newVal;
|
||||
newVal = value / (double)60;
|
||||
intUnit--;
|
||||
}
|
||||
/** returning the previous value*/
|
||||
unit = (timeUnit)(intUnit + 1);
|
||||
return value;
|
||||
}
|
||||
/** ms, us, ns */
|
||||
else {
|
||||
while ((value < 1) && (intUnit < (int)NANOSECONDS)) {
|
||||
value = value * (double)1000;
|
||||
intUnit++;
|
||||
}
|
||||
unit = (timeUnit)(intUnit);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* displays an warning,error,info message
|
||||
* @param message the message to be displayed
|
||||
* @param source is the tab or the source of the message
|
||||
* */
|
||||
static int Message(MessageIndex index, std::string message,
|
||||
std::string source) {
|
||||
static QMessageBox *msgBox;
|
||||
size_t pos;
|
||||
|
||||
// replace all \n with <br>
|
||||
pos = 0;
|
||||
while ((pos = message.find("\n", pos)) != std::string::npos) {
|
||||
message.replace(pos, 1, "<br>");
|
||||
pos += 1;
|
||||
}
|
||||
message.append(
|
||||
std::string(
|
||||
"<p "
|
||||
"style=\"font-size:10px;color:grey;\">Source: ") +
|
||||
source + std::string("</p>"));
|
||||
|
||||
switch (index) {
|
||||
case WARNING:
|
||||
msgBox =
|
||||
new QMessageBox(QMessageBox::Warning, "WARNING",
|
||||
tr(message.c_str()), QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
case CRITICAL:
|
||||
msgBox =
|
||||
new QMessageBox(QMessageBox::Critical, "CRITICAL",
|
||||
tr(message.c_str()), QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
case INFORMATION:
|
||||
msgBox =
|
||||
new QMessageBox(QMessageBox::Information, "INFORMATION",
|
||||
tr(message.c_str()), QMessageBox::Ok, msgBox);
|
||||
break;
|
||||
default:
|
||||
msgBox = new QMessageBox(
|
||||
QMessageBox::Question, "QUESTION", tr(message.c_str()),
|
||||
QMessageBox::Ok | QMessageBox::Cancel, msgBox);
|
||||
break;
|
||||
}
|
||||
// msgBox->setDetailedText(QString(source.c_str())); //close button
|
||||
// doesnt work with this static function and this
|
||||
if (msgBox->exec() == QMessageBox::Ok)
|
||||
return OK;
|
||||
else
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap around to ignore non critical exceptions
|
||||
*/
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
|
||||
// only executing multiSlsDetector function
|
||||
template <typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptions(multiSlsDetector* det, const std::string loc, RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
((det->*somefunc)(Args...));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
Message(qDefs::WARNING, e.what(), loc);
|
||||
}
|
||||
};
|
||||
|
||||
// executing multiSlsDetector funtion and using return value to set QWidget function
|
||||
template <class W, typename WRT, typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptions(W* wid,
|
||||
void (W::*someQfunc)(WRT),
|
||||
multiSlsDetector* det, const std::string loc,
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
auto val = ((det->*somefunc)(Args...));
|
||||
(wid->*someQfunc)(static_cast<RT>(val));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
Message(qDefs::WARNING, e.what(), loc);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
|
||||
template <typename RT, typename... CT>
|
||||
static RT IgnoreNonCriticalExceptionsandReturn(
|
||||
multiSlsDetector* det, const std::string loc,
|
||||
RT (multiSlsDetector::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
return ((det->*somefunc)(Args...));
|
||||
}
|
||||
// catch them here as they are not critical
|
||||
catch (const sls::NonCriticalError &e) {
|
||||
Message(qDefs::WARNING, e.what(), loc);
|
||||
return static_cast<RT>(-1);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif /* QDEFS_H */
|
||||
|
310
slsDetectorGui/include/qDetectorMain.h
Normal file → Executable file
@ -1,202 +1,200 @@
|
||||
/*
|
||||
* qDetectorMain.h
|
||||
* Main Window of the GUI
|
||||
* Created on: Apr 30, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#ifndef QDETECTORMAIN_H
|
||||
#define QDETECTORMAIN_H
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_detectormain.h"
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "ui_form_detectormain.h"
|
||||
class qTabPlot;
|
||||
class qTabActions;
|
||||
class qTabAdvanced;
|
||||
class qTabSettings;
|
||||
class qTabDebugging;
|
||||
class qTabDeveloper;
|
||||
class qTabMessages;
|
||||
class qServer;
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QScrollArea>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
/** To Over-ride the QTabWidget class to get the tabBar */
|
||||
class MyTabWidget:public QTabWidget{
|
||||
public:
|
||||
MyTabWidget(QWidget* parent = 0) {setParent(parent);}
|
||||
class MyTabWidget : public QTabWidget {
|
||||
public:
|
||||
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
||||
/** Overridden method from QTabWidget */
|
||||
QTabBar* tabBar(){return QTabWidget::tabBar();}
|
||||
QTabBar *tabBar() { return QTabWidget::tabBar(); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*@short Main window of the GUI.
|
||||
*/
|
||||
class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{
|
||||
Q_OBJECT
|
||||
class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Main Window constructor.
|
||||
* This is mainly used to create detector object and all the tabs
|
||||
* @param argc number of command line arguments for server options
|
||||
* @param argv server options
|
||||
* @param app the qapplication3
|
||||
* @param parent makes the parent window 0 by default
|
||||
*/
|
||||
qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent = 0);
|
||||
|
||||
public:
|
||||
/** \short Main Window constructor.
|
||||
* This is mainly used to create detector object and all the tabs
|
||||
* @param argc number of command line arguments for server options
|
||||
* @param argv server options
|
||||
* @param app the qapplication3
|
||||
* @param ret OK or FAIL of constructor (from command line arguments)
|
||||
* @param parent makes the parent window 0 by default
|
||||
* */
|
||||
qDetectorMain(int argc, char **argv, QApplication *app, int& ret, QWidget *parent = 0);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qDetectorMain();
|
||||
|
||||
/**Destructor
|
||||
* */
|
||||
~qDetectorMain();
|
||||
/**
|
||||
* Starts or stops Acquisition From gui client
|
||||
* @param start 1 for start and 0 to stop
|
||||
* @returns success or fail
|
||||
*/
|
||||
int StartStopAcquisitionFromClient(bool start);
|
||||
|
||||
/** Starts or stops Acquisition From gui client
|
||||
* @param start 1 for start and 0 to stop
|
||||
/returns success or fail
|
||||
*/
|
||||
int StartStopAcquisitionFromClient(bool start);
|
||||
/**
|
||||
* Returns if plot is running
|
||||
*/
|
||||
bool isPlotRunning();
|
||||
|
||||
/** Returns if plot is running
|
||||
*/
|
||||
bool isPlotRunning(){return myPlot->isRunning();};
|
||||
/**
|
||||
* Returns progress bar value
|
||||
*/
|
||||
int GetProgress();
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return tab_measurement->GetProgress();};
|
||||
/**
|
||||
* Verifies if output directories for all the receivers exist
|
||||
*/
|
||||
int DoesOutputDirExist();
|
||||
|
||||
/** Returns file path */
|
||||
QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;};
|
||||
private slots:
|
||||
/**
|
||||
* Enables modes as selected -Debug, Expert, Dockable: calls setdockablemode
|
||||
*/
|
||||
void EnableModes(QAction *action);
|
||||
|
||||
/** Verifies if output directories for all the receivers exist */
|
||||
int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();};
|
||||
/**
|
||||
* Executes actions in the utilities menu as selected
|
||||
*/
|
||||
void ExecuteUtilities(QAction *action);
|
||||
|
||||
bool isCurrentlyTabDeveloper();
|
||||
/**
|
||||
* Executes actions in the utilities menu as selected
|
||||
*/
|
||||
void ExecuteHelp(QAction *action);
|
||||
|
||||
private:
|
||||
/** The Qt Application */
|
||||
QApplication *theApp;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** sls detector id */
|
||||
int detID;
|
||||
/** true for mythen and eiger */
|
||||
bool digitalDetector;
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
/**Tab Widget */
|
||||
MyTabWidget *tabs;
|
||||
/**Layout of the central Widget */
|
||||
QGridLayout *layoutTabs;
|
||||
/** default height of Plot Window when docked */
|
||||
int heightPlotWindow;
|
||||
/** default height of central widgetwhen plot Window when docked */
|
||||
int heightCentralWidget;
|
||||
/** The default zooming tool tip */
|
||||
QString zoomToolTip;
|
||||
/**
|
||||
* Refreshes the tab each time the tab is changed. Also displays the next
|
||||
* enabled tab
|
||||
*/
|
||||
void Refresh(int index);
|
||||
|
||||
/** The default tab heading color */
|
||||
QColor defaultTabColor;
|
||||
/** enumeration of the tabs */
|
||||
enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, Messages, NumberOfTabs };
|
||||
/* Scroll Area for the tabs**/
|
||||
QScrollArea *scroll[NumberOfTabs];
|
||||
/**Measurement tab */
|
||||
qTabMeasurement *tab_measurement;
|
||||
/**DataOutput tab */
|
||||
qTabDataOutput *tab_dataoutput;
|
||||
/**Plot tab */
|
||||
qTabPlot *tab_plot;
|
||||
/**Actions tab */
|
||||
qTabActions *tab_actions;
|
||||
/**Settings tab */
|
||||
qTabSettings *tab_settings;
|
||||
/**Advanced tab */
|
||||
qTabAdvanced *tab_advanced;
|
||||
/**Debugging tab */
|
||||
qTabDebugging *tab_debugging;
|
||||
/**Developer tab */
|
||||
qTabDeveloper *tab_developer;
|
||||
/**Messages tab */
|
||||
qTabMessages *tab_messages;
|
||||
/**
|
||||
* Resizes the main window if the plot is docked/undocked
|
||||
* @param b bool TRUE if undocked(outside main window), FALSE docked
|
||||
*/
|
||||
void ResizeMainWindow(bool b);
|
||||
|
||||
/** server object*/
|
||||
qServer *myServer;
|
||||
/**
|
||||
* Enables/disables tabs depending on if acquisition is currently in
|
||||
* progress
|
||||
*/
|
||||
void EnableTabs();
|
||||
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
/**
|
||||
* Set the tool tip of mouse controlled zooming depening on if its
|
||||
* enabled/disabled
|
||||
*/
|
||||
void SetZoomToolTip(bool disable);
|
||||
|
||||
/**Sets up the layout of the widget
|
||||
* */
|
||||
void SetUpWidgetWindow();
|
||||
/**
|
||||
* Uncheck the Listen to gui client mode when the server has exited
|
||||
*/
|
||||
void UncheckServer();
|
||||
|
||||
/**Sets up detector
|
||||
* @param fName file name of the config file at start up
|
||||
* */
|
||||
void SetUpDetector(const string fName);
|
||||
protected:
|
||||
/**
|
||||
* Adjust the resizing to resize plot
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
/**Sets up the signals and the slots
|
||||
* */
|
||||
void Initialization();
|
||||
private:
|
||||
/**
|
||||
* Sets up the layout of the widget
|
||||
*/
|
||||
void SetUpWidgetWindow();
|
||||
|
||||
/** Loads config file at start up
|
||||
* */
|
||||
void LoadConfigFile(const string fName);
|
||||
/**
|
||||
* Sets up detector
|
||||
* @param fName file name of the config file at start up
|
||||
* @param multi detector ID
|
||||
*/
|
||||
void SetUpDetector(const std::string fName, int multiID);
|
||||
|
||||
/**
|
||||
* Sets up the signals and the slots
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
private slots:
|
||||
/** Enables modes as selected -Debug, Expert, Dockable(calls setdockablemode())
|
||||
* */
|
||||
void EnableModes(QAction *action);
|
||||
|
||||
/** Executes actions in the utilities menu as selected
|
||||
* */
|
||||
void ExecuteUtilities(QAction *action);
|
||||
|
||||
/** Executes actions in the utilities menu as selected
|
||||
* */
|
||||
void ExecuteHelp(QAction *action);
|
||||
|
||||
/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab
|
||||
* */
|
||||
void Refresh(int index);
|
||||
|
||||
/** Resizes the main window if the plot is docked/undocked
|
||||
* @param b bool TRUE if undocked(outside main window), FALSE docked
|
||||
* */
|
||||
void ResizeMainWindow(bool b);
|
||||
|
||||
/** Enables/disables tabs depending on if acquisition is currently in progress
|
||||
* */
|
||||
void EnableTabs();
|
||||
|
||||
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled
|
||||
* */
|
||||
void SetZoomToolTip(bool disable);
|
||||
|
||||
/** Uncheck the Listen to gui client mode when the server has exited
|
||||
*/
|
||||
void UncheckServer();
|
||||
|
||||
protected:
|
||||
/** Adjust the resizing to resize plot, except for actions tab
|
||||
* */
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
/**
|
||||
* Loads config file at start up
|
||||
*/
|
||||
void LoadConfigFile(const std::string fName);
|
||||
|
||||
/** enumeration of the tabs */
|
||||
enum {
|
||||
MEASUREMENT,
|
||||
SETTINGS,
|
||||
DATAOUTPUT,
|
||||
PLOT,
|
||||
ADVANCED,
|
||||
DEBUGGING,
|
||||
DEVELOPER,
|
||||
MESSAGES,
|
||||
NumberOfTabs
|
||||
};
|
||||
/** Detector Type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector* myDet;
|
||||
/** The Plot widget */
|
||||
qDrawPlot* myPlot;
|
||||
/**Tab Widget */
|
||||
MyTabWidget* tabs;
|
||||
/**Measurement tab */
|
||||
qTabMeasurement* tabMeasurement;
|
||||
/**DataOutput tab */
|
||||
qTabDataOutput* tabDataOutput;
|
||||
/**Plot tab */
|
||||
qTabPlot* tabPlot;
|
||||
/**Settings tab */
|
||||
qTabSettings* tabSettings;
|
||||
/**Advanced tab */
|
||||
qTabAdvanced* tabAdvanced;
|
||||
/**Debugging tab */
|
||||
qTabDebugging* tabDebugging;
|
||||
/**Developer tab */
|
||||
qTabDeveloper* tabDeveloper;
|
||||
/**Messages tab */
|
||||
qTabMessages* tabMessages;
|
||||
/** server object*/
|
||||
qServer* myServer;
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
/** default height of Plot Window when docked */
|
||||
int heightPlotWindow;
|
||||
/** default height of central widgetwhen plot Window when docked */
|
||||
int heightCentralWidget;
|
||||
/** The default zooming tool tip */
|
||||
QString zoomToolTip;
|
||||
/** The default tab heading color */
|
||||
QColor defaultTabColor;
|
||||
};
|
||||
|
||||
#endif /* QDETECTORMAIN_H */
|
||||
|
4
slsDetectorGui/include/qDrawPlot.h
Normal file → Executable file
@ -50,7 +50,7 @@ class qDrawPlot:public QWidget{
|
||||
|
||||
public:
|
||||
/** \short The constructor */
|
||||
qDrawPlot(QWidget *parent,multiSlsDetector*& detector);
|
||||
qDrawPlot(QWidget *parent, multiSlsDetector* detector);
|
||||
/** Destructor */
|
||||
~qDrawPlot();
|
||||
|
||||
@ -181,7 +181,7 @@ void SetLines(bool enable){lines = enable;};
|
||||
/** sets markers */
|
||||
void SetMarkers(bool enable){markers = enable;};
|
||||
/** sets the scan argument to prepare the plot*/
|
||||
void SetScanArgument(int scanArg);
|
||||
// void SetScanArgument(int scanArg);
|
||||
/** sets stop_signal to true */
|
||||
void StopAcquisition(){ stop_signal = true; };
|
||||
/** Set/unset pedestal */
|
||||
|
@ -1,193 +0,0 @@
|
||||
/*
|
||||
* qScanWidget.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QSCANWIDGET_H_
|
||||
#define QSCANWIDGET_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_scan.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QStackedLayout>
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
class qScanWidget : public QWidget,private Ui::ScanObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qScanWidget(QWidget *parent, multiSlsDetector*& detector);
|
||||
|
||||
~qScanWidget();
|
||||
|
||||
/**to update the widgets*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
/**number of scan widgets*/
|
||||
static int NUM_SCAN_WIDGETS;
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/**id of the scan widget*/
|
||||
int id;
|
||||
/**type of steps*/
|
||||
enum sizeIndex{RangeValues, CustomValues, FileValues};
|
||||
enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,PositionScan,CustomScript,NumModes};
|
||||
static const string modeNames[NumModes];
|
||||
|
||||
/**values*/
|
||||
int actualNumSteps;
|
||||
vector <double> positions;
|
||||
|
||||
/**non error font*/
|
||||
QPalette normal;
|
||||
QPalette red;
|
||||
QString customTip;
|
||||
QString fileTip;
|
||||
QString rangeTip;
|
||||
|
||||
/**widgets needed for diff size types*/
|
||||
QButtonGroup *btnGroup;
|
||||
QStackedLayout *stackedLayout;
|
||||
QLabel *lblFrom;
|
||||
QDoubleSpinBox *spinFrom;
|
||||
QLabel *lblTo;
|
||||
QDoubleSpinBox *spinTo;
|
||||
QLabel *lblSize;
|
||||
QDoubleSpinBox *spinSize;
|
||||
QComboBox *comboCustom;
|
||||
QPushButton *btnCustom;
|
||||
QLineEdit *dispFile;
|
||||
QPushButton *btnFile;
|
||||
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
/** Sets up all the parameters from server/client */
|
||||
void LoadPositions();
|
||||
|
||||
/** Sets up the scan parameters
|
||||
* returns if it was set
|
||||
*/
|
||||
int SetScan(int mode);
|
||||
|
||||
private slots:
|
||||
/** Enables widgets depending on which size is clicked.
|
||||
* Options: constant size,specific values,values from file
|
||||
* */
|
||||
void EnableSizeWidgets();
|
||||
|
||||
/** Sets the scan or script. Accordingly enables, disables other widgets
|
||||
* @param mode value chosen*/
|
||||
void SetMode(int mode);
|
||||
|
||||
/** Browse for the script
|
||||
* */
|
||||
void BrowsePath();
|
||||
|
||||
/** Sets the script file
|
||||
* */
|
||||
void SetScriptFile();
|
||||
|
||||
/** Set Parameter
|
||||
* */
|
||||
void SetParameter();
|
||||
|
||||
/** Set precision
|
||||
* @param value value of precision to be set
|
||||
* */
|
||||
void SetPrecision(int value);
|
||||
|
||||
/** Set number of steps
|
||||
* */
|
||||
void SetNSteps();
|
||||
|
||||
/**Checks if size is zero and return FAIL if it does
|
||||
* */
|
||||
int RangeCheckSizeZero();
|
||||
|
||||
/**returns ok and number of steps if valid
|
||||
* @param number of steps
|
||||
* */
|
||||
int RangeCheckNumValid(int &num);
|
||||
|
||||
/**returns fail if to is not exact
|
||||
* */
|
||||
int RangeCheckToValid();
|
||||
|
||||
/** Sets number of steps if from changed
|
||||
* */
|
||||
void RangeFromChanged();
|
||||
|
||||
/** Sets number of steps if to changed
|
||||
* */
|
||||
void RangeToChanged();
|
||||
|
||||
/** Sets s of steps if size changed
|
||||
* */
|
||||
void RangeSizeChanged();
|
||||
|
||||
/** Set range for scan
|
||||
* */
|
||||
void SetRangeSteps();
|
||||
|
||||
|
||||
/** Range type: If size is changed,
|
||||
* the Number of steps is calculated
|
||||
* */
|
||||
//void RangeCalculateNumSteps();
|
||||
|
||||
/** Range type: If size is changed, the To is calculated
|
||||
* */
|
||||
//void RangeCalculateTo();
|
||||
|
||||
|
||||
/** Set custom steps
|
||||
* returns OK if set properly
|
||||
* */
|
||||
int SetCustomSteps();
|
||||
|
||||
/** Delete custom steps
|
||||
* */
|
||||
void DeleteCustomSteps();
|
||||
|
||||
/** Reads the file to get the steps
|
||||
* */
|
||||
void SetFileSteps();
|
||||
|
||||
/** Browses for the file path for steps
|
||||
* */
|
||||
void BrowseFileStepsPath();
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void EnableScanBox();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* QSCANWIDGET_H_ */
|
||||
|
201
slsDetectorGui/include/qServer.h
Normal file → Executable file
@ -1,137 +1,126 @@
|
||||
/*
|
||||
* qServer.h.h
|
||||
*
|
||||
* Created on: Feb 27, 2013
|
||||
* Author: Dhanya Maliakal
|
||||
*/
|
||||
#ifndef QSERVER_H
|
||||
#define QSERVER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "sls_detector_defs.h"
|
||||
#include "qDefs.h"
|
||||
#include "sls_detector_defs.h"
|
||||
class qDetectorMain;
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
class MySocketTCP;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
/** C++ Include Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
class ServerSocket;
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
*@short Sets up the gui server
|
||||
*/
|
||||
class qServer: public QWidget, public virtual slsDetectorDefs{
|
||||
Q_OBJECT
|
||||
class qServer : public QWidget, public virtual slsDetectorDefs {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
qServer(qDetectorMain *t);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qServer();
|
||||
|
||||
public:
|
||||
/** \short The constructor */
|
||||
qServer(qDetectorMain *t);
|
||||
/** Destructor */
|
||||
~qServer();
|
||||
/**
|
||||
* Create (Control and Stop) Gui Servers
|
||||
*/
|
||||
void CreateServers();
|
||||
|
||||
/** Start or Stop Gui Server
|
||||
* @param start is 1 to start and 0 to stop
|
||||
*/
|
||||
int StartStopServer(int start);
|
||||
/**
|
||||
* Destroy (Control and Stop) Gui Servers
|
||||
*/
|
||||
void DestroyServers();
|
||||
|
||||
private:
|
||||
/** assigns functions to the fnum enum */
|
||||
int FunctionTable();
|
||||
private:
|
||||
/**
|
||||
* Assigns functions to the fnum enum
|
||||
*/
|
||||
void FunctionTable();
|
||||
|
||||
/** Decodes Function */
|
||||
int DecodeFunction(MySocketTCP* sock);
|
||||
/**
|
||||
* Decodes Function
|
||||
* @param sock control or stop socket
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int DecodeFunction(ServerSocket *sock);
|
||||
|
||||
/** Exit Server */
|
||||
int ExitServer();
|
||||
/**
|
||||
* Shut down Sockets
|
||||
*/
|
||||
void ShutDownSockets();
|
||||
|
||||
/**
|
||||
* Server thread
|
||||
* @param pointer to control or stop socket
|
||||
*/
|
||||
void ServerThread(ServerSocket* sock);
|
||||
|
||||
/**
|
||||
* Static function - Thread started which listens to client gui.
|
||||
* Called by StartStopServer()
|
||||
* @param this_pointer pointer to this object
|
||||
*/
|
||||
static void* StartServerThread(void *this_pointer);
|
||||
/**
|
||||
* Thread of stop server
|
||||
*/
|
||||
void StopServer();
|
||||
|
||||
/**
|
||||
* Thread started which listens to client gui.
|
||||
* Called by startServerThread()
|
||||
*
|
||||
*/
|
||||
int StartServer();
|
||||
/**
|
||||
* Get Detector Status
|
||||
* @returns success of operation
|
||||
*/
|
||||
int GetStatus();
|
||||
|
||||
/**
|
||||
* Static function - Thread started which listens to client gui to stop acquisition
|
||||
* Called by StartStopServer()
|
||||
* @param this_pointer pointer to this object
|
||||
*/
|
||||
static void* StopServerThread(void *this_pointer);
|
||||
/**
|
||||
* Starts Acquisition
|
||||
* @returns success of operation
|
||||
*/
|
||||
int StartAcquisition();
|
||||
|
||||
/**
|
||||
* Thread started which listens to client gui to stop acquisition.
|
||||
* Called by startServerThread()
|
||||
*
|
||||
*/
|
||||
int StopServer();
|
||||
/**
|
||||
* Stops Acquisition
|
||||
* @returns success of operation
|
||||
*/
|
||||
int StopsAcquisition();
|
||||
|
||||
/**
|
||||
* Acquire - blocking
|
||||
* @returns success of operation
|
||||
*/
|
||||
int Acquire();
|
||||
|
||||
/**
|
||||
* Exit Server
|
||||
* @returns GOODBYE
|
||||
*/
|
||||
int ExitServer();
|
||||
|
||||
/** Get Detector Status */
|
||||
int GetStatus();
|
||||
/** function list */
|
||||
std::vector<int (*)()> flist;
|
||||
|
||||
/** Starts Acquisition */
|
||||
int StartAcquisition();
|
||||
/** if the gui server thread is running*/
|
||||
bool threadRunning;
|
||||
|
||||
/** Stops Acquisition */
|
||||
int StopsAcquisition();
|
||||
/** if thread started */
|
||||
bool threadStarted;
|
||||
|
||||
/** Acquire - blocking */
|
||||
int Acquire();
|
||||
/**The measurement tab object*/
|
||||
qDetectorMain *mainTab;
|
||||
|
||||
/** control port */
|
||||
int controlPort;
|
||||
|
||||
/** stop port */
|
||||
int stopPort;
|
||||
|
||||
/**The measurement tab object*/
|
||||
qDetectorMain *myMainTab;
|
||||
/** control socket */
|
||||
ServerSocket *controlSocket;
|
||||
|
||||
/** tcp socket to gui client */
|
||||
MySocketTCP *mySocket;
|
||||
/** tcp socket to gui client to stop or get status */
|
||||
MySocketTCP *myStopSocket;
|
||||
|
||||
/** server port number*/
|
||||
int port_no;
|
||||
|
||||
/** Lock Status if server locked to a client */
|
||||
int lockStatus;
|
||||
|
||||
/** Function List */
|
||||
static const int NUMBER_OF_FUNCTIONS = 256;
|
||||
int (qServer::*flist[NUMBER_OF_FUNCTIONS])();
|
||||
|
||||
|
||||
/** if the gui server thread is running*/
|
||||
static int gui_server_thread_running;
|
||||
/** thread listening to gui client*/
|
||||
pthread_t gui_server_thread;
|
||||
/** thread also listening to gui client to stop acquisition*/
|
||||
pthread_t gui_stop_server_thread;
|
||||
|
||||
/** server started */
|
||||
int checkStarted;
|
||||
int checkStopStarted;
|
||||
|
||||
/** Message */
|
||||
char mess[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
signals:
|
||||
void ServerStoppedSignal();
|
||||
/** stop socket */
|
||||
ServerSocket *stopSocket;
|
||||
|
||||
signals:
|
||||
// to update the Listening to Gui check box
|
||||
void ServerStoppedSignal();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QSERVER_H */
|
||||
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* qTabActions.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABACTIONS_H_
|
||||
#define QTABACTIONS_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/* Qt Project Class Headers */
|
||||
#include "qActionsWidget.h"
|
||||
#include "qScanWidget.h"
|
||||
/** C++ Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QScrollArea>
|
||||
#include <QGridLayout>
|
||||
#include <QPalette>
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the acions parameters
|
||||
*/
|
||||
class qTabActions:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabActions(QWidget *parent,multiSlsDetector*& detector);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~qTabActions();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
public slots:
|
||||
/** Disable Positions
|
||||
* @param enable true if to disable
|
||||
* */
|
||||
void EnablePositions(bool enable);
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
|
||||
enum actionIndex{
|
||||
ActionStart,
|
||||
Scan0,
|
||||
Scan1,
|
||||
ActionBefore,
|
||||
NumPositions,
|
||||
HeaderBefore,
|
||||
HeaderAfter,
|
||||
ActionAfter,
|
||||
ActionStop,
|
||||
NumTotalActions};
|
||||
|
||||
QGridLayout *gridLayout;
|
||||
QButtonGroup *group;
|
||||
QPalette *palette;
|
||||
|
||||
/** all action widget objects */
|
||||
qActionsWidget *actionWidget[6];
|
||||
qScanWidget *scanWidget[2];
|
||||
QWidget *positionWidget;
|
||||
QPushButton *btnExpand[NumTotalActions];
|
||||
QLabel *lblName[NumTotalActions];
|
||||
|
||||
|
||||
/** NumPositions widget */
|
||||
QLabel *lblNumPos;
|
||||
QLabel *lblPosList;
|
||||
QSpinBox *spinNumPos;
|
||||
QComboBox *comboPos;
|
||||
QPushButton *btnDelete;
|
||||
QCheckBox *chkInvert;
|
||||
QCheckBox *chkSeparate;
|
||||
QCheckBox *chkReturn;
|
||||
|
||||
double *positions;
|
||||
QPalette normal;
|
||||
QIcon *iconPlus;
|
||||
QIcon *iconMinus;
|
||||
|
||||
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
/** creates the Num Positions object */
|
||||
void CreatePositionsWidget();
|
||||
|
||||
/** Returns the index in each of the classes
|
||||
* of actionwidget and scanwidget
|
||||
* @param index the index in the list of all widgets
|
||||
* returns actual index of the class
|
||||
*/
|
||||
int GetActualIndex(int index);
|
||||
|
||||
/** Updates to green color if collapsed and mode not none
|
||||
*/
|
||||
void UpdateCollapseColors();
|
||||
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** To Expand the Action Widget
|
||||
* */
|
||||
void Expand(QAbstractButton *button);
|
||||
|
||||
/** Sets the positions list and the number of positions
|
||||
* */
|
||||
void SetPosition();
|
||||
|
||||
/** Deletes current position
|
||||
* */
|
||||
void DeletePosition();
|
||||
|
||||
|
||||
signals:
|
||||
void EnableScanBox();
|
||||
|
||||
};
|
||||
|
||||
#endif /* QTABACTIONS_H_ */
|
||||
|
216
slsDetectorGui/include/qTabAdvanced.h
Normal file → Executable file
@ -1,24 +1,15 @@
|
||||
/*
|
||||
* qTabAdvanced.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABADVANCED_H_
|
||||
#define QTABADVANCED_H_
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_advanced.h"
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
class slsDetector;
|
||||
/** Qt Project Class Headers */
|
||||
|
||||
class qDrawPlot;
|
||||
/** Qt Include Header */
|
||||
|
||||
#include <QStackedLayout>
|
||||
#include <QSpacerItem>
|
||||
/**
|
||||
@ -28,239 +19,196 @@ class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
* @param plot plot object reference
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
qTabAdvanced(QWidget *parent, multiSlsDetector* detector);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabAdvanced();
|
||||
|
||||
public slots:
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
/** Sets up the widget
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Add ROI Input
|
||||
/**
|
||||
* Add ROI Input
|
||||
* @param num number of inputs to add
|
||||
*/
|
||||
void AddROIInput(int num);
|
||||
|
||||
/** Checks for a few conditions before trimming
|
||||
/returns OK or FAIL
|
||||
*/
|
||||
int validateBeforeTrimming();
|
||||
|
||||
/** update the setalltrimbits value from server
|
||||
/**
|
||||
* Update the setalltrimbits value from server
|
||||
*/
|
||||
void updateAllTrimbitsFromServer();
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
/** Enable/Disable Energy and Calibration Logs
|
||||
*/
|
||||
void SetLogs();
|
||||
|
||||
/** Set acquisition time
|
||||
*/
|
||||
void SetExposureTime();
|
||||
|
||||
/** Set the Threshold dac value
|
||||
*/
|
||||
void SetThreshold();
|
||||
|
||||
/** Set output directory for trimming
|
||||
*/
|
||||
void SetOutputFile();
|
||||
|
||||
/** Browse output directory for trimming
|
||||
*/
|
||||
void BrowseOutputFile();
|
||||
|
||||
/** Enables trimming method and calls SetTrimmingMethod if enabled
|
||||
* @param enable to enable trimming
|
||||
*/
|
||||
void EnableTrimming(bool enable);
|
||||
|
||||
/** Enabling resolution and Counts if this is enabled
|
||||
* @param enable to enable
|
||||
*/
|
||||
void SetOptimize(bool enable);
|
||||
|
||||
/** Sets the trimming method
|
||||
* @param mode trimming method
|
||||
*/
|
||||
void SetTrimmingMethod(int mode);
|
||||
|
||||
/** Ensures the right trimming mode and Executes Trimming
|
||||
*/
|
||||
void StartTrimming();
|
||||
|
||||
/** Updates the plot with trimbits from detector/shared memory
|
||||
*/
|
||||
void UpdateTrimbitPlot(int id);
|
||||
|
||||
/** Sets control port
|
||||
/**
|
||||
* Sets control port
|
||||
* @param port control port
|
||||
*/
|
||||
void SetControlPort(int port);
|
||||
|
||||
/** Sets stop port
|
||||
/**
|
||||
* Sets stop port
|
||||
* @param port stop port
|
||||
*/
|
||||
void SetStopPort(int port);
|
||||
|
||||
/** Sets receiver tcp port
|
||||
/**
|
||||
* Sets receiver tcp port
|
||||
* @param port receiver tcp port
|
||||
*/
|
||||
void SetRxrTCPPort(int port);
|
||||
|
||||
/** Sets receiver udp port
|
||||
/**
|
||||
* Sets receiver udp port
|
||||
* @param port receiver udp port
|
||||
*/
|
||||
void SetRxrUDPPort(int port);
|
||||
|
||||
/** Sets client zmq receiver port
|
||||
/**
|
||||
* Sets client zmq receiver port
|
||||
* @param port client zmq receiver port
|
||||
*/
|
||||
void SetCltZmqPort(int port);
|
||||
|
||||
/** Sets receiver zmq transmitting port
|
||||
/**
|
||||
* Sets receiver zmq transmitting port
|
||||
* @param port receiver zmq transmitting port
|
||||
*/
|
||||
void SetRxrZmqPort(int port);
|
||||
|
||||
/** Sets receiver online
|
||||
/**
|
||||
* Sets receiver online
|
||||
* @param index 1 for online and 0 for offline
|
||||
*/
|
||||
void SetReceiverOnline(int index);
|
||||
|
||||
/** Sets detector online
|
||||
/**
|
||||
* Sets detector online
|
||||
* @param index 1 for online and 0 for offline
|
||||
*/
|
||||
void SetOnline(int index);
|
||||
|
||||
/** Sets network parameters like receiver udp ip,
|
||||
/**
|
||||
* Sets network parameters like receiver udp ip,
|
||||
* receiver udp mac, detector ip and detector mac
|
||||
*/
|
||||
void SetNetworkParameters();
|
||||
|
||||
/** Sets client zmq ip to listen to
|
||||
/**
|
||||
* Sets client zmq ip to listen to
|
||||
*/
|
||||
void SetClientZMQIP();
|
||||
|
||||
/** Sets receiver zmq ip to stream from
|
||||
/**
|
||||
* Sets receiver zmq ip to stream from
|
||||
*/
|
||||
void SetReceiverZMQIP();
|
||||
|
||||
/** Sets the receiver. which also sets the receiver parameters
|
||||
/**
|
||||
* Sets the receiver. which also sets the receiver parameters
|
||||
*/
|
||||
void SetReceiver();
|
||||
|
||||
/** Add ROI Input if the value changed in the last slot
|
||||
/**
|
||||
* Add ROI Input if the value changed in the last slot
|
||||
*/
|
||||
void AddROIInputSlot(){AddROIInput(1);};
|
||||
void AddROIInputSlot();
|
||||
|
||||
/** Clears all the ROI inputs
|
||||
/**
|
||||
* Clears all the ROI inputs
|
||||
*/
|
||||
void clearROI();
|
||||
|
||||
/** Gets ROIs from detector and updates it
|
||||
/**
|
||||
* Gets ROIs from detector and updates it
|
||||
*/
|
||||
void updateROIList();
|
||||
|
||||
/** Sets ROI in detector
|
||||
/**
|
||||
* Sets ROI in detector
|
||||
*/
|
||||
void setROI();
|
||||
|
||||
/** Clears ROI in detector
|
||||
/**
|
||||
* Clears ROI in detector
|
||||
*/
|
||||
void clearROIinDetector();
|
||||
|
||||
/** Clears ROI in detector
|
||||
/**
|
||||
* Select Readout
|
||||
* @param index position index of readout
|
||||
*/
|
||||
void SetDetector(int index);
|
||||
|
||||
/** Set all trimbits to a value
|
||||
/**
|
||||
* Set all trimbits to a value
|
||||
*/
|
||||
void SetAllTrimbits();
|
||||
|
||||
/** Set storage cells */
|
||||
/**
|
||||
* Set storage cells
|
||||
* @param value value to set to
|
||||
*/
|
||||
void SetNumStoragecells(int value);
|
||||
|
||||
/** Set sub frame exposure time */
|
||||
/**
|
||||
* Set sub frame exposure time
|
||||
*/
|
||||
void SetSubExposureTime();
|
||||
|
||||
/** Set sub frame period */
|
||||
void SetSubPeriod();
|
||||
/**
|
||||
* Set sub frame dead time
|
||||
*/
|
||||
void SetSubDeadTime();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** The multi detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** The sls detector object */
|
||||
slsDetector *det;
|
||||
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
|
||||
QButtonGroup *btnGroup;
|
||||
|
||||
/** Tool Tip for the output dir */
|
||||
QString outputDirTip;
|
||||
QString errOutputTip;
|
||||
/** Tool Tip */
|
||||
QString errOnlineTip;
|
||||
QString detOnlineTip;
|
||||
QString rxrOnlineTip;
|
||||
QPalette red;
|
||||
|
||||
/** Trimming mode */
|
||||
slsDetectorDefs::trimMode trimmingMode;
|
||||
static const int TRIMMING_DYNAMIC_RANGE = 32;
|
||||
static const int TRIMMING_FRAME_NUMBER = 1;
|
||||
static const int TRIMMING_TRIGGER_NUMBER = 1;
|
||||
static const int TRIMMING_PROBE_NUMBER = 0;
|
||||
|
||||
bool isEnergy;
|
||||
bool isAngular;
|
||||
|
||||
/** ROI */
|
||||
vector <QLabel*> lblFromX;
|
||||
vector <QSpinBox*> spinFromX;
|
||||
vector <QLabel*> lblFromY;
|
||||
vector <QSpinBox*> spinFromY;
|
||||
vector <QLabel*> lblToX;
|
||||
vector <QSpinBox*> spinToX;
|
||||
vector <QLabel*> lblToY;
|
||||
vector <QSpinBox*> spinToY;
|
||||
std::vector <QLabel*> lblFromX;
|
||||
std::vector <QSpinBox*> spinFromX;
|
||||
std::vector <QLabel*> lblFromY;
|
||||
std::vector <QSpinBox*> spinFromY;
|
||||
std::vector <QLabel*> lblToX;
|
||||
std::vector <QSpinBox*> spinToX;
|
||||
std::vector <QLabel*> lblToY;
|
||||
std::vector <QSpinBox*> spinToY;
|
||||
int numRois;
|
||||
|
||||
/** sub period tool tip variables*/
|
||||
QString acqSubPeriodTip;
|
||||
QString errSubPeriodTip;
|
||||
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABADVANCED_H_ */
|
||||
|
227
slsDetectorGui/include/qTabDataOutput.h
Normal file → Executable file
@ -1,21 +1,11 @@
|
||||
/*
|
||||
* qTabDataOutput.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDATAOUTPUT_H_
|
||||
#define QTABDATAOUTPUT_H_
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_dataoutput.h"
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
@ -26,35 +16,132 @@ class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabDataOutput(QWidget *parent,multiSlsDetector*& detector);
|
||||
qTabDataOutput(QWidget *parent,multiSlsDetector* detector);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabDataOutput();
|
||||
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
/** verify output directories
|
||||
* /returns success or fail
|
||||
/**
|
||||
* Verify output directories
|
||||
* @returns success or fail
|
||||
*/
|
||||
int VerifyOutputDirectory();
|
||||
|
||||
private:
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
* Open dialog to choose the output directory
|
||||
*/
|
||||
void BrowseOutputDir();
|
||||
|
||||
/**
|
||||
* Set output directory
|
||||
*/
|
||||
void SetOutputDir();
|
||||
|
||||
/**
|
||||
* Get output directory
|
||||
*/
|
||||
void GetOutputDir();
|
||||
|
||||
/**
|
||||
* Set rate correction
|
||||
*/
|
||||
void SetRateCorrection(int deadtime=0);
|
||||
|
||||
/**
|
||||
* Set default rate correction
|
||||
*/
|
||||
void SetDefaultRateCorrection();
|
||||
|
||||
/**
|
||||
* Set update rate correction from server
|
||||
*/
|
||||
void UpdateRateCorrectionFromServer();
|
||||
|
||||
/**
|
||||
* Enable/Disable 10GbE
|
||||
*/
|
||||
void EnableTenGigabitEthernet(bool enable, int get=0);
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
*/
|
||||
void SetSpeed();
|
||||
|
||||
/**
|
||||
* Set flags
|
||||
*/
|
||||
void SetFlags();
|
||||
|
||||
/**
|
||||
* Set file format
|
||||
*/
|
||||
void SetFileFormat(int format);
|
||||
|
||||
/**
|
||||
* Set overwrite enable
|
||||
*/
|
||||
void SetOverwriteEnable(bool enable);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/**
|
||||
* Populate the readouts
|
||||
*/
|
||||
void PopulateDetectors();
|
||||
|
||||
/**
|
||||
* Update speed
|
||||
*/
|
||||
void UpdateSpeedFromServer();
|
||||
|
||||
/**
|
||||
* Update flags
|
||||
*/
|
||||
void UpdateFlagsFromServer();
|
||||
|
||||
/**
|
||||
* Update file format
|
||||
*/
|
||||
void UpdateFileFormatFromServer();
|
||||
|
||||
/**
|
||||
* Update overwrite enable
|
||||
*/
|
||||
void UpdateFileOverwriteFromServer();
|
||||
|
||||
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
|
||||
QString flatFieldTip;
|
||||
QString errFlatFieldTip;
|
||||
QString outDirTip;
|
||||
QPalette red;
|
||||
QPalette black;
|
||||
@ -62,95 +149,11 @@ private:
|
||||
QPalette *black1;
|
||||
|
||||
/** enum for the Eiger clock divider */
|
||||
enum {FullSpeed, HalfSpeed, QuarterSpeed, SuperSlowSpeed, NumberofSpeeds};
|
||||
enum {FULLSPEED, HALFSPEED, QUARTERSPEED, SUPERSLOWSPEED, NUMBEROFSPEEDS};
|
||||
/** enum for the Eiger readout flags1 */
|
||||
enum {Continous, Storeinram};
|
||||
enum {CONTINUOUS, STOREINRAM};
|
||||
/** enum for the Eiger readout flags2 */
|
||||
enum {Parallel, NonParallel, Safe};
|
||||
enum {PARALLEL, NONPARALLEL, SAFE};
|
||||
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
/** Populate the readouts
|
||||
*/
|
||||
void PopulateDetectors();
|
||||
|
||||
/** update speed */
|
||||
void UpdateSpeedFromServer();
|
||||
|
||||
/** update flags */
|
||||
void UpdateFlagsFromServer();
|
||||
|
||||
/** update flags */
|
||||
void SetupFileFormat();
|
||||
|
||||
/** update file format */
|
||||
void UpdateFileFormatFromServer();
|
||||
|
||||
/** update overwrite enable */
|
||||
void UpdateFileOverwriteFromServer();
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
/** Open dialog to choose the output directory */
|
||||
void BrowseOutputDir();
|
||||
|
||||
/**set flat field file*/
|
||||
void SetFlatField();
|
||||
|
||||
/** update flat field correction from server */
|
||||
void UpdateFlatFieldFromServer();
|
||||
|
||||
/**browse flat field*/
|
||||
void BrowseFlatFieldPath();
|
||||
|
||||
/**rate correction*/
|
||||
void SetRateCorrection(int deadtime=0);
|
||||
|
||||
/** default rate correction */
|
||||
void SetDefaultRateCorrection();
|
||||
|
||||
/** update rate correction from server */
|
||||
void UpdateRateCorrectionFromServer();
|
||||
|
||||
/**angular correction*/
|
||||
void SetAngularCorrection();
|
||||
|
||||
/**discard bad channels*/
|
||||
void DiscardBadChannels();
|
||||
|
||||
/** set output directory*/
|
||||
void SetOutputDir();
|
||||
|
||||
/** set output directory*/
|
||||
void GetOutputDir();
|
||||
|
||||
/** enable 10GbE */
|
||||
void EnableTenGigabitEthernet(bool enable, int get=0);
|
||||
|
||||
/** set speed */
|
||||
void SetSpeed();
|
||||
|
||||
/** set flags */
|
||||
void SetFlags();
|
||||
|
||||
/** set file format */
|
||||
void SetFileFormat(int format);
|
||||
|
||||
/** set overwrite enable */
|
||||
void SetOverwriteEnable(bool enable);
|
||||
|
||||
signals:
|
||||
/**signal to enable/disable positions in Actions*/
|
||||
void AngularConversionSignal(bool);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABDATAOUTPUT_H_ */
|
||||
|
96
slsDetectorGui/include/qTabDebugging.h
Normal file → Executable file
@ -1,24 +1,13 @@
|
||||
/*
|
||||
* qTabDebugging.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDEBUGGING_H_
|
||||
#define QTABDEBUGGING_H_
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_debugging.h"
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
class slsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
/**
|
||||
@ -28,76 +17,71 @@ class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabDebugging(QWidget *parent,multiSlsDetector*& detector);
|
||||
qTabDebugging(QWidget *parent, multiSlsDetector* detector);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabDebugging();
|
||||
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
* Updates the status depending on current detector
|
||||
*/
|
||||
void UpdateStatus();
|
||||
|
||||
/**
|
||||
* Gets id and versions etc
|
||||
*/
|
||||
void
|
||||
GetInfo();
|
||||
|
||||
/**
|
||||
* Sets id and versions on the display widget
|
||||
*/
|
||||
void SetParameters(QTreeWidgetItem *item);
|
||||
|
||||
/**
|
||||
* Test detector
|
||||
*/
|
||||
void TestDetector();
|
||||
|
||||
private:
|
||||
/** Sets up the widget
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** Updates the module list depending on current detector
|
||||
*/
|
||||
void UpdateModuleList();
|
||||
|
||||
/** Updates the status depending on current detector
|
||||
*/
|
||||
void UpdateStatus();
|
||||
|
||||
/** Gets id and versions etc
|
||||
*/
|
||||
void GetInfo();
|
||||
|
||||
/** Sets id and versions on the display widget
|
||||
*/
|
||||
void SetParameters(QTreeWidgetItem *item);
|
||||
|
||||
/** Test detector and module
|
||||
*/
|
||||
void TestDetector();
|
||||
|
||||
private:
|
||||
/** The multi sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
/**sls detecctor object */
|
||||
slsDetector *det;
|
||||
|
||||
/** Tree Widget displaying the detectors, modules */
|
||||
QTreeWidget *treeDet;
|
||||
/** Widget displaying the serial numbers, mac addresses etc */
|
||||
QFrame *dispFrame;
|
||||
QLabel *lblDetectorId;
|
||||
QLabel *lblDetectorSerial;
|
||||
QLabel *lblDetectorFirmware;
|
||||
QLabel *lblDetectorSoftware;
|
||||
QLabel *lblModuleId;
|
||||
QLabel *lblModuleFirmware;
|
||||
QLabel *lblModuleSerial;
|
||||
QPalette *blue;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABDEBUGGING_H_ */
|
||||
|
176
slsDetectorGui/include/qTabDeveloper.h
Normal file → Executable file
@ -1,18 +1,9 @@
|
||||
/*
|
||||
* qTabDeveloper.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABDEVELOPER_H_
|
||||
#define QTABDEVELOPER_H_
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
@ -26,10 +17,8 @@ class multiSlsDetector;
|
||||
#include <QPalette>
|
||||
class qDetectorMain;
|
||||
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**To override the spin box class to have an id and emit it*/
|
||||
@ -41,11 +30,8 @@ private:
|
||||
void valueChangedWithID() {emit editingFinished(myId);};
|
||||
public:
|
||||
/** Overridden constructor from QDoubleSpinBox */
|
||||
MyDoubleSpinBox(int id,QWidget* parent = 0)
|
||||
:QDoubleSpinBox(parent),myId(id){
|
||||
//setParent(parent);
|
||||
connect(this,SIGNAL(editingFinished()),
|
||||
this,SLOT(valueChangedWithID()));
|
||||
MyDoubleSpinBox(int id,QWidget* parent = 0) :QDoubleSpinBox(parent), myId(id){
|
||||
connect(this, SIGNAL(editingFinished()), this, SLOT(valueChangedWithID()));
|
||||
}
|
||||
signals:
|
||||
void editingFinished(int myId);
|
||||
@ -59,100 +45,104 @@ class qTabDeveloper:public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector);
|
||||
qTabDeveloper(QWidget *parent, multiSlsDetector* detector);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabDeveloper();
|
||||
|
||||
/** To stop ADC Timer when starting acquisition
|
||||
*/
|
||||
void StopADCTimer(){if(adcTimer) adcTimer->stop();};
|
||||
|
||||
private:
|
||||
/** parent widget */
|
||||
qDetectorMain *thisParent;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** The sls detector object */
|
||||
slsDetector *det;
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/**number of dac widgets*/
|
||||
static int NUM_DAC_WIDGETS;
|
||||
/**number of adc widgets*/
|
||||
static int NUM_ADC_WIDGETS;
|
||||
|
||||
static const int ADC_TIMEOUT = 5000;
|
||||
|
||||
vector<string>dacNames;
|
||||
vector<string>adcNames;
|
||||
|
||||
|
||||
/**widgets needed*/
|
||||
QGridLayout *layout;
|
||||
QScrollArea *scroll;
|
||||
QGroupBox *boxDacs;
|
||||
QGroupBox *boxAdcs;
|
||||
QLabel *lblDacs[20];
|
||||
QLabel *lblAdcs[20];
|
||||
MyDoubleSpinBox *spinDacs[20];
|
||||
QLabel *lblDacsmV[20];
|
||||
QLineEdit *spinAdcs[20];
|
||||
QLabel *lblHV;
|
||||
QComboBox *comboHV;
|
||||
QTimer *adcTimer;
|
||||
QGridLayout *dacLayout;
|
||||
QString tipHV;
|
||||
QPalette red;
|
||||
QComboBox *comboDetector;
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Sets up the DAC Widgets
|
||||
*/
|
||||
void CreateDACWidgets();
|
||||
|
||||
/** Sets up the ADC Widgets
|
||||
*/
|
||||
void CreateADCWidgets();
|
||||
|
||||
/** Gets the sls index to set/get dac/adc
|
||||
* @param index is the gui dac/adc index
|
||||
* returns the sls index
|
||||
*/
|
||||
slsDetectorDefs::dacIndex getSLSIndex(int index);
|
||||
|
||||
public slots:
|
||||
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* Refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
/** Refreshes the adcs
|
||||
/**
|
||||
* Refreshes the adcs
|
||||
*/
|
||||
void RefreshAdcs();
|
||||
|
||||
/** Set Dac values
|
||||
/**
|
||||
* Set Dac values
|
||||
* @param id id of dac
|
||||
*/
|
||||
void SetDacValues(int id);
|
||||
|
||||
/** Set High Voltage
|
||||
/**
|
||||
* Set High Voltage
|
||||
*/
|
||||
void SetHighVoltage();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/**
|
||||
* Sets up the DAC Widgets
|
||||
*/
|
||||
void CreateDACWidgets();
|
||||
|
||||
/**
|
||||
* Sets up the ADC Widgets
|
||||
*/
|
||||
void CreateADCWidgets();
|
||||
|
||||
/**
|
||||
* Sets up HV widget
|
||||
*/
|
||||
void CreateHVWidget();
|
||||
|
||||
/**
|
||||
* Gets the sls index to set/get dac/adc
|
||||
* @param index is the gui dac/adc index
|
||||
* @returns the sls index
|
||||
*/
|
||||
slsDetectorDefs::dacIndex getSLSIndex(int index);
|
||||
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/**number of dac widgets*/
|
||||
int numDACWidgets;
|
||||
/**number of adc widgets*/
|
||||
int numADCWidgets;
|
||||
|
||||
/** list of dac and adc names */
|
||||
std::vector<std::string>dacNames;
|
||||
std::vector<std::string>adcNames;
|
||||
|
||||
|
||||
/**widgets needed*/
|
||||
QGroupBox *boxDacs;
|
||||
QGroupBox *boxAdcs;
|
||||
std::vector<QLabel*>lblDacs;
|
||||
std::vector<QLabel*>lblAdcs;
|
||||
std::vector<MyDoubleSpinBox*>spinDacs;
|
||||
std::vector<QLabel*>lblDacsmV;
|
||||
std::vector<QLineEdit*>spinAdcs;
|
||||
QLabel *lblHV;
|
||||
QComboBox *comboHV;
|
||||
QSpinBox *spinHV;
|
||||
QGridLayout *dacLayout;
|
||||
QString tipHV;
|
||||
QPalette red;
|
||||
QComboBox *comboDetector;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABDEVELOPER_H_ */
|
||||
|
238
slsDetectorGui/include/qTabMeasurement.h
Normal file → Executable file
@ -1,20 +1,11 @@
|
||||
/*
|
||||
* qTabMeasurement.h
|
||||
*
|
||||
* Created on: May 2, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#ifndef QTABMEASUREMENT
|
||||
#define QTABMEASUREMENT
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_measurement.h"
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
/** Qt Project Class Headers */
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include "qDrawPlot.h"
|
||||
class qDetectorMain;
|
||||
@ -26,157 +17,172 @@ class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* This tab allows to change the detector settings, the threshold, the number of (non real time) measurements,
|
||||
* the acquisition time, the file name, the start run index and shows the current progress of the measurement
|
||||
* via a progress bar and labels inidicating the current position, scan variable, frame number etc.
|
||||
* Contains the start and stop acquisition button
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
* @param plot plot object reference
|
||||
/**
|
||||
* The constructor
|
||||
* This tab allows to change measurement parameters and to start/stop an acquisition
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
* @param plot plot object reference
|
||||
*/
|
||||
qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
qTabMeasurement(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabMeasurement();
|
||||
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* Returns the status of the acquisition in gui
|
||||
*/
|
||||
void Refresh();
|
||||
bool GetStartStatus();
|
||||
|
||||
/** To enable expert mode
|
||||
* @param enable to enable if true
|
||||
*/
|
||||
void SetExpertMode(bool enable);
|
||||
|
||||
/** Returns the status of the acquisition in gui
|
||||
*/
|
||||
bool GetStartStatus(){return (!btnStart->isEnabled());};
|
||||
|
||||
/** Click the Start/Stop Acquisition button
|
||||
/**
|
||||
* Click the Start/Stop Acquisition button
|
||||
* This is used if this command came from gui client
|
||||
*/
|
||||
void ClickStartStop(){startAcquisition();myPlot->SetClientInitiated();};
|
||||
void ClickStartStop();
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return progressBar->value();};
|
||||
/**
|
||||
* Returns progress bar value
|
||||
*/
|
||||
int GetProgress();
|
||||
|
||||
/**
|
||||
* Refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
/** update plot is finished,
|
||||
/**
|
||||
* Update plot is finished,
|
||||
* changes start/stop text and enables/disables all widgets
|
||||
*/
|
||||
void UpdateFinished();
|
||||
|
||||
/** updates the current measurement
|
||||
/**
|
||||
* Updates the current measurement
|
||||
* @param val the value to be updated
|
||||
*/
|
||||
void SetCurrentMeasurement(int val);
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up the timing mode
|
||||
*/
|
||||
void SetupTimingMode();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Enables/Disables all the widgets
|
||||
*/
|
||||
void Enable(bool enable);
|
||||
|
||||
/** Validates before enabling or disabling probes */
|
||||
void EnableProbes();
|
||||
|
||||
/** Get timing mode from detector
|
||||
* @param startup is true when gui has just started up*/
|
||||
void GetModeFromDetector(bool startup = false);
|
||||
|
||||
/** Checks if acquisition period is greater than exposure time
|
||||
* and dsplays in red as a warning */
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
|
||||
|
||||
private slots:
|
||||
/** Sets the timing mode
|
||||
* @ param mode cane be None, Auto, Gated, Trigger Exposure Series,
|
||||
* Trigger Frame, Trigger Readout, External Trigger Window
|
||||
*/
|
||||
void SetTimingMode(int mode);
|
||||
|
||||
/** Set number of measurements
|
||||
* @param num number of measurements to be set */
|
||||
/**
|
||||
* Set number of measurements
|
||||
* @param num number of measurements to be set
|
||||
*/
|
||||
void setNumMeasurements(int num);
|
||||
|
||||
/** Set file name
|
||||
*/
|
||||
void setFileName();
|
||||
|
||||
/** Set index of file name
|
||||
* @param index index of selection
|
||||
*/
|
||||
void setRunIndex(int index);
|
||||
|
||||
/** starts Acquisition
|
||||
*/
|
||||
void startAcquisition();
|
||||
|
||||
/** stops Acquisition
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/** Set number of frames
|
||||
/**
|
||||
* Set number of frames
|
||||
* @param val number of frames to be set
|
||||
*/
|
||||
void setNumFrames(int val);
|
||||
|
||||
/** Set acquisition time
|
||||
/**
|
||||
* Set acquisition time
|
||||
*/
|
||||
void setExposureTime();
|
||||
|
||||
/** Set frame period between exposures
|
||||
/**
|
||||
* Set frame period between exposures
|
||||
*/
|
||||
void setAcquisitionPeriod();
|
||||
|
||||
/** Set number of triggers
|
||||
/**
|
||||
* Set number of triggers
|
||||
* @param val number of triggers to be set
|
||||
*/
|
||||
void setNumTriggers(int val);
|
||||
|
||||
/** Set delay
|
||||
/**
|
||||
* Set delay
|
||||
*/
|
||||
void setDelay();
|
||||
|
||||
/** Set number of gates
|
||||
* @param val number of gates to be set
|
||||
/**
|
||||
* Set number of samples
|
||||
* @param val number of samples to be set
|
||||
*/
|
||||
void setNumGates(int val);
|
||||
void setNumSamples(int val);
|
||||
|
||||
/** Set number of probes
|
||||
* @param val number of probes to be set
|
||||
/**
|
||||
* Set file name
|
||||
*/
|
||||
void setNumProbes(int val);
|
||||
void setFileName();
|
||||
|
||||
/** Update progress*/
|
||||
void UpdateProgress();
|
||||
|
||||
/** Enable write to file */
|
||||
/**
|
||||
* Enable write to file
|
||||
*/
|
||||
void EnableFileWrite(bool enable);
|
||||
|
||||
/**
|
||||
* Set index of file name
|
||||
* @param index index of selection
|
||||
*/
|
||||
void setRunIndex(int index);
|
||||
|
||||
/**
|
||||
* Update progress
|
||||
*/
|
||||
void UpdateProgress();
|
||||
|
||||
/**
|
||||
* starts Acquisition
|
||||
*/
|
||||
void startAcquisition();
|
||||
|
||||
/**
|
||||
* stops Acquisition
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/**
|
||||
* Sets the timing mode
|
||||
* @param mode timing mode
|
||||
*/
|
||||
void SetTimingMode(int mode);
|
||||
|
||||
private:
|
||||
/** parent widget */
|
||||
qDetectorMain *thisParent;
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/**
|
||||
* Sets up the timing mode
|
||||
*/
|
||||
void SetupTimingMode();
|
||||
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/**
|
||||
* Get timing mode from detector
|
||||
* @param startup is true when gui has just started up
|
||||
*/
|
||||
void GetTimingModeFromDetector(bool startup = false);
|
||||
|
||||
/**
|
||||
* Enables/Disables widgetframes to avoid setting measurement during an acquisition
|
||||
*/
|
||||
void Enable(bool enable);
|
||||
|
||||
/**
|
||||
* Checks if acquisition period is greater than exposure time
|
||||
*/
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
|
||||
/**
|
||||
* Verify if output directory existing error is set
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int VerifyOutputDirectoryError();
|
||||
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** The Plot widget */
|
||||
@ -184,15 +190,13 @@ private:
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/** enum for the timing mode */
|
||||
enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, Burst_Trigger, NumTimingModes};
|
||||
enum{AUTO, TRIGGER, GATED, BURST_TRIGGER, NUM_TIMING_MODES};
|
||||
/** timer to update the progress*/
|
||||
QTimer *progressTimer;
|
||||
/** tool tip variables*/
|
||||
QString acqPeriodTip;
|
||||
QString errPeriodTip;
|
||||
QPalette red;
|
||||
/** expert mode */
|
||||
bool expertMode;
|
||||
/** to access items in settings combobox */
|
||||
QStandardItemModel* model;
|
||||
|
||||
@ -201,7 +205,3 @@ signals:
|
||||
void StopSignal();
|
||||
void CheckPlotIntervalSignal();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABMEASUREMENT */
|
||||
|
88
slsDetectorGui/include/qTabMessages.h
Normal file → Executable file
@ -1,26 +1,14 @@
|
||||
/*
|
||||
* qTabMessages.h
|
||||
*
|
||||
* Created on: Jun 26, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABMESSAGES_H_
|
||||
#define QTABMESSAGES_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
|
||||
/** Project Class Headers */
|
||||
#include "qDebugStream.h"
|
||||
class qDetectorMain;
|
||||
/** Qt Include Headers */
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QEvent>
|
||||
#include <QPushButton>
|
||||
#include "qDebugStream.h"
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the Messages parameters
|
||||
@ -29,17 +17,46 @@ class qTabMessages:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param det the qDetectorMain class reference
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent parent widget
|
||||
*/
|
||||
qTabMessages(qDetectorMain* m);
|
||||
qTabMessages(QWidget* parent);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabMessages();
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* Stream log to textedit in GUI
|
||||
*/
|
||||
void customEvent(QEvent *e);
|
||||
|
||||
/**
|
||||
* Save Log to File
|
||||
*/
|
||||
void SaveLog();
|
||||
|
||||
/**
|
||||
* Clear Log to File
|
||||
*/
|
||||
void ClearLog();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
|
||||
/** The qDetectorMain object */
|
||||
qDetectorMain *myMainTab;
|
||||
|
||||
@ -51,36 +68,5 @@ private:
|
||||
|
||||
/** To clear the log to file */
|
||||
QPushButton *btnClear;
|
||||
|
||||
/** This class creates the log */
|
||||
qDebugStream *qout;
|
||||
qDebugStream *qerr;
|
||||
|
||||
string errMsg;
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
private slots:
|
||||
/** Stream log to textedit in GUI */
|
||||
void customEvent(QEvent *e);
|
||||
|
||||
/** Save Log to File*/
|
||||
void SaveLog();
|
||||
|
||||
/** Clear Log to File*/
|
||||
void ClearLog();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* QTABMESSAGES_H_ */
|
||||
|
4
slsDetectorGui/include/qTabPlot.h
Normal file → Executable file
@ -35,7 +35,7 @@ public:
|
||||
* @param detector is the detector returned from the detector tab
|
||||
* @param plot plot object reference
|
||||
*/
|
||||
qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||
qTabPlot(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
@ -106,7 +106,7 @@ public slots:
|
||||
|
||||
/** Enable Scan box
|
||||
*/
|
||||
void EnableScanBox();
|
||||
void EnableScanBox();
|
||||
|
||||
|
||||
private slots:
|
||||
|
137
slsDetectorGui/include/qTabSettings.h
Normal file → Executable file
@ -1,22 +1,10 @@
|
||||
/*
|
||||
* qTabSettings.h
|
||||
*
|
||||
* Created on: May 10, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef QTABSETTINGS_H_
|
||||
#define QTABSETTINGS_H_
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_settings.h"
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QStandardItemModel>
|
||||
|
||||
/**
|
||||
*@short sets up the Settings parameters
|
||||
@ -25,92 +13,77 @@ class qTabSettings:public QWidget, private Ui::TabSettingsObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
/**
|
||||
* The constructor
|
||||
* @param parent is the parent tab widget
|
||||
* @param detector is the detector returned from the detector tab
|
||||
*/
|
||||
qTabSettings(QWidget *parent,multiSlsDetector*& detector);
|
||||
qTabSettings(QWidget *parent, multiSlsDetector* detector);
|
||||
|
||||
/** Destructor
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qTabSettings();
|
||||
|
||||
/** To refresh and update widgets
|
||||
/**
|
||||
* Refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
/** To enable expert mode
|
||||
* @param enable to enable if true
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* Set settings according to selection
|
||||
* @param index index of selection
|
||||
*/
|
||||
void SetExpertMode(bool enable){expertMode = enable;};
|
||||
void SetSettings(int index);
|
||||
|
||||
/**
|
||||
* Set dynamic range if possible
|
||||
* @param index selection
|
||||
*/
|
||||
void SetDynamicRange(int index);
|
||||
|
||||
/**
|
||||
* Set threshold energy
|
||||
*/
|
||||
void SetEnergy();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/**
|
||||
* Sets up the detector settings
|
||||
*/
|
||||
void SetupDetectorSettings();
|
||||
|
||||
/**
|
||||
* Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/**
|
||||
* Get Settings
|
||||
*/
|
||||
void GetSettings();
|
||||
|
||||
/**
|
||||
* Gets the dynamic range and sets it on the gui
|
||||
*/
|
||||
void GetDynamicRange();
|
||||
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
/** expert mode */
|
||||
bool expertMode;
|
||||
|
||||
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise,
|
||||
DynamicHG0,FixGain1,FixGain2,ForceSwitchG1,ForceSwitchG2, VeryLowGain,
|
||||
Undefined,Uninitialized,NumSettings};
|
||||
|
||||
/** To be able to index items on a combo box */
|
||||
QStandardItemModel* model;
|
||||
QModelIndex index[NumSettings];
|
||||
QStandardItem* item[NumSettings];
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up the detector settings
|
||||
*/
|
||||
void SetupDetectorSettings();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Gets the dynamic range and sets it on the gui
|
||||
* @param setvalue the value set by the gui when used as a check
|
||||
*/
|
||||
void GetDynamicRange(int setvalue = -1);
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** Set settings according to selection
|
||||
* @param index index of selection
|
||||
*/
|
||||
void setSettings(int index);
|
||||
|
||||
/** Set number of modules if possible
|
||||
* @param index number of modules
|
||||
*/
|
||||
void SetNumberOfModules(int index);
|
||||
|
||||
/** Set dynamic range if possible
|
||||
* @param index selection
|
||||
*/
|
||||
void SetDynamicRange(int index);
|
||||
|
||||
/** Set threshold energy
|
||||
*/
|
||||
void SetEnergy();
|
||||
|
||||
|
||||
signals:
|
||||
/**Update Trimbits after Set Settings */
|
||||
void UpdateTrimbitSignal(int);
|
||||
enum{STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
|
||||
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERLOWGAIN,
|
||||
UNDEFINED, UNINITIALIZED, NUMSETTINGS};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* QTABSETTINGS_H_ */
|
||||
|
@ -1,162 +0,0 @@
|
||||
#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 $(LDFLAGDET)
|
||||
|
||||
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/*/*
|
||||
|
||||
|
||||
|
||||
extralib.target = extra
|
||||
extralib.commands = echo `tput setaf 6`; \
|
||||
echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; \
|
||||
echo 'x Compiling slsDetectorGui x'; \
|
||||
echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; \
|
||||
echo `./updateGitVersion.sh; tput sgr0`
|
||||
extralib.depends = $(target)
|
||||
|
||||
QMAKE_EXTRA_TARGETS += extralib
|
||||
PRE_TARGETDEPS = extra
|
||||
|
||||
|
||||
|
||||
|
||||
DEPENDPATH += \
|
||||
slsDetectorPlotting/include\
|
||||
include\
|
||||
forms/include
|
||||
|
||||
|
||||
INCLUDEPATH += \
|
||||
$(QWTDIR)/include\
|
||||
$(QWTDIR) \
|
||||
$(QWTDIR)/src\
|
||||
$(QWT3D)/include\
|
||||
slsDetectorPlotting/include\
|
||||
../slsReceiverSoftware/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\
|
||||
../slsReceiverSoftware/include/sls_receiver_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_advanced.ui\
|
||||
forms/form_tab_settings.ui\
|
||||
forms/form_tab_debugging.ui\
|
||||
forms/form_action.ui\
|
||||
forms/form_scan.ui
|
5
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Normal file → Executable file
@ -13,9 +13,6 @@
|
||||
#ifndef SLSQT1DPLOT_H
|
||||
#define SLSQT1DPLOT_H
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#include "ansi.h"
|
||||
|
||||
|
||||
@ -25,7 +22,7 @@ typedef int int32_t;
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
class QPen;
|
||||
class SlsQt1DPlot;
|
||||
|
7
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Normal file → Executable file
@ -7,13 +7,6 @@
|
||||
#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>
|
||||
|
8
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Normal file → Executable file
@ -9,14 +9,6 @@
|
||||
#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
|
||||
|
5
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Normal file → Executable file
@ -14,11 +14,6 @@
|
||||
#ifndef SLSQT2DPLOT_H
|
||||
#define SLSQT2DPLOT_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
5
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h
Normal file → Executable file
@ -12,11 +12,6 @@
|
||||
#ifndef SLSQT2DPLOTLAYOUT_H
|
||||
#define SLSQT2DPLOTLAYOUT_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwidget.h>
|
||||
|
5
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Normal file → Executable file
@ -9,11 +9,6 @@
|
||||
#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*/
|
||||
|
5
slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h
Normal file → Executable file
@ -7,11 +7,6 @@
|
||||
#ifndef SLSQTNUMBERENTRY_H
|
||||
#define SLSQTNUMBERENTRY_H
|
||||
|
||||
#ifndef IAN
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
#endif
|
||||
|
||||
|
||||
#include <qwidget.h>
|
||||
|
6
slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h
Normal file → Executable file
@ -7,12 +7,6 @@
|
||||
#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>
|
||||
|
||||
|
751
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Normal file → Executable file
@ -4,514 +4,567 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <qwt_legend.h>
|
||||
#include <qwt_math.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"
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
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 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);
|
||||
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();
|
||||
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);
|
||||
SlsQtH1D::~SlsQtH1D() {
|
||||
delete x;
|
||||
delete y;
|
||||
delete pen_ptr;
|
||||
}
|
||||
|
||||
void SlsQtH1D::Detach(SlsQt1DPlot* p){
|
||||
detach();
|
||||
p->HistogramDetached(this);
|
||||
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);
|
||||
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);
|
||||
setPen(*pen_ptr);
|
||||
|
||||
return last_color=c;
|
||||
return last_color = c;
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetLineWidth(int w){
|
||||
pen_ptr->setWidth(w);
|
||||
setPen(*pen_ptr);
|
||||
return w;
|
||||
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::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);
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
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];
|
||||
}
|
||||
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);
|
||||
#if QWT_VERSION < 0x060000
|
||||
setRawData(x, y, ndata);
|
||||
#else
|
||||
setRawSamples(x,y,ndata);
|
||||
setRawSamples(x, y, ndata);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double* data_x, double *data_y){
|
||||
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);
|
||||
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
|
||||
ndata = n;
|
||||
dx = -1; //signifies not regular intervals
|
||||
|
||||
ymin=ymax= data_y ? data_y[0]:0;
|
||||
ymin = ymax = data_y ? data_y[0] : 0;
|
||||
|
||||
firstXgt0=-1;
|
||||
firstYgt0=-1;
|
||||
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];
|
||||
}
|
||||
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
|
||||
// #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];
|
||||
}
|
||||
int SlsQtH1D::SetUpArrays(int n) {
|
||||
n = n < 1 ? 1 : n; //overflow bin
|
||||
|
||||
return n;
|
||||
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::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::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::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); }
|
||||
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;
|
||||
int SlsQtH1D::FindBinIndex(double px) {
|
||||
if (dx > 0)
|
||||
CheckIndex(int((px - x[0]) / dx));
|
||||
|
||||
if(b==0) return 0;
|
||||
else if(fabs(px-x[b-1])<fabs(px-x[b])) return b-1;
|
||||
//find closest bin
|
||||
int b = 0;
|
||||
for (; b < ndata; b++)
|
||||
if (x[b] > px)
|
||||
break;
|
||||
|
||||
return b;
|
||||
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;}
|
||||
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(SlsQtH1D *hist) {
|
||||
the_hist = hist;
|
||||
the_next = 0;
|
||||
}
|
||||
|
||||
SlsQtH1DList::~SlsQtH1DList(){
|
||||
if(the_next) delete the_next;
|
||||
SlsQtH1DList::~SlsQtH1DList() {
|
||||
if (the_next)
|
||||
delete the_next;
|
||||
}
|
||||
|
||||
SlsQtH1D* SlsQtH1DList::Add(SlsQtH1D* hist){
|
||||
// cout<<"Adding: "<<hist<<endl;
|
||||
SlsQtH1DList* hl=this;
|
||||
SlsQtH1D *SlsQtH1DList::Add(SlsQtH1D *hist) {
|
||||
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;
|
||||
}
|
||||
while (hl) {
|
||||
if (hist == hl->the_hist)
|
||||
return hist; //already added
|
||||
if (!hl->the_next)
|
||||
break;
|
||||
hl = hl->the_next;
|
||||
}
|
||||
}
|
||||
// Print();
|
||||
if (hl->the_hist)
|
||||
hl->the_next = new SlsQtH1DList(hist);
|
||||
else
|
||||
hl->the_hist = hist;
|
||||
|
||||
// Print();
|
||||
|
||||
return hist;
|
||||
}
|
||||
|
||||
void SlsQtH1DList::Print() {
|
||||
SlsQtH1DList *hl = this;
|
||||
int i = 0;
|
||||
while (hl) {
|
||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " " << hl->the_next << '\n';
|
||||
hl = hl->the_next;
|
||||
if (i > 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQtH1DList::Remove(SlsQtH1D *hist) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//1d plot stuff
|
||||
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){
|
||||
// n_histograms_attached=0;
|
||||
hline=vline=0;
|
||||
hist_list = new SlsQtH1DList();
|
||||
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
// n_histograms_attached=0;
|
||||
hline = vline = 0;
|
||||
hist_list = new SlsQtH1DList();
|
||||
|
||||
UnknownStuff();
|
||||
alignScales();
|
||||
SetupZoom();
|
||||
UnknownStuff();
|
||||
alignScales();
|
||||
SetupZoom();
|
||||
|
||||
// Assign a title
|
||||
// Assign a title
|
||||
#ifndef IAN
|
||||
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
||||
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
||||
#else
|
||||
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
|
||||
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
|
||||
#endif
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
}
|
||||
|
||||
SlsQt1DPlot::~SlsQt1DPlot(){
|
||||
delete hist_list;
|
||||
SlsQt1DPlot::~SlsQt1DPlot() {
|
||||
delete hist_list;
|
||||
|
||||
if(hline) delete hline;
|
||||
if(vline) delete vline;
|
||||
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::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::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::HistogramDetached(SlsQtH1D *h) {
|
||||
hist_list->Remove(h);
|
||||
CalculateNResetZoomBase();
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::Update(){
|
||||
void SlsQt1DPlot::Update() {
|
||||
replot();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetTitle(const char* title){
|
||||
setTitle(title);
|
||||
|
||||
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::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::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);
|
||||
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
|
||||
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());
|
||||
//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);
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
Update();
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::UnZoom(){
|
||||
setAxisScale(QwtPlot::xBottom,zoomer->x(),zoomer->x()+zoomer->w());
|
||||
setAxisScale(QwtPlot::yLeft,zoomer->y(),zoomer->y()+zoomer->h());
|
||||
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();
|
||||
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::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::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::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::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::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());
|
||||
|
||||
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);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
|
||||
panner = new QwtPlotPanner((QwtPlotCanvas*)canvas());
|
||||
panner = new QwtPlotPanner((QwtPlotCanvas *)canvas());
|
||||
panner->setAxisEnabled(QwtPlot::yRight, false);
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
|
||||
// Avoid jumping when labels with more/less digits
|
||||
// appear/disappear when scrolling vertically
|
||||
// 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 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(){
|
||||
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.
|
||||
|
||||
((QwtPlotCanvas*)canvas())->setFrameStyle(QFrame::Box | QFrame::Plain );
|
||||
((QwtPlotCanvas*)canvas())->setLineWidth(1);
|
||||
((QwtPlotCanvas *)canvas())->setFrameStyle(QFrame::Box | QFrame::Plain);
|
||||
((QwtPlotCanvas *)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);
|
||||
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);
|
||||
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
|
||||
((QwtPlotCanvas*)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
// We don't need the cache here
|
||||
((QwtPlotCanvas *)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);
|
||||
// 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){
|
||||
void SlsQt1DPlot::DisableZoom(bool disableZoom) {
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
else cout<<"Enabling zoom"<<endl;
|
||||
if (disableZoom)
|
||||
std::cout << "Disabling zoom\n";
|
||||
else
|
||||
std::cout << "Enabling zoom\n";
|
||||
#endif
|
||||
if(disableZoom){
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
|
||||
if (disableZoom) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
|
||||
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);
|
||||
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);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Normal file → Executable file
@ -13,7 +13,6 @@
|
||||
#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
|
||||
@ -100,8 +99,6 @@ void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){
|
||||
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();
|
||||
}
|
||||
|
||||
|
0
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Normal file → Executable file
450
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Normal file → Executable file
@ -4,153 +4,148 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <qlist.h>
|
||||
#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_plot_panner.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
|
||||
#include "SlsQt2DPlot.h"
|
||||
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
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);
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
isLog = 0;
|
||||
|
||||
d_spectrogram->attach(this);
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
d_spectrogram = new QwtPlotSpectrogram();
|
||||
|
||||
FillTestPlot();
|
||||
Update();
|
||||
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() {
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap(){
|
||||
|
||||
|
||||
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale );
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLinearScale );
|
||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
||||
#endif
|
||||
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION<0x060000
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION < 0x060000
|
||||
contourLevelsLinear = new QwtValueList();
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level;
|
||||
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);
|
||||
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
#if QWT_VERSION<0x060000
|
||||
//
|
||||
#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;
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
// A color bar on the right axis
|
||||
rightAxis = axisWidget(QwtPlot::yRight);
|
||||
|
||||
rightAxis->setTitle("Intensity");
|
||||
|
||||
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];
|
||||
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));
|
||||
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);
|
||||
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);
|
||||
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
|
||||
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 = 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());
|
||||
#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
|
||||
// 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 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);
|
||||
@ -164,211 +159,200 @@ void SlsQt2DPlot::SetupZoom(){
|
||||
//replot();
|
||||
}*/
|
||||
|
||||
void SlsQt2DPlot::UnZoom(bool replot){
|
||||
#if QWT_VERSION<0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||
#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(replot);//Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
// zoomer->zoom(0);
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
#endif
|
||||
zoomer->setZoomBase(replot); //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){
|
||||
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));
|
||||
#if QWT_VERSION < 0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(xmin, ymin, x_width, y_width));
|
||||
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
||||
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){
|
||||
hist->SetMinMax(zmin,zmax);
|
||||
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
|
||||
hist->SetMinMax(zmin, zmax);
|
||||
}
|
||||
|
||||
QwtLinearColorMap *SlsQt2DPlot::myColourMap(QVector<double> colourStops) {
|
||||
|
||||
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 };
|
||||
int ns = 5;
|
||||
|
||||
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);
|
||||
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};
|
||||
|
||||
for (int is=0; is<ns-1; is++) {
|
||||
c.setRgbF(r[is],g[is],b[is]);
|
||||
copyMap->addColorStop(colourStops.value(is),c );
|
||||
}
|
||||
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);
|
||||
|
||||
return copyMap;
|
||||
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);
|
||||
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());
|
||||
void SlsQt2DPlot::Update() {
|
||||
#if QWT_VERSION < 0x060000
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(), d_spectrogram->colorMap());
|
||||
#else
|
||||
if (isLog)
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
if (isLog)
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
||||
|
||||
rightAxis->setColorMap(zInterval,myColourMap(isLog));
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis);
|
||||
|
||||
rightAxis->setColorMap(zInterval, myColourMap(isLog));
|
||||
|
||||
#endif
|
||||
|
||||
if(!zoomer->zoomRectIndex()) UnZoom();
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
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, d_spectrogram->data().range().minValue(),
|
||||
d_spectrogram->data().range().maxValue());
|
||||
#else
|
||||
|
||||
|
||||
setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue());
|
||||
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue());
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "axis scale set" << endl;
|
||||
std::cout << "axis scale set\n";
|
||||
#endif
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "layout" << endl;
|
||||
std::cout << "layout\n";
|
||||
#endif
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "going to replot" << endl;
|
||||
std::cout << "going to replot\n";
|
||||
#endif
|
||||
replot();
|
||||
replot();
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "done" << endl;
|
||||
std::cout << "done\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SlsQt2DPlot::showContour(bool on){
|
||||
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode,on);
|
||||
Update();
|
||||
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::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::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);
|
||||
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));
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLog);
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLog);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
#endif
|
||||
}else{
|
||||
isLog=0;
|
||||
} else {
|
||||
isLog = 0;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
}
|
||||
Update();
|
||||
|
||||
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){
|
||||
void SlsQt2DPlot::DisableZoom(bool disableZoom) {
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
else cout<<"Enabling zoom"<<endl;
|
||||
if (disableZoom)
|
||||
std::cout << "Disabling zoom\n";
|
||||
else
|
||||
std::cout << "Enabling zoom\n";
|
||||
#endif
|
||||
if(disableZoom){
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
|
||||
if (disableZoom) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
|
||||
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);
|
||||
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);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void SlsQt2DPlot::printPlot(){
|
||||
QPrinter printer;
|
||||
|
2
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
Normal file → Executable file
@ -14,7 +14,7 @@
|
||||
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
the_layout=0;
|
||||
|
1
slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx
Normal file → Executable file
@ -27,7 +27,6 @@
|
||||
|
||||
#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);
|
||||
|
@ -1,219 +0,0 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
622
slsDetectorGui/src/qCloneWidget.cpp
Normal file → Executable file
@ -1,359 +1,341 @@
|
||||
/*
|
||||
* qCloneWidget.cpp
|
||||
*
|
||||
* Created on: May 18, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
#include "qCloneWidget.h"
|
||||
/** Qt Include Headers */
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "qwt_symbol.h"
|
||||
#include <QFileDialog>
|
||||
#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, std::string FilePath, bool displayStats, QString min, QString max, QString sum) : QMainWindow(parent), id(id), filePath(FilePath), cloneplot1D(0), cloneplot2D(0) {
|
||||
// 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);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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),filePath(FilePath),cloneplot1D(0),cloneplot2D(0)
|
||||
{
|
||||
// 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);
|
||||
// Set up widget
|
||||
SetupWidgetWindow(title, xTitle, yTitle, zTitle, numDim);
|
||||
DisplayStats(displayStats, min, max, sum);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qCloneWidget::~qCloneWidget(){
|
||||
delete cloneplot1D;
|
||||
delete cloneplot2D;
|
||||
delete cloneBox;
|
||||
qCloneWidget::~qCloneWidget() {
|
||||
delete cloneplot1D;
|
||||
delete cloneplot2D;
|
||||
delete cloneBox;
|
||||
cloneplot1D_hists.clear();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
SlsQt1DPlot* qCloneWidget::Get1dPlot() {
|
||||
return 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[hist_num]));
|
||||
k->SetLineColor(0);
|
||||
}else{
|
||||
k=cloneplot1D_hists.at(hist_num);
|
||||
k->SetData(histNBins,histXAxis,histYAxis[hist_num]);
|
||||
}
|
||||
void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim) {
|
||||
|
||||
QMenuBar* menubar = new QMenuBar(this);
|
||||
QAction* 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);
|
||||
QGridLayout* 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);
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
void qCloneWidget::SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis[], std::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);
|
||||
if (markers)
|
||||
k->setSymbol(marker);
|
||||
else
|
||||
k->setSymbol(nomarker);
|
||||
#endif
|
||||
|
||||
//set title and attach plot
|
||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||
//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");
|
||||
k->Attach(cloneplot1D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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::SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis, std::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::closeEvent(QCloseEvent* event){
|
||||
emit CloneClosedSignal(id);
|
||||
event->accept();
|
||||
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];
|
||||
|
||||
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();
|
||||
if (!IsXYRange[qDefs::XMAXIMUM]) {
|
||||
if (cloneplot1D)
|
||||
XYCloneRangeValues[qDefs::XMAXIMUM] = cloneplot1D->GetXMaximum();
|
||||
else
|
||||
XYCloneRangeValues[qDefs::XMAXIMUM] = cloneplot2D->GetPlot()->GetXMaximum();
|
||||
} else
|
||||
XYCloneRangeValues[qDefs::XMAXIMUM] = XYRangeValues[qDefs::XMAXIMUM];
|
||||
|
||||
}
|
||||
if (!IsXYRange[qDefs::YMINIMUM]) {
|
||||
if (cloneplot1D)
|
||||
XYCloneRangeValues[qDefs::YMINIMUM] = cloneplot1D->GetYMinimum();
|
||||
else
|
||||
XYCloneRangeValues[qDefs::YMINIMUM] = cloneplot2D->GetPlot()->GetYMinimum();
|
||||
} else
|
||||
XYCloneRangeValues[qDefs::YMINIMUM] = XYRangeValues[qDefs::YMINIMUM];
|
||||
|
||||
if (!IsXYRange[qDefs::YMAXIMUM]) {
|
||||
if (cloneplot1D)
|
||||
XYCloneRangeValues[qDefs::YMAXIMUM] = cloneplot1D->GetYMaximum();
|
||||
else
|
||||
XYCloneRangeValues[qDefs::YMAXIMUM] = 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
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");
|
||||
FILE_LOG(logINFO) << "The SnapShot has been successfully saved";
|
||||
} else {
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save snapshot failed.\n"
|
||||
"Formats: .png, .jpg, .xpm.",
|
||||
"qCloneWidget::SavePlot");
|
||||
FILE_LOG(logWARNING) << "Attempt to save snapshot failed";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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"));
|
||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||
//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();
|
||||
}
|
||||
|
||||
|
||||
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::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();
|
||||
}
|
||||
}
|
||||
|
||||
|
1456
slsDetectorGui/src/qDetectorMain.cpp
Normal file → Executable file
3446
slsDetectorGui/src/qDrawPlot.cpp
Normal file → Executable file
530
slsDetectorGui/src/qServer.cpp
Normal file → Executable file
@ -1,431 +1,171 @@
|
||||
/*
|
||||
* 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 "ServerSocket.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "MySocketTCP.h"
|
||||
// C++ Include Headers
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qServer::gui_server_thread_running(0);
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qServer::qServer(qDetectorMain *t):
|
||||
myMainTab(t), mySocket(0),myStopSocket(0),port_no(DEFAULT_GUI_PORTNO),lockStatus(0),checkStarted(0),checkStopStarted(0){
|
||||
strcpy(mess,"");
|
||||
FunctionTable();
|
||||
#include <future>
|
||||
|
||||
qServer::qServer(qDetectorMain *t)
|
||||
: threadRunning(false), threadStarted(false), mainTab(t),
|
||||
controlPort(DEFAULT_GUI_PORTNO), stopPort(DEFAULT_GUI_PORTNO + 1),
|
||||
controlSocket(nullptr), stopSocket(nullptr) {
|
||||
FILE_LOG(logDEBUG) << "Client Server ready";
|
||||
}
|
||||
|
||||
qServer::~qServer() {}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qServer::~qServer(){
|
||||
delete myMainTab;
|
||||
if(mySocket) delete mySocket;
|
||||
if(myStopSocket) delete myStopSocket;
|
||||
void qServer::FunctionTable() {
|
||||
flist.push_back(qServer::GetStatus);
|
||||
flist.push_back(qServer::StartAcquisition);
|
||||
flist.push_back(qServer::StopsAcquisition);
|
||||
flist.push_back(qServer::Acquire);
|
||||
flist.push_back(qServer::ExitServer);
|
||||
}
|
||||
|
||||
int qServer::DecodeFunction(ServerSocket *sock) {
|
||||
int ret = qDefs::FAIL;
|
||||
int fnum = 0;
|
||||
int n = sock->ReceiveDataOnly(&fnum, sizeof(fnum));
|
||||
if (n <= 0) {
|
||||
FILE_LOG(logDEBUG3) << "Received " << n << " bytes";
|
||||
throw sls::RuntimeError("Could not read socket");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// unrecognized function
|
||||
if (fnum < 0 && fnum >= qDefs::NUM_GUI_FUNCS) {
|
||||
ret = qDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH] = {};
|
||||
sls::strcpy_safe(mess, "Unrecognized function");
|
||||
// will throw an exception
|
||||
sock->SendResult(ret, nullptr, 0, mess);
|
||||
}
|
||||
|
||||
// calling function
|
||||
FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum;
|
||||
ret = (this->*flist[fnum])();
|
||||
|
||||
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;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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;
|
||||
void qServer::ShutDownSockets() {
|
||||
threadRunning = false;
|
||||
if (controlSocket) {
|
||||
controlSocket->shutDownSocket();
|
||||
delete controlSocket;
|
||||
controlSocket = nullptr;
|
||||
}
|
||||
if (stopSocket) {
|
||||
stopSocket->shutDownSocket();
|
||||
delete stopSocket;
|
||||
stopSocket = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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;
|
||||
void qServer::CreateServers() {
|
||||
if (!threadRunning) {
|
||||
FILE_LOG(logINFO) << "Starting Gui Servers";
|
||||
threadRunning = true;
|
||||
|
||||
try {
|
||||
// start control server
|
||||
controlSocket = new ServerSocket(controlPort);
|
||||
std::async(std::launch::async, ServerThread, controlSocket);
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Gui control server thread created successfully.";
|
||||
// start stop server
|
||||
stopSocket = new ServerSocket(stopPort);
|
||||
std::async(std::launch::async, ServerThread, stopSocket);
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Gui stop server thread created successfully.";
|
||||
} catch (...) {
|
||||
ShutDownSockets();
|
||||
std::string message = "Can't create gui control server thread";
|
||||
FILE_LOG(logERROR) << message;
|
||||
qDefs::Message(qDefs::WARNING, message, "qServer::CreateServers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
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 = 0;
|
||||
}
|
||||
|
||||
if(myStopSocket)
|
||||
myStopSocket->ShutDownSocket();
|
||||
pthread_join(gui_stop_server_thread,NULL);
|
||||
if(myStopSocket){
|
||||
delete myStopSocket;
|
||||
myStopSocket = 0;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Server threads stopped successfully." << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
return gui_server_thread_running;
|
||||
void qServer::DestroyServers() {
|
||||
if (threadRunning) {
|
||||
FILE_LOG(logINFO) << "Stopping Gui Servers";
|
||||
ShutDownSockets();
|
||||
FILE_LOG(logDEBUG) << "Server threads stopped successfully.";
|
||||
}
|
||||
}
|
||||
|
||||
void qServer::ServerThread(ServerSocket* sock) {
|
||||
FILE_LOG(logDEBUG) << "Starting Gui Server at port " << sock->getPort();
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
while (threadRunning)) {
|
||||
try{
|
||||
sock->accept();
|
||||
if (DecodeFunction(sock) == GOODBYE) {
|
||||
threadRunning = false;
|
||||
}
|
||||
sock->close();
|
||||
}
|
||||
// any fails will throw an exception, which will be displayed at client side. Ignore here
|
||||
catch (...) {}
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "Stopped gui server thread";
|
||||
|
||||
|
||||
void* qServer::StopServerThread(void* this_pointer){
|
||||
((qServer*)this_pointer)->StopServer();
|
||||
return this_pointer;
|
||||
// stop port is closed last
|
||||
if (sock->getPort() == stopPort)
|
||||
emit ServerStoppedSignal();
|
||||
}
|
||||
|
||||
int qServer::GetStatus(ServerSock* sock) {
|
||||
slsDetectorDefs::runStatus status = slsDetectorDefs::ERROR;
|
||||
int progress = 0;
|
||||
if (myMainTab->isPlotRunning())
|
||||
status = slsDetectorDefs::RUNNING;
|
||||
else
|
||||
status = slsDetectorDefs::IDLE;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
progress = myMainTab->GetProgress();
|
||||
|
||||
|
||||
|
||||
int qServer::StopServer(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "In StopServer()" << endl;
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
try {
|
||||
MySocketTCP* s = new MySocketTCP(port_no+1);
|
||||
myStopSocket = s;
|
||||
} catch(...) {
|
||||
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 = 0;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
emit ServerStoppedSignal();
|
||||
|
||||
return qDefs::OK;
|
||||
int ret = qDefs::OK
|
||||
int retvals[2] = {static_cast<int>(retval), progress};
|
||||
sock->SendResult(ret, retvals, sizeof(retvals), nullptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void* qServer::StartServerThread(void* this_pointer){
|
||||
((qServer*)this_pointer)->StartServer();
|
||||
return this_pointer;
|
||||
int qServer::StartAcquisition(ServerSock* sock) {
|
||||
char mess[MAX_STR_LENGTH] = {};
|
||||
sls::strcpy_safe(mess, "Could not start acquistion in Gui");
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(true);
|
||||
sock->SendResult(ret, nullptr, 0, mess);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int qServer::StartServer(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "In StartServer()" << endl;
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
try {
|
||||
MySocketTCP* s = new MySocketTCP(port_no);
|
||||
mySocket = s;
|
||||
} catch(...) {
|
||||
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 = 0;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
emit ServerStoppedSignal();
|
||||
|
||||
return qDefs::OK;
|
||||
int qServer::StopsAcquisition(ServerSock* sock) {
|
||||
char mess[MAX_STR_LENGTH] = {};
|
||||
sls::strcpy_safe(mess, "Could not stop acquistion in Gui");
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(false);
|
||||
sock->SendResult(ret, nullptr, 0, mess);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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::Acquire(ServerSock* sock) {
|
||||
char mess[MAX_STR_LENGTH] = {};
|
||||
sls::strcpy_safe(mess, "Could not start blocking acquistion in Gui");
|
||||
int ret = myMainTab->StartStopAcquisitionFromClient(true);
|
||||
// blocking
|
||||
usleep(5000);
|
||||
while (myMainTab->isPlotRunning())
|
||||
;
|
||||
sock->SendResult(ret, nullptr, 0, mess);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
int qServer::ExitServer(ServerSock* sock) {
|
||||
DestroyServers();
|
||||
int ret = qDefs::OK;
|
||||
sock->SendResult(ret, nullptr, 0, mess);
|
||||
return GOODBYE;
|
||||
}
|
@ -1,585 +0,0 @@
|
||||
/*
|
||||
* 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::JUNGFRAUCTB) ||
|
||||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
1291
slsDetectorGui/src/qTabAdvanced.cpp
Normal file → Executable file
1222
slsDetectorGui/src/qTabDataOutput.cpp
Normal file → Executable file
779
slsDetectorGui/src/qTabDebugging.cpp
Normal file → Executable file
@ -1,619 +1,272 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, multiSlsDetector *detector) : QWidget(parent),
|
||||
myDet(detector),
|
||||
detType(slsDetectorDefs::GENERIC),
|
||||
treeDet(0),
|
||||
lblDetectorId(0),
|
||||
lblDetectorFirmware(0),
|
||||
lblDetectorSoftware(0) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
FILE_LOG(logDEBUG) << "Debugging ready";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDebugging::SetupWidgetWindow() {
|
||||
|
||||
blue = new QPalette();
|
||||
blue->setColor(QPalette::Active, QPalette::WindowText, Qt::darkBlue);
|
||||
|
||||
qTabDebugging::~qTabDebugging(){
|
||||
delete myDet;
|
||||
if(det) delete det;
|
||||
// Detector Type
|
||||
detType = myDet->getDetectorTypeAsEnum();
|
||||
|
||||
// rename label and disable tests
|
||||
if (detType == slsDetectorDefs::EIGER) {
|
||||
lblDetector->setText("Half Module:");
|
||||
chkDetectorFirmware->setEnabled(false);
|
||||
chkDetectorBus->setEnabled(false);
|
||||
btnTest->setEnabled(false);
|
||||
}
|
||||
|
||||
//add detectors
|
||||
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) {
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
}
|
||||
|
||||
UpdateStatus();
|
||||
|
||||
qDefs::checkErrorMessage(myDet, "qTabDebugging::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDebugging::Initialization() {
|
||||
|
||||
|
||||
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::JUNGFRAUCTB:
|
||||
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()));
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateStatus()));
|
||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||
if (btnTest ->isEnabled())
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::UpdateStatus() {
|
||||
FILE_LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
auto moduleId = comboDetector->currentIndex();
|
||||
int detStatus = (int)myDet->getRunStatus(moduleId);
|
||||
std::string status = slsDetectorDefs::runStatusType(slsDetectorDefs::runStatus(detStatus));
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
|
||||
|
||||
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");
|
||||
qDefs::checkErrorMessage(myDet, comboDetector->currentIndex(), "qTabDebugging::UpdateStatus");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDebugging::GetInfo() {
|
||||
FILE_LOG(logDEBUG) << "Getting Readout Info";
|
||||
|
||||
//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
|
||||
QFrame *dispFrame = new QFrame(popup1);
|
||||
QGridLayout *formLayout = new QGridLayout(dispFrame);
|
||||
// hostname
|
||||
lblDetectorId = new QLabel("");
|
||||
lblDetectorId->setPalette(*blue);
|
||||
// firmware version
|
||||
lblDetectorFirmware = new QLabel("");
|
||||
lblDetectorFirmware->setPalette(*blue);
|
||||
// software version
|
||||
lblDetectorSoftware = new QLabel("");
|
||||
lblDetectorSoftware->setPalette(*blue);
|
||||
//to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
|
||||
QString detName = QString(myDet->getDetectorTypeAsString().c_str());
|
||||
|
||||
switch (detType) {
|
||||
|
||||
|
||||
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());
|
||||
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 Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::UpdateStatus");
|
||||
//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;
|
||||
|
||||
default:
|
||||
|
||||
//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 Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
//tree widget
|
||||
treeDet->setHeaderLabel(QString(detName + " 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;
|
||||
}
|
||||
|
||||
//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;
|
||||
|
||||
auto moduleId = comboDetector->currentIndex();
|
||||
switch (detType) {
|
||||
|
||||
|
||||
void qTabDebugging::GetInfo(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting Info" << endl;
|
||||
#endif
|
||||
//window
|
||||
QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow );
|
||||
QList<QTreeWidgetItem *> items;
|
||||
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;
|
||||
|
||||
sprintf(value, "%lx", (long long unsigned int)myDet->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, moduleId));
|
||||
lblDetectorFirmware->setText(QString(value));
|
||||
sprintf(value, "%lx", (long long unsigned int)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, moduleId));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(myDet, comboDetector->currentIndex(), "qTabDebugging::SetParameters");
|
||||
}
|
||||
break;
|
||||
|
||||
//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);
|
||||
default:
|
||||
//find index
|
||||
for (i = 0; i < comboDetector->count(); ++i)
|
||||
if (item == treeDet->topLevelItem(i))
|
||||
break;
|
||||
|
||||
switch(detType){
|
||||
sprintf(value, "%lx", (long long unsigned int)myDet->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, moduleId));
|
||||
lblDetectorFirmware->setText(QString(value));
|
||||
sprintf(value, "%lx", (long long unsigned int)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, moduleId));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
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:
|
||||
case slsDetectorDefs::JUNGFRAUCTB:
|
||||
//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
|
||||
if (detType == slsDetectorDefs::JUNGFRAU)
|
||||
treeDet->setHeaderLabel("JungFrau Detector");
|
||||
else
|
||||
treeDet->setHeaderLabel("JungFrauCTB 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",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)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",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
lblModuleId->setText(QString("%1").arg(im));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im));
|
||||
lblModuleSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)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",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::JUNGFRAUCTB:
|
||||
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",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
|
||||
lblDetectorSerial->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
|
||||
lblDetectorFirmware ->setText(QString(value));
|
||||
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
|
||||
lblDetectorSoftware->setText(QString(value));
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet, comboDetector->currentIndex(), "qTabDebugging::SetParameters");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDebugging::TestDetector() {
|
||||
FILE_LOG(logINFO) << "Testing Readout";
|
||||
|
||||
|
||||
void qTabDebugging::TestDetector(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Testing" << endl;
|
||||
#endif
|
||||
int retval = slsDetectorDefs::FAIL;
|
||||
QString message;
|
||||
QString Detector = "Detector";
|
||||
|
||||
int retval=slsDetectorDefs::FAIL;
|
||||
QString message;
|
||||
QString Detector = "Detector";
|
||||
//main messagebox title
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
Detector = "Half Module";
|
||||
break;
|
||||
default:
|
||||
Detector = "Module";
|
||||
break;
|
||||
}
|
||||
|
||||
//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::JUNGFRAUCTB:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::PROPIX:
|
||||
case slsDetectorDefs::GOTTHARD: Detector = "Module"; break;
|
||||
default: break;
|
||||
}
|
||||
// construct message
|
||||
message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
|
||||
|
||||
auto moduleId = comboDetector->currentIndex();
|
||||
|
||||
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());
|
||||
//detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
retval = myDet->digitalTest(slsDetectorDefs::DETECTOR_FIRMWARE_TEST, moduleId);
|
||||
if (retval == slsDetectorDefs::FAIL) {
|
||||
message.append(QString("<nobr>%1 Firmware: FAIL</nobr><br>").arg(Detector));
|
||||
FILE_LOG(logERROR) << "Firmware fail";
|
||||
}
|
||||
else
|
||||
message.append(QString("<nobr>%1 Firmware: %2</nobr><br>").arg(Detector, QString::number(retval)));
|
||||
FILE_LOG(logINFO) << "Detector Firmware Test: " << retval;
|
||||
}
|
||||
|
||||
//get sls det object
|
||||
det = myDet->getSlsDetector(comboDetector->currentIndex());
|
||||
qDefs::checkErrorMessage(myDet,"qTabDebugging::TestDetector");
|
||||
//detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
retval = myDet->digitalTest(slsDetectorDefs::DETECTOR_BUS_TEST, moduleId);
|
||||
if (retval == slsDetectorDefs::FAIL) {
|
||||
message.append(QString("<nobr>%1 Bus: FAIL</nobr><br>").arg(Detector));
|
||||
FILE_LOG(logERROR) << "Bus Test fail";
|
||||
} else
|
||||
message.append(QString("<nobr>%1 Bus: %2</nobr><br>").arg(Detector, QString::number(retval)));
|
||||
FILE_LOG(logINFO) << "Detector Bus Test: " << retval;
|
||||
}
|
||||
|
||||
//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");
|
||||
//display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
|
||||
|
||||
qDefs::checkErrorMessage(det,"qTabDebugging::TestDetector");
|
||||
qDefs::checkErrorMessage(myDet, comboDetector->currentIndex(), "qTabDebugging::TestDetector");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDebugging::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Debugging Tab" << endl;
|
||||
#endif
|
||||
UpdateStatus();
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Debugging Tab" << endl << endl;
|
||||
#endif
|
||||
void qTabDebugging::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "\n**Updating Debugging Tab";
|
||||
UpdateStatus();
|
||||
FILE_LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
848
slsDetectorGui/src/qTabDeveloper.cpp
Normal file → Executable file
@ -1,90 +1,58 @@
|
||||
/*
|
||||
* 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 <QDoubleValidator>
|
||||
#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);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
#include <iostream>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) : QWidget(parent),
|
||||
myDet(detector),
|
||||
detType(slsDetectorDefs::GENERIC),
|
||||
numDACWidgets(0),
|
||||
numADCWidgets(0),
|
||||
boxDacs(0),
|
||||
boxAdcs(0),
|
||||
lblHV(0),
|
||||
comboHV(0),
|
||||
dacLayout(0),
|
||||
comboDetector(0) {
|
||||
|
||||
|
||||
lblDacs.clear();
|
||||
lblAdcs.clear();
|
||||
spinDacs.clear();
|
||||
spinAdcs.clear();
|
||||
lblDacsmV.clear();
|
||||
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
FILE_LOG(logDEBUG) << "Developer ready";
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDeveloper::~qTabDeveloper() {
|
||||
delete myDet;
|
||||
if(det) delete det;
|
||||
if(thisParent) delete thisParent;
|
||||
if (myDet)
|
||||
delete myDet;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::SetupWidgetWindow() {
|
||||
//Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
detType = myDet->getDetectorTypeAsEnum();
|
||||
|
||||
//palette
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
|
||||
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;
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
NUM_DAC_WIDGETS = 17;
|
||||
NUM_ADC_WIDGETS = 6;
|
||||
numDACWidgets = 17;
|
||||
numADCWidgets = 6;
|
||||
|
||||
dacNames.push_back("v SvP:");
|
||||
dacNames.push_back("v SvN");
|
||||
@ -112,10 +80,10 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
adcNames.push_back("Temperature FPGA:");
|
||||
|
||||
break;
|
||||
case slsDetectorDefs::PROPIX:
|
||||
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
NUM_DAC_WIDGETS = 8;
|
||||
NUM_ADC_WIDGETS = 2;
|
||||
numDACWidgets = 8;
|
||||
numADCWidgets = 2;
|
||||
dacNames.push_back("v Reference:");
|
||||
dacNames.push_back("v Cascode n:");
|
||||
dacNames.push_back("v Cascode p:");
|
||||
@ -129,28 +97,10 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
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:
|
||||
case slsDetectorDefs::JUNGFRAUCTB:
|
||||
NUM_DAC_WIDGETS = 8;
|
||||
NUM_ADC_WIDGETS = 1;
|
||||
numDACWidgets = 8;
|
||||
numADCWidgets = 1;
|
||||
dacNames.push_back("v vb comp:");
|
||||
dacNames.push_back("v vdd prot:");
|
||||
dacNames.push_back("v vin com:");
|
||||
@ -164,51 +114,154 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MOENCH:
|
||||
|
||||
numDACWidgets = 8;
|
||||
numADCWidgets = 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:");
|
||||
|
||||
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");
|
||||
FILE_LOG(logERROR) << "Unknown detector type: " + myDet->getDetectorTypeAsString();
|
||||
qDefs::Message(qDefs::CRITICAL, std::string("Unknown detector type:") + myDet->getDetectorTypeAsString(), "qTabDeveloper::SetupWidgetWindow");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//layout
|
||||
setFixedWidth(765);
|
||||
setFixedHeight(20+50+(NUM_DAC_WIDGETS/2)*35);
|
||||
//setHeight(340);
|
||||
setFixedHeight(20 + 50 + (numDACWidgets / 2) * 35);
|
||||
|
||||
scroll = new QScrollArea;
|
||||
//scroll->setFrameShape(QFrame::NoFrame);
|
||||
QScrollArea* scroll = new QScrollArea;
|
||||
scroll->setWidget(this);
|
||||
scroll->setWidgetResizable(true);
|
||||
|
||||
layout = new QGridLayout(scroll);
|
||||
layout->setContentsMargins(20,10,10,5);
|
||||
QGridLayout *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()));
|
||||
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);
|
||||
// hv for gotthard, jungfrau, moench
|
||||
if ((detType == slsDetectorDefs::GOTTHARD) ||
|
||||
(detType == slsDetectorDefs::JUNGFRAU) ||
|
||||
(detType == slsDetectorDefs::MOENCH)) {
|
||||
CreateHVWidget();
|
||||
|
||||
lblHV = new QLabel("High Voltage",boxDacs);
|
||||
comboHV = new QComboBox(boxDacs);
|
||||
}
|
||||
layout->addWidget(comboDetector, 0, 0);
|
||||
layout->addWidget(boxDacs, 1, 0);
|
||||
|
||||
//adcs
|
||||
if (numADCWidgets) {
|
||||
CreateADCWidgets();
|
||||
layout->addWidget(boxAdcs, 2, 0);
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet, "qTabDeveloper::SetupWidgetWindow");
|
||||
}
|
||||
|
||||
|
||||
void qTabDeveloper::Initialization() {
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(Refresh()));
|
||||
|
||||
// dacs
|
||||
for (int i = 0; i < numDACWidgets; ++i)
|
||||
connect(spinDacs[i], SIGNAL(editingFinished(int)), this, SLOT(SetDacValues(int)));
|
||||
|
||||
// hv
|
||||
if (comboHV) {
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
} else {
|
||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qTabDeveloper::CreateDACWidgets() {
|
||||
boxDacs = new QGroupBox("Dacs", this);
|
||||
boxDacs->setFixedHeight(25 + (numDACWidgets / 2) * 35);
|
||||
dacLayout = new QGridLayout(boxDacs);
|
||||
|
||||
for (int i = 0; i < numDACWidgets; ++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() {
|
||||
int rows = numADCWidgets / 2;
|
||||
if (numADCWidgets % 2)
|
||||
rows++;
|
||||
setFixedHeight(20 + (50 + (numDACWidgets / 2) * 35) + (50 + rows * 35));
|
||||
boxAdcs = new QGroupBox("ADCs", this);
|
||||
boxAdcs->setFixedHeight(25 + rows * 35);
|
||||
|
||||
QGridLayout *adcLayout = new QGridLayout(boxAdcs);
|
||||
|
||||
for (int i = 0; i < numADCWidgets; ++i) {
|
||||
lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()), boxAdcs);
|
||||
spinAdcs[i] = new QLineEdit(boxAdcs);
|
||||
spinAdcs[i]->setReadOnly(true);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//to make the adcs at the bottom most
|
||||
if (detType != slsDetectorDefs::EIGER) {
|
||||
int diff = 340 - height();
|
||||
setFixedHeight(340);
|
||||
layout->setVerticalSpacing(diff / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDeveloper::CreateHVWidget() {
|
||||
boxDacs->setFixedHeight(boxDacs->height() + 35);
|
||||
lblHV = new QLabel("High Voltage", boxDacs);
|
||||
dacLayout->addWidget(lblHV, (int)(numDACWidgets / 2), 1);
|
||||
|
||||
comboHV = nullptr;
|
||||
spinHV = nullptr;
|
||||
|
||||
// drop down with specific values
|
||||
if (detType == slsDetectorDefs::GOTTHARD) {
|
||||
comboHV = new QComboBox(boxDacs);
|
||||
comboHV->addItem("0");
|
||||
comboHV->addItem("90");
|
||||
comboHV->addItem("110");
|
||||
@ -217,415 +270,306 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
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(NUM_ADC_WIDGETS) {
|
||||
int rows = NUM_ADC_WIDGETS/2;
|
||||
if (NUM_ADC_WIDGETS%2)rows++;
|
||||
setFixedHeight(20+(50+(NUM_DAC_WIDGETS/2)*35)+(50+rows*35));
|
||||
boxAdcs = new QGroupBox("ADCs",this);
|
||||
boxAdcs->setFixedHeight(25+rows*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); adc timer disabled, display adcs only when refreshing developer tab */
|
||||
dacLayout->addWidget(comboHV, (int)(numDACWidgets / 2), 2);
|
||||
}
|
||||
|
||||
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);
|
||||
// jungfrau, moench (range of values)
|
||||
else {
|
||||
spinHV = new QSpinBox(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);
|
||||
}
|
||||
spinDacs[i]->setMaximum(200);
|
||||
tipHV = "<nobr>Set high voltage to 0 or 60 - 200V</nobr>";
|
||||
spinHV->setToolTip(tipHV);
|
||||
dacLayout->addWidget(spinHV, (int)(numDACWidgets / 2), 2);
|
||||
}
|
||||
lblHV->setToolTip(tipHV);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDeveloper::SetDacValues(int id) {
|
||||
FILE_LOG(logINFO) << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value();
|
||||
|
||||
int moduleId = comboDetector->currentIndex() - 1;
|
||||
|
||||
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 QLineEdit(boxAdcs);
|
||||
spinAdcs[i]->setReadOnly(true);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id), 0, moduleId);
|
||||
lblDacsmV[id]->setText(QString("%1mV").arg(myDet->setDAC(-1, getSLSIndex(id), 1, moduleId),-10));
|
||||
qDefs::checkErrorMessage(myDet, moduleId, "qTabDeveloper::SetDacValues");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
void qTabDeveloper::SetHighVoltage() {
|
||||
int highvoltage = (comboHV ? comboHV->currentText().toInt() : spinHV->value());
|
||||
FILE_LOG(logINFO) << "Setting high voltage:" << highvoltage;
|
||||
|
||||
auto moduleId = comboDetector->currentIndex() - 1;
|
||||
int ret = det->setDAC(highvoltage,slsDetectorDefs::HIGH_VOLTAGE, 0, moduleId);
|
||||
qDefs::checkErrorMessage(myDet, moduleId, "qTabDeveloper::SetHighVoltage");
|
||||
|
||||
//error
|
||||
if(ret != highvoltage){
|
||||
qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","qTabDeveloper::SetHighVoltage");
|
||||
if (ret != highvoltage && highvoltage != -1) {
|
||||
qDefs::Message(qDefs::CRITICAL, "High Voltage could not be set to this value.", "qTabDeveloper::SetHighVoltage");
|
||||
FILE_LOG(logERROR) << "Could not set High voltage";
|
||||
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>");
|
||||
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{
|
||||
if (comboHV)
|
||||
comboHV->setToolTip(errTip);
|
||||
else
|
||||
spinHV->setToolTip(errTip);
|
||||
} else {
|
||||
lblHV->setPalette(lblDacs[0]->palette());
|
||||
lblHV->setText("High Voltage:");
|
||||
lblHV->setToolTip(tipHV);
|
||||
comboHV->setToolTip(tipHV);
|
||||
if (comboHV)
|
||||
comboHV->setToolTip(tipHV);
|
||||
else
|
||||
spinHV->setToolTip(errTip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
|
||||
switch (detType) {
|
||||
|
||||
|
||||
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;
|
||||
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");
|
||||
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;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
break;
|
||||
|
||||
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:
|
||||
case slsDetectorDefs::JUNGFRAUCTB:
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
if (index >= 0 && index <= 7) {
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
}
|
||||
if (index == 8) {
|
||||
return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
} else {
|
||||
qDefs::Message(qDefs::CRITICAL, "Unknown DAC/ADC Index. Weird Error Index:" + index, "qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
if (index >= 0 && index <= 7) {
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
} else {
|
||||
qDefs::Message(qDefs::CRITICAL, "Unknown DAC/ADC Index. Weird Error Index:" + index, "qTabDeveloper::getSLSIndex");
|
||||
Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
switch(index){
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
break;
|
||||
case 8: return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
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;
|
||||
default:
|
||||
FILE_LOG(logERROR) << "Unknown detector type:" + myDet->getDetectorTypeAsString();
|
||||
qDefs::Message(qDefs::CRITICAL, std::string("Unknown detector type:") + myDet->getDetectorTypeAsString(), "qTabDeveloper::getSLSIndex");
|
||||
qDefs::checkErrorMessage(myDet, "qTabDeveloper::getSLSIndex");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
return slsDetectorDefs::HUMIDITY;
|
||||
return (slsDetectorDefs::dacIndex)0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDeveloper::RefreshAdcs() {
|
||||
FILE_LOG(logDEBUG) << "Updating ADCs";
|
||||
|
||||
auto moduleId = comboDetector->currentIndex() - 1;
|
||||
|
||||
void qTabDeveloper::RefreshAdcs(){
|
||||
if(!thisParent->isCurrentlyTabDeveloper())
|
||||
return;
|
||||
for (int i = 0; i < numADCWidgets; ++i) {
|
||||
|
||||
#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){
|
||||
double value = (double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS),-1);
|
||||
|
||||
if(value == -1)
|
||||
spinAdcs[i]->setText(QString("Different values"));
|
||||
else {
|
||||
if(detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::JUNGFRAU || detType == slsDetectorDefs::JUNGFRAUCTB)
|
||||
value/=1000.00;
|
||||
spinAdcs[i]->setText(QString::number(value,'f',2)+0x00b0+QString("C"));
|
||||
}
|
||||
}
|
||||
//specific detector
|
||||
else{
|
||||
double value = (double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS));
|
||||
|
||||
if(detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::JUNGFRAU || detType == slsDetectorDefs::JUNGFRAUCTB)
|
||||
value/=1000.00;
|
||||
spinAdcs[i]->setText(QString::number(value,'f',2)+0x00b0+QString("C"));
|
||||
double value = (double)myDet->getADC(getSLSIndex(i + numDACWidgets), moduleId);
|
||||
if (value == -1 && moduleId == -1) {
|
||||
spinAdcs[i]->setText(QString("Different values"));
|
||||
} else {
|
||||
if (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::JUNGFRAU)
|
||||
value /= 1000.00;
|
||||
spinAdcs[i]->setText(QString::number(value, 'f', 2) + 0x00b0 + QString("C"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*adcTimer->start(ADC_TIMEOUT);*/
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::RefreshAdcs");
|
||||
qDefs::checkErrorMessage(myDet, "qTabDeveloper::RefreshAdcs");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabDeveloper::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Developer Tab\n";
|
||||
|
||||
auto moduleId = comboDetector->currentIndex() - 1;
|
||||
|
||||
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 << "Getting DACs" << NUM_DAC_WIDGETS <<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));
|
||||
}
|
||||
// dacs
|
||||
FILE_LOG(logDEBUG) << "Getting DACs";
|
||||
for (int i = 0; i < numDACWidgets; ++i) {
|
||||
spinDacs[i]->setValue(myDet->setDAC(-1, getSLSIndex(i), 0, moduleId));
|
||||
lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1, getSLSIndex(i), 1, moduleId), -10));
|
||||
}
|
||||
|
||||
|
||||
//adcs
|
||||
if(NUM_ADC_WIDGETS) RefreshAdcs();
|
||||
if (numADCWidgets)
|
||||
RefreshAdcs();
|
||||
|
||||
//gotthard -high voltage
|
||||
if((detType == slsDetectorDefs::GOTTHARD) ||
|
||||
(detType == slsDetectorDefs::PROPIX) ||
|
||||
(detType == slsDetectorDefs::MOENCH)){
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
if ((detType == slsDetectorDefs::GOTTHARD) ||
|
||||
(detType == slsDetectorDefs::JUNGFRAU) ||
|
||||
(detType == slsDetectorDefs::MOENCH)) {
|
||||
|
||||
if (comboHV)
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
else
|
||||
disconnect(spinHV, SIGNAL(valueChanged(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);
|
||||
if (comboHV)
|
||||
comboHV->setToolTip(tipHV);
|
||||
else
|
||||
spinHV->setToolTip(tipHV);
|
||||
|
||||
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;
|
||||
//getting hv value
|
||||
int ret = myDet->setDAC(-1, slsDetectorDefs::HIGH_VOLTAGE, 0, moduleId);
|
||||
|
||||
bool error = false;
|
||||
if (spinHV) {
|
||||
if (ret != 0 && ret < 60 && ret > 200)
|
||||
error = true;
|
||||
else
|
||||
spinHV->setValue(ret);
|
||||
} else {
|
||||
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
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
if (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);
|
||||
if (comboHV)
|
||||
comboHV->setToolTip(errTip);
|
||||
else
|
||||
spinHV->setToolTip(errTip);
|
||||
} else {
|
||||
lblHV->setPalette(lblDacs[0]->palette());
|
||||
lblHV->setText("High Voltage:");
|
||||
lblHV->setToolTip(tipHV);
|
||||
if (comboHV)
|
||||
comboHV->setToolTip(tipHV);
|
||||
else
|
||||
spinHV->setToolTip(errTip);
|
||||
}
|
||||
if (comboHV)
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
else
|
||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Developer Tab" << endl << endl;
|
||||
#endif
|
||||
FILE_LOG(logDEBUG) << "**Updated Developer Tab";
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabDeveloper::Refresh");
|
||||
qDefs::checkErrorMessage(myDet, "qTabDeveloper::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
1263
slsDetectorGui/src/qTabMeasurement.cpp
Normal file → Executable file
145
slsDetectorGui/src/qTabMessages.cpp
Normal file → Executable file
@ -1,122 +1,95 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <QGridLayout>
|
||||
#include <QTextStream>
|
||||
|
||||
|
||||
/** C++ Include Headers */
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMessages::qTabMessages(qDetectorMain* m):myMainTab(m),qout(0),qerr(0){
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
FILE_LOG(logDEBUG) << "Messages ready";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabMessages::~qTabMessages(){
|
||||
delete myMainTab;
|
||||
delete dispLog;
|
||||
delete qout;
|
||||
delete qerr;
|
||||
qTabMessages::~qTabMessages() {
|
||||
delete dispLog;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::SetupWidgetWindow(){
|
||||
/** Layout */
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
void qTabMessages::SetupWidgetWindow() {
|
||||
/** Layout */
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
|
||||
dispLog = new QTextEdit(this);
|
||||
dispLog->setReadOnly(true);
|
||||
dispLog->setFocusPolicy(Qt::NoFocus);
|
||||
dispLog->setTextColor(Qt::darkBlue);
|
||||
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"));
|
||||
|
||||
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"));
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
qDebugStream *qout = new qDebugStream(std::cout, this);
|
||||
qDebugStream *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::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);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
QString fName = QString(""); //FIXME:current directory?
|
||||
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, std::string("The Log has been successfully saved to "
|
||||
"") +
|
||||
fName.toAscii().constData(),
|
||||
"qTabMessages::SaveLog");
|
||||
} else {
|
||||
FILE_LOG(logWARNING) << "Attempt to save log file failed.";
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.", "qTabMessages::SaveLog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabMessages::ClearLog() {
|
||||
dispLog->clear();
|
||||
#ifdef VERBOSE
|
||||
cout<<"Log Cleared"<<endl;
|
||||
#endif
|
||||
dispLog->clear();
|
||||
FILE_LOG(logINFO) << "Log Cleared";
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
2381
slsDetectorGui/src/qTabPlot.cpp
Normal file → Executable file
595
slsDetectorGui/src/qTabSettings.cpp
Normal file → Executable file
@ -1,385 +1,304 @@
|
||||
/*
|
||||
* 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 <QStandardItemModel>
|
||||
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
#include <iostream>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
qTabSettings::qTabSettings(QWidget *parent, multiSlsDetector *detector)
|
||||
: QWidget(parent), myDet(detector), detType(slsDetectorDefs::GENERIC) {
|
||||
|
||||
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();
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
FILE_LOG(logDEBUG) << "Settings ready";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
qTabSettings::~qTabSettings() {}
|
||||
|
||||
qTabSettings::~qTabSettings(){
|
||||
delete myDet;
|
||||
void qTabSettings::SetupWidgetWindow() {
|
||||
// Detector Type
|
||||
detType = myDet->getDetectorTypeAsEnum();
|
||||
|
||||
// Settings
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
if (detType == slsDetectorDefs::MOENCH) {
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
} else {
|
||||
SetupDetectorSettings();
|
||||
GetSettings();
|
||||
}
|
||||
|
||||
// Dynamic Range
|
||||
GetDynamicRange();
|
||||
// cannot change dr for other types
|
||||
if (detType != slsDetectorDefs::EIGER) {
|
||||
lblDynamicRange->setEnabled(false);
|
||||
comboDynamicRange->setEnabled(false);
|
||||
}
|
||||
|
||||
// threshold energy
|
||||
if (detType == slsDetectorDefs::EIGER) {
|
||||
qDefs::IgnoreNonCriticalExceptions<QSpinBox>(
|
||||
spinThreshold,
|
||||
&QSpinBox::setValue,
|
||||
myDet,
|
||||
std::string("qTabSettings::SetupWidgetWindow"),
|
||||
&multiSlsDetector::getThresholdEnergy, -1);
|
||||
} else {
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabSettings::SetupDetectorSettings() {
|
||||
|
||||
void qTabSettings::SetupWidgetWindow(){
|
||||
// Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
// To be able to index items on a combo box
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
if (model) {
|
||||
QModelIndex index[NUMSETTINGS];
|
||||
QStandardItem *item[NUMSETTINGS];
|
||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||
comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
// Settings
|
||||
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
|
||||
SetupDetectorSettings();
|
||||
} else
|
||||
comboSettings->setEnabled(false);
|
||||
item[(int)UNDEFINED]->setEnabled(false);
|
||||
item[(int)UNINITIALIZED]->setEnabled(false);
|
||||
|
||||
//threshold
|
||||
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::EIGER))
|
||||
spinThreshold->setValue(myDet->getThresholdEnergy());
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)STANDARD]->setEnabled(true);
|
||||
item[(int)HIGHGAIN]->setEnabled(true);
|
||||
item[(int)LOWGAIN]->setEnabled(true);
|
||||
item[(int)VERYHIGHGAIN]->setEnabled(true);
|
||||
item[(int)VERLOWGAIN]->setEnabled(true);
|
||||
|
||||
//expert mode is not enabled initially
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
item[(int)FAST]->setEnabled(false);
|
||||
item[(int)DYNAMICGAIN]->setEnabled(false);
|
||||
item[(int)MEDIUMGAIN]->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);
|
||||
break;
|
||||
|
||||
// Number of Modules
|
||||
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
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);
|
||||
|
||||
Initialization();
|
||||
item[(int)STANDARD]->setEnabled(false);
|
||||
item[(int)FAST]->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)VERLOWGAIN]->setEnabled(false);
|
||||
break;
|
||||
|
||||
// Dynamic Range
|
||||
GetDynamicRange();
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||
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);
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetupWidgetWindow");
|
||||
item[(int)STANDARD]->setEnabled(false);
|
||||
item[(int)FAST]->setEnabled(false);
|
||||
item[(int)HIGHGAIN]->setEnabled(false);
|
||||
item[(int)LOWGAIN]->setEnabled(false);
|
||||
item[(int)MEDIUMGAIN]->setEnabled(false);
|
||||
item[(int)VERYHIGHGAIN]->setEnabled(false);
|
||||
item[(int)LOWNOISE]->setEnabled(false);
|
||||
item[(int)VERLOWGAIN]->setEnabled(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
"Unknown detector type. Exiting GUI.",
|
||||
"qTabSettings::SetupDetectorSettings");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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::Initialization() {
|
||||
// Settings
|
||||
if (comboSettings->isEnabled())
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled())
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
// Threshold
|
||||
if (spinThreshold->isEnabled())
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
void qTabSettings::GetSettings() {
|
||||
FILE_LOG(logDEBUG) << "Getting settings";
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
int sett = qDefs::IgnoreNonCriticalExceptionsandReturn(
|
||||
myDet, std::string("qTabSettings::SetupWidgetWindow"),
|
||||
&multiSlsDetector::getSettings, -1);
|
||||
|
||||
FILE_LOG(logDEBUG) << "Settings from Detector:" << sett;
|
||||
|
||||
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;
|
||||
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]);
|
||||
}
|
||||
if (sett == -1)
|
||||
sett = UNDEFINED;
|
||||
if (sett == slsDetectorDefs::UNDEFINED)
|
||||
sett = UNDEFINED;
|
||||
else if (sett == slsDetectorDefs::UNINITIALIZED)
|
||||
sett = UNINITIALIZED;
|
||||
|
||||
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
|
||||
sett= Undefined;
|
||||
// exit(-1);
|
||||
}
|
||||
// Setting the detector settings
|
||||
else comboSettings->setCurrentIndex(sett);
|
||||
}
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
// Settings
|
||||
if (detType != slsReceiverDefs::JUNGFRAUCTB)
|
||||
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()));
|
||||
int ret = qDefs::IgnoreNonCriticalExceptionsandReturn(
|
||||
myDet, std::string("qTabSettings::GetDynamicRange"),
|
||||
&multiSlsDetector::setDynamicRange, -1, -1);
|
||||
|
||||
// set the final value on gui
|
||||
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:
|
||||
if (ret != -1) {
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Unknown Dyanmic Range " + std::to_string(ret) + ".",
|
||||
"qTabSettings::SetupDetectorSettings");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
slsDetectorDefs::detectorSettings sett =
|
||||
myDet->setSettings((slsDetectorDefs::detectorSettings)index);
|
||||
FILE_LOG(logINFO) << "Settings set to "
|
||||
<< myDet->slsDetectorDefs::getDetectorSettings(sett);
|
||||
|
||||
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;
|
||||
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)));
|
||||
}
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetEnergy();
|
||||
}
|
||||
|
||||
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");
|
||||
qDefs::checkErrorMessage(myDet, "qTabSettings::SetSettings");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
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:
|
||||
break;
|
||||
}
|
||||
int ret = myDet->setDynamicRange(dr);
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to " << dr;
|
||||
qDefs::checkErrorMessage(myDet, "qTabSettings::SetDynamicRange");
|
||||
|
||||
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");
|
||||
// check
|
||||
if (ret != dr) {
|
||||
qDefs::Message(qDefs::WARNING, "Could not set dynamic range.",
|
||||
"qTabSettings::SetDynamicRange");
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
GetDynamicRange();
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
void qTabSettings::SetEnergy() {
|
||||
int index = spinThreshold->value();
|
||||
FILE_LOG(logINFO) << "Settings threshold energy to " << index;
|
||||
|
||||
myDet->setThresholdEnergy(index);
|
||||
int ret = myDet->getThresholdEnergy();
|
||||
if ((ret - index) > 200) {
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Threshold energy could not be set (tolerance 200).",
|
||||
"qTabSettings::SetEnergy");
|
||||
}
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetEnergy()));
|
||||
spinThreshold->setValue(ret);
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
|
||||
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");
|
||||
qDefs::checkErrorMessage(myDet, "qTabSettings::SetEnergy");
|
||||
}
|
||||
|
||||
void qTabSettings::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "\n**Updating Settings Tab";
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// settings
|
||||
if (comboSettings->isEnabled()) {
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
GetSettings();
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetEnergy()));
|
||||
spinThreshold->setValue(myDet->getThresholdEnergy());
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
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()));
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled()) {
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
GetDynamicRange();
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qTabSettings::SetEnergy");
|
||||
FILE_LOG(logDEBUG) << "**Updated Settings Tab";
|
||||
|
||||
qDefs::checkErrorMessage(myDet, "qTabSettings::Refresh");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Settings Tab" << endl;
|
||||
#endif
|
||||
|
||||
if (detType != slsReceiverDefs::JUNGFRAUCTB)
|
||||
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
|
||||
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting settings" << endl;
|
||||
#endif
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = Undefined;//slsDetectorDefs::UNDEFINED;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (detType != slsReceiverDefs::JUNGFRAUCTB)
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,26 +0,0 @@
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorGui
|
||||
TMPFILE=include/gitInfoGuiTmp.h
|
||||
INCLFILE=include/gitInfoGui.h
|
||||
WD=$PWD
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|build|.git|updateGitVersion|ui*.h|*.o|Makefile.gui' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
||||
#update INCLFILE if changes
|
||||
#if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ..
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
#fi
|