gui works, including clone plots

This commit is contained in:
maliakal_d 2019-07-17 16:58:04 +02:00
parent d3879bb834
commit 8cdfe4194f
26 changed files with 1812 additions and 1555 deletions

View File

@ -5,7 +5,6 @@ set(SOURCES
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
slsDetectorPlotting/src/SlsQt2DHist.cxx
slsDetectorPlotting/src/SlsQt2DPlot.cxx
slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
src/qDetectorMain.cpp
src/qDrawPlot.cpp
src/qCloneWidget.cpp
@ -17,6 +16,7 @@ set(SOURCES
src/qTabDebugging.cpp
src/qTabDeveloper.cpp
src/qTabMessages.cpp
src/qDacWidget.cpp
)
set(FORMS
@ -28,6 +28,10 @@ set(FORMS
forms/form_tab_settings.ui
forms/form_tab_debugging.ui
forms/form_tab_messages.ui
forms/form_tab_developer.ui
forms/form_dac.ui
forms/form_plot.ui
forms/form_cloneplot.ui
)
qt4_wrap_ui(FORMS_H ${FORMS})
@ -37,7 +41,6 @@ set(HEADERS
slsDetectorPlotting/include/SlsQt1DZoomer.h
slsDetectorPlotting/include/SlsQt2DHist.h
slsDetectorPlotting/include/SlsQt2DPlot.h
slsDetectorPlotting/include/SlsQt2DPlotLayout.h
slsDetectorPlotting/include/SlsQt2DZoomer.h
include/qDefs.h
include/qDetectorMain.h
@ -51,6 +54,7 @@ set(HEADERS
include/qTabDebugging.h
include/qTabDeveloper.h
include/qTabMessages.h
include/qDacWidget.h
)
set(RESOURCES
include/icons.qrc

View File

@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ClonePlotObject</class>
<widget class="QMainWindow" name="ClonePlotObject">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>350</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="boxPlot">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="title">
<string>Sample Plot</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="plotLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widgetStatistics" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="6">
<widget class="QLabel" name="lblSum">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Sum: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblMinDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lblMaxDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="lblMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Max: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="lblSumDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Min: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>28</height>
</rect>
</property>
<widget class="QMenu" name="menuSave">
<property name="title">
<string>Save</string>
</property>
<addaction name="actionSaveClone"/>
</widget>
<addaction name="menuSave"/>
</widget>
<action name="actionSave">
<property name="text">
<string>Save</string>
</property>
</action>
<action name="actionSave_2">
<property name="text">
<string>Save Clone</string>
</property>
</action>
<action name="actionSaveClone">
<property name="text">
<string>Save Clone</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

117
slsDetectorGui/forms/form_dac.ui Executable file
View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WidgetDacObject</class>
<widget class="QWidget" name="WidgetDacObject">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>30</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="spinDac">
<property name="minimumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblDac">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblDacmV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>---mV</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlotObject</class>
<widget class="QWidget" name="PlotObject">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>425</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>425</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="layout">
<item row="0" column="0">
<widget class="QGroupBox" name="boxPlot">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="title">
<string>Sample Plot</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="plotLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widgetStatistics" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="6">
<widget class="QLabel" name="lblSum">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Sum: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblMinDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lblMaxDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="lblMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Max: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="lblSumDisp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Min: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>819</width>
<height>377</height>
<width>775</width>
<height>345</height>
</rect>
</property>
<property name="sizePolicy">
@ -24,8 +24,8 @@
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
<width>775</width>
<height>345</height>
</size>
</property>
<property name="windowTitle">
@ -41,6 +41,12 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
@ -48,20 +54,11 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>2</number>
</property>
<property name="elideMode">
<enum>Qt::ElideLeft</enum>
</property>
<widget class="QWidget" name="tab_log">
<property name="enabled">
<bool>false</bool>
</property>
<attribute name="title">
<string>Logs</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
<widget class="QWidget" name="tab_trimming">
<property name="enabled">
<bool>false</bool>
@ -76,11 +73,11 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>550</width>
<width>20</width>
<height>20</height>
</size>
</property>
@ -97,7 +94,7 @@
<widget class="QSpinBox" name="spinSetAllTrimbits">
<property name="minimumSize">
<size>
<width>0</width>
<width>100</width>
<height>25</height>
</size>
</property>
@ -120,7 +117,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>250</height>
<height>20</height>
</size>
</property>
</spacer>
@ -145,7 +142,7 @@
</property>
<property name="minimumSize">
<size>
<width>150</width>
<width>130</width>
<height>0</height>
</size>
</property>
@ -168,7 +165,7 @@
</property>
<property name="minimumSize">
<size>
<width>150</width>
<width>130</width>
<height>0</height>
</size>
</property>
@ -188,7 +185,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
@ -201,7 +198,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
@ -217,7 +214,7 @@
</property>
<property name="minimumSize">
<size>
<width>150</width>
<width>130</width>
<height>0</height>
</size>
</property>
@ -240,7 +237,7 @@
</property>
<property name="minimumSize">
<size>
<width>150</width>
<width>130</width>
<height>0</height>
</size>
</property>
@ -260,7 +257,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
@ -279,8 +276,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>779</width>
<height>267</height>
<width>735</width>
<height>235</height>
</rect>
</property>
<layout class="QGridLayout" name="gridRoi">
@ -312,7 +309,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -348,13 +351,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -398,7 +401,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -421,7 +430,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -463,7 +478,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -486,7 +507,13 @@
<property name="minimumSize">
<size>
<width>127</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -530,7 +557,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -556,7 +589,13 @@
<property name="minimumSize">
<size>
<width>127</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -626,7 +665,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -649,7 +694,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -719,7 +770,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -776,7 +833,13 @@
<property name="minimumSize">
<size>
<width>127</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -820,7 +883,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -855,7 +924,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>60</width>
<width>20</width>
<height>20</height>
</size>
</property>
@ -872,7 +941,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -911,7 +986,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
</widget>
@ -1011,7 +1092,13 @@
<property name="minimumSize">
<size>
<width>180</width>
<height>25</height>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
@ -1083,7 +1170,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>190</height>
<height>20</height>
</size>
</property>
</spacer>
@ -1392,11 +1479,11 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>350</width>
<width>20</width>
<height>20</height>
</size>
</property>

View File

@ -228,11 +228,11 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>450</width>
<width>20</width>
<height>20</height>
</size>
</property>

View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TabDeveloperObject</class>
<widget class="QWidget" name="TabDeveloperObject">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<height>345</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>775</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblReadout">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Readout: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboDetector">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblComboHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>90</string>
</property>
</item>
<item>
<property name="text">
<string>110</string>
</property>
</item>
<item>
<property name="text">
<string>120</string>
</property>
</item>
<item>
<property name="text">
<string>150</string>
</property>
</item>
<item>
<property name="text">
<string>180</string>
</property>
</item>
<item>
<property name="text">
<string>200</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSpinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#vhighvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tabDAC">
<attribute name="title">
<string>DACs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutDac"/>
</widget>
<widget class="QWidget" name="tabADC">
<attribute name="title">
<string>ADCs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutAdc"/>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../include/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1367,378 +1367,6 @@ Displays minimum, maximum and sum of values for each plot.
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="boxPlotType">
<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>65</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Plot Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QRadioButton" name="radioDataGraph">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</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="QRadioButton" name="radioNoPlot">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>No Plot</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="7">
<widget class="QGroupBox" name="boxSnapshot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" 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>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Snapshot</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>9</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="btnCloseClones">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Close All </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/close.png</normaloff>:/icons/images/close.png</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnSaveClones">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Save All </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/saveAll.png</normaloff>:/icons/images/saveAll.png</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="btnClone">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Create </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/new.png</normaloff>:/icons/images/new.png</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="7">
<widget class="QGroupBox" name="boxPlotAxis">
<property name="sizePolicy">
@ -2140,10 +1768,13 @@ Displays minimum, maximum and sum of values for each plot.
</layout>
</widget>
</item>
<item row="0" column="2">
<item row="2" column="7">
<widget class="QGroupBox" name="boxSave">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -2151,12 +1782,12 @@ Displays minimum, maximum and sum of values for each plot.
<property name="minimumSize">
<size>
<width>0</width>
<height>65</height>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
@ -2169,33 +1800,114 @@ Displays minimum, maximum and sum of values for each plot.
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_12">
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>4</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>6</number>
<number>9</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>0</number>
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="btnSave">
<item row="1" column="0">
<widget class="QPushButton" name="btnClone">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>20</red>
<green>20</green>
<blue>20</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clone</string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/new.png</normaloff>:/icons/images/new.png</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="btnSave">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
@ -2249,11 +1961,8 @@ Displays minimum, maximum and sum of values for each plot.
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/save.png</normaloff>:/icons/images/save.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
@ -2540,15 +2249,113 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="boxPlotType">
<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>350</width>
<height>65</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Plot Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QRadioButton" name="radioDataGraph">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</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="QRadioButton" name="radioNoPlot">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>No Plot</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<zorder>boxPlotType</zorder>
<zorder>box1D</zorder>
<zorder>boxFrequency</zorder>
<zorder>box2D</zorder>
<zorder>horizontalSpacer_6</zorder>
<zorder>boxSave</zorder>
<zorder>boxPlotAxis</zorder>
<zorder>boxSnapshot</zorder>
<zorder>boxSave</zorder>
</widget>
<tabstops>
<tabstop>radioNoPlot</tabstop>

View File

@ -1,63 +1,43 @@
#pragma once
#include "ui_form_cloneplot.h"
class SlsQtH1D;
class SlsQt1DPlot;
class SlsQt2DPlotLayout;
class SlsQt2DPlot;
#include <QString>
#include <QMainWindow>
class QwtSymbol;
class QGridLayout;
class QGroupBox;
class QLabel;
class QCloseEvent;
#include <QString>
#include <iostream>
#include <string>
class qCloneWidget : public QMainWindow {
class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
Q_OBJECT
public:
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
QString filePath, QString fileName, int imageIndex,
bool displayStats, QString min, QString max, QString sum);
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp,
QString title, QString filePath, QString fileName,
int64_t aIndex, bool displayStats, QString min, QString max,
QString sum);
~qCloneWidget();
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle, bool isZmax, bool isZmin, double zmin, double zmax);
SlsQt1DPlot *Get1dPlot();
public slots:
int SavePlotAutomatic();
private slots:
void SavePlot();
protected:
void closeEvent(QCloseEvent *event);
private:
void SetupWidgetWindow(QString title);
void DisplayStats(bool enable, QString min, QString max, QString sum);
signals:
void CloneClosedSignal(int);
private:
int id;
QString filePath;
QString fileName;
int imageIndex;
SlsQt1DPlot *cloneplot1D;
SlsQt2DPlotLayout *cloneplot2D;
QVector<SlsQtH1D *> cloneplot1D_hists;
SlsQt1DPlot *plot1d{nullptr};
SlsQt2DPlot *plot2d{nullptr};
SlsQt2DPlot *gainplot2d{nullptr};
QString filePath{"/"};
QString fileName{"run"};
int64_t acqIndex{0};
QwtSymbol *marker;
QwtSymbol *nomarker;
QGridLayout *mainLayout;
QGroupBox *boxPlot;
QLabel *lblHistTitle;
static int NumClones;
};

View File

@ -0,0 +1,34 @@
#pragma once
#include "ui_form_dac.h"
class multiSlsDetector;
#include "sls_detector_defs.h"
#include <string>
class qDacWidget:public QWidget, private Ui::WidgetDacObject {
Q_OBJECT
public:
qDacWidget(QWidget *parent, multiSlsDetector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t);
~qDacWidget();
void SetDetectorIndex(int id);
private slots:
void SetDac();
private:
void SetupWidgetWindow(std::string name);
void Initialization();
void GetDac();
void GetAdc();
void Refresh();
multiSlsDetector *myDet;
bool isDac{true};
slsDetectorDefs::dacIndex index;
bool isMillideg{false};
int detectorIndex{-1};
};

View File

@ -21,7 +21,7 @@ class qDefs : public QWidget {
*/
qDefs(){};
#define GOODBYE -200
static const int Q_FONT_SIZE=9;
static void DisplayExceptions(std::string emsg, std::string src) {
try {

View File

@ -1,18 +1,17 @@
#pragma once
#include "ui_form_plot.h"
#include "qDefs.h"
class detectorData;
class SlsQt1DPlot;
class SlsQtH1D;
class SlsQt2DPlotLayout;
class SlsQt2DPlot;
class qCloneWidget;
class QGridLayout;
class QGroupBox;
#include <QFutureWatcher>
class qDrawPlot : public QWidget {
class qDrawPlot : public QWidget, private Ui::PlotObject {
Q_OBJECT
public:
@ -52,13 +51,10 @@ class qDrawPlot : public QWidget {
void DisplayStatistics(bool enable);
void EnableGainPlot(bool enable);
void ClonePlot();
void CloseClones();
void SaveClones();
void SavePlot();
private slots:
void SetSaveFileName(QString val);
void CloneCloseEvent(int id);
void AcquireFinished();
void UpdatePlot();
@ -71,10 +67,7 @@ class qDrawPlot : public QWidget {
private:
void SetupWidgetWindow();
void Initialization();
void SetupStatistics();
void SetupPlots();
int LockLastImageArray();
int UnlockLastImageArray();
void GetStatistics(double &min, double &max, double &sum);
void DetachHists();
static void GetProgressCallBack(double currentProgress, void *this_pointer);
@ -97,20 +90,15 @@ class qDrawPlot : public QWidget {
SlsQt1DPlot *plot1d{nullptr};
QVector<SlsQtH1D *> hists1d;
SlsQt2DPlotLayout *plot2d{nullptr};
SlsQt2DPlotLayout *gainplot2d{nullptr};
SlsQt2DPlot *plot2d{nullptr};
SlsQt2DPlot *gainplot2d{nullptr};
QFutureWatcher<std::string> *acqResultWatcher;
QGridLayout *layout{nullptr};
QGroupBox *boxPlot{nullptr};
QGridLayout *plotLayout{nullptr};
bool is1d{true};
bool isRunning{false};
// titles
QString plotTitlePrefix{""};
QLabel *lblFrameIndexTitle1d{nullptr};
QString xTitle1d{"Channel Number"};
QString yTitle1d{"Counts"};
QString xTitle2d{"Pixel"};
@ -125,7 +113,7 @@ class qDrawPlot : public QWidget {
bool isZRange[2]{false, false};
// data
unsigned int nHists{1};
int nHists{1};
double *datax1d{nullptr};
std::vector<double *> datay1d;
double *data2d{nullptr};
@ -147,12 +135,7 @@ class qDrawPlot : public QWidget {
bool resetPedestal{false};
bool isAccumulate{false};
bool resetAccumulate{false};
QWidget *widgetStatistics{nullptr};
QLabel *lblMinDisp{nullptr};
QLabel *lblMaxDisp{nullptr};
QLabel *lblSumDisp{nullptr};
bool displayStatistics{false};
std::vector<qCloneWidget *> cloneWidgets;
QString fileSavePath{"/tmp"};
QString fileSaveName{"Image"};
bool hasGainData{false};
@ -162,7 +145,7 @@ class qDrawPlot : public QWidget {
int progress{0};
int64_t currentFrame{0};
mutable std::mutex mPlots;
pthread_mutex_t lastImageCompleteMutex;
int64_t currentAcqIndex{0};
unsigned int nPixelsX{0};
unsigned int nPixelsY{0};

View File

@ -1,42 +1,15 @@
#pragma once
#include "ui_form_tab_developer.h"
class qDacWidget;
class multiSlsDetector;
#include "sls_detector_defs.h"
#include <QDoubleSpinBox>
class QGroupBox;
class QLabel;
class MyDoubleSpinBox;
class QLineEdit;
class QComboBox;
class QSpinBox;
class QGridLayout;
class QString;
class QPalette;
class QGridLayout;
#include <string>
#include <vector>
/**To override the spin box class to have an id and emit it*/
class MyDoubleSpinBox: public QDoubleSpinBox{
Q_OBJECT
private:
int myId;
private slots:
void valueChangedWithID() {emit editingFinished(myId);};
public:
/** Overridden constructor from QDoubleSpinBox */
MyDoubleSpinBox(int id,QWidget* parent = 0) :QDoubleSpinBox(parent), myId(id){
connect(this, SIGNAL(editingFinished()), this, SLOT(valueChangedWithID()));
}
signals:
void editingFinished(int myId);
};
class qTabDeveloper:public QWidget {
class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject {
Q_OBJECT
public:
@ -47,28 +20,18 @@ public slots:
void Refresh();
private slots:
void GetAdcs();
void SetDac(int id);
void SetHighVoltage();
private:
void SetupWidgetWindow();
void Initialization();
void PopulateDetectors();
void CreateDACWidgets();
void CreateADCWidgets();
void CreateHVWidget();
void GetDac(int id);
void GetDacs();
void GetHighVoltage();
slsDetectorDefs::dacIndex getSLSIndex(int index);
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
multiSlsDetector *myDet;
slsDetectorDefs::detectorType detType;
int numDACWidgets;
int numADCWidgets;
std::vector<std::string>dacNames;
std::vector<std::string>adcNames;
std::vector<qDacWidget*> dacWidgets;
std::vector<qDacWidget*> adcWidgets;
enum hvVals {
HV_0,
@ -80,20 +43,6 @@ private:
HV_200
};
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;
QComboBox *comboDetector;
QGridLayout *layout;
static const int HV_MIN = 60;
static const int HV_MAX = 200;
};

View File

@ -114,9 +114,12 @@ class SlsQt1DPlot:public QwtPlot{
SlsQt1DPlot(QWidget* = NULL);
~SlsQt1DPlot();
void SetTitle(const char *t);
void SetXTitle(const char* title);
void SetYTitle(const char* title);
void SetTitle(QString title);
void SetXTitle(QString title);
void SetYTitle(QString title);
void SetTitleFont(const QFont& f);
void SetXFont(const QFont& f);
void SetYFont(const QFont& f);
void InsertHLine(double y);
void RemoveHLine();

View File

@ -1,19 +1,4 @@
/**
* @author Ian Johnson
* @version 1.0
* Modifications:
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
* without using mouse control:
* DisableZoom,
* SetXMinMax,SetYMinMax,
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
*/
#ifndef SLSQT2DPLOT_H
#define SLSQT2DPLOT_H
#pragma once
@ -33,7 +18,65 @@ class QwtLinearColorMap;
class SlsQt2DPlot: public QwtPlot{
Q_OBJECT
public:
SlsQt2DPlot(QWidget * = NULL);
void SetTitle(QString title);
void SetXTitle(QString title);
void SetYTitle(QString title);
void SetZTitle(QString title);
void SetTitleFont(const QFont& f);
void SetXFont(const QFont& f);
void SetYFont(const QFont& f);
void SetZFont(const QFont& f);
void UnZoom(bool replot=true);
void SetZoom(double xmin,double ymin,double x_width,double y_width);
void DisableZoom(bool disable);
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
double GetXMinimum(){return hist->GetXMin();};
double GetXMaximum(){return hist->GetXMax();};
double GetYMinimum(){return hist->GetYMin();};
double GetYMaximum(){return hist->GetYMax();};
double GetZMinimum(){ return hist->GetMinimum();}
double GetZMaximum(){ return hist->GetMaximum();}
void SetZMinMax(double zmin=0,double zmax=-1);
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
double GetZMean() { return hist->GetMean();}
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
}
double* GetDataPtr() {return hist->GetDataPtr();}
int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);}
int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);}
void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);}
double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);}
void FillTestPlot(int i=0);
void Update();
void SetInterpolate(bool enable);
void SetContour(bool enable);
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
void SetZRange(bool isMin, bool isMax, double min, double max);
void LogZ(bool on=1);
public slots:
void showSpectrogram(bool on);
private:
void SetupZoom();
void SetupColorMap();
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
QwtLinearColorMap* myColourMap(int log=0);
QwtPlotSpectrogram *d_spectrogram;
SlsQt2DHist* hist;
SlsQt2DZoomer* zoomer;
@ -50,67 +93,6 @@ private:
QList<double> contourLevelsLog;
#endif
bool disableZoom{false};
void SetupZoom();
void SetupColorMap();
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
QwtLinearColorMap* myColourMap(int log=0);
int isLog;
public:
SlsQt2DPlot(QWidget * = NULL);
// SlsQt2DHist *GetHistogram(){ return hist; }
void UnZoom(bool replot=true);
void SetZoom(double xmin,double ymin,double x_width,double y_width);
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
use zooming functionality without mouse control*/
void DisableZoom(bool disable);
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
double GetXMinimum(){return hist->GetXMin();};
double GetXMaximum(){return hist->GetXMax();};
double GetYMinimum(){return hist->GetYMin();};
double GetYMaximum(){return hist->GetYMax();};
/**---*/
double GetZMinimum(){ return hist->GetMinimum();}
double GetZMaximum(){ return hist->GetMaximum();}
void SetZMinMax(double zmin=0,double zmax=-1);
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
double GetZMean() { return hist->GetMean();}
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
}
double* GetDataPtr() {return hist->GetDataPtr();}
int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);}
int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);}
void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);}
double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);}
void FillTestPlot(int i=0);
void Update();
void LogZ(bool on=1);
void InterpolatedPlot(bool on);
void showContour(bool on);
public slots:
void showSpectrogram(bool on);
// void printPlot();
};
#endif

