going to start actions

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@19 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-07-19 14:20:51 +00:00
parent d2b9b6ae1d
commit 3b59d03526
30 changed files with 1433 additions and 610 deletions

View File

@ -19,6 +19,124 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>89</red>
<green>89</green>
<blue>89</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@ -130,7 +248,6 @@
<property name="title"> <property name="title">
<string>&amp;Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="actionVersion"/>
<addaction name="actionAbout"/> <addaction name="actionAbout"/>
</widget> </widget>
<addaction name="menuUtilities"/> <addaction name="menuUtilities"/>

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>775</width> <width>775</width>
<height>339</height> <height>345</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -35,7 +35,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>75</y> <y>110</y>
<width>731</width> <width>731</width>
<height>206</height> <height>206</height>
</rect> </rect>
@ -43,114 +43,24 @@
<property name="title"> <property name="title">
<string>Correction</string> <string>Correction</string>
</property> </property>
<widget class="QWidget" name="gridLayoutWidget"> <widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>15</x>
<y>20</y> <y>20</y>
<width>711</width> <width>701</width>
<height>181</height> <height>176</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="checkBox_3"> <widget class="QCheckBox" name="chkFlatField">
<property name="text"> <property name="text">
<string>Flat Field File</string> <string>Flat Field File:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Rate Correction</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Angular Conversion</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="5">
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>Discard Bad Channels</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="5">
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>Custom dead time(ns):</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QSpinBox" name="spinBox"/>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -166,6 +76,178 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2" colspan="6">
<widget class="QLineEdit" name="dispFlatField">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate Correction:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioAuto">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="6" colspan="3">
<widget class="QDoubleSpinBox" name="spinDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string> ns</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="6">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="4">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="8">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="7">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="btnFlatField">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QRadioButton" name="radioDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom dead time:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkAngular">
<property name="text">
<string>Angular Conversion</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkDiscardBad">
<property name="text">
<string>Discard Bad Channels</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -187,9 +269,9 @@
<widget class="QWidget" name="horizontalLayoutWidget"> <widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>10</x>
<y>6</y> <y>6</y>
<width>731</width> <width>706</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
@ -217,6 +299,56 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QLabel" name="lblNote">
<property name="geometry">
<rect>
<x>245</x>
<y>327</y>
<width>256</width>
<height>16</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>193</red>
<green>193</green>
<blue>193</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>* Note: Enter valid file to enable Flat Field.</string>
</property>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>748</width> <width>775</width>
<height>350</height> <height>345</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -31,19 +31,163 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<widget class="QPushButton" name="pushButton"> <widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>232</x> <x>265</x>
<y>141</y> <y>30</y>
<width>75</width> <width>251</width>
<height>36</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblModule">
<property name="text">
<string>Module Number:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>165</y>
<width>321</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Digital Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="chk">
<property name="text">
<string>Detector Module</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Test xxx</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnDigital">
<property name="geometry">
<rect>
<x>15</x>
<y>115</y>
<width>291</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Run</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="btnGetInfo">
<property name="geometry">
<rect>
<x>265</x>
<y>95</y>
<width>251</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>PushButton</string> <string>Get Detector Information</string>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>425</x>
<y>165</y>
<width>321</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Analog Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>Detector Module</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Test xxx</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnAnalog">
<property name="geometry">
<rect>
<x>15</x>
<y>115</y>
<width>291</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Run</string>
</property>
</widget>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -28,124 +28,6 @@
<height>345</height> <height>345</height>
</size> </size>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>193</red>
<green>193</green>
<blue>193</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>188</red>
<green>188</green>
<blue>188</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>

View File

@ -494,7 +494,7 @@
<string>Scan - Y Axis Values</string> <string>Scan - Y Axis Values</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>748</width> <width>775</width>
<height>339</height> <height>345</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -34,10 +34,10 @@
<widget class="QWidget" name="gridLayoutWidget"> <widget class="QWidget" name="gridLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>13</x> <x>30</x>
<y>16</y> <y>20</y>
<width>311</width> <width>316</width>
<height>151</height> <height>171</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -48,7 +48,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2" colspan="2">
<widget class="QComboBox" name="comboSettings"> <widget class="QComboBox" name="comboSettings">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -107,17 +107,19 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="2" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Threshold:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinThreshold"> <widget class="QSpinBox" name="spinThreshold">
<property name="suffix">
<string>eV</string>
</property>
<property name="minimum"> <property name="minimum">
<number>-1</number> <number>-100000</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>100</number>
</property> </property>
<property name="value"> <property name="value">
<number>-1</number> <number>-1</number>
@ -138,22 +140,59 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="2" colspan="2">
<widget class="QComboBox" name="comboDynamicRange"> <widget class="QComboBox" name="comboDynamicRange">
<item> <item>
<property name="text"> <property name="text">
<string>16</string> <string>1.67772e+07</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>32</string> <string>65535</string>
</property>
</item>
<item>
<property name="text">
<string>255</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumModules"/> <widget class="QSpinBox" name="spinNumModules">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblThreshold">
<property name="text">
<string>Threshold:</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -24,13 +24,19 @@ class ActionsWidget : public QFrame{
public: public:
/** \short The constructor /** \short The constructor
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param scanType is if its an energy/threshold scan type
* @param id is the id of the widget. to know which one was emitting it
*/ */
ActionsWidget(QWidget *parent, int scanType); ActionsWidget(QWidget *parent, int scanType, int id);
~ActionsWidget(); ~ActionsWidget();
private: private:
/**if its a scan type*/
int scanType;
/**id of the action widget*/
int id;
QGridLayout *layout; QGridLayout *layout;
QComboBox *comboScript; QComboBox *comboScript;
QLineEdit *dispScript; QLineEdit *dispScript;
@ -56,8 +62,8 @@ private:
QPushButton *btnValues; QPushButton *btnValues;
/** Sets up the widget /** Sets up the widget
* @param scanType 1 if it includes Threshold Scan,Energy Scan and Trimbits Scan, else 0*/ */
void SetupWidgetWindow(int scanType); void SetupWidgetWindow();
/** Sets up all the slots and signals */ /** Sets up all the slots and signals */
void Initialization(); void Initialization();
@ -72,6 +78,14 @@ void SetScript(int index);
* Options: constant size,specific values,values from file */ * Options: constant size,specific values,values from file */
void EnableSizeWidgets(); void EnableSizeWidgets();
/** Browse for the script
* */
void BrowsePath();
signals:
void EnableScanBox(bool,int);
void SetScriptSignal(QString&,int);
}; };

View File

@ -21,7 +21,7 @@ class qTabDebugging;
class qTabDeveloper; class qTabDeveloper;
class qTabMessages; class qTabMessages;
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
/** Qt Include Headers */ /** Qt Include Headers */
#include <QScrollArea> #include <QScrollArea>
@ -63,7 +63,7 @@ private:
/** The Qt Application */ /** The Qt Application */
QApplication *theApp; QApplication *theApp;
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** sls detector id */ /** sls detector id */
int detID; int detID;
/** The Plot widget */ /** The Plot widget */

View File

@ -9,7 +9,7 @@
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
#include "detectorData.h" #include "detectorData.h"
/** Qt Project Class Headers */ /** Qt Project Class Headers */
#include "SlsQt1DPlot.h" #include "SlsQt1DPlot.h"
@ -38,7 +38,7 @@ class qDrawPlot:public QWidget{
public: public:
/** \short The constructor */ /** \short The constructor */
qDrawPlot(QWidget *parent,slsDetectorUtils*& detector); qDrawPlot(QWidget *parent,multiSlsDetector*& detector);
/** Destructor */ /** Destructor */
~qDrawPlot(); ~qDrawPlot();
@ -96,7 +96,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** Widgets needed to plot the clone */ /** Widgets needed to plot the clone */

View File

@ -9,7 +9,7 @@
#define QTABACTIONS_H_ #define QTABACTIONS_H_
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
class ActionsWidget; class ActionsWidget;
#include <QWidget> #include <QWidget>
@ -31,7 +31,7 @@ public:
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
*/ */
qTabActions(QWidget *parent,slsDetectorUtils*& detector); qTabActions(QWidget *parent,multiSlsDetector*& detector);
/** Destructor /** Destructor
*/ */
@ -44,7 +44,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
static const int NUM_ACTION_WIDGETS = 9; static const int NUM_ACTION_WIDGETS = 9;
@ -57,6 +57,9 @@ private:
QPushButton *btnExpand[NUM_ACTION_WIDGETS]; QPushButton *btnExpand[NUM_ACTION_WIDGETS];
QLabel *lblName[NUM_ACTION_WIDGETS]; QLabel *lblName[NUM_ACTION_WIDGETS];
enum{Start,Scan0,Scan1,ActionBefore,NumPositions,
HeaderBefore,HeaderAfter,ActionAfter,Stop};
/** Sets up the widget */ /** Sets up the widget */
void SetupWidgetWindow(); void SetupWidgetWindow();
@ -68,6 +71,14 @@ private slots:
/** To Expand the Action Widget */ /** To Expand the Action Widget */
void Expand(QAbstractButton *button); void Expand(QAbstractButton *button);
/** To set the script of action widget
* @param fName name of script
* @param index id of action widget*/
void SetScript(const QString& fName,int index);
signals:
void EnableScanBox(bool,int);
}; };
#endif /* QTABACTIONS_H_ */ #endif /* QTABACTIONS_H_ */

View File

@ -11,7 +11,7 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_advanced.h" #include "ui_form_tab_advanced.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** /**
*@short sets up the advanced parameters *@short sets up the advanced parameters
@ -24,7 +24,7 @@ public:
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
*/ */
qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector); qTabAdvanced(QWidget *parent,multiSlsDetector*& detector);
/** Destructor /** Destructor
*/ */
@ -37,7 +37,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** The sls detector object type*/ /** The sls detector object type*/
int myDetType; int myDetType;

View File

@ -11,7 +11,8 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_dataoutput.h" #include "ui_form_tab_dataoutput.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
#include "sls_detector_defs.h"
/** Qt Include Headers */ /** Qt Include Headers */
#include <QString> #include <QString>
@ -26,8 +27,9 @@ public:
/** \short The constructor /** \short The constructor
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
* @param detID is the id of the detector
*/ */
qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector); qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID);
/** Destructor /** Destructor
*/ */
@ -41,7 +43,13 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/**detector id */
int detID;
/** detector type */
slsDetectorDefs::detectorType detType;
/** methods */ /** methods */
/** Sets up the widget */ /** Sets up the widget */
@ -59,6 +67,27 @@ void setOutputDir(const QString& path);
/** Open dialog to choose the output directory */ /** Open dialog to choose the output directory */
void browseOutputDir(); void browseOutputDir();
/**set flat field file*/
void SetFlatField();
/** update flat field correction from server */
void UpdateFlatFieldFromServer();
/**browse flat field*/
void BrowseFlatFieldPath();
/**rate correction*/
void SetRateCorrection();
/** update rate correction from server */
void UpdateRateCorrectionFromServer();
/**angular correction*/
void SetAngularCorrection();
/**discard bad channels*/
void DiscardBadChannels();
}; };

View File

@ -11,7 +11,11 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_debugging.h" #include "ui_form_tab_debugging.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** Qt Include Headers */
/** C++ Include Headers */
#include "sls_detector_defs.h"
/** /**
*@short sets up the Debugging parameters *@short sets up the Debugging parameters
@ -24,7 +28,7 @@ public:
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
*/ */
qTabDebugging(QWidget *parent,slsDetectorUtils*& detector); qTabDebugging(QWidget *parent,multiSlsDetector*& detector);
/** Destructor /** Destructor
*/ */
@ -36,7 +40,10 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** Sets up the widget /** Sets up the widget
*/ */

View File

@ -11,7 +11,7 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_developer.h" #include "ui_form_tab_developer.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** /**
*@short sets up the Developer parameters *@short sets up the Developer parameters
@ -24,7 +24,7 @@ public:
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
*/ */
qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector); qTabDeveloper(QWidget *parent,multiSlsDetector*& detector);
/** Destructor /** Destructor
*/ */
@ -36,7 +36,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** Sets up the widget /** Sets up the widget
*/ */

View File

@ -10,7 +10,7 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_measurement.h" #include "ui_form_tab_measurement.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** Qt Project Class Headers */ /** Qt Project Class Headers */
class qDrawPlot; class qDrawPlot;
@ -30,7 +30,7 @@ public:
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
* @param plot plot object reference * @param plot plot object reference
*/ */
qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot); qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
/** Destructor /** Destructor
*/ */
@ -43,7 +43,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** The Plot widget */ /** The Plot widget */
qDrawPlot *myPlot; qDrawPlot *myPlot;

View File

@ -11,7 +11,7 @@
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** Qt Include Headers */ /** Qt Include Headers */
#include <QWidget> #include <QWidget>
#include <QTextEdit> #include <QTextEdit>
@ -30,7 +30,7 @@ public:
* @param parent is the parent tab widget * @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
*/ */
qTabMessages(QWidget *parent,slsDetectorUtils*& detector); qTabMessages(QWidget *parent,multiSlsDetector*& detector);
/** Destructor /** Destructor
*/ */
@ -39,7 +39,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** Log of executed commands */ /** Log of executed commands */
QTextEdit *dispLog; QTextEdit *dispLog;

View File

@ -11,7 +11,7 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_plot.h" #include "ui_form_tab_plot.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
/** Qt Project Class Headers */ /** Qt Project Class Headers */
class qDrawPlot; class qDrawPlot;
/** Qt Include Headers */ /** Qt Include Headers */
@ -29,7 +29,7 @@ public:
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
* @param plot plot object reference * @param plot plot object reference
*/ */
qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot); qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
/** Destructor /** Destructor
*/ */
@ -42,7 +42,7 @@ public:
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/** The Plot widget */ /** The Plot widget */
qDrawPlot *myPlot; qDrawPlot *myPlot;
@ -50,6 +50,8 @@ private:
/** 1d/2d plot */ /** 1d/2d plot */
bool isOneD; bool isOneD;
bool scanLevel[2];
QStackedLayout* stackedLayout; QStackedLayout* stackedLayout;
QSpinBox *spinNthFrame; QSpinBox *spinNthFrame;
QDoubleSpinBox *spinTimeGap; QDoubleSpinBox *spinTimeGap;
@ -76,10 +78,13 @@ private:
public slots: public slots:
/** Set frequency between plots /** Set frequency between plots*/
* returns 0 if there were no errors(important void SetFrequency();
* while editing acquisition period in measurement tab) */ /** Enable Scan box
int SetFrequency(); * @param enable to enable the scan group box
* @param id is 0 if its scan level 0 or scan level 1
*/
void EnableScanBox(bool enable,int id);

View File

@ -11,7 +11,7 @@
/** Form Header */ /** Form Header */
#include "ui_form_tab_settings.h" #include "ui_form_tab_settings.h"
/** Project Class Headers */ /** Project Class Headers */
class slsDetectorUtils; class multiSlsDetector;
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
/** Qt Include Headers */ /** Qt Include Headers */
#include <QStandardItemModel> #include <QStandardItemModel>
@ -28,7 +28,7 @@ public:
* @param detector is the detector returned from the detector tab * @param detector is the detector returned from the detector tab
* @param detID is the id of the detector * @param detID is the id of the detector
*/ */
qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID); qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID);
/** Destructor /** Destructor
*/ */
@ -38,15 +38,25 @@ public:
*/ */
void Refresh(); void Refresh();
/** enable expert mode
* @param enable true if expert mode is enabled
*/
void EnableExpertMode(bool enable){expertMode=enable;Refresh();};
private: private:
/** The sls detector object */ /** The sls detector object */
slsDetectorUtils *myDet; multiSlsDetector *myDet;
/**etector id */
/**detector id */
int detID; int detID;
/** detector type */ /** detector type */
slsDetectorDefs::detectorType detType; slsDetectorDefs::detectorType detType;
bool expertMode;
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings};
/** To be able to index items on a combo box */ /** To be able to index items on a combo box */
@ -68,12 +78,27 @@ private:
private slots: private slots:
/** Set settings according to selection /** Set settings according to selection
* @param index index of selection * @param index index of selection
*/ */
void setSettings(int index); void setSettings(int index);
/** Set number of modules if possible
* @param index number of modules
*/
void SetNumberOfModules(int index);
/** Set dynamic range if possible
* @param index selection
*/
void SetDynamicRange(int index);
/** Set threshold energy
*/
void SetEnergy();
}; };

View File

