no plot histogram, messages work

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@16 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-07-04 13:39:30 +00:00
parent ec0878d008
commit 81ac62dd49
30 changed files with 1133 additions and 580 deletions

View File

@ -159,43 +159,6 @@
<height>524287</height>
</size>
</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>
</active>
<inactive>
<colorrole role="WindowText">
<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>119</red>
<green>119</green>
<blue>119</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
@ -220,6 +183,9 @@ p, li { white-space: pre-wrap; }
<property name="statusTip">
<string/>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>

View File

@ -411,9 +411,9 @@
</property>
<property name="geometry">
<rect>
<x>315</x>
<x>430</x>
<y>70</y>
<width>446</width>
<width>331</width>
<height>51</height>
</rect>
</property>
@ -431,7 +431,7 @@
<rect>
<x>10</x>
<y>20</y>
<width>496</width>
<width>321</width>
<height>22</height>
</rect>
</property>
@ -449,7 +449,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QCheckBox" name="chkContour">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -462,7 +462,7 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="4">
<widget class="QCheckBox" name="chkLogz">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -475,8 +475,8 @@
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_3">
<item row="0" column="1">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -485,7 +485,23 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>180</width>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
@ -497,9 +513,9 @@
<widget class="QGroupBox" name="box1D">
<property name="geometry">
<rect>
<x>315</x>
<y>10</y>
<width>446</width>
<x>10</x>
<y>70</y>
<width>391</width>
<height>51</height>
</rect>
</property>
@ -517,13 +533,19 @@
<rect>
<x>10</x>
<y>20</y>
<width>254</width>
<width>376</width>
<height>21</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="chkSuperimpose">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Superimpose</string>
</property>
@ -532,16 +554,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblPersistency">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Persistency:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
@ -558,7 +570,70 @@
</property>
</spacer>
</item>
<item row="0" column="3">
<item row="0" column="5">
<widget class="QCheckBox" name="checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Line</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QCheckBox" name="checkBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Points</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="lblPersistency">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Persistency:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinPersistency">
<property name="enabled">
<bool>false</bool>
@ -571,12 +646,12 @@
</property>
<property name="maximumSize">
<size>
<width>60</width>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
@ -590,37 +665,8 @@
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnClear">
<property name="geometry">
<rect>
<x>395</x>
<y>15</y>
<width>40</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="boxSave">
@ -628,7 +674,7 @@
<rect>
<x>10</x>
<y>135</y>
<width>751</width>
<width>391</width>
<height>51</height>
</rect>
</property>
@ -646,69 +692,11 @@
<rect>
<x>10</x>
<y>15</y>
<width>741</width>
<width>382</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutSave">
<item>
<widget class="QLabel" name="lblFName">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>File Name:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hLayoutSave">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="dispFName">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboFormat">
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>.png</string>
</property>
</item>
<item>
<property name="text">
<string>.jpg</string>
</property>
</item>
<item>
<property name="text">
<string>.xpm</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btnSave">
<property name="sizePolicy">
@ -748,6 +736,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<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>
<widget class="QCheckBox" name="chkSaveAll">
<property name="text">
@ -758,15 +762,15 @@
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="boxSnapshot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>261</width>
<x>430</x>
<y>135</y>
<width>331</width>
<height>51</height>
</rect>
</property>
@ -782,10 +786,10 @@
<widget class="QWidget" name="gridLayoutWidget_4">
<property name="geometry">
<rect>
<x>5</x>
<y>21</y>
<width>251</width>
<height>21</height>
<x>10</x>
<y>15</y>
<width>311</width>
<height>31</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
@ -804,11 +808,11 @@
<string>Create</string>
</property>
<property name="flat">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QPushButton" name="btnCloseClones">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -823,11 +827,11 @@
<string>Close All</string>
</property>
<property name="flat">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="4">
<widget class="QPushButton" name="btnSaveClones">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -842,10 +846,42 @@
<string>Save All</string>
</property>
<property name="flat">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
@ -857,7 +893,7 @@
<rect>
<x>10</x>
<y>10</y>
<width>261</width>
<width>391</width>
<height>51</height>
</rect>
</property>
@ -875,32 +911,222 @@
<rect>
<x>10</x>
<y>20</y>
<width>246</width>
<height>21</height>
<width>381</width>
<height>23</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QCheckBox" name="chkNoPlot">
<widget class="QRadioButton" name="radioNoPlot">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>None</string>
<string>No Plot</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chktest1D_3">
<item row="0" column="4">
<widget class="QRadioButton" name="radioDataGraph">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="chktest1D_4">
<widget class="QRadioButton" name="radioHistogram">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Histogram</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="boxScan">
<property name="geometry">
<rect>
<x>430</x>
<y>10</y>
<width>331</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Scan - Y Axis Values</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>11</x>
<y>20</y>
<width>316</width>
<height>23</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="radioLevel0">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Level 0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radioLevel1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Level 1</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radioFileIndex">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>File Index</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radioAllFrames">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>All Frames</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -139,7 +139,18 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboDynamicRange"/>
<widget class="QComboBox" name="comboDynamicRange">
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinNumModules"/>

View File

@ -72,9 +72,6 @@ void SetScript(int index);
* Options: constant size,specific values,values from file */
void EnableSizeWidgets();
protected:
};

View File