View File

@ -1,38 +0,0 @@
#pragma once
#include <qgroupbox.h>
#include <qwidget.h>
#include "SlsQt2DPlot.h"
class QGridLayout;
class QString;
class QToolButton;
class SlsQt2DPlotLayout : public QGroupBox {
Q_OBJECT
public:
SlsQt2DPlotLayout(QWidget * = NULL);
~SlsQt2DPlotLayout();
SlsQt2DPlot *GetPlot();
void SetXTitle(QString st);
void SetYTitle(QString st);
void SetZTitle(QString st);
void SetInterpolate(bool enable);
void SetContour(bool enable);
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
void SetZRange(bool isMin, bool isMax, double min, double max);
private:
void Layout();
QGridLayout *the_layout;
QToolButton *btnInterpolate;
QToolButton *btnContour;
QToolButton *btnLogz;
SlsQt2DPlot *the_plot;
bool isLog;
};

View File

@ -395,18 +395,34 @@ void SlsQt1DPlot::Update() {
replot();
}
void SlsQt1DPlot::SetTitle(const char *title) {
void SlsQt1DPlot::SetTitle(QString title) {
setTitle(title);
}
void SlsQt1DPlot::SetXTitle(const char *title) {
QwtText t(title);
t.setFont(QFont("Sans Serif", 11, QFont::Normal));
void SlsQt1DPlot::SetXTitle(QString title) {
setAxisTitle(QwtPlot::xBottom, title);
}
void SlsQt1DPlot::SetYTitle(QString title) {
setAxisTitle(QwtPlot::yLeft, title);
}
void SlsQt1DPlot::SetTitleFont(const QFont& f) {
QwtText t("");
t.setFont(f);
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
setTitle(t);
}
void SlsQt1DPlot::SetXFont(const QFont& f) {
QwtText t("");
t.setFont(f);
setAxisTitle(QwtPlot::xBottom, t);
}
void SlsQt1DPlot::SetYTitle(const char *title) {
QwtText t(title);
t.setFont(QFont("Sans Serif", 11, QFont::Normal));
void SlsQt1DPlot::SetYFont(const QFont& f) {
QwtText t("");
t.setFont(f);
setAxisTitle(QwtPlot::yLeft, t);
}

View File

@ -1,8 +1,5 @@
#include "SlsQt2DPlot.h"
/**
* @author Ian Johnson
* @version 1.0
*/
#include "ansi.h"
#include <cmath>
#include <iostream>
@ -22,7 +19,7 @@
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include "SlsQt2DPlot.h"
#if QWT_VERSION >= 0x060100
#define QwtLog10ScaleEngine QwtLogScaleEngine
@ -54,6 +51,48 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
Update();
}
void SlsQt2DPlot::SetTitle(QString title) {
setTitle(title);
}
void SlsQt2DPlot::SetXTitle(QString title) {
setAxisTitle(QwtPlot::xBottom, title);
}
void SlsQt2DPlot::SetYTitle(QString title) {
setAxisTitle(QwtPlot::yLeft, title);
}
void SlsQt2DPlot::SetZTitle(QString title) {
setAxisTitle(QwtPlot::yRight, title);
}
void SlsQt2DPlot::SetTitleFont(const QFont& f) {
QwtText t("");
t.setFont(f);
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
setTitle(t);
}
void SlsQt2DPlot::SetXFont(const QFont& f) {
QwtText t("");
t.setFont(f);
setAxisTitle(QwtPlot::xBottom, t);
}
void SlsQt2DPlot::SetYFont(const QFont& f) {
QwtText t("");
t.setFont(f);
setAxisTitle(QwtPlot::yLeft, t);
}
void SlsQt2DPlot::SetZFont(const QFont& f) {
QwtText t("");
t.setFont(f);
setAxisTitle(QwtPlot::yRight, t);
}
void SlsQt2DPlot::SetupColorMap() {
colorMapLinearScale = myColourMap(0);
@ -179,6 +218,45 @@ void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width, double y_wid
#endif
}
void SlsQt2DPlot::DisableZoom(bool disable) {
if (disableZoom != disable) {
disableZoom = disable;
#ifdef VERBOSE
if (disable)
std::cout << "Disabling zoom\n";
else
std::cout << "Enabling zoom\n";
#endif
if (disable) {
if (zoomer) {
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
}
if (panner)
panner->setMouseButton(Qt::NoButton);
} else {
if (zoomer) {
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
}
if (panner)
panner->setMouseButton(Qt::MidButton);
}
}
}
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
hist->SetMinMax(zmin, zmax);
}
@ -250,21 +328,33 @@ void SlsQt2DPlot::Update() {
}
void SlsQt2DPlot::showContour(bool on) {
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode, on);
void SlsQt2DPlot::SetInterpolate(bool enable) {
hist->Interpolate(enable);
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));
void SlsQt2DPlot::SetContour(bool enable) {
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode, enable);
Update();
}
void SlsQt2DPlot::InterpolatedPlot(bool on) {
hist->Interpolate(on);
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
LogZ(enable);
SetZRange(isMin, isMax, min, max);
}
void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max){
if(isLog) {
SetZMinimumToFirstGreaterThanZero();
}
// set zmin and zmax
if (isMin || isMax) {
double zmin = (isMin ? min : GetZMinimum());
double zmax = (isMax ? max : GetZMaximum());
SetZMinMax(zmin, zmax);
}
Update();
}
@ -303,44 +393,14 @@ void SlsQt2DPlot::LogZ(bool on) {
Update();
}
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
void SlsQt2DPlot::DisableZoom(bool disable) {
if (disableZoom != disable) {
disableZoom = disable;
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();
}
#ifdef VERBOSE
if (disable)
std::cout << "Disabling zoom\n";
else
std::cout << "Enabling zoom\n";
#endif
if (disable) {
if (zoomer) {
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
}
if (panner)
panner->setMouseButton(Qt::NoButton);
} else {
if (zoomer) {
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
}
if (panner)
panner->setMouseButton(Qt::MidButton);
}
}
}
/*
void SlsQt2DPlot::printPlot(){

View File

@ -1,81 +0,0 @@
#include "SlsQt2DPlotLayout.h"
#include "logger.h"
#include <iostream>
#include "ansi.h"
#include <qtoolbutton.h>
#include <qgroupbox.h>
#include <qgridlayout.h>
#include <qlabel.h>
#include <QString>
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
the_layout=0;
the_plot = new SlsQt2DPlot(this);
isLog = false;
Layout();
}
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
if(the_layout) delete the_layout;
delete the_plot;
}
SlsQt2DPlot* SlsQt2DPlotLayout::GetPlot(){
return the_plot;
}
void SlsQt2DPlotLayout::SetXTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
}
void SlsQt2DPlotLayout::SetYTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
}
void SlsQt2DPlotLayout::SetZTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
}
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
the_plot->InterpolatedPlot(enable);
}
void SlsQt2DPlotLayout::SetContour(bool enable) {
the_plot->showContour(enable);
}
void SlsQt2DPlotLayout::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
isLog = enable;
the_plot->LogZ(enable);
SetZRange(isMin, isMax, min, max);
}
void SlsQt2DPlotLayout::Layout(){
if(the_layout) delete the_layout;
the_layout = new QGridLayout(this);
the_layout->addWidget(the_plot,2,0,3,3);
}
void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){
if(isLog) {
the_plot->SetZMinimumToFirstGreaterThanZero();
}
// set zmin and zmax
if (isMin || isMax) {
double zmin = (isMin ? min : the_plot->GetZMinimum());
double zmax = (isMax ? max : the_plot->GetZMaximum());
the_plot->SetZMinMax(zmin, zmax);
}
the_plot->Update();
}

View File

@ -1,165 +1,82 @@
#include "qCloneWidget.h"
#include "qDefs.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
#include "SlsQt2DPlot.h"
#include "qwt_symbol.h"
#include <QWidget>
#include <QCloseEvent>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QAction>
#include <QCheckBox>
#include <QComboBox>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QSpacerItem>
#include <QFileDialog>
#include <QImage>
#include <QPainter>
#include <qwt_text.h>
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
int numDim, QString fPath, QString fName, int iIndex, bool displayStats, QString min, QString max, QString sum) :
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), imageIndex(iIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) {
// Window title
char winTitle[300], currTime[50];
strcpy(currTime, NowTime().c_str());
sprintf(winTitle, "Snapshot:%d - %s", id, currTime);
setWindowTitle(QString(winTitle));
int qCloneWidget::NumClones{0};
marker = new QwtSymbol();
nomarker = new QwtSymbol();
marker->setStyle(QwtSymbol::Cross);
marker->setSize(5, 5);
// Set up widget
SetupWidgetWindow(title, xTitle, yTitle, zTitle, numDim);
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp,
QString title, QString fPath, QString fName, int64_t aIndex,
bool displayStats, QString min, QString max, QString sum):
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
setupUi(this);
id = qCloneWidget::NumClones++;
SetupWidgetWindow(title);
DisplayStats(displayStats, min, max, sum);
}
qCloneWidget::~qCloneWidget() {
if (cloneplot1D)
delete cloneplot1D;
if (cloneplot2D)
delete cloneplot2D;
cloneplot1D_hists.clear();
if (marker)
delete marker;
if (nomarker)
delete nomarker;
if (mainLayout)
delete mainLayout;
if (boxPlot)
delete boxPlot;
if (lblHistTitle)
delete lblHistTitle;
if (plot1d)
delete plot1d;
if (plot2d)
delete plot2d;
if (gainplot2d)
delete gainplot2d;
}
SlsQt1DPlot* qCloneWidget::Get1dPlot() {
return cloneplot1D;
}
void qCloneWidget::SetupWidgetWindow(QString title) {
void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim) {
std::string winTitle = std::string("Snapshot:") + std::to_string(id) + std::string(" - ") + NowTime();
setWindowTitle(QString(winTitle.c_str()));
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
boxPlot = new QGroupBox(this);
QGridLayout* plotLayout = new QGridLayout(boxPlot);
boxPlot->setLayout(plotLayout);
boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif", 11, QFont::Normal));
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
boxPlot->setTitle(title);
boxPlot->setContentsMargins(0, 0, 0, 0);
// According to dimensions, create appropriate 1D or 2Dplot
if (numDim == 1) {
cloneplot1D = new SlsQt1DPlot(boxPlot);
cloneplot1D->setFont(QFont("Sans Serif", 9, QFont::Normal));
cloneplot1D->SetXTitle(xTitle.toAscii().constData());
cloneplot1D->SetYTitle(yTitle.toAscii().constData());
boxPlot->setFlat(false);
boxPlot->setContentsMargins(0, 30, 0, 0);
plotLayout->addWidget(cloneplot1D, 0, 0);
lblHistTitle = new QLabel("");
mainLayout->addWidget(lblHistTitle, 0, 0);
// 1d
if (plot1d != nullptr) {
plotLayout->addWidget(plot1d);
}
// 2d
else {
if (gainplot2d == nullptr) {
plotLayout->addWidget(plot2d);
} else {
cloneplot2D = new SlsQt2DPlotLayout(boxPlot);
cloneplot2D->setFont(QFont("Sans Serif", 9, QFont::Normal));
cloneplot2D->SetXTitle(xTitle);
cloneplot2D->SetYTitle(yTitle);
cloneplot2D->SetZTitle(zTitle);
cloneplot2D->setAlignment(Qt::AlignLeft);
boxPlot->setFlat(true);
boxPlot->setContentsMargins(0, 20, 0, 0);
plotLayout->addWidget(cloneplot2D, 0, 0);
}
// main window widgets
mainLayout->addWidget(boxPlot, 1, 0);
setCentralWidget(centralWidget);
// Save
connect(actionSave, SIGNAL(triggered()), this, SLOT(SavePlot()));
setMinimumHeight(300);
resize(500, 350);
}
void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers) {
//for each plot, create hists
for (unsigned int hist_num = 0; hist_num < nHists; ++hist_num) {
SlsQtH1D *h = new SlsQtH1D("1d plot", histNBins, histXAxis, histYAxis[hist_num]);
h->SetLineColor(0);
h->setStyle(lines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
#if QWT_VERSION < 0x060000
h->setSymbol(markers ? *marker : *nomarker);
#else
h->setSymbol(markers ? marker : nomarker);
#endif
cloneplot1D_hists.append(h);
h->Attach(cloneplot1D);
lblHistTitle->setText(histTitle);
gainplot2d->setFixedWidth(plot2d->width() / 4);
gainplot2d->setFixedHeight(plot2d->height() / 4);
plotLayout->addWidget(plot2d, 0, 0, 4, 4);
plotLayout->addWidget(gainplot2d, 0, 4, 1, 1);
}
}
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle, bool isZmax, bool isZmin, double zmin, double zmax) {
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
cloneplot2D->SetZRange(isZmin, isZmax, zmin, zmax);
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
}
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
if (enable) {
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
widgetStatistics->show();
} else {
widgetStatistics->hide();
}
}
void qCloneWidget::SavePlot() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
QString fName = filePath + QString('/') + fileName + QString("_clone") + QString("%1").arg(id) + QString("_acq") + QString("%1").arg(acqIndex) + QString(".png");
FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
//save
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
QImage img(centralwidget->size().width(), centralwidget->size().height(), QImage::Format_RGB32);
QPainter painter(&img);
boxPlot->render(&painter);
centralwidget->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()) {
@ -172,63 +89,3 @@ void qCloneWidget::SavePlot() {
}
}
}
int qCloneWidget::SavePlotAutomatic() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
//save
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
QPainter painter(&img);
boxPlot->render(&painter);
if (img.save(fName))
return 0;
else
return -1;
}
void qCloneWidget::closeEvent(QCloseEvent *event) {
emit CloneClosedSignal(id);
event->accept();
}
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
if (enable) {
QWidget *widgetStatistics = new QWidget(this);
widgetStatistics->setFixedHeight(15);
QHBoxLayout *hl1 = new QHBoxLayout;
hl1->setSpacing(0);
hl1->setContentsMargins(0, 0, 0, 0);
QLabel *lblMin = new QLabel("Min: ");
lblMin->setFixedWidth(40);
lblMin->setAlignment(Qt::AlignRight);
QLabel *lblMax = new QLabel("Max: ");
lblMax->setFixedWidth(40);
lblMax->setAlignment(Qt::AlignRight);
QLabel *lblSum = new QLabel("Sum: ");
lblSum->setFixedWidth(40);
lblSum->setAlignment(Qt::AlignRight);
QLabel *lblMinDisp = new QLabel(min);
lblMinDisp->setAlignment(Qt::AlignLeft);
QLabel *lblMaxDisp = new QLabel(max);
lblMaxDisp->setAlignment(Qt::AlignLeft);
QLabel *lblSumDisp = new QLabel(sum);
lblSumDisp->setAlignment(Qt::AlignLeft);
hl1->addItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));
hl1->addWidget(lblMin);
hl1->addWidget(lblMinDisp);
hl1->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));
hl1->addWidget(lblMax);
hl1->addWidget(lblMaxDisp);
hl1->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));
hl1->addWidget(lblSum);
hl1->addWidget(lblSumDisp);
hl1->addItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));
widgetStatistics->setLayout(hl1);
mainLayout->addWidget(widgetStatistics, 2, 0);
widgetStatistics->show();
}
}

View File

@ -0,0 +1,93 @@
#include "qDacWidget.h"
#include "qDefs.h"
#include <iostream>
qDacWidget::qDacWidget(QWidget *parent, multiSlsDetector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t) :
QWidget(parent), myDet(detector), isDac(d), index(i), isMillideg(t) {
setupUi(this);
SetupWidgetWindow(n);
}
qDacWidget::~qDacWidget() {}
void qDacWidget::SetupWidgetWindow(std::string name) {
lblDac->setText(name.c_str());
if (isDac) {
spinDac->setDecimals(0);
} else {
spinDac->setSuffix(0x00b0 + QString("C"));
spinDac->setReadOnly(true);
lblDacmV->setMinimumWidth(0);
lblDacmV->setMaximumWidth(0);
}
Initialization();
Refresh();
}
void qDacWidget::Initialization() {
if (isDac) {
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
}
}
void qDacWidget::SetDetectorIndex(int id) {
detectorIndex = id;
Refresh();
}
void qDacWidget::GetDac() {
FILE_LOG(logDEBUG) << "Getting Dac " << index;
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
try {
// dac units
auto retval = myDet->setDAC(-1, index, 0, detectorIndex);
spinDac->setValue(retval);
// mv
retval = myDet->setDAC(-1, index, 1, detectorIndex);
lblDacmV->setText(QString("%1mV").arg(retval -10));
} CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac")
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
}
void qDacWidget::SetDac() {
int val = (int)spinDac->value();
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
try {
myDet->setDAC(val, index, 0, detectorIndex);
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
// update mV anyway
GetDac();
}
void qDacWidget::GetAdc() {
FILE_LOG(logDEBUG) << "Getting ADC " << index;
try {
auto retval = myDet->getADC(index, detectorIndex);
if (retval == -1 && detectorIndex == -1) {
spinDac->setValue(-1);
} else {
if (isMillideg) {
retval /= 1000.00;
}
spinDac->setValue(retval);
}
} CATCH_DISPLAY (std::string("Could not get adc ") + std::to_string(index), "qDacWidget::GetAdc")
}
void qDacWidget::Refresh() {
if (isDac) {
GetDac();
} else {
GetAdc();
}
}

View File

@ -142,6 +142,7 @@ qDetectorMain::~qDetectorMain() {
}
void qDetectorMain::SetUpWidgetWindow() {
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
// plot setup
myPlot = new qDrawPlot(dockWidgetPlot, myDet);

View File

@ -1,20 +1,18 @@
#include "qDrawPlot.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
#include "SlsQt2DPlot.h"
#include "detectorData.h"
#include "qCloneWidget.h"
#include <QGridLayout>
#include <QLabel>
#include <QFileDialog>
#include <QPainter>
#include <QtConcurrentRun>
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector)
: QWidget(parent), myDet(detector) {
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) {
setupUi(this);
SetupWidgetWindow();
FILE_LOG(logINFO) << "Plots ready";
}
@ -47,38 +45,10 @@ qDrawPlot::~qDrawPlot() {
delete [] pedestalVals;
if (tempPedestalVals)
delete [] tempPedestalVals;
for (auto &it : cloneWidgets) {
delete it;
}
if (lblFrameIndexTitle1d)
delete lblFrameIndexTitle1d;
if (boxPlot)
delete boxPlot;
if (layout)
delete layout;
if (plotLayout)
delete plotLayout;
if (widgetStatistics)
delete widgetStatistics;
if (lblMinDisp)
delete lblMinDisp;
if (lblMaxDisp)
delete lblMaxDisp;
if (lblSumDisp)
delete lblSumDisp;
}
void qDrawPlot::SetupWidgetWindow() {
detType = myDet->getDetectorTypeAsEnum();
pthread_mutex_init(&lastImageCompleteMutex, NULL);
// frame index 1d
lblFrameIndexTitle1d = new QLabel("");
lblFrameIndexTitle1d->setFixedHeight(10);
// save
try {
std::string temp = myDet->getFilePath();
@ -92,11 +62,9 @@ void qDrawPlot::SetupWidgetWindow() {
}
SetupPlots();
SetupStatistics();
SetDataCallBack(true);
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
myDet->registerProgressCallback(&(GetProgressCallBack), this);
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
acqResultWatcher = new QFutureWatcher<std::string>();
@ -108,44 +76,8 @@ void qDrawPlot::Initialization() {
connect(acqResultWatcher, SIGNAL(finished()), this, SLOT(AcquireFinished()));
}
void qDrawPlot::SetupStatistics() {
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);
lblMinDisp = new QLabel("-");
lblMinDisp->setAlignment(Qt::AlignLeft);
lblMaxDisp = new QLabel("-");
lblMaxDisp->setAlignment(Qt::AlignLeft);
lblSumDisp = new QLabel("-");
lblSumDisp->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
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);
layout->addWidget(widgetStatistics, 2, 0);
widgetStatistics->hide();
}
void qDrawPlot::SetupPlots() {
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
// default image size
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
@ -158,17 +90,8 @@ void qDrawPlot::SetupPlots() {
FILE_LOG(logINFO) << "nPixelsX:" << nPixelsX;
FILE_LOG(logINFO) << "nPixelsY:" << nPixelsY;
// plot layout
layout = new QGridLayout;
this->setLayout(layout);
setFont(QFont("Sans Serif", 9));
boxPlot = new QGroupBox("");
layout->addWidget(boxPlot, 1, 0);
boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif", 11, QFont::Normal));
boxPlot->setTitle("Sample Plot");
boxPlot->setFlat(true);
boxPlot->setContentsMargins(0, 15, 0, 0);
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
widgetStatistics->hide();
// setup 1d data
if (datax1d)
@ -194,9 +117,13 @@ void qDrawPlot::SetupPlots() {
hists1d.append(h);
// setup 1d plot
plot1d = new SlsQt1DPlot(boxPlot);
plot1d->setFont(QFont("Sans Serif", 9, QFont::Normal));
plot1d->SetXTitle(xTitle1d.toAscii().constData());
plot1d->SetYTitle(yTitle1d.toAscii().constData());
plot1d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot1d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot1d->SetTitle("--");
plot1d->SetXTitle(xTitle1d);
plot1d->SetYTitle(yTitle1d);
plot1d->hide();
h->Attach(plot1d);
@ -222,29 +149,30 @@ void qDrawPlot::SetupPlots() {
pow(double(py) - nPixelsY / 2, 2) / pow(nPixelsY / 2, 2)) /
sqrt(2);
// setup 2d plot
plot2d = new SlsQt2DPlotLayout(boxPlot);
plot2d->setFont(QFont("Sans Serif", 9, QFont::Normal));
plot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
plot2d = new SlsQt2DPlot(boxPlot);
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
-0.5, nPixelsY - 0.5, data2d);
plot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot2d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot2d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot2d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot2d->SetZFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
plot2d->setTitle("");
plot2d->SetXTitle(xTitle2d);
plot2d->SetYTitle(yTitle2d);
plot2d->SetZTitle(zTitle2d);
plot2d->setAlignment(Qt::AlignLeft);
gainplot2d = new SlsQt2DPlotLayout(boxPlot);
gainplot2d->setFont(QFont("Sans Serif", 9, QFont::Normal));
gainplot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
gainplot2d = new SlsQt2DPlot(boxPlot);
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
-0.5, nPixelsY - 0.5, gainData);
gainplot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
gainplot2d->setTitle("");
gainplot2d->setAlignment(Qt::AlignLeft);
gainplot2d->GetPlot()->enableAxis(0, false);
gainplot2d->GetPlot()->enableAxis(1, false);
gainplot2d->GetPlot()->enableAxis(2, false);
gainplot2d->enableAxis(0, false);
gainplot2d->enableAxis(1, false);
gainplot2d->enableAxis(2, false);
gainplot2d->hide();
// layout of plots
plotLayout = new QGridLayout(boxPlot);
plotLayout->setContentsMargins(0, 0, 0, 0);
plotLayout->addWidget(plot1d, 0, 0, 4, 4);
plotLayout->addWidget(plot2d, 0, 0, 4, 4);
plotLayout->addWidget(gainplot2d, 0, 4, 1, 1);
@ -270,24 +198,18 @@ void qDrawPlot::Select1dPlot(bool enable) {
if (enable) {
is1d = true;
// DetachHists(); it clears the last measurement
plot1d->SetXTitle(xTitle1d.toAscii().constData());
plot1d->SetYTitle(yTitle1d.toAscii().constData());
plot1d->SetXTitle(xTitle1d);
plot1d->SetYTitle(yTitle1d);
plot1d->show();
plot2d->hide();
boxPlot->setFlat(false);
layout->addWidget(lblFrameIndexTitle1d, 0, 0);
plotLayout->setContentsMargins(10, 10, 10, 10);
} else {
is1d = false;
plot2d->SetTitle("");
plot2d->SetXTitle(xTitle2d);
plot2d->SetYTitle(yTitle2d);
plot2d->SetZTitle(zTitle2d);
plot1d->hide();
plot2d->show();
boxPlot->setFlat(true);
lblFrameIndexTitle1d->setText("");
layout->removeWidget(lblFrameIndexTitle1d);
plotLayout->setContentsMargins(0, 0, 0, 0);
}
}
@ -339,28 +261,28 @@ double qDrawPlot::GetXMinimum() {
if (is1d)
return plot1d->GetXMinimum();
else
return plot2d->GetPlot()->GetXMinimum();
return plot2d->GetXMinimum();
}
double qDrawPlot::GetXMaximum() {
if (is1d)
return plot1d->GetXMaximum();
else
return plot2d->GetPlot()->GetXMaximum();
return plot2d->GetXMaximum();
}
double qDrawPlot::GetYMinimum() {
if (is1d)
return plot1d->GetYMinimum();
else
return plot2d->GetPlot()->GetYMinimum();
return plot2d->GetYMinimum();
}
double qDrawPlot::GetYMaximum() {
if (is1d)
return plot1d->GetYMaximum();
else
return plot2d->GetPlot()->GetYMaximum();
return plot2d->GetYMaximum();
}
void qDrawPlot::SetDataCallBack(bool enable) {
@ -391,7 +313,7 @@ void qDrawPlot::SetLines(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable << std::noboolalpha;
isLines = enable;
for (unsigned int i = 0; i < nHists; ++i) {
for (int i = 0; i < nHists; ++i) {
SlsQtH1D* h = hists1d.at(i);
h->setStyleLinesorDots(isLines);
}
@ -401,7 +323,7 @@ void qDrawPlot::SetMarkers(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable << std::noboolalpha;
isMarkers = enable;
for (unsigned int i = 0; i < nHists; ++i) {
for (int i = 0; i < nHists; ++i) {
SlsQtH1D* h = hists1d.at(i);
h->setSymbolMarkers(isMarkers);
}
@ -475,70 +397,59 @@ void qDrawPlot::SetSaveFileName(QString val) {
void qDrawPlot::ClonePlot() {
std::lock_guard<std::mutex> lock(mPlots);
int index = 0;
SlsQt1DPlot* cloneplot1D = nullptr;
SlsQt2DPlot* cloneplot2D = nullptr;
SlsQt2DPlot* clonegainplot2D = nullptr;
if (is1d) {
FILE_LOG(logINFO) << "Cloning 1D Image";
qCloneWidget *q = new qCloneWidget(
this, cloneWidgets.size(), boxPlot->title(), xTitle1d, yTitle1d, "", 1,
fileSavePath, fileSaveName, currentFrame, displayStatistics, lblMinDisp->text(),
lblMaxDisp->text(), lblSumDisp->text());
cloneWidgets.push_back(q);
index = cloneWidgets.size();
cloneWidgets[index]->SetCloneHists(nHists, nPixelsX, datax1d, datay1d,
lblFrameIndexTitle1d->text(), isLines, isMarkers);
FILE_LOG(logDEBUG) << "Cloning 1D Image";
cloneplot1D = new SlsQt1DPlot();
cloneplot1D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot1D->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot1D->SetTitle(plot1d->title().text());
cloneplot1D->SetXTitle(xTitle1d);
cloneplot1D->SetYTitle(yTitle1d);
QVector<SlsQtH1D *> cloneplotHists1D;
for (int iHist = 0; iHist < nHists; ++iHist) {
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[iHist]);
h->SetLineColor(iHist);
h->setStyleLinesorDots(isLines);
h->setSymbolMarkers(isMarkers);
cloneplotHists1D.append(h);
h->Attach(cloneplot1D);
}
} else {
FILE_LOG(logINFO) << "Cloning 2D Image";
qCloneWidget *q = new qCloneWidget(
this, cloneWidgets.size(), boxPlot->title(), xTitle2d, yTitle2d, zTitle2d, 2,
fileSavePath, fileSaveName, currentFrame, displayStatistics, lblMinDisp->text(),
lblMaxDisp->text(), lblSumDisp->text());
cloneWidgets.push_back(q);
index = cloneWidgets.size();
cloneWidgets[index]->SetCloneHists2D(nPixelsX, -0.5, nPixelsX - 0.5,
nPixelsY, -0.5, nPixelsY - 0.5,
data2d, plot2d->title(), isZRange[0], isZRange[1], zRange[0], zRange[1]);
}
FILE_LOG(logDEBUG) << "Cloning 2D Image";
cloneplot2D = new SlsQt2DPlot();
cloneplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot2D->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot2D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot2D->SetZFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
cloneplot2D->setTitle(plot2d->title().text());
cloneplot2D->SetXTitle(xTitle2d);
cloneplot2D->SetYTitle(yTitle2d);
cloneplot2D->SetZTitle(zTitle2d);
cloneplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
cloneplot2D->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
cloneWidgets[index]->show();
// to remember which all clone widgets were closed
connect(cloneWidgets[index], SIGNAL(CloneClosedSignal(int)), this, SLOT(CloneCloseEvent(int)));
}
void qDrawPlot::CloseClones() {
FILE_LOG(logDEBUG) << "Closing all Clones";
for (auto &it : cloneWidgets) {
it->close();
if (isGainDataExtracted) {
clonegainplot2D = new SlsQt2DPlot();
clonegainplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
clonegainplot2D->enableAxis(0, false);
clonegainplot2D->enableAxis(1, false);
clonegainplot2D->enableAxis(2, false);
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
clonegainplot2D->SetTitle(gainplot2d->title().text());
}
}
void qDrawPlot::CloneCloseEvent(int id) {
FILE_LOG(logDEBUG) << "Closing Clone " << id;
cloneWidgets.erase(cloneWidgets.begin() + id);
}
void qDrawPlot::SaveClones() {
FILE_LOG(logINFO) << "Saving all Clones";
char errID[200];
std::string errMessage = "The Snapshots with ID's: ";
bool success = true;
for (unsigned int i = 0; i < cloneWidgets.size(); ++i) {
if (cloneWidgets[i]->SavePlotAutomatic()) {
success = false;
sprintf(errID, "%d", i);
errMessage.append(std::string(errID) + std::string(", "));
}
}
if (success) {
qDefs::Message(
qDefs::INFORMATION,
"The Snapshots have all been saved successfully in .png.", "Dock");
} else {
qDefs::Message(qDefs::WARNING,
errMessage + std::string("were not saved."),
"qDrawPlot::SaveClones");
FILE_LOG(logWARNING) << errMessage << "were not saved";
}
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot2D,
boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
q->show();
}
void qDrawPlot::SavePlot() {
@ -547,10 +458,13 @@ void qDrawPlot::SavePlot() {
QPainter painter(&savedImage);
render(&painter);
QString fName = fileSavePath + QString('/') + fileSaveName + QString('_') + currentFrame + QString('_') + QString(NowTime().c_str()) + QString(".png");
fName = QFileDialog::getSaveFileName(
0, tr("Save Image"), fName,
tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
QString fName = fileSavePath + QString('/') +
fileSaveName +
QString('_') + (is1d ? plot1d->title().text() : plot2d->title().text()) +
QString('_') + QString("%1").arg(currentAcqIndex) +
QString(".png");
fName = QFileDialog::getSaveFileName(0, tr("Save Image"), fName, tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()) {
@ -699,6 +613,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
<< " ]";
progress = (int)data->progressIndex;
currentAcqIndex = data->fileIndex;
currentFrame = frameIndex;
FILE_LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame << " ]";
@ -774,11 +689,6 @@ void qDrawPlot::Get1dData(double* rawData) {
// allocate
for(int i = datay1d.size(); i <= persistency; ++i) {
datay1d.push_back(new double [nPixelsX]);
SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]);
h->SetLineColor(i);
h->setStyleLinesorDots(isLines);
h->setSymbolMarkers(isMarkers);
hists1d.append(h);
}
// copy previous data
for (int i = currentPersistency; i > 0; --i)
@ -848,12 +758,22 @@ void qDrawPlot::Get2dData(double* rawData) {
void qDrawPlot::Update1dPlot() {
DetachHists();
plot1d->SetXTitle(xTitle1d.toAscii().constData());
plot1d->SetYTitle(yTitle1d.toAscii().constData());
for (unsigned int i = 0; i < nHists; ++i) {
plot1d->SetTitle(indexTitle);
plot1d->SetXTitle(xTitle1d);
plot1d->SetYTitle(yTitle1d);
for (int i = 0; i < nHists; ++i) {
if (i < hists1d.size()) {
SlsQtH1D* h = hists1d.at(i);
h->SetData(nPixelsX, datax1d, datay1d[i]);
h->Attach(plot1d);
} else {
SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]);
h->SetLineColor(i);
h->setStyleLinesorDots(isLines);
h->setSymbolMarkers(isMarkers);
hists1d.append(h);
h->Attach(plot1d);
}
}
if (xyRangeChanged) {
Update1dXYRange();
@ -863,13 +783,15 @@ void qDrawPlot::Update1dPlot() {
}
void qDrawPlot::Update2dPlot() {
plot2d->SetTitle(indexTitle);
plot2d->SetXTitle(xTitle2d);
plot2d->SetYTitle(yTitle2d);
plot2d->SetZTitle(zTitle2d);
plot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5,
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5,
nPixelsY, -0.5, nPixelsY - 0.5, data2d);
if (isGainDataExtracted) {
gainplot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
gainplot2d->SetTitle(indexTitle);
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
-0.5, nPixelsY - 0.5, gainData);
gainplot2d->setFixedWidth(plot2d->width() / 4);
gainplot2d->setFixedHeight(plot2d->height() / 4);
@ -881,7 +803,7 @@ void qDrawPlot::Update2dPlot() {
Update2dXYRange();
xyRangeChanged = false;
}
plot2d->GetPlot()->DisableZoom(disableZoom);
plot2d->DisableZoom(disableZoom);
plot2d->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
}
@ -906,21 +828,21 @@ void qDrawPlot::Update1dXYRange() {
void qDrawPlot::Update2dXYRange() {
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
plot2d->GetPlot()->EnableXAutoScaling();
plot2d->EnableXAutoScaling();
} else {
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot2d->GetPlot()->GetXMinimum());
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot2d->GetPlot()->GetXMaximum());
plot2d->GetPlot()->SetXMinMax(xmin, xmax);
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot2d->GetXMinimum());
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot2d->GetXMaximum());
plot2d->SetXMinMax(xmin, xmax);
}
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
plot2d->GetPlot()->EnableYAutoScaling();
plot2d->EnableYAutoScaling();
} else {
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot2d->GetPlot()->GetYMinimum());
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot2d->GetPlot()->GetYMaximum());
plot2d->GetPlot()->SetYMinMax(ymin, ymax);
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot2d->GetYMinimum());
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot2d->GetYMaximum());
plot2d->SetYMinMax(ymin, ymax);
}
plot2d->GetPlot()->Update();
plot2d->Update();
}
void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest) {
@ -1000,12 +922,8 @@ void qDrawPlot::UpdatePlot() {
boxPlot->setTitle(plotTitle);
if (is1d) {
lblFrameIndexTitle1d->setText(indexTitle);
Update1dPlot();
} else {
plot2d->setTitle(indexTitle.toAscii().constData());
if (isGainDataExtracted)
gainplot2d->setTitle(indexTitle.toAscii().constData());
Update2dPlot();
}

View File

@ -1,167 +1,123 @@
#include "qTabDeveloper.h"
#include "qDefs.h"
#include <QWidget>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QScrollArea>
#include <QTimer>
#include <QString>
#include <QPalette>
#include <QDoubleValidator>
#include <QSpacerItem>
#include <QString>
#include "qDacWidget.h"
#include <iostream>
qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) :
QWidget(parent), myDet(detector), detType(slsDetectorDefs::GENERIC), numDACWidgets(0), numADCWidgets(0),
boxDacs(nullptr), boxAdcs(nullptr), lblHV(nullptr), comboHV(nullptr), spinHV(nullptr), dacLayout(nullptr), comboDetector(nullptr), layout(nullptr) {
qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) {
setupUi(this);
SetupWidgetWindow();
FILE_LOG(logDEBUG) << "Developer ready";
}
qTabDeveloper::~qTabDeveloper() {
for (size_t i = 0; i < lblDacs.size(); ++i) {
delete lblDacs[i];
delete lblDacsmV[i];
delete spinDacs[i];
}
for (size_t i = 0; i < lblAdcs.size(); ++i) {
delete lblAdcs[i];
delete spinAdcs[i];
}
if (boxDacs)
delete boxDacs;
if (boxAdcs)
delete boxAdcs;
if (lblHV)
delete lblHV;
if (comboHV)
delete comboHV;
if (spinHV)
delete spinHV;
if (dacLayout)
delete dacLayout;
if (comboDetector)
delete comboDetector;
if (layout)
delete layout;
}
qTabDeveloper::~qTabDeveloper() {}
void qTabDeveloper::SetupWidgetWindow() {
detType = myDet->getDetectorTypeAsEnum();
int tempid = 0;
comboHV->hide();
lblComboHV->hide();
lblSpinHV->hide();
spinHV->hide();
try{
slsDetectorDefs::detectorType detType = myDet->getDetectorTypeAsEnum();
switch (detType) {
case slsDetectorDefs::EIGER:
numDACWidgets = 17;
numADCWidgets = 6;
dacNames.push_back("v SvP:");
dacNames.push_back("v SvN");
dacNames.push_back("v Vrf:");
dacNames.push_back("v Vrs:");
dacNames.push_back("v Vtr:");
dacNames.push_back("v Vtgstv:");
dacNames.push_back("v cal:");
dacNames.push_back("v Vcp");
dacNames.push_back("v Vcn:");
dacNames.push_back("v Vis:");
dacNames.push_back("v rxb_lb:");
dacNames.push_back("v rxb_rb:");
dacNames.push_back("v Vcmp_ll:");
dacNames.push_back("v Vcmp_lr:");
dacNames.push_back("v Vcmp_rl:");
dacNames.push_back("v Vcmp_rr:");
dacNames.push_back("v threshold:");
adcNames.push_back("Temperature FPGA Ext:");
adcNames.push_back("Temperature 10GE:");
adcNames.push_back("Temperature DCDC:");
adcNames.push_back("Temperature SODL:");
adcNames.push_back("Temperature SODR:");
adcNames.push_back("Temperature FPGA:");
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v SvP: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v SvN ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vrf: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vrs: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vtr: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vtgstv: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v cal: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcp ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcn: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vis: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v rxb_lb: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v rxb_rb: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_ll: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_lr: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_rl: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_rr: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v threshold: ", getSLSIndex(detType, tempid++), false));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA Ext: ", getSLSIndex(detType, tempid++), true));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature 10GE: ", getSLSIndex(detType, tempid++), true));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature DCDC: ", getSLSIndex(detType, tempid++), true));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature SODL: ", getSLSIndex(detType, tempid++), true));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature SODR: ", getSLSIndex(detType, tempid++), true));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), true));
break;
case slsDetectorDefs::GOTTHARD:
numDACWidgets = 8;
numADCWidgets = 2;
dacNames.push_back("v Reference:");
dacNames.push_back("v Cascode n:");
dacNames.push_back("v Cascode p:");
dacNames.push_back("v Comp. Output:");
dacNames.push_back("v Cascode out");
dacNames.push_back("v Comp. Input:");
dacNames.push_back("v Comp. Ref:");
dacNames.push_back("i Base Test:");
adcNames.push_back("Temperature ADC:");
adcNames.push_back("Temperature FPGA:");
comboHV->show();
lblComboHV->show();
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Reference: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode n: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode p: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Output: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode out ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Input: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Ref: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i Base Test: ", getSLSIndex(detType, tempid++), false));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature ADC: ", getSLSIndex(detType, tempid++), false));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), false));
break;
case slsDetectorDefs::JUNGFRAU:
numDACWidgets = 8;
numADCWidgets = 1;
dacNames.push_back("v vb comp:");
dacNames.push_back("v vdd prot:");
dacNames.push_back("v vin com:");
dacNames.push_back("v vref prech:");
dacNames.push_back("v vb pixbuf:");
dacNames.push_back("v vb ds:");
dacNames.push_back("v vref ds:");
dacNames.push_back("i vref comp:");
adcNames.push_back("Temperature ADC/FPGA:");
lblSpinHV->show();
spinHV->show();
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb comp: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vdd prot: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vin com: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vref prech: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb pixbuf: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb ds: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vref ds: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i vref comp: ", getSLSIndex(detType, tempid++), false));
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature ADC/FPGA: ", getSLSIndex(detType, tempid++), true));
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:");
lblSpinHV->show();
spinHV->show();
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 0: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 1: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 2: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 3: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 4: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 5: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 6: ", getSLSIndex(detType, tempid++), false));
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i Dac 7: ", getSLSIndex(detType, tempid++), false));
break;
default:
break;
}
} CATCH_DISPLAY (std::string("Could not get dac/ adc index ") + std::to_string(tempid), "qTabDeveloper::SetupWidgetWindow")
setFixedWidth(765);
setFixedHeight(20 + 50 + (numDACWidgets / 2) * 35);
QScrollArea* scroll = new QScrollArea;
scroll->setWidget(this);
scroll->setWidgetResizable(true);
layout = new QGridLayout(scroll);
layout->setContentsMargins(20, 10, 10, 5);
setLayout(layout);
for (size_t i = 0; i < dacWidgets.size(); ++i) {
gridlayoutDac->addWidget(dacWidgets[i], i / 2, i % 2);
}
gridlayoutDac->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Expanding),dacWidgets.size(), 0);
for (size_t i = 0; i < adcWidgets.size(); ++i) {
gridlayoutAdc->addWidget(adcWidgets[i], i / 2, i % 2);
}
gridlayoutAdc->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Expanding),adcWidgets.size(), 0);
tabWidget->setCurrentIndex(0);
comboDetector = new QComboBox(this);
PopulateDetectors();
CreateDACWidgets();
CreateHVWidget();
layout->addWidget(comboDetector, 0, 0);
layout->addWidget(boxDacs, 1, 0);
CreateADCWidgets();
Initialization();
Refresh();
}
void qTabDeveloper::Initialization() {
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(Refresh()));
for (int i = 0; i < numDACWidgets; ++i)
connect(spinDacs[i], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int)));
if (comboHV != nullptr) {
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
}
if (spinHV != nullptr) {
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
}
}
void qTabDeveloper::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors";
@ -172,185 +128,22 @@ void qTabDeveloper::PopulateDetectors() {
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
}
}
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.push_back(new QLabel(QString(dacNames[i].c_str()), boxDacs));
spinDacs.push_back(new MyDoubleSpinBox(i, boxDacs));
spinDacs[i]->setMinimum(-1);
spinDacs[i]->setMaximum(10000);
lblDacsmV.push_back(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() {
if (!numADCWidgets)
return;
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.push_back(new QLabel(QString(adcNames[i].c_str()), boxAdcs));
spinAdcs.push_back(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);
}
layout->addWidget(boxAdcs, 2, 0);
}
void qTabDeveloper::CreateHVWidget() {
switch(detType) {
case slsDetectorDefs::GOTTHARD:
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
break;
default:
return;
}
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");
comboHV->addItem("120");
comboHV->addItem("150");
comboHV->addItem("180");
comboHV->addItem("200");
comboHV->setToolTip("<nobr>Set high voltage to 0, 90, 110, 120, 150 or 200V.</nobr>");
lblHV->setToolTip(comboHV->toolTip());
dacLayout->addWidget(comboHV, (int)(numDACWidgets / 2), 2);
}
// jungfrau, moench (range of values)
else {
spinHV = new QSpinBox(boxDacs);
spinHV->setMinimum(-1);
spinHV->setMaximum(HV_MAX);
spinHV->setToolTip("<nobr>Set high voltage to 0 or 60 - 200V</nobr>");
lblHV->setToolTip(spinHV->toolTip());
dacLayout->addWidget(spinHV, (int)(numDACWidgets / 2), 2);
}
}
void qTabDeveloper::GetDac(int id) {
FILE_LOG(logDEBUG) << "Getting Dac " << id;
disconnect(spinDacs[id], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int)));
try {
// dac units
auto retval = myDet->setDAC(-1, getSLSIndex(id), 0, comboDetector->currentIndex() - 1);
spinDacs[id]->setValue(retval);
// mv
retval = myDet->setDAC(-1, getSLSIndex(id), 1, comboDetector->currentIndex() - 1);
lblDacsmV[id]->setText(QString("%1mV").arg(retval -10));
} CATCH_DISPLAY("Could not get dac.", "qTabDeveloper::GetDac")
connect(spinDacs[id], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int)));
}
void qTabDeveloper::GetDacs() {
FILE_LOG(logDEBUG) << "Getting All Dacs";
for (int i = 0; i < numDACWidgets; ++i) {
GetDac(i);
}
}
void qTabDeveloper::SetDac(int id) {
int val = spinDacs[id]->value();
FILE_LOG(logINFO) << "Setting dac:" << dacNames[id] << " : " << val;
try {
myDet->setDAC(val, getSLSIndex(id), 0, comboDetector->currentIndex() - 1);
} CATCH_DISPLAY ("Could not set dac.", "qTabDeveloper::SetDac")
// update mV anyway
GetDac(id);
}
void qTabDeveloper::GetAdcs() {
FILE_LOG(logDEBUG) << "Getting ADCs";
auto moduleId = comboDetector->currentIndex() - 1;
for (int i = 0; i < numADCWidgets; ++i) {
try {
auto retval = myDet->getADC(getSLSIndex(i + numDACWidgets), moduleId);
if (retval == -1 && moduleId == -1) {
spinAdcs[i]->setText(QString("Different values"));
} else {
if (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::JUNGFRAU) {
retval /= 1000.00;
}
spinAdcs[i]->setText(QString::number(retval, 'f', 2) + 0x00b0 + QString("C"));
}
} CATCH_DISPLAY ("Could not get adcs.", "qTabDeveloper::GetAdcs")
}
comboDetector->setCurrentIndex(0);
}
void qTabDeveloper::GetHighVoltage() {
// not enabled for this detector type
if (comboHV == nullptr && spinHV == nullptr)
// not enabled for eiger
if (!comboHV->isVisible() && !spinHV->isVisible())
return;
FILE_LOG(logDEBUG) << "Getting High Voltage";
if (spinHV != nullptr) {
disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
}
if (comboHV != nullptr) {
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
}
try {
// dac units
auto retval = myDet->setDAC(-1, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1);
if (spinHV != nullptr) {
if (spinHV->isVisible()) {
if (retval != 0 && retval != -1 && retval < HV_MIN && retval > HV_MAX) {
qDefs::Message(qDefs::WARNING, std::string("Unknown High Voltage: ") + std::to_string(retval), "qTabDeveloper::GetHighVoltage");
} else{
@ -390,16 +183,12 @@ void qTabDeveloper::GetHighVoltage() {
} CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
if (spinHV != nullptr) {
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
}
if (comboHV != nullptr) {
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
}
}
void qTabDeveloper::SetHighVoltage() {
int val = (comboHV ? comboHV->currentText().toInt() : spinHV->value());
int val = (comboHV->isVisible() ? comboHV->currentText().toInt() : spinHV->value());
FILE_LOG(logINFO) << "Setting high voltage:" << val;
try {
@ -408,8 +197,7 @@ void qTabDeveloper::SetHighVoltage() {
this, &qTabDeveloper::GetHighVoltage)
}
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
switch (detType) {
case slsDetectorDefs::EIGER:
@ -492,35 +280,33 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index) {
break;
case slsDetectorDefs::JUNGFRAU:
if (index >= 0 && index < numDACWidgets) {
if (index >= 0 && index < (int)dacWidgets.size()) {
return (slsDetectorDefs::dacIndex)index;
}
if (index == numDACWidgets) {
if (index == (int)dacWidgets.size()) {
return slsDetectorDefs::TEMPERATURE_ADC;
} else {
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
}
break;
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
case slsDetectorDefs::MOENCH:
if (index >= 0 && index < numDACWidgets) {
if (index >= 0 && index < (int)dacWidgets.size()) {
return (slsDetectorDefs::dacIndex)index;
} else {
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
}
break;
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
default:
break;
throw sls::RuntimeError(std::string("Unknown detector type"));
}
return (slsDetectorDefs::dacIndex)0;
}
void qTabDeveloper::Refresh() {
FILE_LOG(logDEBUG) << "**Updating Developer Tab\n";
GetDacs();
GetAdcs();
for (const auto &it : dacWidgets) {
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
}
for (const auto &it : adcWidgets) {
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
}
GetHighVoltage();
FILE_LOG(logDEBUG) << "**Updated Developer Tab";
}

View File

@ -130,13 +130,9 @@ void qTabPlot::Initialization() {
if (chkGapPixels->isEnabled())
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
// Save
// Save, clone
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
// Snapshot box
connect(btnClone, SIGNAL(clicked()), myPlot, SLOT(ClonePlot()));
connect(btnCloseClones, SIGNAL(clicked()), myPlot, SLOT(CloseClones()));
connect(btnSaveClones, SIGNAL(clicked()), myPlot, SLOT(SaveClones()));
// Plot Axis
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
@ -195,7 +191,6 @@ void qTabPlot::SetPlot() {
box1D->setEnabled(plotEnable);
box2D->setEnabled(plotEnable);
boxSave->setEnabled(plotEnable);
boxSnapshot->setEnabled(plotEnable);
boxPlotAxis->setEnabled(plotEnable);
if (plotEnable) {