This commit is contained in:
2019-06-12 14:40:04 +02:00
parent e6361c73fc
commit 5d2567005d
8 changed files with 157 additions and 417 deletions

View File

@ -1,147 +1,102 @@
#pragma once
class SlsQtH1D;
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
class SlsQt1DPlot;
class SlsQt2DPlotLayout;
#include <QAction>
#include <QCheckBox>
#include <QCloseEvent>
#include <QComboBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QSpacerItem>
#include <QString>
#include <QWidget>
#include <QMainWindow>
class QwtSymbol;
class QGridLayout;
class QGroupBox;
class QLabel;
class QCloseEvent;
#include <iostream>
#include <string>
/**
*@short Sets up the clone plot widget
*/
class qCloneWidget : public QMainWindow {
Q_OBJECT
public:
/**
* The constructor
*/
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim, std::string FilePath,
bool displayStats, QString min, QString max, QString sum);
/**
* Destructor
*/
~qCloneWidget();
/**
* Sets up the widget window
* @param title title of the image with frame number
* @param xTitle title of x axis
* @param yTitle title of y axis
* @param zTitle title of z axis
* @param numDim 1D or 2D
* */
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
/**
* Get the 1D hist values to plot
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
* @param histYAxis Y Axis value in 1D
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
*/
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
* @param histYAxis Y Axis value in 1D
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
*/
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis[], std::string histTitle[], bool lines, bool markers);
/**
* Get the 1D hist values to plot for angle plotting
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
* @param histYAxis Y Axis value in 1D
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
*/
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
* @param histYAxis Y Axis value in 1D
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
*/
void SetCloneHists(int nHists, int histNBins, double *histXAxis, double *histYAxis, std::string histTitle[], bool lines, bool markers);
/**
* Get the 1D hist values to plot for angle plotting
* @param nbinsx number of bins in x axis
* @param xmin minimum in x axis
* @param xmax maximum in x axis
* @param nbinsy number of bins in y axis
* @param ymin minimum in y axis
* @param ymax maximum in y axis
* @param d data
*/
* @param nbinsx number of bins in x axis
* @param xmin minimum in x axis
* @param xmax maximum in x axis
* @param nbinsy number of bins in y axis
* @param ymin minimum in y axis
* @param ymax maximum in y axis
* @param d data
*/
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d);
/**
* Set the range of the 1d plot
* @param IsXYRange array of x,y,min,max if these values are set
* @param XYRangeValues array of set values of x,y, min, max
*/
* @param IsXYRange array of x,y,min,max if these values are set
* @param XYRangeValues array of set values of x,y, min, max
*/
void SetRange(bool IsXYRange[], double XYRangeValues[]);
/**
* Returns the 1d plot
*/
SlsQt1DPlot *Get1dPlot();
public slots:
/**
* Save Plots automatically by save all clones
* returns -1 if fail
*/
int SavePlotAutomatic();
private:
/** Gets the current time stamp for the window title*/
char *GetCurrentTimeStamp();
/** Display Statistics */
void DisplayStats(bool enable, QString min, QString max, QString sum);
/** clone window id*/
int id;
/** Default Save file path */
std::string filePath;
/** clone 1D Plot */
SlsQt1DPlot *cloneplot1D;
/** clone 2D Plot */
SlsQt2DPlotLayout *cloneplot2D;
/** vector of 1D hist values */
QVector<SlsQtH1D *> cloneplot1D_hists;
/** markers for the plot*/
QwtSymbol *marker;
QwtSymbol *nomarker;
QGridLayout *mainLayout;
QGroupBox *cloneBox;
QLabel *lblHistTitle;
private slots:
/** Save Plot */
void SavePlot();
protected:
void closeEvent(QCloseEvent *event);
private:
char *GetCurrentTimeStamp();
void DisplayStats(bool enable, QString min, QString max, QString sum);
signals:
void CloneClosedSignal(int);
private:
int id;
std::string filePath;
SlsQt1DPlot *cloneplot1D;
SlsQt2DPlotLayout *cloneplot2D;
QVector<SlsQtH1D *> cloneplot1D_hists;
QwtSymbol *marker;
QwtSymbol *nomarker;
QGridLayout *mainLayout;
QGroupBox *cloneBox;
QLabel *lblHistTitle;
};

View File

