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

@ -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: