included network tab in gui, correctedmulti to be able to clear sls detectors error mask,included coud not set up network parameter error

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@144 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2013-02-07 17:34:16 +00:00
parent aec136cf21
commit f3eb9c924f
7 changed files with 1103 additions and 27 deletions

View File

@ -35,17 +35,26 @@
<iconset resource="../include/icons.qrc"> <iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/refresh.png</normaloff>:/icons/images/refresh.png</iconset> <normaloff>:/icons/images/refresh.png</normaloff>:/icons/images/refresh.png</iconset>
</property> </property>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabAdvancedSettings">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>5</x> <x>5</x>
<y>5</y> <y>3</y>
<width>761</width> <width>761</width>
<height>341</height> <height>343</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string/>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>3</number>
</property>
<property name="elideMode">
<enum>Qt::ElideLeft</enum>
</property> </property>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@ -802,6 +811,682 @@ An extension given by the modules serial number will be attached.
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Network</string>
</attribute>
<widget class="QGroupBox" name="boxDetectorPorts">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>336</width>
<height>96</height>
</rect>
</property>
<property name="title">
<string>Detector Ports</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_5">
<property name="geometry">
<rect>
<x>20</x>
<y>25</y>
<width>296</width>
<height>56</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QSpinBox" name="spinControlPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>127</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sets Control Port
#port#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Control Port:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stop Port:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSpinBox" name="spinStopPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets Stop Port
#stopport#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<zorder>gridLayoutWidget_5</zorder>
<zorder>dispFileName</zorder>
<zorder>gridLayoutWidget_7</zorder>
</widget>
<widget class="QGroupBox" name="boxRxrPorts">
<property name="geometry">
<rect>
<x>410</x>
<y>10</y>
<width>336</width>
<height>96</height>
</rect>
</property>
<property name="title">
<string>Receiver Ports</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_6">
<property name="geometry">
<rect>
<x>20</x>
<y>25</y>
<width>296</width>
<height>56</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UDP Port:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TCP Port:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QSpinBox" name="spinTCPPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>127</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string notr="true">Sets Receiver TCP Port
#rx_tcpport#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSpinBox" name="spinUDPPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>127</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets Receiver UDP Port
#rx_udpport#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="boxRxr">
<property name="geometry">
<rect>
<x>410</x>
<y>120</y>
<width>336</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Receiver Parameters</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_8">
<property name="geometry">
<rect>
<x>20</x>
<y>25</y>
<width>296</width>
<height>116</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="dispRxrHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver.
#rx_hostname#</string>
</property>
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_18">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UDP MAC:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="dispUDPMAC">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets the Receiver UDP MAC
#rx_udpmac#</string>
</property>
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UDP IP:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblRxrOnline">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Online:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hostname / IP:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="dispUDPIP">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets the Receiver UDP IP
#rx_udpip#</string>
</property>
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboRxrOnline">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;If the receiver is online&lt;br&gt;#r_online#&lt;/nobr&gt;&lt;</string>
</property>
<item>
<property name="text">
<string>Offline</string>
</property>
</item>
<item>
<property name="text">
<string>Online</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="boxDetector">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>336</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Detector Parameters</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_9">
<property name="geometry">
<rect>
<x>20</x>
<y>25</y>
<width>296</width>
<height>116</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hostname / IP:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="dispMAC">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets the detector MAC to send packets to receiver
#detectormac#</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblMAC">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>MAC:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="dispHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Detector Hostname #hostname#</string>
</property>
<property name="text">
<string/>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="cursorPosition">
<number>0</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblOnline">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Online:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblIP">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>IP:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="dispIP">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Sets the detector IP to send packets to receiver
#detectorip#</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboOnline">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;If the detector is online&lt;br&gt;#online#&lt;/nobr&gt;&lt;</string>
</property>
<item>
<property name="text">
<string>Offline</string>
</property>
</item>
<item>
<property name="text">
<string>Online</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QPushButton" name="btnRxr">
<property name="geometry">
<rect>
<x>410</x>
<y>285</y>
<width>336</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Set Receiver</string>
</property>
</widget>
<widget class="QPushButton" name="btnConfigure">
<property name="geometry">
<rect>
<x>10</x>
<y>285</y>
<width>336</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Configure MAC</string>
</property>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
<resources> <resources>

View File

@ -481,8 +481,8 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Settings of the detector. <string>Timing Mode of the detector.
#settings#</string> #timing#</string>
</property> </property>
<item> <item>
<property name="text"> <property name="text">

View File

