made some changes to make clone and main window resize plot

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@3 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d
2012-05-29 08:24:03 +00:00
parent 934bbbd0c8
commit 4624c65398
14 changed files with 782 additions and 425 deletions

View File

@ -57,21 +57,10 @@
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
<width>524287</width>
<height>450</height>
</size>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>754</width>
<height>368</height>
</rect>
</property>
<layout class="QGridLayout" name="layoutTabs"/>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
@ -321,8 +310,8 @@
<font>
<family>Sans Serif</family>
<pointsize>11</pointsize>
<weight>50</weight>
<bold>false</bold>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="features">
@ -339,7 +328,7 @@
</attribute>
<widget class="QWidget" name="dockWidgetContentsPlot">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>734</width>
<width>718</width>
<height>339</height>
</rect>
</property>
@ -153,9 +153,9 @@
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<y>10</y>
<width>321</width>
<height>117</height>
<height>130</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -270,9 +270,9 @@
<property name="geometry">
<rect>
<x>390</x>
<y>20</y>
<y>11</y>
<width>322</width>
<height>312</height>
<height>321</height>
</rect>
</property>
<layout class="QGridLayout" name="gridTimeResolved">
@ -788,7 +788,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>150</y>
<y>170</y>
<width>319</width>
<height>90</height>
</rect>

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>748</width>
<width>734</width>
<height>339</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
@ -29,8 +35,8 @@
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>731</width>
<y>130</y>
<width>711</width>
<height>151</height>
</rect>
</property>
@ -45,7 +51,7 @@
<rect>
<x>10</x>
<y>20</y>
<width>712</width>
<width>691</width>
<height>121</height>
</rect>
</property>
@ -97,6 +103,9 @@
<height>0</height>
</size>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
</widget>
</item>
<item row="1" column="6">
@ -220,6 +229,9 @@
</item>
<item row="3" column="6">
<widget class="QCheckBox" name="chkZMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Z max:</string>
</property>
@ -227,6 +239,9 @@
</item>
<item row="3" column="7">
<widget class="QLineEdit" name="dispZMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -270,10 +285,10 @@
<widget class="QGroupBox" name="box2D">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<x>11</x>
<y>70</y>
<width>571</width>
<height>61</height>
<height>51</height>
</rect>
</property>
<property name="title">
@ -282,16 +297,16 @@
<property name="flat">
<bool>false</bool>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<widget class="QWidget" name="gridLayoutWidget_5">
<property name="geometry">
<rect>
<x>10</x>
<x>8</x>
<y>20</y>
<width>585</width>
<height>31</height>
<width>551</width>
<height>22</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QCheckBox" name="chkInterpolate">
<property name="text">
@ -314,16 +329,13 @@
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_9">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>250</width>
<width>40</width>
<height>20</height>
</size>
</property>
@ -336,11 +348,129 @@
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<y>10</y>
<width>571</width>
<height>61</height>
<height>51</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>183</red>
<green>183</green>
<blue>183</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>171</red>
<green>171</green>
<blue>171</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>179</red>
<green>179</green>
<blue>179</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>154</red>
<green>154</green>
<blue>154</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="title">
<string>1D Plot Options</string>
</property>
@ -352,83 +482,231 @@
<rect>
<x>10</x>
<y>20</y>
<width>658</width>
<height>30</height>
<width>551</width>
<height>16</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="chkLogz_2">
<property name="enabled">
<bool>false</bool>
</property>
<widget class="QCheckBox" name="chktest1D">
<property name="text">
<string>Log Scale (Z)</string>
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chkLogz_3">
<property name="enabled">
<bool>false</bool>
</property>
</layout>
</widget>
<zorder>gridLayoutWidget_3</zorder>
<zorder>btnClear</zorder>
<zorder>gridLayoutWidget_4</zorder>
</widget>
<widget class="QGroupBox" name="boxSave">
<property name="geometry">
<rect>
<x>10</x>
<y>288</y>
<width>711</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Save</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>13</y>
<width>698</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutSave">
<item>
<widget class="QLabel" name="lblFName">
<property name="text">
<string>Superimpose</string>
<string>File Name:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item>
<layout class="QHBoxLayout" name="hLayoutSave">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<item>
<widget class="QLineEdit" name="dispFName"/>
</item>
<item>
<widget class="QComboBox" name="comboFormat">
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>.gif</string>
</property>
</item>
<item>
<property name="text">
<string>.pdf</string>
</property>
</item>
<item>
<property name="text">
<string>.png</string>
</property>
</item>
<item>
<property name="text">
<string>.gif+</string>
</property>
</item>
<item>
<property name="text">
<string>.jpg</string>
</property>
</item>
<item>
<property name="text">
<string>.ps</string>
</property>
</item>
<item>
<property name="text">
<string>.eps</string>
</property>
</item>
<item>
<property name="text">
<string>.xpm</string>
</property>
</item>
<item>
<property name="text">
<string>.C</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btnSave">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>295</width>
<height>20</height>
</size>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
</spacer>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkAutoFName">
<property name="text">
<string>Automatic File Name</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkSaveAll">
<property name="text">
<string>Save All</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="gridLayoutWidget_4">
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>610</x>
<y>22</y>
<x>599</x>
<y>41</y>
<width>121</width>
<height>71</height>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="btnClone">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="title">
<string>Clone</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>101</width>
<height>71</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="topMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="verticalSpacing">
<number>-1</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="btnClone">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clone Plot</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="btnCloseClones">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Close All</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>600</x>
<y>16</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="btnClear">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clone</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="btnCloseClones">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Close All Clones</string>
<string>Clear</string>
</property>
</widget>
</item>

