From f3eb9c924f5490474e0aee6a33fddbb8f2e96553 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 7 Feb 2013 17:34:16 +0000 Subject: [PATCH] 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 --- slsDetectorGui/forms/form_tab_advanced.ui | 693 ++++++++++++++++++- slsDetectorGui/forms/form_tab_measurement.ui | 4 +- slsDetectorGui/include/qDefs.h | 1 + slsDetectorGui/include/qTabAdvanced.h | 50 +- slsDetectorGui/src/qDetectorMain.cpp | 2 - slsDetectorGui/src/qTabAdvanced.cpp | 376 +++++++++- slsDetectorGui/src/qTabMessages.cpp | 4 +- 7 files changed, 1103 insertions(+), 27 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 402ebe43a..60384eccb 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -35,17 +35,26 @@ :/icons/images/refresh.png:/icons/images/refresh.png - + 5 - 5 + 3 761 - 341 + 343 + + + + + QTabWidget::North + - 2 + 3 + + + Qt::ElideLeft @@ -802,6 +811,682 @@ An extension given by the modules serial number will be attached. + + + Network + + + + + 10 + 10 + 336 + 96 + + + + Detector Ports + + + + + 20 + 25 + 296 + 56 + + + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 127 + 16777215 + + + + Sets Control Port +#port# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + Control Port: + + + + + + + + 0 + 0 + + + + Stop Port: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets Stop Port +#stopport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + gridLayoutWidget_5 + dispFileName + gridLayoutWidget_7 + + + + + 410 + 10 + 336 + 96 + + + + Receiver Ports + + + + + 20 + 25 + 296 + 56 + + + + + -1 + + + + + + 0 + 0 + + + + UDP Port: + + + + + + + + 0 + 0 + + + + TCP Port: + + + + + + + + 0 + 0 + + + + + 127 + 0 + + + + Sets Receiver TCP Port +#rx_tcpport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + + 127 + 0 + + + + Sets Receiver UDP Port +#rx_udpport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + + + 410 + 120 + 336 + 156 + + + + Receiver Parameters + + + + + 20 + 25 + 296 + 116 + + + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + 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# + + + none + + + + + + + + 0 + 0 + + + + UDP MAC: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the Receiver UDP MAC +#rx_udpmac# + + + none + + + + + + + + 0 + 0 + + + + UDP IP: + + + + + + + + 0 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + Hostname / IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the Receiver UDP IP +#rx_udpip# + + + none + + + + + + + + 0 + 0 + + + + <nobr>If the receiver is online<br>#r_online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + + + 10 + 120 + 336 + 156 + + + + Detector Parameters + + + + + 20 + 25 + 296 + 116 + + + + + -1 + + + + + + 0 + 0 + + + + Hostname / IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector MAC to send packets to receiver +#detectormac# + + + + + + + + + + + 0 + 0 + + + + MAC: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Detector Hostname #hostname# + + + + + + false + + + 0 + + + true + + + + + + + + 0 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector IP to send packets to receiver +#detectorip# + + + + + + + + + + + 0 + 0 + + + + <nobr>If the detector is online<br>#online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + + + 410 + 285 + 336 + 25 + + + + Set Receiver + + + + + + 10 + 285 + 336 + 25 + + + + Configure MAC + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 98a81f770..24f6556c1 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -481,8 +481,8 @@ - Settings of the detector. - #settings# + Timing Mode of the detector. + #timing# diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index bf5d29634..f8836e63a 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -208,6 +208,7 @@ static const int64_t GUI_VERSION=0x20121213; qDefs::Message((MessageIndex)errorLevel,retval,"Main"); } + myDet->clearAllErrorMask(); return retval; }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index ec4dc68b2..b0961e192 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -38,12 +38,11 @@ public: */ ~qTabAdvanced(); +public slots: /** To refresh and update widgets */ void Refresh(); - - private: /** Sets up the widget */ @@ -104,6 +103,49 @@ private slots: */ 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: /** The sls detector object */ multiSlsDetector *myDet; @@ -119,6 +161,9 @@ private: /** Tool Tip for the output dir */ QString outputDirTip; QString errOutputTip; + QString errOnlineTip; + QString detOnlineTip; + QString rxrOnlineTip; QPalette red; /** Trimming mode */ @@ -127,6 +172,7 @@ private: bool isEnergy; bool isAngular; + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 833d58980..afde69957 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -308,7 +308,6 @@ void qDetectorMain::LoadConfigFile(const string fName){ qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); qDefs::checkErrorMessage(myDet); - myDet->clearErrorMask(); } } @@ -540,7 +539,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tab_plot->Refresh(); } qDefs::checkErrorMessage(myDet); - myDet->clearErrorMask(); } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 769b05423..75a5b73ee 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -39,11 +39,33 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ + //executed even for non digital, so make sure its necessary //readout adc lblADC->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("

" + "Output Trim File should contain both existing directory and a file name.
" + "The extensions are automatically added.

" + "Enter valid Output Trim File to enable Start Trimming button.
"); + detOnlineTip = comboOnline->toolTip(); + rxrOnlineTip = comboRxrOnline->toolTip(); + errOnlineTip = QString("

It is offline!"); detType = myDet->getDetectorsType(); switch(detType){ @@ -55,12 +77,20 @@ void qTabAdvanced::SetupWidgetWindow(){ isAngular = true; lblADC->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; default: break; } - + //logs if(!isAngular && !isEnergy) boxLogs->setEnabled(false); else{ if(!isAngular) chkAngularLog->setEnabled(false); @@ -68,16 +98,7 @@ void qTabAdvanced::SetupWidgetWindow(){ chkEnergyLog->setEnabled(false); boxPlot->setEnabled(false); boxTrimming->setEnabled(false); - } - else{ - outputDirTip = dispFile->toolTip(); - errOutputTip = QString("

" - "Output Trim File should contain both existing directory and a file name.
" - "The extensions are automatically added.

" - "Enter valid Output Trim File to enable Start Trimming button.
"); - red = QPalette(); - red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); - + }else{ boxTrimming->setChecked(false); SetOptimize(false); @@ -85,9 +106,44 @@ void qTabAdvanced::SetupWidgetWindow(){ btnGroup->addButton(btnRefresh,0); btnGroup->addButton(btnGetTrimbits,1); } - - Initialization(); } + + + //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(); + } @@ -95,6 +151,9 @@ void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::Initialization(){ + + connect(tabAdvancedSettings,SIGNAL(currentChanged(int)), this, SLOT(Refresh())); + //energy/angular logs if(isAngular) connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); @@ -129,8 +188,29 @@ void qTabAdvanced::Initialization(){ connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); } - if(detType==slsDetectorDefs::GOTTHARD) - connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + //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))); + + //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(){ #ifdef VERBOSE cout << endl << "**Updating Advanced Tab" << endl; #endif + //setting color of tab + //void setTabBar ( QTabBar * tb ) + //QTabBar * tabBar () const + /* + for(int i=0;itabBar()->setTabTextColor(i,defaultTabColor); + tabAdvancedSettings->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); + */ if(isAngular){ #ifdef VERBOSE @@ -466,6 +722,96 @@ void qTabAdvanced::Refresh(){ 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 cout << "**Updated Advanced Tab" << endl << endl; #endif diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index f826ba3b5..3bbe0db9f 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -67,8 +67,8 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addWidget(dispLog,3,0,1,5); errMsg = " Please check Messages Tab. Following message was caught:

"; - qout=new qDebugStream(std::cout,this); - qerr=new qDebugStream(std::cerr,this); + //qout=new qDebugStream(std::cout,this); + //qerr=new qDebugStream(std::cerr,this); }