@ -208,6 +208,7 @@ static const int64_t GUI_VERSION=0x20121213;
qDefs::Message((MessageIndex)errorLevel,retval,"Main"); qDefs::Message((MessageIndex)errorLevel,retval,"Main");
} }
myDet->clearAllErrorMask();
return retval; return retval;
}; };

View File

@ -38,12 +38,11 @@ public:
*/ */
~qTabAdvanced(); ~qTabAdvanced();
public slots:
/** To refresh and update widgets /** To refresh and update widgets
*/ */
void Refresh(); void Refresh();
private: private:
/** Sets up the widget /** Sets up the widget
*/ */
@ -104,6 +103,49 @@ private slots:
*/ */
void UpdateTrimbitPlot(int id); void UpdateTrimbitPlot(int id);
/** Sets control port
* @param port control port
*/
void SetControlPort(int port);
/** Sets stop port
* @param port stop port
*/
void SetStopPort(int port);
/** Sets receiver tcp port
* @param port receiver tcp port
*/
void SetRxrTCPPort(int port);
/** Sets receiver udp port
* @param port receiver udp port
*/
void SetRxrUDPPort(int port);
/** Sets receiver online
* @param index 1 for online and 0 for offline
*/
void SetReceiverOnline(int index);
/** Sets detector online
* @param index 1 for online and 0 for offline
*/
void SetOnline(int index);
/** Sets network parameters like receiver udp ip,
* receiver udp mac, detector ip and detector mac
*/
void SetNetworkParameters();
/** Sets the receiver. which also sets the receiver parameters
*/
void SetReceiver();
/** Configures mac
*/
void Configuremac();
private: private:
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
@ -119,6 +161,9 @@ private:
/** Tool Tip for the output dir */ /** Tool Tip for the output dir */
QString outputDirTip; QString outputDirTip;
QString errOutputTip; QString errOutputTip;
QString errOnlineTip;
QString detOnlineTip;
QString rxrOnlineTip;
QPalette red; QPalette red;
/** Trimming mode */ /** Trimming mode */
@ -127,6 +172,7 @@ private:
bool isEnergy; bool isEnergy;
bool isAngular; bool isAngular;
}; };

View File

@ -308,7 +308,6 @@ void qDetectorMain::LoadConfigFile(const string fName){
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","Main"); qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","Main");
qDefs::checkErrorMessage(myDet); qDefs::checkErrorMessage(myDet);
myDet->clearErrorMask();
} }
} }
@ -540,7 +539,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
tab_plot->Refresh(); tab_plot->Refresh();
} }
qDefs::checkErrorMessage(myDet); qDefs::checkErrorMessage(myDet);
myDet->clearErrorMask();
} }

View File