View File

@ -14,6 +14,14 @@ class SlsQt2DPlotLayout;
/** Qt Include Headers */
#include <QFrame>
#include <QCloseEvent>
#include <QGroupBox>
#include <QWidget>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
/**
*@short Sets up the clone plot widget
@ -24,13 +32,16 @@ class qCloneWidget:public QFrame{
public:
/** \short The constructor
*/
qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D);
qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D);
/** Destructor
*/
~qCloneWidget();
/** Get the 1D plot reference
*/
SlsQt1DPlot* Get1Dplot(){ return cloneplot1D;};
public slots:
@ -44,6 +55,17 @@ private:
/** clone 2D Plot */
SlsQt2DPlotLayout* cloneplot2D;
QGridLayout *mainLayout;
QGroupBox *boxSave;
QWidget *horizontalLayoutWidget;
QHBoxLayout *layoutSave;
QLabel *lblFName;
QHBoxLayout *hLayoutSave;
QLineEdit *dispFName;
QComboBox *comboFormat;
QPushButton *btnSave;
QCheckBox *chkAutoFName;
QCheckBox *chkSaveAll;
protected:
void closeEvent(QCloseEvent* event);

View File

@ -24,6 +24,7 @@ class slsDetectorUtils;
#include "sls_detector_defs.h"
/** Qt Include Headers */
#include <QScrollArea>
#include <QGridLayout>
/**
*@short Main window of the GUI.
@ -50,16 +51,14 @@ public:
private:
/** The Qt Application */
QApplication *theApp;
/** The sls detector object */
slsDetectorUtils *myDet;
/** The Plot widget */
qDrawPlot *myPlot;
/**Tab Widget */
QTabWidget *tabs;
/**Layout of the central Widget */
QGridLayout *layoutTabs;
/** height of Plot Window when undocked */
int heightPlotWindow;
@ -68,7 +67,6 @@ private:
/* Scroll Area for the tabs**/
QScrollArea *scroll[NumberOfTabs];
QScrollArea *scrollMain;
/**Measurement tab */
qTabMeasurement *tab_measurement;
/**DataOutput tab */
@ -99,9 +97,10 @@ private:
*/
void Initialization();
/** Enables the developer tab
/** Sets/unsets the developer mode (developer tab)
* @param b bool TRUE sets, FALSE unsets\
*/
void SetDeveloperMode();
void SetDeveloperMode(bool b);
private slots:
/** Sets/unsets the debug mode i.e. enables/disables the debug tab

View File

@ -21,6 +21,7 @@ class qCloneWidget;
#include <QGridLayout>
#include <QGroupBox>
#include <QTimer>
#include <QString>
/**
@ -44,6 +45,20 @@ public:
*/
void StartStopDaqToggle(bool stop_if_running=0);
/** sets plot Title */
void SetPlotTitle(QString title) {boxPlot->setTitle(title);}
/** sets 1D X Axis Title */
void SetHistXAxisTitle(QString title) {histXAxisTitle = title;}
/** sets 1D Y Axis Title */
void SetHistYAxisTitle(QString title) {histYAxisTitle = title;}
/** sets 2D X Axis Title */
void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;}
/** sets 2D Y Axis Title */
void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;}
/** sets 2D Z Axis Title */
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;}
private:
/** The sls detector object */
slsDetectorUtils *myDet;
@ -61,7 +76,7 @@ private:
/** Max Number of Clone Windows */
static const int MAXCloneWindows = 50;
/** Array of clone window widget pointers */
qCloneWidget *winClone[MAXCloneWindows];
qCloneWidget *winClone[MAXCloneWindows];
/** Widgets needed to set up plot*/
QGroupBox *boxPlot;
@ -69,13 +84,16 @@ private:
QGridLayout *plotLayout;
/** Timer to update plot */
QTimer* plot_update_timer;
/** 1D object */
SlsQt1DPlot* plot1D;
/** 2D object */
SlsQt2DPlotLayout* plot2D;
/** 1D hist values */
/** vector of 1D hist values */
QVector<SlsQtH1D*> plot1D_hists;
QVector<SlsQtH1D*> cloneplot1D_hists;
/**variables for threads */
/** */
@ -91,11 +109,11 @@ private:
/** Title in 2D */
std::string imageTitle;
/** X Axis Title in 2D */
std::string imageXAxisTitle;
QString imageXAxisTitle;
/** Y Axis Title in 2D */
std::string imageYAxisTitle;
QString imageYAxisTitle;
/** Z Axis Title in 2D */
std::string imageZAxisTitle;
QString imageZAxisTitle;
/** Number of Pixels in X Axis */
unsigned int nPixelsX;
/** Number of Pixels in Y Axis */
@ -107,9 +125,9 @@ private:
/** Title for all the graphs in 1D */
std::string histTitle[10];
/** X Axis Title in 1D */
std::string histXAxisTitle;
QString histXAxisTitle;
/** Y Axis Title in 1D */
std::string histYAxisTitle;
QString histYAxisTitle;
/** Total Number of X axis values/channels in 1D */
int histNBins;
/** X Axis value in 1D */
@ -123,46 +141,19 @@ private:
/** */
int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);}
/** */
SlsQt1DPlot* Get1DPlotPtr() {return plot1D;}
/** */
SlsQt2DPlotLayout* Get2DPlotPtr() {return plot2D;}
/** */
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
/** */
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
/** */
unsigned int PlotInScope() {return plot_in_scope;}
/** */
unsigned int GetLastImageNumber() {return lastImageNumber;}
/** */
const char* GetImageTitle() {return imageTitle.c_str();}
/** */
const char* GetImageXAxisTitle() {return imageXAxisTitle.c_str();}
/** */
const char* GetImageYAxisTitle() {return imageYAxisTitle.c_str();}
/** */
const char* GetImageZAxisTitle() {return imageZAxisTitle.c_str();}
/** */
unsigned int GetNPixelsX() {return nPixelsX;}
/** */
unsigned int GetNPixelsY() {return nPixelsY;}
/** */
double* GetLastImageArray() {return lastImageArray;}
/** */
unsigned int GetNHists() {return nHists;}
/** */
const char* GetHistTitle(int i) {return (i>=0&&i<10) ? histTitle[i].c_str():0;} //int for hist number
/** */
const char* GetHistXAxisTitle() {return histXAxisTitle.c_str();}
/** */
const char* GetHistYAxisTitle() {return histYAxisTitle.c_str();}
/** */
unsigned int GetHistNBins() {return histNBins;}
/** */
double* GetHistXAxis() {return histXAxis;}
/** */
double* GetHistYAxis(int i) {return (i>=0&&i<10) ? histYAxis[i]:0;} //int for hist number
/** Initializes all its members and the thread */
void Initialization();
@ -229,6 +220,9 @@ void StopUpdatePlot();
*/
void StartDaq(bool start);
/** To set the reference to zero after closing a clone
* @param id is the id of the clone
*/
void CloneCloseEvent(int id);
signals:

View File

@ -41,6 +41,15 @@ private:
/** The Plot widget */
qDrawPlot *myPlot;
/** some Default Values */
static QString defaultPlotTitle;
static QString defaultHistXAxisTitle;
static QString defaultHistYAxisTitle;
static QString defaultImageXAxisTitle;
static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle;
/** methods */
/** Sets up the widget
*/
@ -63,6 +72,22 @@ public slots:
private slots:
/** Selects the plot to display, enables/disables widgets
* @param b true to select plot dimension 1, else false to select 2D
*/
void Select1DPlot(bool b);
/**Sets the titles in plot axis
*/
void SetTitles();
/** Enables/Sets Titles to default
*/
void EnableTitles();
signals:

View File

@ -1,58 +1,3 @@
/**
* @author Ian Johnson
* @version 1.0
*/
/*
#ifndef SLSQT2DPLOTLAYOUT_H
#define SLSQT2DPLOTLAYOUT_H
#include <qwidget.h>
#include <qgroupbox.h>
#include <QString>
#include "SlsQtNumberEntry.h"
#include "SlsQt2DPlot.h"
//class QGridLayout;
//class QToolbar;
class SlsQt2DPlotLayout: public QGroupBox{
Q_OBJECT
public:
SlsQt2DPlotLayout(QWidget * = NULL);
~SlsQt2DPlotLayout();
SlsQt2DPlot* GetPlot() {return the_plot;}
void SetXTitle(QString st);
void SetYTitle(QString st);
void SetZTitle(QString st);
void UpdateNKeepSetRangeIfSet();
private:
//QGridLayout* the_layout;
SlsQt2DPlot* the_plot;
//SlsQtNumberEntry* z_range_ne;
void ConnectSignalsAndSlots();
public slots:
void SetZScaleToLog(bool yes);
void ResetRange();
};
#endif
*/
/**
* @author Ian Johnson
* @version 1.0
@ -69,6 +14,7 @@ private:
#include "SlsQt2DPlot.h"
class QGridLayout;
class QString;
@ -102,6 +48,7 @@ private:
public slots:
void SetZScaleToLog(bool yes);
void ResetRange();
void SetTitle(QString st);
signals:
void InterpolateSignal(bool);

View File

@ -1,105 +1,3 @@
/**
* @author Ian Johnson
* @version 1.0
*/
/*
#include <iostream>
#include <qgroupbox.h>
//#include <qgridlayout.h>
//#include <qlabel.h>
#include "SlsQt2DPlotLayout.h"
using namespace std;
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
//the_layout=0;
the_plot = new SlsQt2DPlot(this);
// z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2);
// z_range_ne->setFixedWidth(402);
ConnectSignalsAndSlots();
}
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
//if(the_layout) delete the_layout;
delete the_plot;
// delete z_range_ne;
}
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool)));
connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool)));
connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool)));
connect(z_range_ne,SIGNAL(CheckBoxChanged(bool)),this,SLOT(ResetRange()));
connect(z_range_ne,SIGNAL(AValueChanged(SlsQtNumberEntry*)),this,SLOT(ResetRange()));
btnInterpolate->setChecked(false);
btnContour->setChecked(false);
btnLogz->setChecked(false);
}
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
if(z_range_ne->CheckBoxState()){
//just reset histogram range before update
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
}
the_plot->Update();
}
void SlsQt2DPlotLayout::ResetRange(){
//refind z limits
the_plot->SetZMinMax();
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
if(z_range_ne->CheckBoxState()){
//first time check validity
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
//set histogram range
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
}
the_plot->Update();
}
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
the_plot->LogZ(yes);
ResetRange();
}
void SlsQt2DPlotLayout::SetXTitle(QString st){
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
}
void SlsQt2DPlotLayout::SetYTitle(QString st){
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
}
void SlsQt2DPlotLayout::SetZTitle(QString st){
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
}
*/
/**
* @author Ian Johnson
* @version 1.0
@ -112,6 +10,7 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){
#include <qgroupbox.h>
#include <qgridlayout.h>
#include <qlabel.h>
#include <QString>
#include "SlsQt2DPlotLayout.h"
@ -147,8 +46,6 @@ void SlsQt2DPlotLayout::Layout(){
the_layout = new QGridLayout(this);
the_layout->addWidget(the_plot,2,1,3,3);
the_layout->addWidget(z_range_ne,5,1,1,3);
the_layout->setMargin(12);
}
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
@ -210,3 +107,6 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
}
void SlsQt2DPlotLayout::SetTitle(QString st){
setTitle(st);
}

View File

@ -17,30 +17,97 @@
/** C++ Include Headers */
#include <iostream>
#include <string>
#include <QSizePolicy>
using namespace std;
qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){
qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){
mainLayout = new QGridLayout(this);
setLayout(mainLayout);
QGroupBox *cloneBox = new QGroupBox(this);
QGridLayout *gridClone = new QGridLayout(cloneBox);
cloneBox->setLayout(gridClone);
cloneBox->setFlat(1);
cloneBox->setTitle("Startup Image");
cloneBox->resize(fSize);
cloneBox->setTitle(title);
cloneBox->setAlignment(Qt::AlignHCenter);
cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold));
if(numDim==1){
cloneplot1D = plot1D;
gridClone->addWidget(cloneplot1D,0,0);
cloneBox->setFlat(false);
}else{
cloneplot2D = plot2D;
gridClone->addWidget(cloneplot2D,0,0);
cloneBox->setFlat(true);
}
/*
boxSave = new QGroupBox(this);
layoutSave = new QHBoxLayout;
boxSave->setLayout(layoutSave);
lblFName = new QLabel(layoutSave);
lblFName->setText("File Name:");
layoutSave->addWidget(lblFName);
hLayoutSave = new QHBoxLayout();
hLayoutSave->setSpacing(0);
dispFName = new QLineEdit(layoutSave);
hLayoutSave->addWidget(dispFName);
comboFormat = new QComboBox(layoutSave);
comboFormat->setFrame(true);
comboFormat->insertItem(".gif");
comboFormat->insertItem(".pdf");
comboFormat->insertItem(".png");
comboFormat->insertItem(".gif+");
comboFormat->insertItem(".jpg");
comboFormat->insertItem(".ps");
comboFormat->insertItem(".eps");
comboFormat->insertItem(".xpm");
comboFormat->insertItem(".C");
hLayoutSave->addWidget(comboFormat);
layoutSave->addLayout(hLayoutSave);
btnSave = new QPushButton(layoutSave);
bnSave->setText("Save");
QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy2.setHeightForWidth(btnSave->sizePolicy().hasHeightForWidth());
btnSave->setSizePolicy(sizePolicy2);
btnSave->setFocusPolicy(Qt::NoFocus);
layoutSave->addWidget(btnSave);
chkAutoFName = new QCheckBox(layoutSave);
chkAutoFName->setText("Automatic File Name");
layoutSave->addWidget(chkAutoFName);
chkSaveAll = new QCheckBox(layoutSave);
chkSaveAll->setText("Save All")
layoutSave->addWidget(chkSaveAll);
gridClone->addWidget(boxSave,0,0);
mainLayout->addWidget(boxSave,1,1);*/
mainLayout->addWidget(cloneBox,0,0);
}