@ -0,0 +1,113 @@
/*
* qDebugStream.h
*
* Created on: Jun 28, 2012
* Author: Anna Bergamaschi
*/
#ifndef QDEBUGSTREAM_H_
#define QDEBUGSTREAM_H_
#include <QApplication>
#include <QWidget>
#include <QString>
#include <QEvent>
#include <QCustomEvent>
#include <iostream>
#include <streambuf>
#include <string>
using namespace std;
#define STREAMEVENT 60001
//-------------------------------------------------------------------------------------------------------------------------------------------------
class qStreamEvent:public QEvent{
public:
qStreamEvent(QString s):QEvent(static_cast<QEvent::Type>(STREAMEVENT)) {str=s;};
/** \returns the progress index */
QString getString() {return str;};
private:
QString str;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
class qDebugStream : public basic_streambuf<char> {
public:
qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) {
m_old_buf = stream.rdbuf();
stream.rdbuf(this);
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
~qDebugStream(){
// output anything that is left
if (!m_string.empty()) {
qStreamEvent *ce=new qStreamEvent(m_string.c_str());
QApplication::postEvent(log_window, ce);
#ifdef VERBOSE
cerr << m_string << endl;
#endif
}
m_stream.rdbuf(m_old_buf);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
protected:
virtual int_type overflow(int_type v){
if (v == '\n'){
qStreamEvent *ce=new qStreamEvent(m_string.c_str());
QApplication::postEvent(log_window, ce);
#ifdef VERBOSE
cerr << m_string << endl;
#endif
m_string.erase(m_string.begin(), m_string.end());
}
else
m_string += v;
return v;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
virtual streamsize xsputn(const char *p, streamsize n) {
m_string.append(p, p + n);
uint pos = 0;
while (pos != string::npos)
{
pos = m_string.find('\n');
if (pos != string::npos)
{
string tmp(m_string.begin(), m_string.begin() + pos);
qStreamEvent *ce=new qStreamEvent(tmp.c_str());
QApplication::postEvent(log_window, ce);
#ifdef VERBOSE
cerr << tmp << endl;
#endif
m_string.erase(m_string.begin(), m_string.begin() + pos + 1);
}
}
return n;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
private:
ostream &m_stream;
streambuf *m_old_buf;
string m_string;
QWidget* log_window;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
#endif /* QDEBUGSTREAM_H_ */

View File

@ -35,7 +35,24 @@ public:
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** returns the value in ns to send to server.
/** returns the unit in words
* @param unit is the time unit
*/
static string getUnitString(timeUnit unit){
switch(unit){
case HOURS: return string("hrs");
case MINUTES: return string("min");
case SECONDS: return string("sec");
case MILLISECONDS: return string("msec");
case MICROSECONDS: return string("usec");
case NANOSECONDS: return string("nsec");
default: return string("error");
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** returns the value in ns to send to server as the
* server class slsdetector accepts in ns.
* @param unit unit of time
* @param value time
* returns time value in ns
@ -95,9 +112,22 @@ public:
* @param source is the tab or the source of the error
* */
static void ErrorMessage(string errorMessage,char source[])
{
static QMessageBox* errorBox;
errorBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, errorBox);
errorBox->exec();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**displays an information message
* @param infoMessage the message to be displayed
* @param source is the tab or the source of the information
* */
static void InfoMessage(string infoMessage,char source[])
{
static QMessageBox* msgBox;
msgBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, msgBox);
msgBox= new QMessageBox(QMessageBox::Information,source,tr(infoMessage.c_str()),QMessageBox::Ok, msgBox);
msgBox->exec();
}

View File

@ -52,10 +52,11 @@ public:
* @param argv server options
* @param app the qapplication
* @param parent makes the parent window 0 by default
*/
* */
qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0);
/**Destructor */
/**Destructor
* */
~qDetectorMain();
private:
@ -103,88 +104,55 @@ private:
/**Messages tab */
qTabMessages *tab_messages;
/**if the developer tab should be enabled,known from command line */
int isDeveloper;
/**Sets up the layout of the widget
*/
* */
void SetUpWidgetWindow();
/**Sets up detector
*/
* */
void SetUpDetector();
/**Sets up the signals and the slots
*/
* */
void Initialization();
/** Sets/unsets the developer mode (developer tab)
* @param b bool TRUE sets, FALSE unsets\
*/
void SetDeveloperMode(bool b);
private slots:
/** Sets/unsets the debug mode i.e. enables/disables the debug tab
* @param b bool TRUE sets, FALSE unsets
*/
void SetDebugMode(bool b);
/** Enables modes as selected -Debug, Beamline, Expert, Dockable(calls setdockablemode())
* */
void EnableModes(QAction *action);
/** Sets/unsets the beamline mode (at the moment it doesn't do anything)
* @param b bool TRUE sets, FALSE unsets
*/
void SetBeamlineMode(bool b);
/** Executes actions in the utilities menu as selected
* */
void ExecuteUtilities(QAction *action);
/** Sets/unsets the expert mode i.e. enables/disables the advanced and Settings tabs
* @param b bool TRUE sets, FALSE unsets
*/
void SetExpertMode(bool b);
/** Executes actions in the utilities menu as selected
* */
void ExecuteHelp(QAction *action);
/** Sets/unsets the dockable plot mode
* @param b bool TRUE sets, FALSE unsets
*/
void SetDockableMode(bool b);
/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab */
void refresh(int index);
/** Opens Setup */
void OpenSetup();
/** Saves Setup */
void SaveSetup();
/** Measurement Wizard */
void MeasurementWizard();
/** Open Configuration*/
void OpenConfiguration();
/** Save Configuration */
void SaveConfiguration();
/** Executing Energy Calibration */
void EnergyCalibration();
/** Executing Angular Calibration */
void AngularCalibration();
/** Executing Version */
void Version();
/** Executing About */
void About();
/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab
* */
void Refresh(int index);
/** Resizes the main window if the plot is docked/undocked
* @param b bool TRUE if undocked(outside main window), FALSE docked
*/
* */
void ResizeMainWindow(bool b);
/** Enables/disables tabs depending on if acquisition is currently in progress */
/** Enables/disables tabs depending on if acquisition is currently in progress
* */
void EnableTabs();
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled*/
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled
* */
void SetZoomToolTip(bool disable);
protected:
/** Adjust the resizing to resize plot, except for actions tab
* */
void resizeEvent(QResizeEvent* event);
signals:

View File

@ -40,6 +40,8 @@ public:
/** Destructor */
~qDrawPlot();
bool isRunning(){return running;};
/** Number of x axis pixels */
int GetPixelsX(){return nPixelsX;};
/** Number of y axis pixels */
@ -72,7 +74,10 @@ public:
void DisableZoom(bool disable);
/** gets the progress of acquisition to the measurement tab*/
int GetProgress(){return progress;};
/** Enables plot from the plot tab*/
void EnablePlot(bool enable);
/** To know whether 1d started*/
bool DoesPlotExist(){return plotExists;};
/** Starts or stop acquisition
* Calls startDaq() function
@ -171,6 +176,8 @@ private:
int currentPersistency;
int progress;
bool plotEnable;
bool plotExists;
bool running;
/** Initializes all its members and the thread */
void Initialization();
@ -223,13 +230,10 @@ void Clear1DPlot();
void ClonePlot();
/** Closes all the clone plots */
void CloseClones();
/** To Save plot
@param FName full name of file */
void SavePlot(QString FName);
/** To Save plot */
void SavePlot();
/** Sets persistency from plot tab */
void SetPersistency(int val);
/** Enables plot */
void EnablePlot(bool enable);

View File

@ -37,6 +37,10 @@ public:
*/
~qTabActions();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -30,6 +30,10 @@ public:
*/
~qTabAdvanced();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -33,14 +33,16 @@ public:
*/
~qTabDataOutput();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */
slsDetectorUtils *myDet;
/** Output Directory */
QString outputDir;
/** methods */
/** Sets up the widget */
void SetupWidgetWindow();
@ -48,9 +50,6 @@ private:
/** Sets up all the slots and signals */
void Initialization();
/** Enables/Disables all the widgets */
void Enable(bool enable);
private slots:
/** Sets the output directory

View File

@ -30,6 +30,9 @@ public:
*/
~qTabDebugging();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -30,6 +30,9 @@ public:
*/
~qTabDeveloper();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -36,6 +36,10 @@ public:
*/
~qTabMeasurement();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -15,7 +15,9 @@ class slsDetectorUtils;
/** Qt Include Headers */
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
#include <QEvent>
#include <QPushButton>
#include "qDebugStream.h"
/**
*@short sets up the Messages parameters
@ -42,11 +44,14 @@ private:
/** Log of executed commands */
QTextEdit *dispLog;
/** Command display */
QLineEdit *dispCommand;
/** To save the log to file */
QPushButton *btnSave;
/** Path display */
QLineEdit *dispPath;
/** To clear the log to file */
QPushButton *btnClear;
/** This class creates the log */
qDebugStream *qout;
/** methods */
/** Sets up the widget */
@ -55,9 +60,15 @@ private:
/** Sets up all the slots and signals */
void Initialization();
private slots:
void executeCommand();
/** Stream log to textedit in GUI */
void customEvent(QEvent *e);
/** Save Log to File*/
void SaveLog();
/** Clear Log to File*/
void ClearLog();
};

View File

@ -34,6 +34,7 @@ public:
~qTabPlot();
private:
/** The sls detector object */
slsDetectorUtils *myDet;
@ -41,6 +42,9 @@ private:
/** The Plot widget */
qDrawPlot *myPlot;
/** 1d/2d plot */
bool isOneD;
/** some Default Values */
static QString defaultPlotTitle;
static QString defaultHistXAxisTitle;
@ -58,11 +62,6 @@ private:
*/
void Initialization();
/** Enables/Disables all the widgets
*/
void Enable(bool enable);
@ -93,9 +92,10 @@ void SetAxesRange();
void SetZRange();
/** Enables the range of the z axis */
void EnableZRange();
/** Save Plot */
void SavePlot();
/** Set Plot to none, data graph, histogram*/
void SetPlot();
/** Enable Histogram */
void EnableHistogram(bool enable);
signals:
void DisableZoomSignal(bool);

View File

@ -34,6 +34,10 @@ public:
*/
~qTabSettings();
/** To refresh and update widgets
*/
void Refresh();
private:
/** The sls detector object */

View File

@ -71,6 +71,7 @@ HEADERS = \
slsDetectorPlotting/include/SlsQtValidators.h\
slsDetectorPlotting/include/SlsQtNumberEntry.h\
include/qDefs.h\
include/qDebugStream.h\
include/qDetectorMain.h\
include/qDrawPlot.h\
include/qCloneWidget.h\

View File

@ -141,7 +141,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]){
/** for each plot*/
/** for each plot*/cout<<"qclone nhists:"<<nHists<<endl;
for(int hist_num=0;hist_num<nHists;hist_num++){
/** create hists */
SlsQtH1D* k;
@ -183,11 +183,12 @@ void qCloneWidget::SavePlot(){
QPainter painter(&img);
cloneBox->render(&painter);
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
fName,tr("Images (*.png *.xpm *.jpg)"));
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("Images (*.png *.xpm *.jpg)"),0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty())
if(!(img.save(fName)))
qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed","Snapshot: WARNING");
if((img.save(fName)))
qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot: Information");
else
qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed. Wrong Format","Snapshot: WARNING");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@
#include "sls_detector_defs.h"
/** Qt Include Headers */
#include <QSizePolicy>
#include <QFileDialog>
/** C++ Include Headers */
#include<iostream>
#include <string>
@ -25,6 +26,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
int main (int argc, char **argv) {
QApplication *theApp = new QApplication(argc, argv);
@ -35,8 +37,10 @@ int main (int argc, char **argv) {
return theApp->exec();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) :
QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){
@ -61,23 +65,26 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
qDetectorMain::~qDetectorMain(){
delete myDet;
if (menubar) delete menubar;
if (centralwidget) delete centralwidget;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetUpWidgetWindow(){
/** Layout */
layoutTabs= new QGridLayout;
centralwidget->setLayout(layoutTabs);
/** plot setup*/
myPlot = new qDrawPlot(dockWidgetPlot,myDet);
dockWidgetPlot->setWidget(myPlot);
@ -86,6 +93,7 @@ void qDetectorMain::SetUpWidgetWindow(){
tabs = new MyTabWidget(this);
layoutTabs->addWidget(tabs);
/** creating all the tab widgets */
tab_messages = new qTabMessages (this, myDet);
tab_measurement = new qTabMeasurement (this, myDet,myPlot);
tab_dataoutput = new qTabDataOutput (this, myDet);
tab_plot = new qTabPlot (this, myDet,myPlot);
@ -94,7 +102,6 @@ void qDetectorMain::SetUpWidgetWindow(){
tab_advanced = new qTabAdvanced (this, myDet);
tab_debugging = new qTabDebugging (this, myDet);
tab_developer = new qTabDeveloper (this, myDet);
tab_messages = new qTabMessages (this, myDet);
/** creating the scroll area widgets for the tabs */
for(int i=0;i<NumberOfTabs;i++){
scroll[i] = new QScrollArea;
@ -109,8 +116,6 @@ void qDetectorMain::SetUpWidgetWindow(){
scroll[Advanced] ->setWidget(tab_advanced);
scroll[Debugging] ->setWidget(tab_debugging);
scroll[Developer] ->setWidget(tab_developer);
/** inserting all the tabs*/
tabs->insertTab(Measurement, scroll[Measurement], "Measurement");
tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output");
@ -122,21 +127,38 @@ void qDetectorMain::SetUpWidgetWindow(){
tabs->insertTab(Developer, scroll[Developer], "Developer");
/** Prefer this to expand and not have scroll buttons*/
tabs->insertTab(Messages, tab_messages, "Messages");
/** Default tab color*/
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
/**Set the current tab(measurement) to blue as it is the current one*/
tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255));
/** increase the width so it uses all the empty space for the tab titles*/
tabs->tabBar()->setFixedWidth(width()+61);
/** mode setup - to set up the tabs initially as disabled, not in form so done here */
SetDebugMode(false);
SetBeamlineMode(false);
SetExpertMode(false);
SetDeveloperMode(false);
SetDeveloperMode(isDeveloper);
tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255));
#ifdef VERBOSE
cout<<"Setting Debug Mode to 0\nSetting Beamline Mode to 0\n"
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n"
"Setting Developer Mode to "<<isDeveloper<<endl;
#endif
tabs->setTabEnabled(Debugging,false);
//beamline mode to false
tabs->setTabEnabled(Advanced,false);
dockWidgetPlot->setFloating(false);
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
tabs->setTabEnabled(Developer,isDeveloper);
/** Other setup*/
/**Height of plot and central widget*/
heightPlotWindow = dockWidgetPlot->size().height();
heightCentralWidget = centralwidget->size().height();
/** Default zoom Tool Tip */
zoomToolTip = dockWidgetPlot->toolTip();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetUpDetector(){
@ -178,14 +200,16 @@ void qDetectorMain::SetUpDetector(){
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::Initialization(){
/** Dockable Plot*/
connect(dockWidgetPlot,SIGNAL(topLevelChanged(bool)),this,SLOT(ResizeMainWindow(bool)));
/** tabs */
connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*)));
connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(Refresh(int)));//( QWidget*)));
/** Measurement tab*/
/** Plot tab */
connect(tab_plot,SIGNAL(DisableZoomSignal(bool)),this, SLOT(SetZoomToolTip(bool)));
@ -200,166 +224,187 @@ void qDetectorMain::Initialization(){
/** menubar */
/** Modes Menu */
connect(actionDebug, SIGNAL(toggled(bool)),this,SLOT(SetDebugMode(bool)));
connect(actionBeamline, SIGNAL(toggled(bool)),this,SLOT(SetBeamlineMode(bool)));
connect(actionExpert, SIGNAL(toggled(bool)),this,SLOT(SetExpertMode(bool)));
connect(actionDockable, SIGNAL(toggled(bool)),this,SLOT(SetDockableMode(bool)));
connect(menuModes,SIGNAL(triggered(QAction*)),SLOT(EnableModes(QAction*)));
/** Utilities Menu */
connect(actionOpenSetup,SIGNAL(triggered()),this,SLOT(OpenSetup()));
connect(actionSaveSetup,SIGNAL(triggered()),this,SLOT(SaveSetup()));
connect(actionMeasurementWizard,SIGNAL(triggered()),this,SLOT(MeasurementWizard()));
connect(actionOpenConfiguration,SIGNAL(triggered()),this,SLOT(OpenConfiguration()));
connect(actionSaveConfiguration,SIGNAL(triggered()),this,SLOT(SaveConfiguration()));
connect(actionEnergyCalibration,SIGNAL(triggered()),this,SLOT(EnergyCalibration()));
connect(actionAngularCalibration,SIGNAL(triggered()),this,SLOT(AngularCalibration()));
connect(actionAbout,SIGNAL(triggered()),this,SLOT(About()));
connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version()));
heightPlotWindow = dockWidgetPlot->size().height();
heightCentralWidget = centralwidget->size().height();
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
zoomToolTip = dockWidgetPlot->toolTip();
connect(menuUtilities,SIGNAL(triggered(QAction*)),SLOT(ExecuteUtilities(QAction*)));
/** Help Menu */
connect(menuHelp,SIGNAL(triggered(QAction*)),SLOT(ExecuteHelp(QAction*)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetDeveloperMode(bool b){
void qDetectorMain::EnableModes(QAction *action){
bool enable;
/**Set DebugMode */
if(action==actionDebug){
enable = actionDebug->isChecked();
tabs->setTabEnabled(Debugging,enable);
#ifdef VERBOSE
cout<<"Setting Developer Mode to "<<b<<endl;
#endif
tabs->setTabEnabled(Developer,b);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetDebugMode(bool b){
#ifdef VERBOSE
cout<<"Setting Debug Mode to "<<b<<endl;
#endif
tabs->setTabEnabled(Debugging,b);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetBeamlineMode(bool b){
#ifdef VERBOSE
cout<<"Setting Beamline Mode to "<<b<<endl;
cout<<"Setting Debug Mode to "<<enable<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetExpertMode(bool b){
/**Set BeamlineMode */
else if(action==actionBeamline){
enable = actionBeamline->isChecked();
#ifdef VERBOSE
cout<<"Setting Expert Mode to "<<b<<endl;
cout<<"Setting Beamline Mode to "<<enable<<endl;
#endif
tabs->setTabEnabled(Advanced,b);
}
/**Set ExpertMode */
else if(action==actionExpert){
enable = actionExpert->isChecked();
tabs->setTabEnabled(Advanced,enable);
#ifdef VERBOSE
cout<<"Setting Expert Mode to "<<enable<<endl;
#endif
}
/**Set DockableMode */
else{
enable = actionDockable->isChecked();
if(enable)
dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable);
else{
dockWidgetPlot->setFloating(false);
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
}
#ifdef VERBOSE
cout<<"Setting Dockable Mode to "<<enable<<endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::refresh(int index){
void qDetectorMain::ExecuteUtilities(QAction *action){
if(action==actionOpenSetup){
#ifdef VERBOSE
cout<<"Opening Setup"<<endl;
#endif
QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Setup"),fName,
tr("Detector Setup files (*.det)"));
/** Gets called when cancelled as well*/
if (!fName.isEmpty()){
myDet->retrieveDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully setup.","Main: Information");
}
}
else if(action==actionSaveSetup){
#ifdef VERBOSE
cout<<"Saving Setup"<<endl;
#endif
QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Setup"),fName,
tr("Detector Setup files (*.det) "));
/** Gets called when cancelled as well*/
if (!fName.isEmpty()){
myDet->dumpDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The setup parameters have been successfully saved.","Main: Information");
}
}
else if(action==actionMeasurementWizard){
#ifdef VERBOSE
cout<<"Measurement Wizard"<<endl;
#endif
}
else if(action==actionOpenConfiguration){
#ifdef VERBOSE
cout<<"Opening Configuration"<<endl;
#endif
QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Configuration"),fName,
tr("Configuration files (*.config)"));
/** Gets called when cancelled as well*/
if (!fName.isEmpty()){
myDet->readConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully configured.","Main: Information");
}
}
else if(action==actionSaveConfiguration){
#ifdef VERBOSE
cout<<"Saving Configuration"<<endl;
#endif
QString fName = QString(myDet->getFilePath().c_str());
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Configuration"),fName,
tr("Configuration files (*.config) "));
/** Gets called when cancelled as well*/
if (!fName.isEmpty()){
myDet->writeConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main: Information");
}
}
else if(action==actionEnergyCalibration){
#ifdef VERBOSE
cout<<"Executing Energy Calibration"<<endl;
#endif
}
else{
#ifdef VERBOSE
cout<<"Executing Angular Calibration"<<endl;
#endif
}
Refresh(tabs->currentIndex());
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::ExecuteHelp(QAction *action){
if(action==actionVersion){
#ifdef VERBOSE
cout<<"Version"<<endl;
#endif
}
else{
#ifdef VERBOSE
cout<<"About"<<endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::Refresh(int index){
if(!tabs->isTabEnabled(index))
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
else{
;
switch(tabs->currentIndex()){
case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break;
case Settings: tab_settings->Refresh(); break;
case DataOutput: tab_dataoutput->Refresh(); break;
case Plot: break;
case Actions: tab_actions->Refresh(); break;
case Advanced: tab_advanced->Refresh(); break;
case Debugging: tab_debugging->Refresh(); break;
case Developer: tab_developer->Refresh(); break;
case Messages: break;
}
}
for(int i=0;i<NumberOfTabs;i++)
tabs->tabBar()->setTabTextColor(i,defaultTabColor);
tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetDockableMode(bool b){
#ifdef VERBOSE
cout<<"Setting Dockable Mode to "<<b<<endl;
#endif
if(b)
dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable);
else{
dockWidgetPlot->setFloating(false);
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::OpenSetup(){
#ifdef VERBOSE
cout<<"Opening Setup"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SaveSetup(){
#ifdef VERBOSE
cout<<"Saving Setup"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::MeasurementWizard(){
#ifdef VERBOSE
cout<<"Measurement Wizard"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::OpenConfiguration(){
#ifdef VERBOSE
cout<<"Opening Configuration"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SaveConfiguration(){
#ifdef VERBOSE
cout<<"Saving Configuration"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::EnergyCalibration(){
#ifdef VERBOSE
cout<<"Executing Energy Calibration"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::AngularCalibration(){
#ifdef VERBOSE
cout<<"Executing Angular Calibration"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::Version(){
#ifdef VERBOSE
cout<<"Executing Version"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::About(){
#ifdef VERBOSE
cout<<"Executing About"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::ResizeMainWindow(bool b){
#ifdef VERBOSE
@ -379,6 +424,9 @@ void qDetectorMain::ResizeMainWindow(bool b){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::resizeEvent(QResizeEvent* event){
if(!dockWidgetPlot->isFloating()){
if(tabs->currentIndex()== Actions){
@ -394,8 +442,10 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
event->accept();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::EnableTabs(){
#ifdef VERBOSE
cout<<"Entering EnableTabs function"<<endl;
@ -427,6 +477,7 @@ void qDetectorMain::EnableTabs(){
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -437,4 +488,5 @@ void qDetectorMain::SetZoomToolTip(bool disable){
dockWidgetPlot->setToolTip(zoomToolTip);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -7,6 +7,8 @@
/** Qt Project Class Headers */
#include "qDrawPlot.h"
#include "qCloneWidget.h"
#include "qDefs.h"
#include "slsDetector.h"
/** Project Class Headers */
#include "slsDetector.h"
#include "multiSlsDetector.h"
@ -15,6 +17,7 @@
#include <QFont>
#include <QImage>
#include <QPainter>
#include <QFileDialog>
/** C++ Include Headers */
#include <iostream>
#include <string>
@ -22,7 +25,6 @@
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
@ -73,6 +75,9 @@ void qDrawPlot::SetupWidgetWindow(){
currentPersistency = 0;
progress = 0;
plotEnable=true;
plotExists=false;
/** This is so that it initially stop and plots */
running = 1;
for(int i=0;i<MAX_1DPLOTS;i++) {histYAxis[i]=0;yvalues[i]=0; }
/*clone*/
@ -144,9 +149,9 @@ void qDrawPlot::Initialization(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
static bool running = 1;
//static bool running = 1;
if(running){ //stopping
StartDaq(0);
StartDaq(false);
running=!running;
}else if(!stop_if_running){ //then start
@ -199,6 +204,7 @@ int qDrawPlot::ResetDaqForGui(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
bool qDrawPlot::StartOrStopThread(bool start){
static bool firstTime = true;
static bool gui_acquisition_thread_running = 0;
static pthread_t gui_acquisition_thread;
static pthread_mutex_t gui_acquisition_start_stop_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -207,13 +213,13 @@ bool qDrawPlot::StartOrStopThread(bool start){
//stop part, before start or restart
if(gui_acquisition_thread_running){
cout<<"Stopping current acquisition thread ...."<<endl;
stop_signal = 1;//sort of useless
pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
stop_signal = 1;//sorta useless right now
gui_acquisition_thread_running = 0;
}
//start part
if(start){
/** Defaults */
progress = 0;
currentFrame = 0;
@ -232,12 +238,14 @@ bool qDrawPlot::StartOrStopThread(bool start){
/** Setting the callback function to get data from software client*/
myDet->registerDataCallback(&(GetDataCallBack),this);
/** Start acquiring data from server */
if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits
pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this);
firstTime = false;
/** This is set here and later reset to zero when all the plotting is done
* This is manually done instead of keeping track of thread because
* this thread returns immediately after executing the acquire command*/
gui_acquisition_thread_running=1;
cout<<"Started acquiring threaddd"<<endl;
cout<<"Started acquiring threaddd:"<<endl;
}
pthread_mutex_unlock(&gui_acquisition_start_stop_mutex);
return gui_acquisition_thread_running;
@ -262,9 +270,9 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){
//-------------------------------------------------------------------------------------------------------------------------------------------------
int qDrawPlot::GetData(detectorData *data){
//#ifdef VERYVERBOSE
#ifdef VERYVERBOSE
cout<<"Entering GetDatafunction"<<endl;
//#endif
#endif
progress=(int)data->progressIndex;
@ -332,6 +340,9 @@ int qDrawPlot::GetData(detectorData *data){
void qDrawPlot::setNumMeasurements(int num){
number_of_measurements = num;
#ifdef VERBOSE
cout<<"Setting Number of Measurements to " <<num<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -366,7 +377,6 @@ void qDrawPlot::Clear1DPlot(){
void qDrawPlot::UpdatePlot(){
//static int last_plot_number = 0;
plot_update_timer->stop();
if(plotEnable){
LockLastImageArray();
@ -392,6 +402,8 @@ void qDrawPlot::UpdatePlot(){
h->Attach(plot1D);
}
/**plot exists is false in the beginning, right after cloning and when no plot is checked*/
plotExists=true;
}
}
@ -407,14 +419,15 @@ void qDrawPlot::UpdatePlot(){
plot2D->SetZTitle(imageZAxisTitle);
plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
}
/**plot exists is false in the beginning, right after cloning and when no plot is checked*/
plotExists=true;
}
}
last_plot_number=lastImageNumber;
if(plotEnable) UnlockLastImageArray();
/** Measurement not over, continue*/
if(number_of_exposures!=last_plot_number){
if(number_of_exposures!=currentFrame){//las plot number?
plot_update_timer->start(500);
}
/** if a measurement is over */
@ -428,7 +441,6 @@ void qDrawPlot::UpdatePlot(){
}/** To start the next measurement*/
else{
StopDaqForGui();
//StartDaq(false);
StartDaq(true);
}
}
@ -457,7 +469,10 @@ void qDrawPlot::ClonePlot(){
}
/** save height to keep maintain same height of plot */
int preheight = height();
/** create clone */
/** plotexists is true after calling updateplot*/
plotExists=false;
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath());
if(plot_in_scope==1){
plot1D = new SlsQt1DPlot(boxPlot);
@ -465,7 +480,7 @@ void qDrawPlot::ClonePlot(){
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
plotLayout->addWidget(plot1D,1,1,1,1);
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle);
if(running) winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle);
}
else{
plot2D = new SlsQt2DPlotLayout(boxPlot);
@ -478,8 +493,9 @@ void qDrawPlot::ClonePlot(){
}
setMinimumHeight(preheight);
resize(width(),preheight);
/** update the actual plot */
UpdatePlot();
/** update the actual plot only if running, else it doesnt know when its over*/
if(running) UpdatePlot();
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
@ -509,11 +525,21 @@ void qDrawPlot::CloneCloseEvent(int id){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::SavePlot(QString FName){
void qDrawPlot::SavePlot(){
/** render image */
QImage img(size().width(),size().height(),QImage::Format_RGB32);
QPainter painter(&img);
render(&painter);
img.save(FName);
/** save image*/
QString fName = QString(myDet->getFilePath().c_str())+"/Image.png";
fName = QFileDialog::getSaveFileName(this,tr("Save Image"),fName,tr("Images (*.png *.xpm *.jpg)"));
if (!fName.isEmpty())
if(img.save(fName))
qDefs::InfoMessage("The Image has been successfully saved","Dock: Information");
else
qDefs::ErrorMessage("ERROR: Attempt to save image failed. Wrong Format","Dock: WARNING");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -532,7 +558,10 @@ void qDrawPlot::EnablePlot(bool enable){
#ifdef VERBOSE
cout<<"Plotting set to:"<<enable<<endl;
#endif
plotEnable = !enable;
plotEnable = enable;
/**if no plot, cant do setting range.
* not true vice versa where plot was false and now set it to true*/
if(!enable) plotExists=false;
Clear1DPlot();
}

View File

@ -232,4 +232,11 @@ void qTabActions::ChangeStepSize(bool b){
//if(!QString::compare(btntry->text(),"+")){
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabActions::Refresh(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -76,4 +76,13 @@ void qTabAdvanced::getTemperature(){
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):
@ -27,6 +28,7 @@ qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDataOutput::~qTabDataOutput(){
@ -34,14 +36,16 @@ qTabDataOutput::~qTabDataOutput(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetupWidgetWindow(){
outputDir= QString(myDet->getFilePath().c_str());
dispOutputDir->setText(outputDir);
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Initialization(){
connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&)));
@ -49,22 +53,29 @@ void qTabDataOutput::Initialization(){
}
void qTabDataOutput::Enable(bool enable){
layoutOutput->setEnabled(enable);
boxCorrection->setEnabled(enable);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::setOutputDir(const QString& path){
outputDir = path;
myDet->setFilePath(string(outputDir.toAscii().constData()));
myDet->setFilePath(string(path.toAscii().constData()));
#ifdef VERBOSE
cout<<"Output Directory changed to :"<<myDet->getFilePath()<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
/** output dir*/
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::browseOutputDir()
{
QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text());
@ -73,3 +84,4 @@ void qTabDataOutput::browseOutputDir()
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -48,3 +48,13 @@ void qTabDebugging::Enable(bool enable){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::Refresh(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -41,5 +41,14 @@ void qTabDeveloper::SetupWidgetWindow(){
void qTabDeveloper::Initialization(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDeveloper::Refresh(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -302,7 +302,7 @@ void qTabMeasurement::setExposureTime(){
/** Get the value of timer in ns **/
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
#ifdef VERBOSE
cout<<"Setting acquisition time to " << exptimeNS << " clocks" << endl;
cout<<"Setting acquisition time to " << exptimeNS << " clocks" << "/"<<spinExpTime->value()<<qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex())<<endl;
#endif
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptimeNS);
@ -312,12 +312,12 @@ void qTabMeasurement::setExposureTime(){
if(exptimeNS>acqtimeNS) {
lblNote->show();
lblPeriod->setPalette(lblNote->palette());
lblPeriod->setText("* Acquisition Period");
lblPeriod->setText("Acquisition Period:*");
}
else {
lblNote->hide();
lblPeriod->setPalette(lblNumFrames->palette());
lblPeriod->setText("Acquisition Period");
lblPeriod->setText("Acquisition Period:");
}
}
}
@ -329,7 +329,7 @@ void qTabMeasurement::setAcquisitionPeriod(){
/** Get the value of timer in ns **/
acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
#ifdef VERBOSE
cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks" << endl;
cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/"<<spinPeriod->value()<<qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex())<<endl;
#endif
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS);
@ -338,12 +338,12 @@ void qTabMeasurement::setAcquisitionPeriod(){
if(exptimeNS>acqtimeNS){
lblNote->show();
lblPeriod->setPalette(lblNote->palette());
lblPeriod->setText("* Acquisition Period");
lblPeriod->setText("Acquisition Period:*");
}
else {
lblNote->hide();
lblPeriod->setPalette(lblNumFrames->palette());
lblPeriod->setText("Acquisition Period");
lblPeriod->setText("Acquisition Period:");
}
}
@ -363,7 +363,7 @@ void qTabMeasurement::setDelay(){
/** Get the value of timer in ns **/
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value());
#ifdef VERBOSE
cout<<"Setting delay after trigger to " << exptimeNS << " clocks" << endl;
cout<<"Setting delay after trigger to " << exptimeNS << " clocks"<< "/"<<spinDelay->value()<<qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex())<<endl;
#endif
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS);
}
@ -496,7 +496,7 @@ void qTabMeasurement::setTimingMode(int mode){
if(lblExpTime->isEnabled()){
time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
#ifdef VERBOSE
cout<<"Getting acquisition time : " << time << "s" << endl;
cout<<"Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl;
#endif
spinExpTime->setValue(time);
comboExpUnit->setCurrentIndex((int)unit);
@ -506,7 +506,7 @@ void qTabMeasurement::setTimingMode(int mode){
if(lblPeriod->isEnabled()){
time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))));
#ifdef VERBOSE
cout<<"Getting frame period between exposures : " << time << "s" << endl;
cout<<"Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl;
#endif
spinPeriod->setValue(time);
comboPeriodUnit->setCurrentIndex((int)unit);
@ -517,17 +517,17 @@ void qTabMeasurement::setTimingMode(int mode){
if(exptimeNS>acqtimeNS) {
lblNote->show();
lblPeriod->setPalette(lblNote->palette());
lblPeriod->setText("* Acquisition Period");
lblPeriod->setText("Acquisition Period:*");
}
else {
lblNote->hide();
lblPeriod->setPalette(lblNumFrames->palette());
lblPeriod->setText("Acquisition Period");
lblPeriod->setText("Acquisition Period:");
}
}else {
lblNote->hide();
lblPeriod->setPalette(lblNumFrames->palette());
lblPeriod->setText("Acquisition Period");
lblPeriod->setText("Acquisition Period:");
}
/**Number of Triggers */
@ -543,7 +543,7 @@ void qTabMeasurement::setTimingMode(int mode){
if(lblDelay->isEnabled()){
time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9))));
#ifdef VERBOSE
cout<<"Getting delay after trigger : " << time << "s" << endl;
cout<<"Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl;
#endif
spinDelay->setValue(time);
comboDelayUnit->setCurrentIndex((int)unit);
@ -574,4 +574,22 @@ void qTabMeasurement::setTimingMode(int mode){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMeasurement::Refresh(){
/** File Name **/
dispFileName->setText(QString(myDet->getFileName().c_str()));
/** File Index **/
spinIndex->setValue(myDet->getFileIndex());
/** progress label index **/
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
/** Progress bar **/
progressBar->setValue(myDet->getCurrentProgress());
/** Timing mode**/
SetupTimingMode();//comboTimingMode->setCurrentIndex((int)myDet->setExternalCommunicationMode());
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -5,25 +5,26 @@
* Author: l_maliakal_d
*/
/** Qt Project Class Headers */
#include "qTabMessages.h"
#include "qDefs.h"
/** Project Class Headers */
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** Qt Include Headers */
#include <QGridLayout>
#include <QLabel>
#include <QSpacerItem>
#include <QDir>
#include <QProcess>
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
#include <QSizePolicy>
/** C++ Include Headers */
#include <iostream>
#include <string>
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):
QWidget(parent),myDet(detector){
qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
SetupWidgetWindow();
Initialization();
}
@ -33,8 +34,6 @@ qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):
qTabMessages::~qTabMessages(){
delete myDet;
delete dispLog;
delete dispCommand;
delete dispPath;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -42,88 +41,71 @@ qTabMessages::~qTabMessages(){
void qTabMessages::SetupWidgetWindow(){
/** Layout */
QGridLayout *gridLayout = new QGridLayout(this);
QLabel *lblCommand = new QLabel("System Command:",this);
QLabel *lblPath = new QLabel("Working Directory:",this);
QSpacerItem *hSpacer= new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
dispLog = new QTextEdit(this);
dispCommand = new QLineEdit(this);
dispPath = new QLineEdit(this);
dispLog->setReadOnly(true);
dispPath->setReadOnly(true);
dispLog->setFocusPolicy(Qt::NoFocus);
dispPath->setFocusPolicy(Qt::NoFocus);
gridLayout->addWidget(dispLog, 0, 0, 1, 3);
gridLayout->addWidget(lblCommand, 1, 0, 1, 1);
gridLayout->addItem(hSpacer, 1, 1, 1, 1);
gridLayout->addWidget(dispCommand, 1, 2, 1, 1);
gridLayout->addWidget(lblPath, 2, 0, 1, 1);
gridLayout->addWidget(dispPath, 2, 2, 1, 1);
/** Command & Path*/
dispCommand->setText("Insert your command here");
dispPath->setText(QDir("./").absolutePath());
dispLog = new QTextEdit(this);
dispLog->setReadOnly(true);
dispLog->setFocusPolicy(Qt::NoFocus);
QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
btnSave = new QPushButton("Save Log",this);
btnSave->setFocusPolicy(Qt::NoFocus);
btnSave->setSizePolicy(sizePolicy);
btnClear = new QPushButton("Clear",this);
btnClear->setFocusPolicy(Qt::NoFocus);
btnClear->setSizePolicy(sizePolicy);
gridLayout->addWidget(btnSave,0,0,1,1);
gridLayout->addWidget(btnClear,0,4,1,1);
gridLayout->addWidget(dispLog,1,0,1,5);
qout=new qDebugStream(std::cout,this);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::Initialization(){
connect(dispCommand,SIGNAL(returnPressed()),this,SLOT(executeCommand()));
connect(btnSave,SIGNAL(clicked()),this,SLOT(SaveLog()));
connect(btnClear,SIGNAL(clicked()),this,SLOT(ClearLog()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::executeCommand(){
#ifdef VERBOSE
cout<<"Calling: "<< dispCommand->text().toAscii().constData()<<endl;
#endif
QProcess proc(this);
#ifdef VERBOSE
//std::cout <<"working directory would be " << proc.workingDirectory().absPath() << std::endl;
cout<<"Original Working Directory: "<< proc.workingDirectory().toAscii().constData()<<endl;
#endif
proc.setWorkingDirectory(QDir(dispPath->text()).absolutePath());
#ifdef VERBOSE
//std::cout <<"working directory is " << proc.workingDirectory().absPath() << std::endl;
cout<<"Current Working Directory: "<<proc.workingDirectory().toAscii().constData()<<endl;
#endif
proc.setArguments(QStringList::split(' ',dispCommand->text()));
#ifdef VERBOSE
/* QStringList list = proc.arguments();
QStringList::Iterator it = list.begin();
while( it != list.end() ) {
cout<<*it<<endl;
++it;
}*/
#endif
//if (!proc.start()) {
if(!(proc.state()==QProcess::Running)){
// error handling
cout<<"Could not launch process"<<endl;
} else {
//while(proc.isRunning()) {
while(proc.state()==QProcess::Running){
;
#ifdef VERBOSE
cout<<"Process running "<< proc.exitStatus()<< endl;
#endif
}
//if (proc.normalExit()) {
if(proc.exitStatus()==QProcess::NormalExit){
;
#ifdef VERBOSE
cout<<" process returned OK"<<endl;
#endif
} else
cout<<" process returned error"<<endl;
while (proc.canReadLineStdout()) {//readAllStandardOutput ()
cout<<proc.readLineStdout() <<endl;
}
while (proc.canReadLineStderr()) {
cout<<"Error: "<<proc.readLineStderr() <<endl;
}
}
void qTabMessages::customEvent(QEvent *e) {
if (e->type() == STREAMEVENT)
dispLog->append(((qStreamEvent*)e)->getString());
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::SaveLog() {
QString fName = QString(myDet->getFilePath().c_str());
fName = fName+"/LogFile.txt";
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
fName,tr("Text files (*.txt)"));
if (!fName.isEmpty()){
QFile outfile;
outfile.setFileName(fName);
if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append
QTextStream out(&outfile);
out<<dispLog->toPlainText() << endl;
qDefs::InfoMessage(string("The Log has been successfully saved to "
"")+fName.toAscii().constData(),"Messages: Information");
}
else qDefs::ErrorMessage("ERROR: Attempt to save log file failed.","Messages: WARNING");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::ClearLog() {
dispLog->clear();
#ifdef VERBOSE
cout<<"Log Cleared"<<endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -11,11 +11,13 @@
/** Project Class Headers */
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** Qt Include Headers */
/** C++ Include Headers */
#include <iostream>
#include <string>
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
QString qTabPlot::defaultPlotTitle("Measurement");
@ -26,6 +28,9 @@ QString qTabPlot::defaultImageYAxisTitle("Pixel");
QString qTabPlot::defaultImageZAxisTitle("Intensity");
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this);
SetupWidgetWindow();
@ -42,6 +47,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabPlot::~qTabPlot(){
@ -50,6 +56,7 @@ qTabPlot::~qTabPlot(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetupWidgetWindow(){
@ -75,8 +82,11 @@ void qTabPlot::SetupWidgetWindow(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::Select1DPlot(bool b){
SetupWidgetWindow();
isOneD = b;
if(b){
box1D->setEnabled(true);
box2D->setEnabled(false);
@ -105,9 +115,16 @@ void qTabPlot::Select1DPlot(bool b){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::Initialization(){
/** Plot arguments box*/
connect(chkNoPlot, SIGNAL(toggled(bool)),myPlot, SLOT(EnablePlot(bool)));
connect(radioNoPlot, SIGNAL(clicked()),this, SLOT(SetPlot()));
connect(radioHistogram, SIGNAL(clicked()),this, SLOT(SetPlot()));
connect(radioDataGraph, SIGNAL(clicked()),this, SLOT(SetPlot()));
/** Scan box*/
//connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(EnablePlot(bool)));
/** Snapshot box*/
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
@ -147,21 +164,13 @@ void qTabPlot::Initialization(){
connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
/** Common Buttons*/
connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot()));
/** Save */
connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot()));
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::Enable(bool enable){
btnClone->setEnabled(enable);
btnCloseClones->setEnabled(enable);
box1D->setEnabled(enable);
box2D->setEnabled(enable);
boxPlotAxis->setEnabled(enable);
}
void qTabPlot::EnablePersistency(bool enable){
lblPersistency->setEnabled(enable);
@ -172,19 +181,21 @@ void qTabPlot::EnablePersistency(bool enable){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetTitles(){
int oneD = box1D->isEnabled();
/** Plot Title*/
if(dispTitle->isEnabled())
myPlot->SetPlotTitle(dispTitle->text());
/** X Axis */
if(dispXAxis->isEnabled()){
if(oneD) myPlot->SetHistXAxisTitle(dispXAxis->text());
if(isOneD) myPlot->SetHistXAxisTitle(dispXAxis->text());
else myPlot->SetImageXAxisTitle(dispXAxis->text());
}
/** Y Axis */
if(dispYAxis->isEnabled()){
if(oneD) myPlot->SetHistYAxisTitle(dispYAxis->text());
if(isOneD) myPlot->SetHistYAxisTitle(dispYAxis->text());
else myPlot->SetImageYAxisTitle(dispYAxis->text());
}
/** Z Axis */
@ -193,9 +204,10 @@ void qTabPlot::SetTitles(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableTitles(){
int oneD = box1D->isEnabled();
/** Plot Title*/
dispTitle->setEnabled(chkTitle->isChecked());
if(!chkTitle->isChecked()){
@ -205,7 +217,7 @@ void qTabPlot::EnableTitles(){
/** X Axis */
dispXAxis->setEnabled(chkXAxis->isChecked());
if(!chkXAxis->isChecked()){
if(oneD){
if(isOneD){
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
dispXAxis->setText(defaultHistXAxisTitle);
}
@ -217,7 +229,7 @@ void qTabPlot::EnableTitles(){
/** Y Axis */
dispYAxis->setEnabled(chkYAxis->isChecked());
if(!chkYAxis->isChecked()){
if(oneD){
if(isOneD){
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
dispYAxis->setText(defaultHistYAxisTitle);
}else{
@ -234,6 +246,7 @@ void qTabPlot::EnableTitles(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableRange(){
@ -253,6 +266,8 @@ void qTabPlot::EnableRange(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetAxesRange(){
double xmin=0,xmax=0,ymin=0,ymax=0;
@ -260,28 +275,40 @@ void qTabPlot::SetAxesRange(){
/** If disabled, get the min or max range of the plot as default */
if((dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()))
xmin = dispXMin->text().toDouble();
else xmin = myPlot->GetXMinimum();
else if(myPlot->DoesPlotExist())
xmin = myPlot->GetXMinimum();
if((dispXMax->isEnabled())&&(!dispXMax->text().isEmpty()))
xmax = dispXMax->text().toDouble();
else xmax = myPlot->GetXMaximum();
else if(myPlot->DoesPlotExist())
xmax = myPlot->GetXMaximum();
if((dispYMin->isEnabled())&&(!dispYMin->text().isEmpty()))
ymin = dispYMin->text().toDouble();
else ymin = myPlot->GetYMinimum();
else if(myPlot->DoesPlotExist())
ymin = myPlot->GetYMinimum();
if((dispYMax->isEnabled())&&(!dispYMax->text().isEmpty()))
ymax = dispYMax->text().toDouble();
else ymax = myPlot->GetYMaximum();
else if(myPlot->DoesPlotExist())
ymax = myPlot->GetYMaximum();
/** Setting the range*/
if(myPlot->DoesPlotExist()){
myPlot->SetXMinMax(xmin,xmax);
myPlot->SetYMinMax(ymin,ymax);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetZRange(){
emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble());
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableZRange(){
dispZMin->setEnabled(chkZMin->isChecked());
dispZMax->setEnabled(chkZMax->isChecked());
@ -289,9 +316,48 @@ void qTabPlot::EnableZRange(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SavePlot(){
QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText();
myPlot->SavePlot(fullFileName);
void qTabPlot::SetPlot(){
if(radioNoPlot->isChecked()){
myPlot->EnablePlot(false);
/**if enable is true, disable everything */
box1D->setEnabled(false);
box2D->setEnabled(false);
boxSnapshot->setEnabled(false);
boxSave->setEnabled(false);
boxPlotAxis->setEnabled(false);
boxScan->setEnabled(false);
}else if(radioHistogram->isChecked()){
myPlot->EnablePlot(true);
/**if enable is true, disable everything */
box1D->setEnabled(true);
box2D->setEnabled(true);
boxSnapshot->setEnabled(true);
boxSave->setEnabled(true);
boxPlotAxis->setEnabled(true);
boxScan->setEnabled(false);
}else{
myPlot->EnablePlot(true);
/**if enable is true, disable everything */
box1D->setEnabled(true);
box2D->setEnabled(true);
boxSnapshot->setEnabled(true);
boxSave->setEnabled(true);
boxPlotAxis->setEnabled(true);
boxScan->setEnabled(true);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableHistogram(bool enable){
//boxScan->setEnabled(false);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -148,3 +148,13 @@ void qTabSettings::setSettings(int index){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::Refresh(){
/** Settings */
SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------