@ -39,11 +39,33 @@ qTabAdvanced::~qTabAdvanced(){
void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::SetupWidgetWindow(){
//executed even for non digital, so make sure its necessary //executed even for non digital, so make sure its necessary
//readout adc //readout adc
lblADC->setEnabled(false); lblADC->setEnabled(false);
comboADC->setEnabled(false); comboADC->setEnabled(false);
//Network
lblIP->setEnabled(false);
lblMAC->setEnabled(false);
dispIP->setEnabled(false);
dispMAC->setEnabled(false);
boxRxrPorts->setEnabled(false);
boxRxr->setEnabled(false);
btnRxr->setEnabled(false);
btnConfigure->setEnabled(false);
red = QPalette();
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
outputDirTip = dispFile->toolTip();
errOutputTip = QString("<br><br><font color=\"red\"><nobr>"
"<b>Output Trim File</b> should contain both existing directory and a file name.</nobr><br>"
"<nobr>The extensions are automatically added.</nobr><br><br>"
"<nobr>Enter valid<b> Output Trim File</b> to enable <b>Start Trimming</b> button.</nobr></font>");
detOnlineTip = comboOnline->toolTip();
rxrOnlineTip = comboRxrOnline->toolTip();
errOnlineTip = QString("<nobr><br><br><font color=\"red\"><nobr>It is offline!</nobr></font>");
detType = myDet->getDetectorsType(); detType = myDet->getDetectorsType();
switch(detType){ switch(detType){
@ -55,12 +77,20 @@ void qTabAdvanced::SetupWidgetWindow(){
isAngular = true; isAngular = true;
lblADC->setEnabled(true); lblADC->setEnabled(true);
comboADC->setEnabled(true); comboADC->setEnabled(true);
lblIP->setEnabled(true);
lblMAC->setEnabled(true);
dispIP->setEnabled(true);
dispMAC->setEnabled(true);
boxRxrPorts->setEnabled(true);
boxRxr->setEnabled(true);
btnRxr->setEnabled(true);
btnConfigure->setEnabled(true);
break; break;
default: break; default: break;
} }
//logs
if(!isAngular && !isEnergy) boxLogs->setEnabled(false); if(!isAngular && !isEnergy) boxLogs->setEnabled(false);
else{ else{
if(!isAngular) chkAngularLog->setEnabled(false); if(!isAngular) chkAngularLog->setEnabled(false);
@ -68,16 +98,7 @@ void qTabAdvanced::SetupWidgetWindow(){
chkEnergyLog->setEnabled(false); chkEnergyLog->setEnabled(false);
boxPlot->setEnabled(false); boxPlot->setEnabled(false);
boxTrimming->setEnabled(false); boxTrimming->setEnabled(false);
} }else{
else{
outputDirTip = dispFile->toolTip();
errOutputTip = QString("<br><br><font color=\"red\"><nobr>"
"<b>Output Trim File</b> should contain both existing directory and a file name.</nobr><br>"
"<nobr>The extensions are automatically added.</nobr><br><br>"
"<nobr>Enter valid<b> Output Trim File</b> to enable <b>Start Trimming</b> button.</nobr></font>");
red = QPalette();
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
boxTrimming->setChecked(false); boxTrimming->setChecked(false);
SetOptimize(false); SetOptimize(false);
@ -85,9 +106,44 @@ void qTabAdvanced::SetupWidgetWindow(){
btnGroup->addButton(btnRefresh,0); btnGroup->addButton(btnRefresh,0);
btnGroup->addButton(btnGetTrimbits,1); btnGroup->addButton(btnGetTrimbits,1);
} }
}
//network
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1));
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1));
spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT)));
dispHostname->setText(QString(myDet->getHostname().c_str()));
dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP)));
dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC)));
dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME)));
dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP)));
dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC)));
//check if its online and set it to red if offline
myDet->checkOnline();
myDet->checkReceiverOnline();
comboOnline->setCurrentIndex(myDet->setOnline());
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline());
if(!comboOnline->currentIndex()){
comboOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setPalette(red);
lblOnline->setText("Online:*");
}
if((comboRxrOnline->isEnabled())&&(!comboRxrOnline->currentIndex())){
comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setPalette(red);
lblRxrOnline->setText("Online:*");
}
Initialization(); Initialization();
}
} }
@ -95,6 +151,9 @@ void qTabAdvanced::SetupWidgetWindow(){
void qTabAdvanced::Initialization(){ void qTabAdvanced::Initialization(){
connect(tabAdvancedSettings,SIGNAL(currentChanged(int)), this, SLOT(Refresh()));
//energy/angular logs //energy/angular logs
if(isAngular) if(isAngular)
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
@ -129,9 +188,30 @@ void qTabAdvanced::Initialization(){
connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int)));
} }
if(detType==slsDetectorDefs::GOTTHARD) //network
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
if(detType==slsDetectorDefs::GOTTHARD){
//readout
connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
//network
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
}
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -408,10 +488,186 @@ void qTabAdvanced::UpdateTrimbitPlot(int id){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetControlPort(int port){
#ifdef VERBOSE
cout << "Setting Control Port:" << port << endl;
#endif
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,port));
qDefs::checkErrorMessage(myDet);
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetStopPort(int port){
#ifdef VERBOSE
cout << "Setting Stop Port:" << port << endl;
#endif
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,port));
qDefs::checkErrorMessage(myDet);
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetRxrTCPPort(int port){
#ifdef VERBOSE
cout << "Setting Receiver TCP Port:" << port << endl;
#endif
disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,port));
qDefs::checkErrorMessage(myDet);
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetRxrUDPPort(int port){
#ifdef VERBOSE
cout << "Setting Receiver UDP Port:" << port << endl;
#endif
char sNumber[100];
sprintf(sNumber,"%d",port);
disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
spinUDPPort->setValue(atoi(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT,sNumber)));
qDefs::checkErrorMessage(myDet);
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetReceiverOnline(int index){
#ifdef VERBOSE
cout << "Setting Reciever Online to :" << index << endl;
#endif
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline(index));
qDefs::checkErrorMessage(myDet);
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
//highlight in red if offline
if(!comboRxrOnline->currentIndex()){
comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setPalette(red);
lblRxrOnline->setText("Online:*");
}else{
comboRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setPalette(lblHostname->palette());
lblRxrOnline->setText("Online:");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetOnline(int index){
#ifdef VERBOSE
cout << "Setting Detector Online to " << index << endl;
#endif
disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
comboOnline->setCurrentIndex(myDet->setOnline(index));
qDefs::checkErrorMessage(myDet);
connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
//highlight in red if offline
if(!comboOnline->currentIndex()){
comboOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setPalette(red);
lblOnline->setText("Online:*");
}else{
comboOnline->setToolTip(detOnlineTip);
lblOnline->setToolTip(detOnlineTip);
lblOnline->setPalette(lblHostname->palette());
lblOnline->setText("Online:");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetNetworkParameters(){
#ifdef VERBOSE
cout << "Setting Network Parametrs" << endl;
#endif
disconnect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
dispIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_IP,dispIP->text().toAscii().constData())));
dispMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_MAC,dispMAC->text().toAscii().constData())));
dispUDPIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP,dispUDPIP->text().toAscii().constData())));
dispUDPMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC,dispUDPMAC->text().toAscii().constData())));
qDefs::checkErrorMessage(myDet);
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetReceiver(){
#ifdef VERBOSE
cout << "Setting Receiver" << endl;
#endif
dispRxrHostname->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME,dispRxrHostname->text().toAscii().constData())));
qDefs::checkErrorMessage(myDet);
Refresh();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Configuremac(){
#ifdef VERBOSE
cout << "Configuring Mac:" << endl;
#endif
int adc = comboADC->currentIndex();
if(adc==5) adc=-1;
myDet->configureMAC(adc);
// qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced");
//else
// qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced");
qDefs::checkErrorMessage(myDet);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){ void qTabAdvanced::Refresh(){
#ifdef VERBOSE #ifdef VERBOSE
cout << endl << "**Updating Advanced Tab" << endl; cout << endl << "**Updating Advanced Tab" << endl;
#endif #endif
//setting color of tab
//void setTabBar ( QTabBar * tb )
//QTabBar * tabBar () const
/*
for(int i=0;i<NumberOfTabs;i++)
tabAdvancedSettings->tabBar()->setTabTextColor(i,defaultTabColor);
tabAdvancedSettings->tabBar()->setTabTextColor(index,QColor(0,0,200,255));
*/
if(isAngular){ if(isAngular){
#ifdef VERBOSE #ifdef VERBOSE
@ -466,6 +722,96 @@ void qTabAdvanced::Refresh(){
connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
} }
//network
//so that updated status
myDet->checkOnline();
dispHostname->setText(QString(myDet->getHostname().c_str()));
//disconnect
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1));
spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1));
comboOnline->setCurrentIndex(myDet->setOnline());
//connect
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
if(detType==slsDetectorDefs::GOTTHARD){
//disconnect
disconnect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
disconnect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
disconnect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
//so that updated status
myDet->checkReceiverOnline();
dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME)));
spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1));
spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT)));
dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP)));
dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC)));
comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline());
dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP)));
dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC)));
//connect
connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver()));
connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac()));
}
//highlight in red if detector or receiver is offline
if(!comboOnline->currentIndex()){
comboOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setToolTip(detOnlineTip + errOnlineTip);
lblOnline->setPalette(red);
lblOnline->setText("Online:*");
}else{
comboOnline->setToolTip(detOnlineTip);
lblOnline->setToolTip(detOnlineTip);
lblOnline->setPalette(lblHostname->palette());
lblOnline->setText("Online:");
}
if(comboRxrOnline->isEnabled()){
if(!comboRxrOnline->currentIndex()){
comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip);
lblRxrOnline->setPalette(red);
lblRxrOnline->setText("Online:*");
}else{
comboRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setToolTip(rxrOnlineTip);
lblRxrOnline->setPalette(lblHostname->palette());
lblRxrOnline->setText("Online:");
}
}
#ifdef VERBOSE #ifdef VERBOSE
cout << "**Updated Advanced Tab" << endl << endl; cout << "**Updated Advanced Tab" << endl << endl;
#endif #endif

View File

@ -67,8 +67,8 @@ void qTabMessages::SetupWidgetWindow(){
gridLayout->addWidget(dispLog,3,0,1,5); gridLayout->addWidget(dispLog,3,0,1,5);
errMsg = "<nobr> Please check Messages Tab. Following message was caught:</nobr><br><br><nobr><font color=\"darkBlue\">"; errMsg = "<nobr> Please check Messages Tab. Following message was caught:</nobr><br><br><nobr><font color=\"darkBlue\">";
qout=new qDebugStream(std::cout,this); //qout=new qDebugStream(std::cout,this);
qerr=new qDebugStream(std::cerr,this); //qerr=new qDebugStream(std::cerr,this);
} }