@ -1,10 +1,11 @@
#pragma once
#include "qDefs.h"
#include "qDrawPlot.h"
#include "qTabDataOutput.h"
#include "qTabMeasurement.h"
#include "ui_form_detectormain.h"
#include "qDefs.h"
class qDrawPlot;
class qTabMeasurement;
class qTabDataOutput;
class qTabPlot;
class qTabAdvanced;
class qTabSettings;
@ -15,12 +16,8 @@ class qServer;
class multiSlsDetector;
#include <QGridLayout>
#include <QResizeEvent>
#include <QScrollArea>
#include <QTabWidget>
#include <iostream>
class QResizeEvent;
/** To Over-ride the QTabWidget class to get the tabBar */
class MyTabWidget : public QTabWidget {
@ -30,27 +27,12 @@ class MyTabWidget : public QTabWidget {
QTabBar *tabBar() { return QTabWidget::tabBar(); }
};
/**
*@short Main window of the GUI.
*/
class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
Q_OBJECT
public:
/**
* Main Window constructor.
* This is mainly used to create detector object and all the tabs
* @param argc number of command line arguments for server options
* @param argv server options
* @param app the qapplication3
* @param parent makes the parent window 0 by default
*/
qDetectorMain(int argc, char **argv, QApplication *app,
QWidget *parent = 0);
/**
* Destructor
*/
~qDetectorMain();
/**
@ -59,37 +41,13 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
* @returns success or fail
*/
int StartStopAcquisitionFromClient(bool start);
/**
* Returns if plot is running
*/
bool isPlotRunning();
/**
* Returns progress bar value
*/
int GetProgress();
private slots:
/**
* Enables modes as selected -Debug, Expert, Dockable: calls setdockablemode
*/
void EnableModes(QAction *action);
/**
* Executes actions in the utilities menu as selected
*/
void ExecuteUtilities(QAction *action);
/**
* Executes actions in the utilities menu as selected
*/
void ExecuteHelp(QAction *action);
/**
* Refreshes the tab each time the tab is changed. Also displays the next
* enabled tab
*/
void Refresh(int index);
/**
@ -97,51 +55,17 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
* @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
*/
void EnableTabs();
/**
* Set the tool tip of mouse controlled zooming depening on if its
* enabled/disabled
*/
void SetZoomToolTip(bool disable);
/**
* Uncheck the Listen to gui client mode when the server has exited
*/
void UncheckServer();
protected:
/**
* Adjust the resizing to resize plot
*/
void resizeEvent(QResizeEvent *event);
private:
/**
* Sets up the layout of the widget
*/
void SetUpWidgetWindow();
/**
* Sets up detector
* @param fName file name of the config file at start up
* @param multi detector ID
*/
void SetUpDetector(const std::string fName, int multiID);
/**
* Sets up the signals and the slots
*/
void Initialization();
/**
* Loads config file at start up
*/
void LoadConfigFile(const std::string fName);
/** enumeration of the tabs */
@ -156,40 +80,22 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
MESSAGES,
NumberOfTabs
};
/** Detector Type */
slsDetectorDefs::detectorType detType;
/** The sls detector object */
multiSlsDetector* myDet;
/** The Plot widget */
qDrawPlot* myPlot;
/**Tab Widget */
MyTabWidget* tabs;
/**Measurement tab */
qTabMeasurement* tabMeasurement;
/**DataOutput tab */
qTabDataOutput* tabDataOutput;
/**Plot tab */
qTabPlot* tabPlot;
/**Settings tab */
qTabSettings* tabSettings;
/**Advanced tab */
qTabAdvanced* tabAdvanced;
/**Debugging tab */
qTabDebugging* tabDebugging;
/**Developer tab */
qTabDeveloper* tabDeveloper;
/**Messages tab */
qTabMessages* tabMessages;
/** server object*/
qServer* myServer;
/**if the developer tab should be enabled,known from command line */
int isDeveloper;
/** default height of Plot Window when docked */
int heightPlotWindow;
/** default height of central widgetwhen plot Window when docked */
int heightCentralWidget;
/** The default zooming tool tip */
QString zoomToolTip;
/** The default tab heading color */
QColor defaultTabColor;
};

View File

@ -27,6 +27,11 @@ class qServer : public QWidget {
void Acquire(sls::ServerInterface2* socket);
void ExitServer(sls::ServerInterface2* socket);
signals:
// to update the Listening to Gui check box
void ServerStoppedSignal();
private:
void (qServer::*flist[qDefs::QF_NUM_FUNCTIONS])(sls::ServerInterface2 &socket);
qDetectorMain *mainTab;
bool tcpThreadCreated{false};
@ -38,7 +43,5 @@ class qServer : public QWidget {
std::unique_ptr<sls::ServerSocket> controlSocket{nullptr};
std::unique_ptr<sls::ServerSocket> stopSocket{nullptr};
signals:
// to update the Listening to Gui check box
void ServerStoppedSignal();
};

View File

@ -64,6 +64,13 @@ private:
void Enable(bool enable);
int VerifyOutputDirectoryError();
signals:
void StartSignal();
void StopSignal();
void CheckPlotIntervalSignal();
private:
multiSlsDetector *myDet;
qDrawPlot *myPlot;
// enum for the timing mode
@ -81,9 +88,4 @@ private:
QPalette red;
bool delayImplemented;
bool sampleImplemented;
signals:
void StartSignal();
void StopSignal();
void CheckPlotIntervalSignal();
};