@ -5,9 +5,9 @@
* Author: l_maliakal_d * Author: l_maliakal_d
*/ */
/** Qt Project Class Headers */ // Qt Project Class Headers
#include "qActionsWidget.h" #include "qActionsWidget.h"
/** Qt Include Headers */ // Qt Include Headers
#include <QGridLayout> #include <QGridLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QComboBox> #include <QComboBox>
@ -19,20 +19,23 @@
#include <QSpinBox> #include <QSpinBox>
#include <QGroupBox> #include <QGroupBox>
#include <QRadioButton> #include <QRadioButton>
/** C++ Include Headers */ #include <QFileDialog>
// C++ Include Headers
#include<iostream> #include<iostream>
using namespace std; using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
ActionsWidget::ActionsWidget(QWidget *parent, int scanType): QFrame(parent){ ActionsWidget::ActionsWidget(QWidget *parent, int scanType, int id):
SetupWidgetWindow(scanType); QFrame(parent),scanType(scanType),id(id){
SetupWidgetWindow();
Initialization(); Initialization();
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
ActionsWidget::~ActionsWidget(){ ActionsWidget::~ActionsWidget(){
@ -40,24 +43,25 @@ ActionsWidget::~ActionsWidget(){
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::SetupWidgetWindow(int scanType){ void ActionsWidget::SetupWidgetWindow(){
/** Widget Settings */ // Widget Settings
//setFrameStyle(QFrame::Box); //setFrameStyle(QFrame::Box);
//setFrameShadow(QFrame::Raised); //setFrameShadow(QFrame::Raised);
setFixedHeight(25); setFixedHeight(25);
if(scanType) setFixedHeight(125); if(scanType) setFixedHeight(125);
/** Main Layout Settings */ // Main Layout Settings
layout = new QGridLayout(this); layout = new QGridLayout(this);
setLayout(layout); setLayout(layout);
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
if(scanType) layout->setVerticalSpacing(5); if(scanType) layout->setVerticalSpacing(5);
/** Main Widgets*/ // Main Widgets
comboScript = new QComboBox(this); comboScript = new QComboBox(this);
if(!scanType){ if(!scanType){
comboScript->addItem("None"); comboScript->addItem("None");
@ -88,7 +92,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
/** Scan Levels Widgets*/ // Scan Levels Widgets
if(scanType){ if(scanType){
lblSteps = new QLabel("Number of Steps:"); lblSteps = new QLabel("Number of Steps:");
lblSteps->setEnabled(false); lblSteps->setEnabled(false);
@ -104,13 +108,13 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
layout->addWidget(spinPrecision,1,6); layout->addWidget(spinPrecision,1,6);
group = new QGroupBox(this); group = new QGroupBox(this);
group->setEnabled(false); group->setEnabled(false);
/** Fix the size of the groupbox*/ // Fix the size of the groupbox
group->setFixedSize(513,66); group->setFixedSize(513,66);
layout->addWidget(group,2,2,1,5); layout->addWidget(group,2,2,1,5);
/** Group Box for step size */ // Group Box for step size
/** Radio Buttons Layout */ // Radio Buttons Layout
QWidget *h1Widget = new QWidget(group); QWidget *h1Widget = new QWidget(group);
h1Widget->setGeometry(QRect(10, 5, group->width()-20, 23)); h1Widget->setGeometry(QRect(10, 5, group->width()-20, 23));
QHBoxLayout *h1 = new QHBoxLayout(h1Widget); QHBoxLayout *h1 = new QHBoxLayout(h1Widget);
@ -124,7 +128,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
h1->addWidget(radioValue); h1->addWidget(radioValue);
/** Constant Size Layout */ // Constant Size Layout
QWidget *h2ConstantWidget = new QWidget(group); QWidget *h2ConstantWidget = new QWidget(group);
h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget); QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget);
@ -149,7 +153,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
h2Constant->addWidget(spinSize); h2Constant->addWidget(spinSize);
h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
/** Specific Values Layout */ // Specific Values Layout
QWidget *h2SpecificWidget = new QWidget(group); QWidget *h2SpecificWidget = new QWidget(group);
h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget); QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget);
@ -160,7 +164,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
comboSpecific->hide(); comboSpecific->hide();
h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
/** Values From a File Layout */ // Values From a File Layout
QWidget *h2ValuesWidget = new QWidget(group); QWidget *h2ValuesWidget = new QWidget(group);
h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget); QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget);
@ -181,57 +185,67 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::Initialization(){ void ActionsWidget::Initialization(){
connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int))); connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int)));
if(comboScript->count()>2){ if(scanType){
connect(radioConstant,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); connect(radioConstant,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
connect(radioSpecific,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); connect(radioSpecific,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
connect(radioValue,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); connect(radioValue,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
} }
connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath()));
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::SetScript(int index){ void ActionsWidget::SetScript(int index){
/** defaults */ // defaults
dispScript->setEnabled(false); dispScript->setEnabled(false);
btnBrowse->setEnabled(false); btnBrowse->setEnabled(false);
lblParameter->setEnabled(false); lblParameter->setEnabled(false);
dispParameter->setEnabled(false); dispParameter->setEnabled(false);
if(comboScript->count()>2){ if(scanType){
group->setEnabled(false); group->setEnabled(false);
lblSteps->setEnabled(false); lblSteps->setEnabled(false);
spinSteps->setEnabled(false); spinSteps->setEnabled(false);
lblPrecision->setEnabled(false); lblPrecision->setEnabled(false);
spinPrecision->setEnabled(false); spinPrecision->setEnabled(false);
} }
/** If anything other than None is selected*/ // If anything other than None is selected
if(index){ if(index){
/** Custom Script only enables the first layout with addnl parameters etc */ // Custom Script only enables the first layout with addnl parameters etc
if(!comboScript->currentText().compare("Custom Script")){ if(!comboScript->currentText().compare("Custom Script")){
dispScript->setEnabled(true); dispScript->setEnabled(true);
btnBrowse->setEnabled(true); btnBrowse->setEnabled(true);
lblParameter->setEnabled(true); lblParameter->setEnabled(true);
dispParameter->setEnabled(true); dispParameter->setEnabled(true);
} }
/** If this group includes Energy scan , threhold scan etc */ // If this group includes Energy scan , threhold scan etc
if(comboScript->count()>2){ if(scanType){
group->setEnabled(true); group->setEnabled(true);
lblPrecision->setEnabled(true); lblPrecision->setEnabled(true);
spinPrecision->setEnabled(true); spinPrecision->setEnabled(true);
/** Steps are enabled only if constant step size is not checked*/ // Steps are enabled only if constant step size is not checked
lblSteps->setEnabled(!radioConstant->isChecked()); lblSteps->setEnabled(!radioConstant->isChecked());
spinSteps->setEnabled(!radioConstant->isChecked()); spinSteps->setEnabled(!radioConstant->isChecked());
} }
} }
//emit signal to enable scanbox and the radiobuttons
if(scanType) emit EnableScanBox(index,((id==2)?1:0));
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::EnableSizeWidgets(){ void ActionsWidget::EnableSizeWidgets(){
/** defaults */ // defaults
lblFrom->hide(); lblFrom->hide();
spinFrom->hide(); spinFrom->hide();
lblTo->hide(); lblTo->hide();
@ -243,7 +257,7 @@ void ActionsWidget::EnableSizeWidgets(){
btnValues->hide(); btnValues->hide();
lblSteps->setEnabled(true); lblSteps->setEnabled(true);
spinSteps->setEnabled(true); spinSteps->setEnabled(true);
/** Constant Step Size */ // Constant Step Size
if(radioConstant->isChecked()){ if(radioConstant->isChecked()){
lblFrom->show(); lblFrom->show();
spinFrom->show(); spinFrom->show();
@ -253,13 +267,28 @@ void ActionsWidget::EnableSizeWidgets(){
spinSize->show(); spinSize->show();
lblSteps->setEnabled(false); lblSteps->setEnabled(false);
spinSteps->setEnabled(false); spinSteps->setEnabled(false);
}/** Specific Values */ }// Specific Values
else if(radioSpecific->isChecked()) else if(radioSpecific->isChecked())
comboSpecific->show(); comboSpecific->show();
/** Values from a File */ // Values from a File
else{ else{
dispValues->show(); dispValues->show();
btnValues->show(); btnValues->show();
} }
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::BrowsePath(){
QString fName = dispScript->text();
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
if(dir.isEmpty()) dir = "/home";
fName = QFileDialog::getOpenFileName(this,
tr("Load Script File"),dir,
tr("Script Files(*.awk);;All Files(*)"));//,0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()){
dispScript->setText(fName);
emit SetScriptSignal(fName,id);
}
}

View File

@ -1,4 +1,8 @@
/** Qt Project Class Headers */ /**********************************************************************
* TO DO
* 1. settcpsocket is done with slsdetector.maybe do for all detectors connected: mythen
* ********************************************************************/
// Qt Project Class Headers
#include "qDetectorMain.h" #include "qDetectorMain.h"
#include "qDefs.h" #include "qDefs.h"
#include "qDrawPlot.h" #include "qDrawPlot.h"
@ -11,14 +15,14 @@
#include "qTabDebugging.h" #include "qTabDebugging.h"
#include "qTabDeveloper.h" #include "qTabDeveloper.h"
#include "qTabMessages.h" #include "qTabMessages.h"
/** Project Class Headers */ // Project Class Headers
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
/** Qt Include Headers */ // Qt Include Headers
#include <QSizePolicy> #include <QSizePolicy>
#include <QFileDialog> #include <QFileDialog>
/** C++ Include Headers */ // C++ Include Headers
#include<iostream> #include<iostream>
#include <string> #include <string>
using namespace std; using namespace std;
@ -44,17 +48,17 @@ int main (int argc, char **argv) {
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) :
QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){ QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){
/** Getting all the command line arguments */ // Getting all the command line arguments
for(int iarg=1; iarg<argc; iarg++){ for(int iarg=1; iarg<argc; iarg++){
if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;} if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;}
if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);} if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);}
if(!strcasecmp(argv[iarg],"-help")){ if(!strcasecmp(argv[iarg],"-help")){
cout<<"Possible Arguments are:"<<endl; cout << "Possible Arguments are:" << endl;
cout<<"-help \t\t : \t This help"<<endl; cout << "-help \t\t : \t This help" << endl;
cout<<"-developer \t : \t Enables the developer tab"<<endl; cout << "-developer \t : \t Enables the developer tab" << endl;
cout<<"-id i \t : \t Sets the detector to id i (the default is 0). " cout << "-id i \t : \t Sets the detector to id i (the default is 0). "
"Required only when more than one detector is connected in parallel."<<endl; "Required only when more than one detector is connected in parallel." << endl;
} }
} }
@ -81,33 +85,33 @@ qDetectorMain::~qDetectorMain(){
void qDetectorMain::SetUpWidgetWindow(){ void qDetectorMain::SetUpWidgetWindow(){
/** Layout */ // Layout
layoutTabs= new QGridLayout; layoutTabs= new QGridLayout;
centralwidget->setLayout(layoutTabs); centralwidget->setLayout(layoutTabs);
/** plot setup*/ // plot setup
myPlot = new qDrawPlot(dockWidgetPlot,myDet); myPlot = new qDrawPlot(dockWidgetPlot,myDet);
dockWidgetPlot->setWidget(myPlot); dockWidgetPlot->setWidget(myPlot);
/**tabs setup*/ //tabs setup
tabs = new MyTabWidget(this); tabs = new MyTabWidget(this);
layoutTabs->addWidget(tabs); layoutTabs->addWidget(tabs);
/** creating all the tab widgets */ // creating all the tab widgets
tab_messages = new qTabMessages (this, myDet); tab_messages = new qTabMessages (this, myDet);
tab_measurement = new qTabMeasurement (this, myDet,myPlot); tab_measurement = new qTabMeasurement (this, myDet,myPlot);
tab_dataoutput = new qTabDataOutput (this, myDet); tab_dataoutput = new qTabDataOutput (this, myDet, detID);
tab_plot = new qTabPlot (this, myDet,myPlot); tab_plot = new qTabPlot (this, myDet,myPlot);
tab_actions = new qTabActions (this, myDet); tab_actions = new qTabActions (this, myDet);
tab_settings = new qTabSettings (this, myDet, detID); tab_settings = new qTabSettings (this, myDet, detID);
tab_advanced = new qTabAdvanced (this, myDet); tab_advanced = new qTabAdvanced (this, myDet);
tab_debugging = new qTabDebugging (this, myDet); tab_debugging = new qTabDebugging (this, myDet);
tab_developer = new qTabDeveloper (this, myDet); tab_developer = new qTabDeveloper (this, myDet);
/** creating the scroll area widgets for the tabs */ // creating the scroll area widgets for the tabs
for(int i=0;i<NumberOfTabs;i++){ for(int i=0;i<NumberOfTabs;i++){
scroll[i] = new QScrollArea; scroll[i] = new QScrollArea;
scroll[i]->setFrameShape(QFrame::NoFrame); scroll[i]->setFrameShape(QFrame::NoFrame);
} }
/** setting the tab widgets to the scrollareas*/ // setting the tab widgets to the scrollareas
scroll[Measurement] ->setWidget(tab_measurement); scroll[Measurement] ->setWidget(tab_measurement);
scroll[DataOutput] ->setWidget(tab_dataoutput); scroll[DataOutput] ->setWidget(tab_dataoutput);
scroll[Plot] ->setWidget(tab_plot); scroll[Plot] ->setWidget(tab_plot);
@ -116,7 +120,7 @@ void qDetectorMain::SetUpWidgetWindow(){
scroll[Advanced] ->setWidget(tab_advanced); scroll[Advanced] ->setWidget(tab_advanced);
scroll[Debugging] ->setWidget(tab_debugging); scroll[Debugging] ->setWidget(tab_debugging);
scroll[Developer] ->setWidget(tab_developer); scroll[Developer] ->setWidget(tab_developer);
/** inserting all the tabs*/ // inserting all the tabs
tabs->insertTab(Measurement, scroll[Measurement], "Measurement"); tabs->insertTab(Measurement, scroll[Measurement], "Measurement");
tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output");
tabs->insertTab(Plot, scroll[Plot], "Plot"); tabs->insertTab(Plot, scroll[Plot], "Plot");
@ -125,20 +129,20 @@ void qDetectorMain::SetUpWidgetWindow(){
tabs->insertTab(Advanced, scroll[Advanced], "Advanced"); tabs->insertTab(Advanced, scroll[Advanced], "Advanced");
tabs->insertTab(Debugging, scroll[Debugging], "Debugging"); tabs->insertTab(Debugging, scroll[Debugging], "Debugging");
tabs->insertTab(Developer, scroll[Developer], "Developer"); tabs->insertTab(Developer, scroll[Developer], "Developer");
/** Prefer this to expand and not have scroll buttons*/ // Prefer this to expand and not have scroll buttons
tabs->insertTab(Messages, tab_messages, "Messages"); tabs->insertTab(Messages, tab_messages, "Messages");
/** Default tab color*/ // Default tab color
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
/**Set the current tab(measurement) to blue as it is the current one*/ //Set the current tab(measurement) to blue as it is the current one
tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255)); tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255));
/** increase the width so it uses all the empty space for the tab titles*/ // increase the width so it uses all the empty space for the tab titles
tabs->tabBar()->setFixedWidth(width()+61); tabs->tabBar()->setFixedWidth(width()+61);
/** mode setup - to set up the tabs initially as disabled, not in form so done here */ // mode setup - to set up the tabs initially as disabled, not in form so done here
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting Debug Mode to 0\nSetting Beamline Mode to 0\n" cout << "Setting Debug Mode to 0\nSetting Beamline Mode to 0\n"
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n" "Setting Expert Mode to 0\nSetting Dockable Mode to false\n"
"Setting Developer Mode to "<<isDeveloper<<endl; "Setting Developer Mode to " << isDeveloper << endl;
#endif #endif
tabs->setTabEnabled(Debugging,false); tabs->setTabEnabled(Debugging,false);
//beamline mode to false //beamline mode to false
@ -147,11 +151,11 @@ void qDetectorMain::SetUpWidgetWindow(){
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
tabs->setTabEnabled(Developer,isDeveloper); tabs->setTabEnabled(Developer,isDeveloper);
/** Other setup*/ // Other setup
/**Height of plot and central widget*/ //Height of plot and central widget
heightPlotWindow = dockWidgetPlot->size().height(); heightPlotWindow = dockWidgetPlot->size().height();
heightCentralWidget = centralwidget->size().height(); heightCentralWidget = centralwidget->size().height();
/** Default zoom Tool Tip */ // Default zoom Tool Tip
zoomToolTip = dockWidgetPlot->toolTip(); zoomToolTip = dockWidgetPlot->toolTip();
} }
@ -162,38 +166,43 @@ void qDetectorMain::SetUpWidgetWindow(){
void qDetectorMain::SetUpDetector(){ void qDetectorMain::SetUpDetector(){
/**instantiate detector and set window title*/ //instantiate detector and set window title
myDet = new multiSlsDetector(detID); myDet = new multiSlsDetector(detID);
if(!myDet->getHostname(detID).length()){ string host = myDet->getHostname(detID);
slsDetector *s = myDet->getSlsDetector(detID);
//if hostname doesnt exist even in shared memory
if(!host.length()){
#ifdef VERBOSE #ifdef VERBOSE
cout<<endl<<"No Detector Connected at id:"<<detID<<endl; cout << endl << "No Detector Connected at id:" << detID << endl;
cout<<myDet->getHostname(detID)<<endl;
#endif #endif
char cIndex[10]; char cIndex[10];
sprintf(cIndex,"%d",detID); sprintf(cIndex,"%d",detID);
qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main"); qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main");
exit(-1); exit(-1);
}//if the detector is not even connected
else if(s->setTCPSocket()==slsDetectorDefs::FAIL){
qDefs::ErrorMessage(string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main");
cout << "The detector " << host << "is not connected. Exiting GUI." << endl;
exit(-1);
} }
else{ else{
/** Check if type valid. If not, exit*/ slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
switch(myDet->getDetectorsType()){ // Check if type valid. If not, exit
switch(detType){
case slsDetectorDefs::MYTHEN: break; case slsDetectorDefs::MYTHEN: break;
case slsDetectorDefs::EIGER: break; case slsDetectorDefs::EIGER: break;
case slsDetectorDefs::GOTTHARD: break; case slsDetectorDefs::GOTTHARD: break;
default: default:
string detName = myDet->slsDetectorBase::getDetectorType(myDet->getDetectorsType()); string detName = myDet->slsDetectorBase::getDetectorType(detType);
string hostname = myDet->getHostname(detID); string errorMess = host+string(" has unknown detector type \"")+
string errorMess = hostname+string(" has unknown detector type \"")+
detName+string("\". Exiting GUI."); detName+string("\". Exiting GUI.");
qDefs::ErrorMessage(errorMess,"Main"); qDefs::ErrorMessage(errorMess,"Main");
exit(-1); exit(-1);
} }
setWindowTitle("SLS Detector GUI : "+ setWindowTitle("SLS Detector GUI : "+
QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+ QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str()));
" - "+QString(myDet->getHostname(detID).c_str()));
#ifdef VERBOSE #ifdef VERBOSE
cout<<endl<<"Type : "<<slsDetectorBase::getDetectorType(myDet->getDetectorsType())<<"\t\t\tDetector : " cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl;
""<<myDet->getHostname(detID)<<endl;
#endif #endif
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
} }
@ -204,27 +213,30 @@ void qDetectorMain::SetUpDetector(){
void qDetectorMain::Initialization(){ void qDetectorMain::Initialization(){
/** Dockable Plot*/ // Dockable Plot
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool))); connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
/** tabs */ // tabs
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
/** Measurement tab*/ // Measurement tab
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
/** Plot tab */ // Plot tab
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
/** Plotting */ // Actions tab
/** When the acquisition is finished, must update the meas tab */ connect(tab_actions, SIGNAL(EnableScanBox(bool,int)), tab_plot,SLOT(EnableScanBox(bool,int)));
// Plotting
// When the acquisition is finished, must update the meas tab
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished())); connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int))); connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
/** menubar */ // menubar
/** Modes Menu */ // Modes Menu
connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
/** Utilities Menu */ // Utilities Menu
connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*))); connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*)));
/** Help Menu */ // Help Menu
connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*))); connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*)));
} }
@ -235,33 +247,34 @@ void qDetectorMain::Initialization(){
void qDetectorMain::EnableModes(QAction *action){ void qDetectorMain::EnableModes(QAction *action){
bool enable; bool enable;
/**Set DebugMode */ //Set DebugMode
if(action==actionDebug){ if(action==actionDebug){
enable = actionDebug->isChecked(); enable = actionDebug->isChecked();
tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Debugging,enable);
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting Debug Mode to "<<enable<<endl; cout << "Setting Debug Mode to " << enable << endl;
#endif #endif
} }
/**Set BeamlineMode */ //Set BeamlineMode
else if(action==actionBeamline){ else if(action==actionBeamline){
enable = actionBeamline->isChecked(); enable = actionBeamline->isChecked();
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting Beamline Mode to "<<enable<<endl; cout << "Setting Beamline Mode to " << enable << endl;
#endif #endif
} }
/**Set ExpertMode */ //Set ExpertMode
else if(action==actionExpert){ else if(action==actionExpert){
enable = actionExpert->isChecked(); enable = actionExpert->isChecked();
tabs->setTabEnabled(Advanced,enable); tabs->setTabEnabled(Advanced,enable);
tab_settings->EnableExpertMode(enable);
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting Expert Mode to "<<enable<<endl; cout << "Setting Expert Mode to " << enable << endl;
#endif #endif
} }
/**Set DockableMode */ //Set DockableMode
else{ else{
enable = actionDockable->isChecked(); enable = actionDockable->isChecked();
if(enable) if(enable)
@ -271,7 +284,7 @@ void qDetectorMain::EnableModes(QAction *action){
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
} }
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting Dockable Mode to "<<enable<<endl; cout << "Setting Dockable Mode to " << enable << endl;
#endif #endif
} }
} }
@ -284,13 +297,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
if(action==actionOpenSetup){ if(action==actionOpenSetup){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Opening Setup"<<endl; cout << "Opening Setup" << endl;
#endif #endif
QString fName = QString(myDet->getFilePath().c_str()); QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getOpenFileName(this, fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Setup"),fName, tr("Load Detector Setup"),fName,
tr("Detector Setup files (*.det)")); tr("Detector Setup files (*.det)"));
/** Gets called when cancelled as well*/ // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
myDet->retrieveDetectorSetup(string(fName.toAscii().constData())); myDet->retrieveDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully setup.","Main"); qDefs::InfoMessage("The parameters have been successfully setup.","Main");
@ -298,13 +311,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
} }
else if(action==actionSaveSetup){ else if(action==actionSaveSetup){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Saving Setup"<<endl; cout << "Saving Setup" << endl;
#endif #endif
QString fName = QString(myDet->getFilePath().c_str()); QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getSaveFileName(this, fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Setup"),fName, tr("Save Current Detector Setup"),fName,
tr("Detector Setup files (*.det) ")); tr("Detector Setup files (*.det) "));
/** Gets called when cancelled as well*/ // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
myDet->dumpDetectorSetup(string(fName.toAscii().constData())); myDet->dumpDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The setup parameters have been successfully saved.","Main"); qDefs::InfoMessage("The setup parameters have been successfully saved.","Main");
@ -312,18 +325,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
} }
else if(action==actionMeasurementWizard){ else if(action==actionMeasurementWizard){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Measurement Wizard"<<endl; cout << "Measurement Wizard" << endl;
#endif #endif
} }
else if(action==actionOpenConfiguration){ else if(action==actionOpenConfiguration){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Opening Configuration"<<endl; cout << "Opening Configuration" << endl;
#endif #endif
QString fName = QString(myDet->getFilePath().c_str()); QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getOpenFileName(this, fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Configuration"),fName, tr("Load Detector Configuration"),fName,
tr("Configuration files (*.config)")); tr("Configuration files (*.config)"));
/** Gets called when cancelled as well*/ // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
myDet->readConfigurationFile(string(fName.toAscii().constData())); myDet->readConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully configured.","Main"); qDefs::InfoMessage("The parameters have been successfully configured.","Main");
@ -331,13 +344,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
} }
else if(action==actionSaveConfiguration){ else if(action==actionSaveConfiguration){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Saving Configuration"<<endl; cout << "Saving Configuration" << endl;
#endif #endif
QString fName = QString(myDet->getFilePath().c_str()); QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getSaveFileName(this, fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Configuration"),fName, tr("Save Current Detector Configuration"),fName,
tr("Configuration files (*.config) ")); tr("Configuration files (*.config) "));
/** Gets called when cancelled as well*/ // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
myDet->writeConfigurationFile(string(fName.toAscii().constData())); myDet->writeConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main"); qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main");
@ -345,12 +358,12 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
} }
else if(action==actionEnergyCalibration){ else if(action==actionEnergyCalibration){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Executing Energy Calibration"<<endl; cout << "Executing Energy Calibration" << endl;
#endif #endif
} }
else{ else{
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Executing Angular Calibration"<<endl; cout << "Executing Angular Calibration" << endl;
#endif #endif
} }
@ -362,15 +375,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
void qDetectorMain::ExecuteHelp(QAction *action){ void qDetectorMain::ExecuteHelp(QAction *action){
if(action==actionVersion){ if(action==actionAbout){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Version"<<endl; cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl;
#endif
}
else{
#ifdef VERBOSE
cout<<"About"<<endl;
#endif #endif
//<h1 style="font-family:verdana;">A heading</h1>
qDefs::InfoMessage("<p style=\"font-family:verdana;\">SLS Detector GUI version: 1.0<br><br>"
"Common GUI to control the SLS Detectors: "
"Mythen, Eiger, Gotthard and Agipd.<br><br>"
"It can be operated in parallel with the command line interface:<br>"
"sls_detector_put,<br>sls_detector_get,<br>sls_detector_acquire and<br>sls_detector_help.<br><br>"
"The software is still in progress. "
"Please report bugs to dhanya.maliakal@psi.ch.<\\p>","About SLS Detector GUI");
} }
} }
@ -405,18 +421,18 @@ void qDetectorMain::Refresh(int index){
void qDetectorMain::ResizeMainWindow(bool b){ void qDetectorMain::ResizeMainWindow(bool b){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Resizing Main Window: height:"<<height()<<endl; cout << "Resizing Main Window: height:" << height() << endl;
#endif #endif
/** undocked from the main window */ // undocked from the main window
if(b){ if(b){
/** sets the main window height to a smaller maximum to get rid of space*/ // sets the main window height to a smaller maximum to get rid of space
setMaximumHeight(height()-heightPlotWindow-9); setMaximumHeight(height()-heightPlotWindow-9);
dockWidgetPlot->setMinimumHeight(0); dockWidgetPlot->setMinimumHeight(0);
cout<<"undocking it from main window"<<endl; cout << "undocking it from main window" << endl;
} }
else{ else{
setMaximumHeight(QWIDGETSIZE_MAX); setMaximumHeight(QWIDGETSIZE_MAX);
/** the minimum for plot will be set when the widget gets resized automatically*/ // the minimum for plot will be set when the widget gets resized automatically
} }
} }
@ -445,26 +461,26 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
void qDetectorMain::EnableTabs(){ void qDetectorMain::EnableTabs(){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Entering EnableTabs function"<<endl; cout << "Entering EnableTabs function" << endl;
#endif #endif
bool enable; bool enable;
enable=!(tabs->isTabEnabled(DataOutput)); enable=!(tabs->isTabEnabled(DataOutput));
// or use the Enable/Disable button // or use the Enable/Disable button
/** normal tabs*/ // normal tabs
tabs->setTabEnabled(DataOutput,enable); tabs->setTabEnabled(DataOutput,enable);
tabs->setTabEnabled(Actions,enable); tabs->setTabEnabled(Actions,enable);
tabs->setTabEnabled(Settings,enable); tabs->setTabEnabled(Settings,enable);
tabs->setTabEnabled(Messages,enable); tabs->setTabEnabled(Messages,enable);
/** special tabs */ // special tabs
if(enable==false){ if(enable==false){
tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Debugging,enable);
tabs->setTabEnabled(Advanced,enable); tabs->setTabEnabled(Advanced,enable);
tabs->setTabEnabled(Developer,enable); tabs->setTabEnabled(Developer,enable);
} }
else{ else{
/** enable these tabs only if they were enabled earlier */ // enable these tabs only if they were enabled earlier
if(actionDebug->isChecked()) if(actionDebug->isChecked())
tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Debugging,enable);
if(actionExpert->isChecked()) if(actionExpert->isChecked())

View File

@ -27,7 +27,7 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
StartStopDaqToggle(); //as default StartStopDaqToggle(); //as default

View File

@ -4,23 +4,24 @@
* Created on: May 10, 2012 * Created on: May 10, 2012
* Author: l_maliakal_d * Author: l_maliakal_d
*/ */
/** Qt Project Class Headers */ // Qt Project Class Headers
#include "qTabActions.h" #include "qTabActions.h"
#include "qDefs.h" #include "qDefs.h"
#include "qActionsWidget.h" #include "qActionsWidget.h"
/** Project Class Headers */ // Project Class Headers
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
/** Qt Include Headers */ // Qt Include Headers
#include <QButtonGroup> #include <QButtonGroup>
/** C++ Include Headers */ // C++ Include Headers
#include<iostream> #include<iostream>
using namespace std; using namespace std;
qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector){
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
} }
@ -36,32 +37,32 @@ qTabActions::~qTabActions(){
void qTabActions::SetupWidgetWindow(){ void qTabActions::SetupWidgetWindow(){
/** Window Settings*/ // Window Settings
setFixedSize(705,350); setFixedSize(705,350);
setContentsMargins(0,0,0,0); setContentsMargins(0,0,0,0);
/** Scroll Area Settings*/ // Scroll Area Settings
QScrollArea *scroll = new QScrollArea; QScrollArea *scroll = new QScrollArea;
scroll->setWidget(this); scroll->setWidget(this);
scroll->setWidgetResizable(true); scroll->setWidgetResizable(true);
/** Layout Settings*/ // Layout Settings
gridLayout = new QGridLayout(scroll); gridLayout = new QGridLayout(scroll);
setLayout(gridLayout); setLayout(gridLayout);
gridLayout->setContentsMargins(10,5,0,0); gridLayout->setContentsMargins(10,5,0,0);
gridLayout->setVerticalSpacing(2); gridLayout->setVerticalSpacing(2);
/** Buttongroup to know which +/- button was clicked*/ // Buttongroup to know which +/- button was clicked
group = new QButtonGroup(this); group = new QButtonGroup(this);
palette = new QPalette(); palette = new QPalette();
/** For each level of Actions */ // For each level of Actions
for(int i=0;i<NUM_ACTION_WIDGETS;i++){ for(int i=0;i<NUM_ACTION_WIDGETS;i++){
/** Add the extra widgets only for the 1st 2 levels*/ // Add the extra widgets only for the 1st 2 levels
if((i==1)||(i==2)) if((i==Scan0)||(i==Scan1))
actionWidget[i] = new ActionsWidget(this,1); actionWidget[i] = new ActionsWidget(this,1,i);
else else
actionWidget[i] = new ActionsWidget(this,0); actionWidget[i] = new ActionsWidget(this,0,i);
btnExpand[i] = new QPushButton("+"); btnExpand[i] = new QPushButton("+");
btnExpand[i]->setFixedSize(20,20); btnExpand[i]->setFixedSize(20,20);
@ -70,168 +71,80 @@ void qTabActions::SetupWidgetWindow(){
gridLayout->addWidget(btnExpand[i],(i*2),0); gridLayout->addWidget(btnExpand[i],(i*2),0);
gridLayout->addWidget(lblName[i],(i*2),1); gridLayout->addWidget(lblName[i],(i*2),1);
gridLayout->addWidget(actionWidget[i],(i*2)+1,1,1,2); gridLayout->addWidget(actionWidget[i],(i*2)+1,1,1,2);
/* gridLayout->addWidget(btnExpand[i],(i*2),i);
gridLayout->addWidget(lblName[i],(i*2),i+1);
gridLayout->addWidget(actionWidget[i],(i*2)+1,i+1,1,2);*/
} }
/** Label Values */ // Label Values
lblName[0]->setText("Action at Start"); lblName[Start]->setText("Action at Start");
lblName[1]->setText("Scan Level 0"); lblName[Scan0]->setText("Scan Level 0");
lblName[2]->setText("Scan Level 1"); lblName[Scan1]->setText("Scan Level 1");
lblName[3]->setText("Action before each Frame"); lblName[ActionBefore]->setText("Action before each Frame");
lblName[4]->setText("Number of Positions"); lblName[NumPositions]->setText("Number of Positions");
lblName[5]->setText("Header before Frame"); lblName[HeaderBefore]->setText("Header before Frame");
lblName[6]->setText("Header after Frame"); lblName[HeaderAfter]->setText("Header after Frame");
lblName[7]->setText("Action after each Frame"); lblName[ActionAfter]->setText("Action after each Frame");
lblName[8]->setText("Action at Stop"); lblName[Stop]->setText("Action at Stop");
/** initially hide all the widgets*/ // initially hide all the widgets
for(int i=0;i<NUM_ACTION_WIDGETS;i++) actionWidget[i]->hide(); for(int i=0;i<NUM_ACTION_WIDGETS;i++)
actionWidget[i]->hide();
} }
void qTabActions::Initialization(){ void qTabActions::Initialization(){
connect(group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(Expand(QAbstractButton*))); connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
connect(actionWidget[Scan0],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int)));
connect(actionWidget[Scan1],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int)));
for(int i=0;i<NUM_ACTION_WIDGETS;i++){
connect(actionWidget[i],SIGNAL(SetScriptSignal(QString&,int)), this,SLOT(SetScript(QString&,int)));
}
} }
void qTabActions::Expand(QAbstractButton *button ){ void qTabActions::Expand(QAbstractButton *button ){
int index = group->id(button); int index = group->id(button);
/** Collapse */ // Collapse
if(!QString::compare(button->text(), "-")){ if(!QString::compare(button->text(), "-")){
palette->setColor(QPalette::WindowText,Qt::black); palette->setColor(QPalette::WindowText,Qt::black);
lblName[index]->setPalette(*palette); lblName[index]->setPalette(*palette);
actionWidget[index]->hide(); actionWidget[index]->hide();
button->setText("+"); button->setText("+");
if((index==1)||(index==2)) if((index==Scan0)||(index==Scan1))
setFixedHeight(height()-130); setFixedHeight(height()-130);
else else
setFixedHeight(height()-30); setFixedHeight(height()-30);
}else{ }else{
/** Expand */ // Expand
palette->setColor(QPalette::WindowText,QColor(0,0,200,255)); palette->setColor(QPalette::WindowText,QColor(0,0,200,255));
lblName[index]->setPalette(*palette); lblName[index]->setPalette(*palette);
actionWidget[index]->show(); actionWidget[index]->show();
button->setText("-"); button->setText("-");
if((index==1)||(index==2)) if((index==Scan0)||(index==Scan1))
setFixedHeight(height()+130); setFixedHeight(height()+130);
else else
setFixedHeight(height()+30); setFixedHeight(height()+30);
} }
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabActions::SetScript(const QString& fName,int index){
#ifdef VERBOSE
cout << "Setting script file of action widget:" << index << " to " << fName.toAscii().constData() << endl;
#endif
/*
void qTabActions::Initialization(){
connect(radio0Constant, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio0Specific, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio0Value, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Constant, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Specific, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Value, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(btntry, SIGNAL(clicked()),this,SLOT(Trial()));
} }
void qTabActions::Enable(bool enable){
}
void qTabActions::ChangeStepSize(bool b){
* defaults
lbl0From->hide();
lbl0Size->hide();
lbl0To->hide();
spin0From->hide();
spin0Size->hide();
spin0To->hide();
combo0Specific->hide();
btn0Browse->hide();
disp0File->hide();
lbl1From->hide();
lbl1Size->hide();
lbl1To->hide();
spin1From->hide();
spin1Size->hide();
spin1To->hide();
combo1Specific->hide();
btn1Browse->hide();
disp1File->hide();
*Scan 0
* constant step size
if(radio0Constant->isChecked()){
lbl0From->show();
lbl0Size->show();
lbl0To->show();
spin0From->show();
spin0Size->show();
spin0To->show();
}
* specific values
else if(radio0Specific->isChecked())
combo0Specific->show();
* values from a file
else{
btn0Browse->show();
disp0File->show();
}
*Scan 1
* constant step size
if(radio1Constant->isChecked()){
lbl1From->show();
lbl1Size->show();
lbl1To->show();
spin1From->show();
spin1Size->show();
spin1To->show();
}
* specific values
else if(radio1Specific->isChecked())
combo1Specific->show();
* values from a file
else{
btn1Browse->show();
disp1File->show();
}
//groupBox->hide();
}
//if(!QString::compare(btntry->text(),"+")){
*/
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabActions::Refresh(){ void qTabActions::Refresh(){

View File

@ -16,7 +16,7 @@ using namespace std;
qTabAdvanced::qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this); setupUi(this);
myDetType = (int)myDet->getDetectorsType(); myDetType = (int)myDet->getDetectorsType();
SetupWidgetWindow(); SetupWidgetWindow();

View File

@ -4,14 +4,19 @@
* Created on: May 10, 2012 * Created on: May 10, 2012
* Author: l_maliakal_d * Author: l_maliakal_d
*/ */
/**********************************************************************
* TO DO
* 1. Rate correction auto: for eiger depends on settings, tdeadtime{vv,vv,vv} in postprocessing.h
* ********************************************************************/
#include "qTabDataOutput.h" #include "qTabDataOutput.h"
#include "qDefs.h" #include "qDefs.h"
/** Project Class Headers */ // Project Class Headers
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
/** Qt Include Headers */ // Qt Include Headers
#include <QFileDialog> #include <QFileDialog>
/** C++ Include Headers */ // C++ Include Headers
#include <iostream> #include <iostream>
#include <string> #include <string>
using namespace std; using namespace std;
@ -20,11 +25,12 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector): qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector){ QWidget(parent),myDet(detector),detID(detID){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
Refresh();
} }
@ -40,7 +46,12 @@ qTabDataOutput::~qTabDataOutput(){
void qTabDataOutput::SetupWidgetWindow(){ void qTabDataOutput::SetupWidgetWindow(){
dispOutputDir->setText(QString(myDet->getFilePath().c_str())); // Detector Type
detType=myDet->getDetectorsType();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
chkRate->setEnabled(true);
} }
@ -48,18 +59,30 @@ void qTabDataOutput::SetupWidgetWindow(){
void qTabDataOutput::Initialization(){ void qTabDataOutput::Initialization(){
//output dir
connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&))); connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&)));
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir())); connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir()));
//flat field correction
connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField()));
connect(btnFlatField, SIGNAL(clicked()), this, SLOT(BrowseFlatFieldPath()));
//rate correction
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
//angular correction
connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection()));
//discard bad channels
connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels()));
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::setOutputDir(const QString& path){ void qTabDataOutput::setOutputDir(const QString& path){
myDet->setFilePath(string(path.toAscii().constData())); myDet->setFilePath(string(path.toAscii().constData()));
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Output Directory changed to :"<<myDet->getFilePath()<<endl; cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
#endif #endif
} }
@ -67,20 +90,288 @@ void qTabDataOutput::setOutputDir(const QString& path){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
/** output dir*/
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::browseOutputDir() void qTabDataOutput::browseOutputDir()
{ {
QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text()); QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text());
if (!directory.isEmpty()) if (!directory.isEmpty())
dispOutputDir->setText(directory); dispOutputDir->setText(directory);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetFlatField(){
#ifdef VERYVERBOSE
cout << "Entering Set Flat Field Correction Function" << endl;
#endif
// so that it doesnt call it twice
disconnect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
//enable/disable
dispFlatField->setEnabled(chkFlatField->isChecked());
btnFlatField->setEnabled(chkFlatField->isChecked());
if(chkFlatField->isChecked()){
if(dispFlatField->text().isEmpty()){
lblNote->show();
chkFlatField->setPalette(lblNote->palette());
chkFlatField->setText("Flat Field File:*");
#ifdef VERBOSE
cout << "Flat Field File is not set." << endl;
#endif
}else{
QString fName = dispFlatField->text();
QString file = fName.section('/',-1);
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
lblNote->hide();
chkFlatField->setPalette(chkRate->palette());
chkFlatField->setText("Flat Field File:");
//set ff dir
myDet->setFlatFieldCorrectionDir(dir.toAscii().constData());
//set ff file and catch error if -1
if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){
string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData();
if(sDir.length()<1) sDir = "/home";
qDefs::WarningMessage("Invalid Flat Field file - "+sDir+sFile+
".\nUnsetting Flat Field.","Data Output");
//Unsetting flat field
myDet->setFlatFieldCorrectionFile("");
dispFlatField->setText("");
lblNote->show();
chkFlatField->setPalette(lblNote->palette());
chkFlatField->setText("Flat Field File:*");
#ifdef VERBOSE
cout << "Invalid Flat Field File - "<< sDir << sFile << ". Unsetting Flat Field." << endl;
#endif
}
else{
#ifdef VERBOSE
cout << "Setting flat field file to "<< dispFlatField->text().toAscii().constData() << endl;
#endif
}
}
}else{
lblNote->hide();
chkFlatField->setPalette(chkRate->palette());
chkFlatField->setText("Flat Field File:");
//Unsetting flat field
myDet->setFlatFieldCorrectionFile("");
dispFlatField->setText("");
#ifdef VERBOSE
cout << "Unsetting flat field correction file" << endl;
#endif
}
connect(dispFlatField,SIGNAL(editingFinished()),this,SLOT(SetFlatField()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::UpdateFlatFieldFromServer(){
disconnect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
dispFlatField->setText(QString(myDet->getFlatFieldCorrectionDir().c_str())+"/"+QString(myDet->getFlatFieldCorrectionFile().c_str()));
#ifdef VERBOSE
cout << "Getting flat field correction file" << dispFlatField->text().toAscii().constData() << endl;
#endif
//calls setflatfield to ensure the file still exists or disable it
if(!QString(myDet->getFlatFieldCorrectionFile().c_str()).compare("none")){
dispFlatField->setText("");
chkFlatField->setChecked(false);
#ifdef VERBOSE
cout << "Flat Field is not set." << endl;
#endif
}
else
chkFlatField->setChecked(true);
lblNote->hide();
connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::BrowseFlatFieldPath()
{
QString fName = dispFlatField->text();
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
if(dir.isEmpty()) dir = "/home";
fName = QFileDialog::getOpenFileName(this,
tr("Load Flat Field Correction File"),dir,
tr("Flat Field Correction Files(*.dat)"));//,0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()){
dispFlatField->setText(fName);
SetFlatField();
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetRateCorrection(){
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
#ifdef VERBOSE
cout << "Entering Set Rate Correction function" << endl;
#endif
slsDetector *s = myDet->getSlsDetector(detID);
if(chkRate->isChecked()){
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
//set auto as default if nothing selected
if(!radioAuto->isChecked()&&!radioDeadTime->isChecked())
radioAuto->setChecked(true);
//auto
if(radioAuto->isChecked()){
spinDeadTime->setEnabled(false);
s->setRateCorrection(-1);
#ifdef VERBOSE
cout << "Setting rate corrections with default dead time" << endl;
#endif
}//custom dead time
else{
spinDeadTime->setEnabled(true);
s->setRateCorrection((float)spinDeadTime->value());
#ifdef VERBOSE
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
#endif
}
}//unsetting
else{
radioAuto->setEnabled(false);
radioDeadTime->setEnabled(false);
spinDeadTime->setEnabled(false);
//Unsetting rate correction
s->setRateCorrection(0);
#ifdef VERBOSE
cout << "Unsetting rate correction" << endl;
#endif
}
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::UpdateRateCorrectionFromServer(){
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
double rate;
slsDetector *s = myDet->getSlsDetector(detID);
rate = (double)s->getRateCorrectionTau();
#ifdef VERBOSE
cout << "Getting rate correction from server:" << rate << " : ";
#endif
if(rate==0){
#ifdef VERBOSE
cout << "None" << endl;
#endif
radioAuto->setEnabled(false);
radioDeadTime->setEnabled(false);
spinDeadTime->setEnabled(false);
chkRate->setChecked(false);
}else if(rate<0){
#ifdef VERBOSE
cout << "Auto" << endl;
#endif
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
spinDeadTime->setEnabled(false);
chkRate->setChecked(true);
radioAuto->setChecked(true);
}else{
#ifdef VERBOSE
cout << "Custom" << endl;
#endif
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
spinDeadTime->setEnabled(true);
chkRate->setChecked(true);
radioDeadTime->setChecked(true);
spinDeadTime->setValue((double)rate);
}
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetAngularCorrection(){
#ifdef VERYVERBOSE
cout << "Entering Set Angular Correction function" << endl;
#endif
if(chkAngular->isChecked()){
myDet->setAngularConversionFile("default");
#ifdef VERBOSE
cout << "Setting angular conversion to default" << endl;
#endif
}else{
myDet->setAngularConversionFile("");
#ifdef VERBOSE
cout << "Unsetting angular correction" << endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::DiscardBadChannels(){
#ifdef VERYVERBOSE
cout << "Entering Discard bad channels function" << endl;
#endif
if(chkDiscardBad->isChecked()){
myDet->setBadChannelCorrection("default");
#ifdef VERBOSE
cout << "Setting bad channel correction to default" << endl;
#endif
}else{
myDet->setBadChannelCorrection("");
#ifdef VERBOSE
cout << "Unsetting bad channel correction" << endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
// output dir
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
//flat field correction from server
UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
UpdateRateCorrectionFromServer();
//update angular conversion from server
int ang;
if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true);
//discard bad channels from server
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
} }

View File

@ -6,17 +6,17 @@
*/ */
#include "qTabDebugging.h" #include "qTabDebugging.h"
#include "qDefs.h" #include "qDefs.h"
/** Project Class Headers */ // Project Class Headers
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
/** C++ Include Headers */ // C++ Include Headers
#include<iostream> #include<iostream>
using namespace std; using namespace std;
qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
@ -33,6 +33,20 @@ qTabDebugging::~qTabDebugging(){
void qTabDebugging::SetupWidgetWindow(){ void qTabDebugging::SetupWidgetWindow(){
// Detector Type
detType=myDet->getDetectorsType();
if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:");
else lblModule->setText("Module Number:");
// loading combo box module numbers
int max = myDet->setNumberOfModules(GET_FLAG,slsDetectorDefs::X)*myDet->setNumberOfModules(GET_FLAG,slsDetectorDefs::Y);
for(int i=0;i<max;i++){
slsDetector *s = myDet->getSlsDetector(i);
if(s->setTCPSocket()!=slsDetectorDefs::FAIL){
comboModule->addItem(QString::number(i));
}
}
} }

View File

@ -16,7 +16,7 @@ using namespace std;
qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();

View File

@ -25,7 +25,7 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot): qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):
QWidget(parent),myDet(detector),myPlot(plot){ QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();

View File

@ -24,7 +24,7 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
} }

View File

@ -32,18 +32,9 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
/** Depending on whether the detector is 1d or 2d*/
switch(myDet->getDetectorsType()){
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
default:
cout<<"ERROR: Detector Type is Generic"<<endl;
exit(-1);
}
Initialization(); Initialization();
} }
@ -61,6 +52,9 @@ qTabPlot::~qTabPlot(){
void qTabPlot::SetupWidgetWindow(){ void qTabPlot::SetupWidgetWindow(){
scanLevel[0]=false;
scanLevel[1]=false;
/** Plot Axis*/ /** Plot Axis*/
myPlot->SetPlotTitle(defaultPlotTitle); myPlot->SetPlotTitle(defaultPlotTitle);
dispTitle->setText(defaultPlotTitle); dispTitle->setText(defaultPlotTitle);
@ -109,13 +103,18 @@ void qTabPlot::SetupWidgetWindow(){
stackedLayout->addWidget(w); stackedLayout->addWidget(w);
stackedLayout->addWidget(spinNthFrame); stackedLayout->addWidget(spinNthFrame);
stackWidget->setLayout(stackedLayout); stackWidget->setLayout(stackedLayout);
/** Depending on whether the detector is 1d or 2d*/
switch(myDet->getDetectorsType()){
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
default:
cout<<"ERROR: Detector Type is Generic"<<endl;
exit(-1);
}
} }
@ -149,6 +148,8 @@ void qTabPlot::Select1DPlot(bool b){
dispZAxis->setText(defaultImageZAxisTitle); dispZAxis->setText(defaultImageZAxisTitle);
myPlot->Select2DPlot(); myPlot->Select2DPlot();
} }
boxScan->setEnabled(false);
} }
@ -368,7 +369,7 @@ void qTabPlot::SetPlot(){
boxFrequency->setEnabled(false); boxFrequency->setEnabled(false);
boxPlotAxis->setEnabled(false); boxPlotAxis->setEnabled(false);
boxScan->setEnabled(false); boxScan->setEnabled(false);
}else if(radioHistogram->isChecked()){ }else {
myPlot->EnablePlot(true); myPlot->EnablePlot(true);
/**if enable is true, disable everything */ /**if enable is true, disable everything */
if(isOneD) box1D->show(); else box1D->hide(); if(isOneD) box1D->show(); else box1D->hide();
@ -377,25 +378,20 @@ void qTabPlot::SetPlot(){
boxSave->setEnabled(true); boxSave->setEnabled(true);
boxFrequency->setEnabled(true); boxFrequency->setEnabled(true);
boxPlotAxis->setEnabled(true); boxPlotAxis->setEnabled(true);
boxScan->setEnabled(false);
}else{ if(radioHistogram->isChecked())
myPlot->EnablePlot(true); boxScan->setEnabled(false);
/**if enable is true, disable everything */ else
if(isOneD) box1D->show(); else box1D->hide(); //check first if there is a scan from actions tab
if(!isOneD) box2D->show(); else box2D->hide(); boxScan->setEnabled(false);
boxSnapshot->setEnabled(true);
boxSave->setEnabled(true);
boxFrequency->setEnabled(true);
boxPlotAxis->setEnabled(true);
boxScan->setEnabled(true);
} }
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
int qTabPlot::SetFrequency(){ void qTabPlot::SetFrequency(){
int ret=0;
disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
@ -411,7 +407,6 @@ int qTabPlot::SetFrequency(){
/* Get the time interval from gui in ms*/ /* Get the time interval from gui in ms*/
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6);
if(timeMS<minPlotTimer){ if(timeMS<minPlotTimer){
ret = 1;
qDefs::WarningMessage("Interval between Plots - The Time Interval between plots " qDefs::WarningMessage("Interval between Plots - The Time Interval between plots "
"must be atleast "+string(cplotms)+".","Plot"); "must be atleast "+string(cplotms)+".","Plot");
spinTimeGap->setValue(minPlotTimer); spinTimeGap->setValue(minPlotTimer);
@ -431,7 +426,6 @@ int qTabPlot::SetFrequency(){
timeMS = (spinNthFrame->value())*acqPeriodMS; timeMS = (spinNthFrame->value())*acqPeriodMS;
/** To make sure the period between plotting is not less than minimum plot timer in ms*/ /** To make sure the period between plotting is not less than minimum plot timer in ms*/
if(timeMS<minPlotTimer){ if(timeMS<minPlotTimer){
ret = 1;
int minFrame = (ceil)(minPlotTimer/acqPeriodMS); int minFrame = (ceil)(minPlotTimer/acqPeriodMS);
qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>" qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>"
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 500ms." "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 500ms."
@ -450,14 +444,49 @@ int qTabPlot::SetFrequency(){
connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
return ret;
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableScanBox(bool enable,int id){
cout<<"enable:"<<enable<<" id:"<<id<<endl;
/**find out when this is enabled*/
scanLevel[id]=enable;
//both are disabled
if((!scanLevel[0])&&(!scanLevel[1])){
boxScan->setEnabled(false);
}//both are enabled
else if((scanLevel[0])&&(scanLevel[1])){
//disable none and check the other
if(id) {radioLevel1->setEnabled(true);radioLevel1->setChecked(true);}
else {radioLevel0->setEnabled(true);radioLevel0->setChecked(true);}
}//either 1 is enabled/disabled
else{
if(!boxScan->isEnabled()) {
boxScan->setEnabled(true);
radioFileIndex->setEnabled(false);
}
//disable one and check the other
if(id) {
radioLevel0->setEnabled(!enable);
radioLevel0->setChecked(!enable);
radioLevel1->setEnabled(enable);
radioLevel1->setChecked(enable);
}else{
radioLevel0->setEnabled(enable);
radioLevel0->setChecked(enable);
radioLevel1->setEnabled(!enable);
radioLevel1->setChecked(!enable);
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::Refresh(){ void qTabPlot::Refresh(){
SetFrequency(); SetFrequency();
} }

View File

@ -16,8 +16,8 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID): qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID){ QWidget(parent),myDet(detector),detID(detID), expertMode(false){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
@ -41,6 +41,22 @@ void qTabSettings::SetupWidgetWindow(){
SetupDetectorSettings(); SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID)); comboSettings->setCurrentIndex(myDet->getSettings(detID));
/**expert mode is not enabled initially*/
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
/** Number of Modules */
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
spinNumModules->setValue(myDet->setNumberOfModules());
/** Dynamic Range */
switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
} }
@ -107,15 +123,12 @@ void qTabSettings::SetupDetectorSettings(){
qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. "
"Exiting GUI.","Settings"); "Exiting GUI.","Settings");
#ifdef VERBOSE #ifdef VERBOSE
cout<<"ERROR: Unknown Detector Settings retrieved from detector."<<endl; cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
#endif #endif
exit(-1); exit(-1);
} }
/** Setting the detector settings */ /** Setting the detector settings */
else { else comboSettings->setCurrentIndex((int)sett);
comboSettings->setCurrentIndex((int)sett);
}
} }
} }
@ -123,7 +136,13 @@ void qTabSettings::SetupDetectorSettings(){
void qTabSettings::Initialization(){ void qTabSettings::Initialization(){
/** Settings */ /** Settings */
connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int))); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
/** Number of Modules */
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
/** Dynamic Range */
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
/** Threshold */
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -142,11 +161,91 @@ void qTabSettings::setSettings(int index){
} }
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID); slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID);
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett)<<endl; cout << "Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
#endif #endif
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
if((index==Undefined)||(index==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(expertMode);
spinThreshold->setEnabled(expertMode);
if(expertMode) SetEnergy();
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetNumberOfModules(int index){
#ifdef VERBOSE
cout << "Setting number of modules to "<< index << endl;
#endif
int i = myDet->setNumberOfModules(index);
if(index!=i)
qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings");
#ifdef VERBOSE
cout << "ERROR: Setting number of modules to "<< i << endl;
#endif
spinNumModules->setValue(i);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetDynamicRange(int index){
int ret,dr;
switch (index) {
case 0: dr=32; break;
case 1: dr=16; break;
case 2: dr=8; break;
case 3: dr=4; break;
default: dr=32; break;
}
#ifdef VERBOSE
cout << "Setting dynamic range to "<< dr << endl;
#endif
ret=myDet->setDynamicRange(dr);
if(ret!=dr){
qDefs::WarningMessage("Dynamic Range cannot be set for this value.","Settings");
#ifdef VERBOSE
cout << "ERROR: Setting dynamic range to "<< ret << endl;
#endif
switch(ret){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetEnergy(){
#ifdef VERBOSE
cout << "Settings threshold energy to "<< index << endl;
#endif
int index = spinThreshold->value();
myDet->setThresholdEnergy(index);
int ret = (int)myDet->getThresholdEnergy();
if(ret!=index){
qDefs::WarningMessage("Threshold energy could not be set.","Settings");
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
spinThreshold->setValue(ret);
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
}
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -154,6 +253,33 @@ void qTabSettings::Refresh(){
/** Settings */ /** Settings */
SetupDetectorSettings(); SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID)); comboSettings->setCurrentIndex(myDet->getSettings(detID));
/** Number of Modules */
spinNumModules->setValue(myDet->setNumberOfModules());
/** Dynamic Range */
switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
if((comboSettings->currentIndex()==Undefined)||(comboSettings->currentIndex()==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(expertMode);
spinThreshold->setEnabled(expertMode);
if(expertMode) SetEnergy();
}
}
} }