View File

@ -41,20 +41,26 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *
setupUi(this);
SetUpWidgetWindow();
Initialization();
SetDeveloperMode();
/**need to use argc and argv to determine which slsdet or multidet to use.*/
if(argc>1){
if(!strcasecmp(argv[1],"-developer"))
tabs->setTabEnabled(Developer,true);
else
tabs->setTabEnabled(Developer,false);
for(int iarg=1; iarg<argc; iarg++){
if(!strcasecmp(argv[1],"-developer")) SetDeveloperMode(true);
if(!strcasecmp(argv[1],"-help")){
cout<<"Possible Arguments are:"<<endl;
cout<<"-help \t\t : \t This help"<<endl;
cout<<"-developer \t : \t Enables the developer tab"<<endl;
//cout<<"-id i \t : \t Sets the detector to id i (the default is 0). ";
//cout<<"Required only when more than one detector is connected in parallel."<<endl;
}
}
//centralwidget->setFixedHeight(centralwidget->height());
}
//Qt::ScrollBarAsNeeded
qDetectorMain::~qDetectorMain(){
@ -70,13 +76,12 @@ qDetectorMain::~qDetectorMain(){
void qDetectorMain::SetUpWidgetWindow(){
/* scrollMain = new QScrollArea;
setCentralWidget(scrollMain);
scrollMain ->setWidget(centralwidget);
scrollMain->setWidgetResizable(true);*/
SetUpDetector();
/** Layout */
layoutTabs= new QGridLayout;
centralwidget->setLayout(layoutTabs);
/** plot setup*/
myPlot = new qDrawPlot(dockWidgetPlot,myDet);
dockWidgetPlot->setWidget(myPlot);
@ -107,6 +112,7 @@ 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");
@ -121,6 +127,8 @@ void qDetectorMain::SetUpWidgetWindow(){
SetDebugMode(false);
SetBeamlineMode(false);
SetExpertMode(false);
SetDeveloperMode(false);
}
@ -190,11 +198,11 @@ void qDetectorMain::Initialization(){
}
void qDetectorMain::SetDeveloperMode(){
void qDetectorMain::SetDeveloperMode(bool b){
#ifdef VERBOSE
cout<<"Enabling Developer Mode "<<endl;
cout<<"Setting Developer Mode to "<<b<<endl;
#endif
tabs->setTabEnabled(Developer,true);
tabs->setTabEnabled(Developer,b);
}
@ -314,31 +322,32 @@ void qDetectorMain::ResizeMainWindow(bool b){
#ifdef VERBOSE
cout<<"Resizing Main Window: height:"<<height()<<endl;
#endif
if(b)/** sets the main window height to a smaller maximum to get rid of space*/
/** undocked from the main window */
if(b){/** sets the main window height to a smaller maximum to get rid of space*/
setMaximumHeight(height()-heightPlotWindow-9);
else
dockWidgetPlot->setMinimumHeight(0);
}
else{
setMaximumHeight(QWIDGETSIZE_MAX);
dockWidgetPlot->setMinimumHeight(heightPlotWindow);
}
cout<<"size hint ht:"<<sizeHint().height()<<endl;
}
void qDetectorMain::SetTerminalWindowSize(bool b){
#ifdef VERBOSE
cout<<"Resizing Terminal Window"<<endl;
#endif
cout<<"min width:"<<dockWidgetTerminal->minimumWidth()<<endl;
cout<<"min height:"<<dockWidgetTerminal->minimumHeight()<<endl;
//depends on gridlayout in qdrawterminal widget class
if(b){
dockWidgetTerminal->setMinimumWidth(width()/2);
}
//dockWidgetTerminal->setFixedSize(width()/2,dockWidgetTerminal->minimumHeight());
else{
dockWidgetTerminal->setMinimumWidth(38);
QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
dockWidgetTerminal->setSizePolicy(sizePolicy);
//dockWidgetTerminal->setSizePolicy(new QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
//dockWidgetTerminal->setFixedSize(dockWidgetTerminal->minimumWidth(),dockWidgetTerminal->minimumHeight());
}
}

View File

@ -25,8 +25,8 @@ using namespace std;
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){
if(myDet) {
Initialization();
SetupWidgetWindow();
Initialization();
StartStopDaqToggle(); //as default
}
}
@ -35,47 +35,44 @@ qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent
qDrawPlot::~qDrawPlot(){
/** Clear plot*/
Clear1DPlot();
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++)
delete *h;
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h;
plot1D_hists.clear();
delete[] lastImageArray; lastImageArray=0;
StartOrStopThread(0);
/** delete detector object pointer*/
delete myDet;
for(int i=0;i<MAXCloneWindows;i++) delete winClone[i];
}
void qDrawPlot::Initialization(){
#ifdef VERBOSE
cout<<"Setting up plot variables"<<endl;
#endif
stop_signal = 0;
pthread_mutex_init(&last_image_complete_mutex,NULL);
plot_in_scope = 0;
lastImageNumber = 0;
nPixelsX = 0;
nPixelsY = 0;
lastImageArray = 0;
nHists = 0;
histNBins = 0;
histXAxis = 0;
for(int i=0;i<10;i++) histYAxis[i]=0;
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
}
void qDrawPlot::SetupWidgetWindow(){
#ifdef VERBOSE
cout<<"Setting up plot variables"<<endl;
#endif
stop_signal = 0;
pthread_mutex_init(&last_image_complete_mutex,NULL);
plot_in_scope = 0;
lastImageNumber = 0;
nPixelsX = 0;
nPixelsY = 0;
lastImageArray = 0;
nHists = 0;
histNBins = 0;
histXAxis = 0;
for(int i=0;i<10;i++) histYAxis[i]=0;
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
/** Setting up window*/
setFont(QFont("Sans Serif",9));
layout = new QGridLayout;
boxPlot = new QGroupBox("Start Image");
boxPlot = new QGroupBox("Measurement");
boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif",11,QFont::Bold));
layout->addWidget(boxPlot,1,1);
this->setLayout(layout);
@ -83,26 +80,28 @@ void qDrawPlot::SetupWidgetWindow(){
connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));
plot1D = new SlsQt1DPlot(boxPlot);
plot1D->SetXTitle("x axis");
plot1D->SetYTitle("y axis");
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot1D->hide();
plot2D = new SlsQt2DPlotLayout(boxPlot);
plot2D->SetXTitle("pixel");
plot2D->SetYTitle("pixel");
plot2D->SetZTitle("Intensity");
boxPlot->setFlat(1);
boxPlot->setTitle("Startup Image");
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot2D->setTitle("Start Image");
plot2D->setAlignment(Qt::AlignLeft);
boxPlot->setFlat(true);
plotLayout = new QGridLayout(boxPlot);
plotLayout->addWidget(plot1D,1,1,1,1);
plotLayout->addWidget(plot2D,1,1,1,1);
}
void qDrawPlot::Initialization(){
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)));
}
@ -269,7 +268,7 @@ void* qDrawPlot::AcquireImages(){
if(!pthread_mutex_trylock(&last_image_complete_mutex)){
//plot_in_scope = 1;//i%2 + 1;
plot_in_scope = 2;
//plot_in_scope = 2;
cout<<"value:"<<image_data[6]<<endl;
lastImageNumber = i+1;
@ -278,8 +277,6 @@ void* qDrawPlot::AcquireImages(){
nHists = 2;
sprintf(temp_title,"curve one %d",i); histTitle[0] = temp_title;
sprintf(temp_title,"curve two %d",i); histTitle[1] = temp_title;
sprintf(temp_title,"Channel Number"); histXAxisTitle=temp_title;
sprintf(temp_title,"Intensity"); histYAxisTitle=temp_title;
histNBins = nx;
memcpy(histXAxis, xvalues,nx*sizeof(double));
memcpy(histYAxis[0],yvalues0,nx*sizeof(double));
@ -287,9 +284,6 @@ void* qDrawPlot::AcquireImages(){
//2d image stuff
sprintf(temp_title,"Image number %d",i); imageTitle=temp_title;
sprintf(temp_title,"The x-axis title"); imageXAxisTitle=temp_title;
sprintf(temp_title,"The y-axis title"); imageYAxisTitle=temp_title;
sprintf(temp_title,"The z-axis title"); imageZAxisTitle=temp_title;
nPixelsX = nx;
nPixelsY = ny;
memcpy(lastImageArray,image_data,nx*ny*sizeof(double));
@ -315,9 +309,13 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
if(i==1){
plot1D->show();
plot2D->hide();
boxPlot->setFlat(false);
plot_in_scope=1;
}else{
plot1D->hide();
plot2D->show();
boxPlot->setFlat(true);
plot_in_scope=2;
}
}
@ -339,17 +337,17 @@ void qDrawPlot::UpdatePlot(){
LockLastImageArray();
//1-d plot stuff
if(GetHistNBins()){
plot1D->SetXTitle(GetHistXAxisTitle());
plot1D->SetYTitle(GetHistYAxisTitle());
for(int hist_num=0;hist_num<GetNHists();hist_num++){
if(histNBins){
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
for(int hist_num=0;hist_num<nHists;hist_num++){
SlsQtH1D* h;
if(hist_num+1>plot1D_hists.size()){
plot1D_hists.append(h=new SlsQtH1D("1d plot",GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num)));
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
h->SetLineColor(hist_num+1);
}else{
h=plot1D_hists.at(hist_num);
h->SetData(GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num));
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
}
h->setTitle(GetHistTitle(hist_num));
h->Attach(plot1D);
@ -359,23 +357,23 @@ void qDrawPlot::UpdatePlot(){
//2-d plot stuff
static int last_plot_number = 0;
if(GetLastImageArray()){
if(GetLastImageNumber()&&last_plot_number!=GetLastImageNumber() && //there is a new plot
GetNPixelsX()>0&&GetNPixelsY()>0){
plot2D->GetPlot()->SetData(GetNPixelsX(),-0.5,GetNPixelsX()-0.5,GetNPixelsY(),-0.5,GetNPixelsY()-0.5,GetLastImageArray());
if(lastImageArray){
if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
//as it inherits a widget
boxPlot->setTitle(GetImageTitle());
plot2D->SetXTitle(GetImageXAxisTitle());
plot2D->SetYTitle(GetImageYAxisTitle());
plot2D->SetZTitle(GetImageZAxisTitle());
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
}
}
last_plot_number=GetLastImageNumber();
last_plot_number=lastImageNumber;
UnlockLastImageArray();
if(PlotInScope()==1) SelectPlot(1);
else if(PlotInScope()==2) SelectPlot(2);
/* if(plot_in_scope==1) SelectPlot(1);
else if(plot_in_scope==2) SelectPlot(2);*/
if(number_of_exposures==last_plot_number){
StartStopDaqToggle(1);
@ -407,13 +405,32 @@ void qDrawPlot::ClonePlot(){
exit(-1);
}
winClone[i] = new qCloneWidget(this,i,boxPlot->size(),(int)PlotInScope(),plot1D,plot2D);
if(PlotInScope()==1)
winClone[i] = new qCloneWidget(this,i,boxPlot->size(),boxPlot->title(),(int)plot_in_scope,plot1D,plot2D);
if(plot_in_scope==1){
plot1D = new SlsQt1DPlot(boxPlot);
else
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
plotLayout->addWidget(plot1D,1,1,1,1);
/** Somehow the 1d plot hists are lost*/
SlsQtH1D* h;
for(int hist_num=0;hist_num<nHists;hist_num++){
SlsQtH1D* k;
if(hist_num+1>cloneplot1D_hists.size()){
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
k->SetLineColor(hist_num+1);
}else{
k=cloneplot1D_hists.at(hist_num);
k->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
}
k->setTitle(GetHistTitle(hist_num));
k->Attach(winClone[i]->Get1Dplot());
}
winClone[i]->Get1Dplot()->UnZoom();
}
else{
plot2D = new SlsQt2DPlotLayout(boxPlot);
plotLayout->addWidget(plot1D,1,1,1,1);
plotLayout->addWidget(plot2D,1,1,1,1);
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plotLayout->addWidget(plot2D,1,1,1,1);
}
UpdatePlot();
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));

View File

@ -319,30 +319,27 @@ void qTabMeasurement::setTimingMode(int mode){
cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<<endl;
#endif
//need to send to client to set the timing mode
/** Default settings */
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false);
switch(mode){
case None:
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false);
break;
case Auto:
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
break;
case Gated:
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
break;
case Trigger_Exp_Series:
@ -351,39 +348,26 @@ void qTabMeasurement::setTimingMode(int mode){
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
break;
case Trigger_Readout:
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false);
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
break;
case Gated_Start:
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
break;
case Trigger_Frame:
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
break;
case Trigger_Window:
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false); spinNumGates->setEnabled(false);
break;
default:
cout<<"ERROR: Timing mode being set to other should never happen"<<endl;
@ -392,9 +376,7 @@ void qTabMeasurement::setTimingMode(int mode){
if(mode!=None){
if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){
lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true);
}else{
lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false);
lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true);
}
}

View File

@ -12,19 +12,30 @@
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** C++ Include Headers */
#include<iostream>
#include <iostream>
#include <string>
using namespace std;
#define Detector_Index 0
QString qTabPlot::defaultPlotTitle("Measurement");
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
QString qTabPlot::defaultHistYAxisTitle("Counts");
QString qTabPlot::defaultImageXAxisTitle("Pixel");
QString qTabPlot::defaultImageYAxisTitle("Pixel");
QString qTabPlot::defaultImageZAxisTitle("Intensity");
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this);
if(myDet)
{
SetupWidgetWindow();
// wherever you choose plot do all these steps
//This also selects the text if unchecked
//includes setupwidgetwindow
//SelectPlot(1);
Initialization();
}
}
@ -41,10 +52,51 @@ qTabPlot::~qTabPlot(){
void qTabPlot::SetupWidgetWindow(){
box1D->setEnabled(false);
/** Plot Axis*/
myPlot->SetPlotTitle(defaultPlotTitle);
dispTitle->setText(defaultPlotTitle);
dispTitle->setEnabled(false);
dispXAxis->setEnabled(false);
dispYAxis->setEnabled(false);
dispZAxis->setEnabled(false);
dispXMin->setEnabled(false);
dispYMin->setEnabled(false);
dispZMin->setEnabled(false);
dispXMax->setEnabled(false);
dispYMax->setEnabled(false);
dispZMax->setEnabled(false);
}
void qTabPlot::Select1DPlot(bool b){
SetupWidgetWindow();
if(b){
myPlot->Select1DPlot();
box1D->setEnabled(true);
box2D->setEnabled(false);
chkZAxis->setEnabled(false);
chkZMin->setEnabled(false);
chkZMax->setEnabled(false);
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
dispXAxis->setText(defaultHistXAxisTitle);
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
dispYAxis->setText(defaultHistYAxisTitle);
}else{
myPlot->Select2DPlot();
box1D->setEnabled(false);
box2D->setEnabled(true);
chkZAxis->setEnabled(true);
chkZMin->setEnabled(true);
chkZMax->setEnabled(true);
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
dispXAxis->setText(defaultImageXAxisTitle);
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
dispYAxis->setText(defaultImageYAxisTitle);
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
dispZAxis->setText(defaultImageZAxisTitle);
}
}
void qTabPlot::Initialization(){
/** Plot box*/
@ -54,6 +106,21 @@ void qTabPlot::Initialization(){
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool)));
/** Plot Axis **/
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
connect(dispTitle, SIGNAL(returnPressed()), this, SLOT(SetTitles()));
connect(dispXAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles()));
connect(dispYAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles()));
connect(dispZAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles()));
/** Common Buttons*/
connect(btnClear, SIGNAL(clicked()),myPlot, SLOT(Clear1DPlot()));
/** test for 1D*/
connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool)));
}
@ -66,4 +133,65 @@ void qTabPlot::Enable(bool enable){
boxPlotAxis->setEnabled(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());
else myPlot->SetImageXAxisTitle(dispXAxis->text());
}
/** Y Axis */
if(dispYAxis->isEnabled()){
if(oneD) myPlot->SetHistYAxisTitle(dispYAxis->text());
else myPlot->SetImageYAxisTitle(dispYAxis->text());
}
/** Z Axis */
if(dispZAxis->isEnabled())
myPlot->SetImageZAxisTitle(dispZAxis->text());
}
void qTabPlot::EnableTitles(){
int oneD = box1D->isEnabled();
/** Plot Title*/
dispTitle->setEnabled(chkTitle->isChecked());
if(!chkTitle->isChecked()){
myPlot->SetPlotTitle(defaultPlotTitle);
dispTitle->setText(defaultPlotTitle);
}
/** X Axis */
dispXAxis->setEnabled(chkXAxis->isChecked());
if(!chkXAxis->isChecked()){
if(oneD){
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
dispXAxis->setText(defaultHistXAxisTitle);
}
else{
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
dispXAxis->setText(defaultImageXAxisTitle);
}
}
/** Y Axis */
dispYAxis->setEnabled(chkYAxis->isChecked());
if(!chkYAxis->isChecked()){
if(oneD){
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
dispYAxis->setText(defaultHistYAxisTitle);
}else{
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
dispYAxis->setText(defaultImageYAxisTitle);
}
}
/** Z Axis */
dispZAxis->setEnabled(chkZAxis->isChecked());
if(!chkZAxis->isChecked()){
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
dispZAxis->setText(defaultImageZAxisTitle);
}
}