View File

@ -1,64 +1,70 @@
/*
* qTabPlot.h
*
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
#pragma once
#ifndef QTABPLOT_H_
#define QTABPLOT_H_
#include "qDefs.h"
/** Form Header */
#include "ui_form_tab_plot.h"
/** Project Class Headers */
class multiSlsDetector;
/** Qt Project Class Headers */
class qDrawPlot;
/** Qt Include Headers */
#include <QStackedLayout>
#include <QButtonGroup>
#include <QAbstractButton>
class multiSlsDetector;
class QStackedLayout;
class QSpinBox;
class QDoubleSpinBox;
class QComboBox;
class QButtonGroup;
class QPalette;
/**
*@short sets up the Plot parameters
*/
class qTabPlot:public QWidget, private Ui::TabPlotObject{
Q_OBJECT
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
*/
qTabPlot(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
/** Destructor
*/
~qTabPlot();
/** Sets the scan argument of the plot
*/
void SetScanArgument();
/** To refresh and update widgets
*/
void Refresh();
public slots:
void SetFrequency();
void EnableScanBox();
private slots:
void Select1DPlot(bool b);
/**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable);
void SetTitles();
void EnableTitles();
void checkAspectRatio();
/** maintain aspect ratio
* @param axis axis to be changed: 0 for x(y axis values changed), 1 for y (xaxis values changes), -1 for the larger one (aspect ratio checked)
*/
void maintainAspectRatio(int axis);
void EnableXRange();
void EnableYRange();
void EnableRange();
void SetXAxisRange();
void SetYAxisRange();
void SetAxesRange();
void SetZRange();
void EnableZRange();
bool CheckZRange(QString value);
void SetPlot();
void SetPlotOptionsRightPage();
void SetPlotOptionsLeftPage();
void SetBinary();
void SetHistogramOptions();
void EnableGapPixels(bool enable);
signals:
void DisableZoomSignal(bool);
void ResetZMinZMaxSignal(bool,bool,double,double);
private:
/** The sls detector object */
void SetupWidgetWindow();
void Initialization();
multiSlsDetector *myDet;
/** The Plot widget */
qDrawPlot *myPlot;
/** 1d/2d plot */
bool isOneD;
bool isOriginallyOneD;
@ -72,6 +78,8 @@ private:
QButtonGroup *btnGroupScan;
QButtonGroup *btnGroupPlotType;
QButtonGroup *btnGroupHistogram;
QPalette *red;
QString intervalTip;
/** some Default Values */
static QString defaultPlotTitle;
@ -84,105 +92,6 @@ private:
/** scans */
static const QString modeNames[5];
/** error palette*/
QPalette *red;
QString intervalTip;
/** Sets up the widget
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals
*/
void Initialization();
public slots:
/** Set frequency between plots*/
void SetFrequency();
/** Enable Scan box
*/
void EnableScanBox();
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);
/**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable);
/**Sets the titles in plot axis */
void SetTitles();
/** Enables/Sets default Titles to default */
void EnableTitles();
/** check aspect ratio */
void checkAspectRatio();
/** maintain aspect ratio
* @param axis axis to be changed: 0 for x(y axis values changed), 1 for y (xaxis values changes), -1 for the larger one (aspect ratio checked)
*/
void maintainAspectRatio(int axis);
/** Enables range of the X axis */
void EnableXRange();
/** Enables range of the Y axis */
void EnableYRange();
/** Enables range of all axes, called by EnableXRange and EnableYRange */
void EnableRange();
/** Sets the range of the x axis */
void SetXAxisRange();
/** Sets the range of the y axis */
void SetYAxisRange();
/** Sets the range of both axes, called by SetXAxisRange and SetYAxisRange */
void SetAxesRange();
/** Sets the range of the z axis */
void SetZRange();
/** Enables the range of the z axis */
void EnableZRange();
/** Return true if valid */
bool CheckZRange(QString value);
/** Set Plot to none, data graph, histogram*/
void SetPlot();
/** Change pages in plot options box to the right*/
void SetPlotOptionsRightPage();
/** Change pages in plot options box to the left*/
void SetPlotOptionsLeftPage();
/** Plot binary plot */
void SetBinary();
/** Set histogram options */
void SetHistogramOptions();
/** Enable Gap pixels */
void EnableGapPixels(bool enable);
signals:
void DisableZoomSignal(bool);
void ResetZMinZMaxSignal(bool,bool,double,double);
};
#endif /* QTABPLOT_H_ */