commit 9f851d61561603e130c4446342494ac884a45a6d Author: maliakal_d Date: Mon May 21 16:00:26 2012 +0000 Creating Classes, Libraries and Functions for the Common SLS Detector GUI git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@1 af1100a4-978c-4157-bff7-07162d2ba061 diff --git a/slsDetectorGui/doxy.config b/slsDetectorGui/doxy.config new file mode 100644 index 000000000..2fabbef2b --- /dev/null +++ b/slsDetectorGui/doxy.config @@ -0,0 +1,102 @@ +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +INPUT = \ + slsDetectorPlotting/include/SlsQt1DPlot.h\ + slsDetectorPlotting/src/SlsQt1DPlot.cxx + slsDetectorPlotting/include/SlsQt1DZoomer.h\ + slsDetectorPlotting/src/SlsQt1DZoomer.cxx\ + slsDetectorPlotting/include/SlsQt2DHist.h\ + slsDetectorPlotting/src/SlsQt2DHist.cxx\ + slsDetectorPlotting/include/SlsQt2DPlot.h\ + slsDetectorPlotting/src/SlsQt2DPlot.cxx\ + slsDetectorPlotting/include/SlsQt2DPlotLayout.h\ + slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\ + slsDetectorPlotting/include/SlsQtNumberEntry.h\ + slsDetectorPlotting/src/SlsQtNumberEntry.cxx\ + slsDetectorPlotting/include/SlsQt2DZoomer.h\ + slsDetectorPlotting/include/SlsQtValidators.h\ + include/qDetectorMain.h\ + src/qDetectorMain.cpp\ + include/qDrawPlot.h\ + src/qDrawPlot.cpp\ + include/qCloneWidget.h\ + src/qCloneWidget.cpp\ + include/qTabMeasurement.h\ + src/qTabMeasurement.cpp\ + include/qTabDataOutput.h\ + src/qTabDataOutput.cpp\ + include/qTabPlot.h\ + src/qTabPlot.cpp\ + include/qTabActions.h\ + src/qTabActions.cpp\ + include/qTabAdvanced.h\ + src/qTabAdvanced.cpp\ + include/qTabSettings.h\ + src/qTabSettings.cpp\ + include/qTabDebugging.h\ + src/qTabDebugging.cpp\ + include/qTabDeveloper.h\ + src/qTabDeveloper.cpp\ + include/qDefs.h + + +OUTPUT_DIRECTORY = docs + diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui new file mode 100644 index 000000000..02fa824f5 --- /dev/null +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -0,0 +1,399 @@ + + + DetectorMainObject + + + true + + + + 0 + 0 + 1000 + 956 + + + + + 0 + 0 + + + + + 9 + + + + SLS Detector GUI + + + Qt::ImhNone + + + false + + + QTabWidget::Rounded + + + false + + + QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks + + + + + 0 + 0 + + + + + 0 + 470 + + + + + 1000 + 470 + + + + + + 0 + 0 + 953 + 470 + + + + + + + + + 0 + 0 + 1000 + 25 + + + + + 9 + + + + false + + + true + + + + + 9 + + + + &Utilities + + + + + + + + + + + + + + + &Modes + + + + + + + + + &Help + + + + + + + + + + + + 0 + 0 + + + + + 40 + 54 + + + + + 524287 + 470 + + + + + 11 + 75 + true + + + + Undock, move and enlarge the window to use it + + + false + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar + + + Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea + + + SLS Detector Terminal + + + 2 + + + + + 9 + 50 + false + + + + + + + + 0 + 0 + + + + + 58 + 455 + + + + + 524287 + 524287 + + + + + Sans Serif + 11 + 75 + true + + + + QDockWidget::DockWidgetMovable + + + Qt::BottomDockWidgetArea + + + SLS Detector Plot + + + 8 + + + + + 0 + 0 + + + + + 0 + 429 + + + + + 16777215 + 16777215 + + + + + 9 + 50 + false + + + + + + 0 + 0 + 1000 + 431 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 9 + + + + QFrame::NoFrame + + + QFrame::Raised + + + 1 + + + + + + + &Open Setup + + + + + + + + &Save Setup + + + + + + + + &Measurement Wizard + + + + + &Open Configuration + + + + + &Save Configuration + + + + + &Energy Calibration + + + + + &Angular Calibration + + + + + true + + + false + + + &Debug + + + + + true + + + false + + + &Beamline + + + + + true + + + false + + + &Expert + + + + + true + + + false + + + &Configuration + + + + + &Version + + + + + &About + + + + + true + + + &Dockable Plot + + + + + + diff --git a/slsDetectorGui/forms/form_drawplot.ui b/slsDetectorGui/forms/form_drawplot.ui new file mode 100644 index 000000000..67c2cee30 --- /dev/null +++ b/slsDetectorGui/forms/form_drawplot.ui @@ -0,0 +1,71 @@ + + + DrawPlotObject + + + + 0 + 0 + 1000 + 435 + + + + + 0 + 0 + + + + Form + + + + + 3 + -2 + 1000 + 435 + + + + + 0 + 0 + + + + + 50 + false + + + + Startup Image + + + true + + + false + + + + + -3 + 16 + 1001 + 421 + + + + + QLayout::SetNoConstraint + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_actions.ui b/slsDetectorGui/forms/form_tab_actions.ui new file mode 100644 index 000000000..9f96ef508 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_actions.ui @@ -0,0 +1,44 @@ + + + TabActionsObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 224 + 223 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui new file mode 100644 index 000000000..fb03a0ed6 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -0,0 +1,139 @@ + + + TabAdvancedObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 3 + 412 + 75 + 25 + + + + PushButton + + + + + + 626 + 8 + 91 + 41 + + + + Qt::NoFocus + + + Gets both the temperature of ADC and FPGA + + + Get +Temperature + + + + + + 796 + 34 + 151 + 21 + + + + Reads temperature of FPGA. + #temp_fpga# + + + false + + + Qt::AlignCenter + + + true + + + + + + 736 + 4 + 41 + 20 + + + + ADC: + + + + + + 736 + 34 + 41 + 20 + + + + FPGA: + + + + + + 796 + 4 + 151 + 21 + + + + Reads temperature of ADC. + #temp_adc# + + + + + + false + + + Qt::AlignCenter + + + true + + + + + + diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui new file mode 100644 index 000000000..a822cbda6 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -0,0 +1,44 @@ + + + TabDataOutputObject + + + + 0 + 0 + 900 + 400 + + + + + 0 + 0 + + + + + 952 + 1000 + + + + Form + + + + + 157 + 256 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui new file mode 100644 index 000000000..8890e4adf --- /dev/null +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -0,0 +1,44 @@ + + + TabDebuggingObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 232 + 141 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_developer.ui b/slsDetectorGui/forms/form_tab_developer.ui new file mode 100644 index 000000000..074e6adf3 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_developer.ui @@ -0,0 +1,44 @@ + + + TabDeveloperObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 232 + 141 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui new file mode 100644 index 000000000..1b05d7ad7 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -0,0 +1,346 @@ + + + TabMeasurementObject + + + + 0 + 0 + 900 + 400 + + + + + 0 + 0 + + + + + 952 + 500 + + + + Form + + + + + 9 + 30 + 420 + 355 + + + + + + + + 0 + 0 + + + + Settings of the detector. + #settings# + + + + Standard + + + + + Fast + + + + + High Gain + + + + + Dynamic Gain + + + + + Low Gain + + + + + Medium Gain + + + + + Very High Gain + + + + + Undefined + + + + + Uninitialized + + + + + + + + Settings: + + + + + + + Number of measurements: + + + + + + + Acquisition Time: + + + + + + + + 0 + 0 + + + + Exposure time of each frame. + #exptime# + + + 2000000000.000000000000000 + + + 1.000000000000000 + + + + + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + + 0 + 0 + + + + Frame period between exposures. + #period# + + + 2000000000.000000000000000 + + + 2.000000000000000 + + + + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Frame Period: + + + + + + + File Name: + + + + + + + Root of the file name - please check that the output directory is correctly set and select the file name format. + #fname# + + + run + + + + + + + Run Index: + + + + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + Qt::NoFocus + + + Starts Acquisition + + + Start + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 2000 + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui new file mode 100644 index 000000000..b6ce36b03 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -0,0 +1,372 @@ + + + TabPlotObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 10 + 250 + 571 + 151 + + + + Plot Axis + + + + + 10 + 20 + 551 + 121 + + + + + + + X Axis: + + + + + + + + + + X min: + + + + + + + + + + X max: + + + + + + + + + + Y Axis: + + + + + + + + + + Y min: + + + + + + + + + + Y max: + + + + + + + + + + Z Axis: + + + + + + + + + + Z min: + + + + + + + + + + Z max: + + + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Title: + + + + + + + + + + + + + 10 + 170 + 571 + 61 + + + + 2D Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Interpolate + + + + + + + Contour + + + + + + + Log Scale (Z) + + + + + + + + + + 10 + 90 + 571 + 61 + + + + 1D Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 430 + 20 + + + + + + + + + + + 10 + 10 + 571 + 61 + + + + Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 300 + 20 + + + + + + + + Clone + + + + + + + Close All Clones + + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui new file mode 100644 index 000000000..779aaa9d2 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -0,0 +1,44 @@ + + + TabSettingsObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 333 + 161 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h new file mode 100644 index 000000000..af49e1bc1 --- /dev/null +++ b/slsDetectorGui/include/qCloneWidget.h @@ -0,0 +1,58 @@ +/* + * qCloneWidget.h + * + * Created on: May 18, 2012 + * Author: l_maliakal_d + */ + +#ifndef QCLONEWIDGET_H_ +#define QCLONEWIDGET_H_ + +/** Qt Project Class Headers */ +class SlsQt1DPlot; +class SlsQt2DPlotLayout; +/** Qt Include Headers */ +#include +#include + +/** + *@short Sets up the clone plot widget + */ +class qCloneWidget:public QFrame{ + Q_OBJECT + +public: + /** \short The constructor + */ + qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); + + /** Destructor + */ + ~qCloneWidget(); + + + +public slots: + + + +private: + /** clone window id*/ + int id; + /** clone 1D Plot */ + SlsQt1DPlot* cloneplot1D; + /** clone 2D Plot */ + SlsQt2DPlotLayout* cloneplot2D; + +protected: + void closeEvent(QCloseEvent* event); + +signals: +void CloneClosedSignal(int); + +}; + + + + +#endif /* QCLONEWIDGET_H_ */ diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h new file mode 100644 index 000000000..3785a7e34 --- /dev/null +++ b/slsDetectorGui/include/qDefs.h @@ -0,0 +1,54 @@ +/* + * qDefs.h + * + * Created on: May 4, 2012 + * Author: l_maliakal_d + */ + +#ifndef QDEFS_H +#define QDEFS_H + +class qDefs +{ +public: + /** Empty Constructor + */ + qDefs(){}; + + /** unit of time + */ + enum timeUnit{ + HOURS, /** hr */ + MINUTES, /** min */ + SECONDS, /** s */ + MILLISECONDS, /** ms */ + MICROSECONDS, /** us */ + NANOSECONDS /** ns */ + }; + + + /** returns the value in ns to send to server. + * @param unit unit of time + * @param value time + * returns time value in ns + */ + static int64_t get64bTime(timeUnit unit, double value){ + int64_t value64=value; + switch(unit){ + case HOURS: value64*=60; + case MINUTES: value64*=60; + case SECONDS: value64*=1000; + case MILLISECONDS: value64*=1000; + case MICROSECONDS: value64*=1000; + case NANOSECONDS: + default:; + } + return value64; + }; + + + +}; + + +#endif /* QDEFS_H */ diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h new file mode 100644 index 000000000..1568303c7 --- /dev/null +++ b/slsDetectorGui/include/qDetectorMain.h @@ -0,0 +1,161 @@ +/* + * qDetectorMain.h + * Main Window of the GUI + * Created on: Apr 30, 2012 + * Author: l_maliakal_d + */ +#ifndef QDETECTORMAIN_H +#define QDETECTORMAIN_H + +/** Form Header */ +#include "ui_form_detectormain.h" +/** Qt Project Class Headers */ +class qDrawPlot; +class qTabMeasurement; +class qTabDataOutput; +class qTabPlot; +class qTabActions; +class qTabAdvanced; +class qTabSettings; +class qTabDebugging; +class qTabDeveloper; +/** Project Class Headers */ +class slsDetectorUtils; +#include "sls_detector_defs.h" +/** Qt Include Headers */ +#include + +/** + *@short Main window of the GUI. + */ +class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{ + Q_OBJECT + + +public: + /** \short 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 qapplication + * @param parent makes the parent window 0 by default + */ + qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0); + + /**Destructor + */ + ~qDetectorMain(); + + +private: + /** The Qt Application */ + QApplication *theApp; + + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + /**Tab Widget */ + QTabWidget *tabs; + + static const int NUMBER_OF_TABS = 8; + + /* Scroll Area for the tabs**/ + QScrollArea *scroll[NUMBER_OF_TABS]; + QScrollArea *scrollMain; + /**Measurement tab */ + qTabMeasurement *tab_measurement; + /**DataOutput tab */ + qTabDataOutput *tab_dataoutput; + /**Plot tab */ + qTabPlot *tab_plot; + /**Actions tab */ + qTabActions *tab_actions; + /**Advanced tab */ + qTabAdvanced *tab_advanced; + /**Settings tab */ + qTabSettings *tab_Settings; + /**Debugging tab */ + qTabDebugging *tab_debugging; + /**Developer tab */ + qTabDeveloper *tab_developer; + + /** enumeration of the tabs */ + enum {Measurement, DataOutput, Plot, Actions, Advanced, Settings, Debugging, Developer }; + + + /**Sets up the layout of the widget + */ + void SetUpWidgetWindow(); + + /**Sets up detector + */ + void SetUpDetector(); + + /**Sets up the signals and the slots + */ + void Initialization(); + + /** Enables the developer tab + */ + void SetDeveloperMode(); + +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); + +/** Sets/unsets the beamline mode (at the moment it doesn't do anything) + * @param b bool TRUE sets, FALSE unsets + */ +void SetBeamlineMode(bool b); + +/** 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); + +/** 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(); + + +signals: + +}; + +#endif /* QDETECTORMAIN_H */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h new file mode 100644 index 000000000..8401e2e1f --- /dev/null +++ b/slsDetectorGui/include/qDrawPlot.h @@ -0,0 +1,225 @@ +/* + * qDrawPlot.h + * + * Created on: May 7, 2012 + * Author: Ian Johnson + */ +#ifndef QDRAWPLOT_H +#define QDRAWPLOT_H + +/** Form Header */ +#include "ui_form_drawplot.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class SlsQtH1D; +class SlsQt1DPlot; +class SlsQt2DPlotLayout; +class qCloneWidget; +/** Qt Include Headers */ +class QTimer; +class QGridLayout; + +/** + *@short Sets up the plot widget + */ +class qDrawPlot:public QWidget, private Ui::DrawPlotObject{ + Q_OBJECT + +public: + /** \short The constructor + */ + qDrawPlot(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qDrawPlot(); + + /** Starts or stop acquisition + * Calls startDaq() function + * @param stop_if_running is 0 to stop acquisition and 1 to start acquisition + */ + void StartStopDaqToggle(bool stop_if_running=0); + +public slots: +/** To select 1D or 2D plot + * @param i is 1 for 1D, else 2D plot + */ +void SelectPlot(int i=2); + +/** To select 1D plot + */ +void Select1DPlot() {SelectPlot(1);} + +/** To select 2D plot + */ +void Select2DPlot() {SelectPlot(2);} + +/** To clear plot + */ +void Clear1DPlot(); + +/** Creates a clone of the plot + * */ +void ClonePlot(); + +/** Closes all the clone plots + * */ +void CloseClones(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + /** Number of Exposures */ + int number_of_exposures; + /** Duration between Exposures */ + double framePeriod; + /** Acquisition Time */ + double acquisitionTime; + +/** Widgets needed to plot the clone */ + static const int MAXCloneWindows = 50; + /** */ + qCloneWidget *winClone[MAXCloneWindows]; + /** */ + QTimer* plot_update_timer; + /** */ + SlsQt1DPlot* plot1D; + /** */ + SlsQt2DPlotLayout* plot2D; + /** */ + QVector plot1D_hists; + + +/**variables for threads */ + /** */ + volatile bool stop_signal; + /** */ + pthread_mutex_t last_image_complete_mutex; + +/**variables for histograms */ + /** */ + unsigned int plot_in_scope; + /** */ + unsigned int lastImageNumber; + /** */ + std::string imageTitle; + /** */ + std::string imageXAxisTitle; + /** */ + std::string imageYAxisTitle; + /** */ + std::string imageZAxisTitle; + /** */ + unsigned int nPixelsX; + /** */ + unsigned int nPixelsY; + /** */ + double* lastImageArray; + /** */ + unsigned int nHists; + /** */ + std::string histTitle[10]; + /** */ + std::string histXAxisTitle; + /** */ + std::string histYAxisTitle; + /** */ + int histNBins; + /** */ + double* histXAxis; + /** */ + double* histYAxis[10]; + + + /** */ + int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); } + /** */ + 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(); + + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** */ + int ResetDaqForGui(); + + /**acquisition thread stuff */ + /** */ + bool StartOrStopThread(bool start); + /** */ + static void* DataAcquisionThread(void *this_pointer); + /** */ + void* AcquireImages(); + + +private slots: +/** To update plot + */ +void UpdatePlot(); + +/** To stop updating plot + */ +void StopUpdatePlot(); + +/** To start or stop acquisition + * @param start is 1 to start and 0 to stop acquisition + */ +void StartDaq(bool start); + +void CloneCloseEvent(int id); +signals: + +void UpdatingPlotFinished(); +void InterpolateSignal(bool); +void ContourSignal(bool); +void LogzSignal(bool); + +}; + + + +#endif /* QDRAWPLOT_H */ diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h new file mode 100644 index 000000000..5f9408c1d --- /dev/null +++ b/slsDetectorGui/include/qTabActions.h @@ -0,0 +1,52 @@ +/* + * qTabActions.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABACTIONS_H_ +#define QTABACTIONS_H_ + +/** Form Header */ +#include "ui_form_tab_actions.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the acions parameters + */ +class qTabActions:public QWidget, private Ui::TabActionsObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabActions(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabActions(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + +#endif /* QTABACTIONS_H_ */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h new file mode 100644 index 000000000..86cf27e8c --- /dev/null +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -0,0 +1,62 @@ +/* + * qTabAdvanced.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABADVANCED_H_ +#define QTABADVANCED_H_ + +/** Form Header */ +#include "ui_form_tab_advanced.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the advanced parameters + */ +class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabAdvanced(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The sls detector object type*/ + int myDetType; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +private slots: +/** Get Temperature data + */ +void getTemperature(); + +}; + + + +#endif /* QTABADVANCED_H_ */ diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h new file mode 100644 index 000000000..9d3183a72 --- /dev/null +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -0,0 +1,54 @@ +/* + * qTabDataOutput.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDATAOUTPUT_H_ +#define QTABDATAOUTPUT_H_ + +/** Form Header */ +#include "ui_form_tab_dataoutput.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the DataOutput parameters + */ +class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDataOutput(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDATAOUTPUT_H_ */ diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h new file mode 100644 index 000000000..a51e84c7d --- /dev/null +++ b/slsDetectorGui/include/qTabDebugging.h @@ -0,0 +1,54 @@ +/* + * qTabDebugging.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDEBUGGING_H_ +#define QTABDEBUGGING_H_ + +/** Form Header */ +#include "ui_form_tab_debugging.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Debugging parameters + */ +class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDebugging(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDebugging(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDEBUGGING_H_ */ diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h new file mode 100644 index 000000000..9f82f7512 --- /dev/null +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -0,0 +1,54 @@ +/* + * qTabDeveloper.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDEVELOPER_H_ +#define QTABDEVELOPER_H_ + +/** Form Header */ +#include "ui_form_tab_developer.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Developer parameters + */ +class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDeveloper(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDEVELOPER_H_ */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h new file mode 100644 index 000000000..e4df24797 --- /dev/null +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -0,0 +1,108 @@ +/* + * qTabMeasurement.h + * + * Created on: May 2, 2012 + * Author: l_maliakal_d + */ +#ifndef QTABMEASUREMENT +#define QTABMEASUREMENT + +/** Form Header */ +#include "ui_form_tab_measurement.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class qDrawPlot; + +/** + *@short sets up the measurement parameters + */ +class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{ + Q_OBJECT + +public: + /** \short The constructor + * This tab allows to change the detector settings, the threshold, the number of (non real time) measurements, + * the acquisition time, the file name, the start run index and shows the current progress of the measurement + * via a progress bar and labels inidicating the current position, scan variable, frame number etc. + * Contains the start and stop acquisition button + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + * @param plot plot object reference + */ + qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot); + + /** Destructor + */ + ~qTabMeasurement(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + +/** methods */ + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + + +public slots: +/** update plot is finished, + * changes start/stop text and enables/disables all widgets + */ +void UpdateFinished(); + + +private slots: +/** Set settings according to selection + * @param index index of selection + */ +void setSettings(int index); +/** Set number of frames + * @param val number of frames to be set + */ +void setNumFrames(int val); + +/** Set acquisition time + */ +void setAcquisitionTime(); + +/** Set frame period between exposures + */ +void setFramePeriod(); + +/** Set file name + * @param fName name of file + */ +void setFileName(const QString& fName); + +/** Set index of file name + * @param index index of selection + */ +void setRunIndex(int index); + +/** starts/stops Acquisition + */ +void startStopAcquisition(); + +signals: + + +}; + + + +#endif /* QTABMEASUREMENT */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h new file mode 100644 index 000000000..e5b2bedb9 --- /dev/null +++ b/slsDetectorGui/include/qTabPlot.h @@ -0,0 +1,74 @@ +/* + * qTabPlot.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABPLOT_H_ +#define QTABPLOT_H_ + +/** Form Header */ +#include "ui_form_tab_plot.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class qDrawPlot; + +/** + *@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,slsDetectorUtils*& detector, qDrawPlot*& plot); + + /** Destructor + */ + ~qTabPlot(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + +/** methods */ + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + + + +public slots: + + + + + +private slots: +signals: + + +}; + + + +#endif /* QTABPLOT_H_ */ diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h new file mode 100644 index 000000000..3424d0129 --- /dev/null +++ b/slsDetectorGui/include/qTabSettings.h @@ -0,0 +1,54 @@ +/* + * qTabSettings.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABSETTINGS_H_ +#define QTABSETTINGS_H_ + +/** Form Header */ +#include "ui_form_tab_settings.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Settings parameters + */ +class qTabSettings:public QWidget, private Ui::TabSettingsObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabSettings(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabSettings(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABSETTINGS_H_ */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro new file mode 100644 index 000000000..a10917037 --- /dev/null +++ b/slsDetectorGui/slsDetectorGui.pro @@ -0,0 +1,92 @@ +DESTDIR = bin +MOC_DIR = mocs +OBJECTS_DIR = objs +UI_HEADERS_DIR = forms/include + +DEFINES += VERBOSE + +target.path += $(DESTDIR) +documentation.path = /$(DOCPATH) +documentation.files = docs/* +INSTALLS += target +INSTALLS += documentation +QMAKE_CLEAN += docs/*/* \ + $(DESTDIR)* \ + forms/include/* + + +LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ + -L/usr/local/qwt-5.2.3-svn/lib -lqwt + +DEPENDPATH += \ + slsDetectorPlotting/include\ + include\ + forms/include + + +INCLUDEPATH += \ + /usr/local/qwt-5.2.3-svn/include\ + slsDetectorPlotting/include\ + include\ + forms/include\ + ../slsDetectorSoftware/commonFiles\ + ../slsDetectorSoftware/MySocketTCP\ + ../slsDetectorSoftware/slsDetector\ + ../slsDetectorSoftware/slsDetectorAnalysis\ + ../slsDetectorSoftware/multiSlsDetector\ + ../slsDetectorSoftware/usersFunctions + +SOURCES = \ + slsDetectorPlotting/src/SlsQt1DPlot.cxx\ + slsDetectorPlotting/src/SlsQt1DZoomer.cxx\ + slsDetectorPlotting/src/SlsQt2DHist.cxx\ + slsDetectorPlotting/src/SlsQt2DPlot.cxx\ + slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\ + slsDetectorPlotting/src/SlsQtNumberEntry.cxx\ + src/qDetectorMain.cpp\ + src/qDrawPlot.cpp\ + src/qCloneWidget.cpp\ + src/qTabMeasurement.cpp\ + src/qTabDataOutput.cpp\ + src/qTabPlot.cpp\ + src/qTabActions.cpp\ + src/qTabAdvanced.cpp\ + src/qTabSettings.cpp\ + src/qTabDebugging.cpp\ + src/qTabDeveloper.cpp + +HEADERS = \ + slsDetectorPlotting/include/SlsQt1DPlot.h\ + slsDetectorPlotting/include/SlsQt1DZoomer.h\ + slsDetectorPlotting/include/SlsQt2DHist.h\ + slsDetectorPlotting/include/SlsQt2DPlot.h\ + slsDetectorPlotting/include/SlsQt2DPlotLayout.h\ + slsDetectorPlotting/include/SlsQt2DZoomer.h\ + slsDetectorPlotting/include/SlsQtValidators.h\ + slsDetectorPlotting/include/SlsQtNumberEntry.h\ + include/qDefs.h\ + include/qDetectorMain.h\ + include/qDrawPlot.h\ + include/qCloneWidget.h\ + include/qTabMeasurement.h\ + include/qTabDataOutput.h\ + include/qTabPlot.h\ + include/qTabActions.h\ + include/qTabAdvanced.h\ + include/qTabSettings.h\ + include/qTabDebugging.h\ + include/qTabDeveloper.h\ + ../slsDetectorSoftware/commonFiles/sls_detector_defs.h + + +FORMS = \ + forms/form_detectormain.ui\ + forms/form_drawplot.ui\ + forms/form_tab_measurement.ui\ + forms/form_tab_dataoutput.ui\ + forms/form_tab_plot.ui\ + forms/form_tab_actions.ui\ + forms/form_tab_advanced.ui\ + forms/form_tab_settings.ui\ + forms/form_tab_debugging.ui\ + forms/form_tab_developer.ui diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h new file mode 100644 index 000000000..43dc7781c --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -0,0 +1,145 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQT1DPLOT_H +#define SLSQT1DPLOT_H + +#include +#include +#include + +#include "SlsQt1DZoomer.h" + +class QPen; +class SlsQt1DPlot; + +class SlsQtH1D:public QwtPlotCurve{ + + public: + SlsQtH1D(QString title, int n, double xmin, double xmax, double* data=0); + SlsQtH1D(QString title, int n, double* data_x, double* data_y); + ~SlsQtH1D(); + + void Attach(SlsQt1DPlot* p); + void Detach(SlsQt1DPlot* p); + + int SetLineColor(int c=-1); + int SetLineWidth(int w=1); + void SetLineStyle(int s=0); + + void SetData(int n, double xmin, double xmax, double* d=0); + void SetData(int n, double* dx, double* dy); + + double* GetX() {return x;} + double* GetY() {return y;} + int GetNBinsX() {return ndata;} + + double FillBin(int bx, double v=1); + double Fill(double x, double v=1); + double SetBinContent(int bx,double v); + double SetContent(double x,double v); + int FindBinIndex(double px); + + double GetXMin() {return x[0];} + double GetFirstXgtZero() {return firstXgt0;} + double GetXMax() {return x[ndata-1];} + double GetYMin() {return ymin;} + double GetFirstYgtZero() {return firstYgt0;} + double GetYMax() {return ymax;} + + SlsQtH1D* Add(double v); + + + private: + int ndata; + int n_array; + double dx; + double *x,*y; + double ymin,ymax; + double firstXgt0,firstYgt0; + + void Initailize(); + int SetUpArrays(int n); + int CheckIndex(int bx); + + QPen* pen_ptr; +}; + + +class SlsQtH1DList{ + public: + SlsQtH1DList(SlsQtH1D* hist=0); + ~SlsQtH1DList(); + + SlsQtH1D* Add(SlsQtH1D* h); + void Remove(SlsQtH1D* h); + void Print(); + + SlsQtH1D* Hist() {return the_hist;} //if no hist returns 0 + SlsQtH1DList* Next() {return the_next;} + + +private: + SlsQtH1DList* the_next; + SlsQtH1D* the_hist; +}; + + +class SlsQt1DPlot:public QwtPlot{ + Q_OBJECT + + public: + SlsQt1DPlot(QWidget* = NULL); + ~SlsQt1DPlot(); + + void SetTitle(const char *t); + void SetXTitle(const char* title); + void SetYTitle(const char* title); + + void InsertHLine(double y); + void RemoveHLine(); + void InsertVLine(double v); + void RemoveVLine(); + + void SetZoom(double xmin,double ymin,double x_width,double y_width); + void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);} + + + private: + + SlsQtH1DList* hist_list; + SlsQt1DZoomer* zoomer; + QwtPlotPanner* panner; + + QwtPlotMarker *hline; + QwtPlotMarker *vline; + + void SetupZoom(); + void UnknownStuff(); + void alignScales(); + + void CalculateNResetZoomBase(); + void NewHistogramAttached(SlsQtH1D* h); + void HistogramDetached(SlsQtH1D* h); + + void SetLog(int axisId, bool yes); + + friend void SlsQtH1D::Attach(SlsQt1DPlot* p); + friend void SlsQtH1D::Detach(SlsQt1DPlot* p); + + + public slots: + void UnZoom(); + void Update(); + + void SetLogX(bool yes=1); + void SetLogY(bool yes=1); + + protected: + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h new file mode 100644 index 000000000..94afd2707 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -0,0 +1,59 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQT1DZOOMER_H +#define SLSQT1DZOOMER_H + + +#include +#include +class SlsQtH1D; + +class SlsQt1DZoomer:public QwtPlotZoomer{ + private: + double x0,x1,y0,y1; + double firstXgt0,firstYgt0; + bool xIsLog,yIsLog; + + public: + SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ + setTrackerMode(AlwaysOn); + xIsLog=yIsLog=0; + } + + double x() {return x0;} + double x_firstGreaterThan0() {return firstXgt0;} + double w() {return x1-x0;} + + double y() {return y0;} + double y_firstGreaterThan0() {return firstYgt0;} + double h() {return y1-y0;} + + void SetZoomBase(double xmin,double ymin,double x_width, double y_width); + void SetZoomBase(SlsQtH1D* h); + void ExtendZoomBase(SlsQtH1D* h); + void ResetZoomBase(); + + bool IsLogX(){ return xIsLog;} + bool IsLogY(){ return yIsLog;} + bool SetLogX(bool yes) { return xIsLog=yes;} + bool SetLogY(bool yes) { return yIsLog=yes;} + + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + QColor bg(Qt::white); +#if QT_VERSION >= 0x040300 + bg.setAlpha(200); +#endif + + QwtText text = QwtPlotZoomer::trackerText(pos); + + text.setBackgroundBrush( QBrush( bg )); + return text; + } + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h new file mode 100644 index 000000000..b3d93a001 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h @@ -0,0 +1,113 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DHIST_H +#define SLSQT2DHIST_H + + + +#if QT_VERSION >= 0x040000 +#include +#endif +#include +#include +#include +#include + + +class SlsQt2DHist: public QwtRasterData{ + + private: + + double x_min,x_max,y_min,y_max; + double x_width,y_width; + + int nx,ny,nb; + double *data; + double z_min,z_mean,z_max; + bool z_mean_has_been_calculated; + + int nx_array,ny_array; + + bool interp; + + static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap + return (v2-v1)/(p2-p1)*(p-p1)+v1; + } + + public: + SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1); + virtual ~SlsQt2DHist(); + + double GetXMin() {return x_min;} + double GetXMax() {return x_max;} + double GetXBinWidth() {return x_width;} + double GetYMin() {return y_min;} + double GetYMax() {return y_max;} + double GetYBinWidth() {return y_width;} + double GetMinimum() {return z_min;} + double GetMaximum() {return z_max;} + double GetMean(); + + int GetNBinsX(){return nx;} + int GetNBinsY(){return ny;} + double GetBinValue(int bx,int by); + int GetBinIndex(int bx,int by); + double* GetDataPtr(){return data;} + + void Interpolate(bool on=1) {interp=on;} + void SetBinValue(int bx,int by,double v); + void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1); + + double SetMinimumToFirstGreaterThanZero(); + void SetMinimum(double zmin) {z_min=zmin;} + void SetMaximum(double zmax) {z_max=zmax;} + void SetMinMax(double zmin=0,double zmax=-1); + + int FindBinIndex(double x, double y); + + + + virtual QwtRasterData *copy() const{ + //this function does not create a new SlsQt2DHistData instance, + //just passes a pointer so that data is common to both the copy and the original instance + return (QwtRasterData*) this; + } + virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);} + + virtual double value(double x, double y) const{ + //if(!interp){ //default is box like plot + int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx; + if(index<0||index>nb) index = nb; + if(!interp) return data[index]; + //} + + + int x_int = int((x-x_min)/x_width-0.5); + if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2; + int y_int = int((y-y_min)/y_width-0.5); + if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2; + + int b00 = x_int*ny + y_int; + int b01 = x_int*ny + y_int+1; + int b10 = (x_int+1)*ny + y_int; + int b11 = (x_int+1)*ny + y_int+1; + + //vertical extrap + double y0 = y_min+(y_int+0.5)*y_width; + double y1 = y_min+(y_int+1.5)*y_width; + double left_v = value_between_points(y0,data[b00],y1,data[b01],y); + double right_v = value_between_points(y0,data[b10],y1,data[b11],y); + //horazontal extrap + return value_between_points(x_min+(x_int+0.5)*x_width,left_v, + x_min+(x_int+1.5)*x_width,right_v,x); + } + +}; + + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h new file mode 100644 index 000000000..cc6db7ea3 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -0,0 +1,79 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DPLOT_H +#define SLSQT2DPLOT_H + + +#include +#include + +#include "SlsQt2DZoomer.h" +#include "SlsQt2DHist.h" + + +class QwtPlotPanner; +class QwtScaleWidget; +class QwtLinearColorMap; + + +class SlsQt2DPlot: public QwtPlot{ + Q_OBJECT + +private: + QwtPlotSpectrogram *d_spectrogram; + SlsQt2DHist* hist; + SlsQt2DZoomer* zoomer; + QwtPlotPanner* panner; + QwtScaleWidget *rightAxis; + + QwtLinearColorMap* colorMapLinearScale; + QwtLinearColorMap* colorMapLogScale; + QwtValueList* contourLevelsLinear; + QwtValueList* contourLevelsLog; + + void SetupZoom(); + void SetupColorMap(); + +public: + SlsQt2DPlot(QWidget * = NULL); + + // SlsQt2DHist *GetHistogram(){ return hist; } + + void UnZoom(); + void SetZoom(double xmin,double ymin,double x_width,double y_width); + + double GetZMinimum(){ return hist->GetMinimum();} + double GetZMaximum(){ return hist->GetMaximum();} + void SetZMinMax(double zmin=0,double zmax=-1); + void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();} + double GetZMean() { return hist->GetMean();} + + void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){ + hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); + } + + double* GetDataPtr() {return hist->GetDataPtr();} + int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);} + int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);} + void SetBinValue(int bx,int by,double v) {hist->SetBinValue(bx,by,v);} + double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);} + + + void FillTestPlot(int i=0); + void Update(); + +public slots: + void LogZ(bool on=1); + void InterpolatedPlot(bool on); + void showContour(bool on); + void showSpectrogram(bool on); + // void printPlot(); + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h new file mode 100644 index 000000000..2f11bd8c3 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -0,0 +1,112 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ +/* + + +#ifndef SLSQT2DPLOTLAYOUT_H +#define SLSQT2DPLOTLAYOUT_H + +#include +#include +#include + +#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 + */ + + +#ifndef SLSQT2DPLOTLAYOUT_H +#define SLSQT2DPLOTLAYOUT_H + +#include +#include + +#include "SlsQtNumberEntry.h" +#include "SlsQt2DPlot.h" + +class QGridLayout; + + + +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; + + bool logsChecked; + + void ConnectSignalsAndSlots(); + + void Layout(); + +public slots: +void SetZScaleToLog(bool yes); +void ResetRange(); + +signals: +void InterpolateSignal(bool); +void ContourSignal(bool); +}; + +#endif + diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h new file mode 100644 index 000000000..0b665660b --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -0,0 +1,51 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DZOOMER_H +#define SLSQT2DZOOMER_H + + +#include +#include + +#include "SlsQt2DHist.h" + +class SlsQt2DZoomer:public QwtPlotZoomer{ + private: + SlsQt2DHist* hist; + + public: + SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ + setTrackerMode(AlwaysOn); + } + + void SetHist(SlsQt2DHist* h){ + hist=h; + } + + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + QColor bg(Qt::white); +#if QT_VERSION >= 0x040300 + bg.setAlpha(200); +#endif + + + //QwtText text = QwtPlotZoomer::trackerText(pos); + + static QwtText text; + if(hist){ + static char t[200]; + sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y())); + text.setText(t); + }else text = QwtPlotZoomer::trackerText(pos); + + text.setBackgroundBrush( QBrush( bg )); + return text; + } +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h new file mode 100644 index 000000000..1bcd9e937 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h @@ -0,0 +1,140 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQTNUMBERENTRY_H +#define SLSQTNUMBERENTRY_H + +#include +#include + +class QGridLayout; + +class QLabel; +class QLineEdit; +class QIntValidator; +class QDoubleValidator; +class QCheckBox; +class QComboBox; +class QSpinBox; + +#include "SlsQtValidators.h" + +class SlsQtNumberEntry:public QWidget{ + Q_OBJECT + + public: + //type=0->units only, type=1->int,type=2->double, type=3->spinbox + //adding middle text will automatically add a second number field + SlsQtNumberEntry(QWidget *parent,int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0); + //without unit box + SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_strin, int num_type, char *middle_string, int num2_type, char* end_string); + + + ~SlsQtNumberEntry(); + + void Enable(bool en_flag=1); + void Disable(); + void EnableNumberField(int which_number_field,bool en_flag=1); //which_number_field is 0 or 1 + void DisableNumberField(int which_number_field); + + void AddCheckBox(); + void SetFrontText(char* s); + void SetMiddleText(char* s); + void SetBackText(char* s); + void SetupNumberField(int type,int which_number_field=0); + void SetUnits(int n_units,char** units,double* unit_factors); + + void SetMinimumNumberWidth(int nchar_width,int which_number_field=0); + void SetNDecimalsOfDoubleValidators(int ndecimals); + void SetNDecimalsOfDoubleValidator(int ndecimals,int which_number_field=0); + void SetMinimumUnitWidth(int nchar_width); + + bool Enabled(); + bool CheckBoxState(); + bool IsValueOk(int which_number_field=0); + + const char* GetFrontText(); + const char* GetMiddleText(); + const char* GetBackText(); + + int GetNumberInt(int which_number_field=0,bool* ok=0); + double GetNumber(int which_number_field=0,bool *ok=0); + + int GetValueInt(int which_number_field=0,bool* ok=0); + double GetValue(int which_number_field=0,bool *ok=0); + + int GetComboBoxIndex(); + double GetComboBoxValue(); + + private: + void SetupNumberEntry(int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0); + + QGridLayout* layout; //default layout + + QCheckBox* check_box; + QLabel* front_text; + QLabel* middle_text; + QLineEdit* num_field[2]; + QSpinBox* spin_box[2]; + bool num_field_enabled[2]; + + SlsQtIntValidator* validator_int[2]; + SlsQtDoubleValidator* validator_double[2]; + QComboBox* unit_cbb; + double* factors; + QLabel* back_text; + + void SetText(char* s, QLabel** pp); + void SetLayout(); + + + public slots: + void FirstValueEntered(); + void SecondValueEntered(); + void UnitSelected(); + + void SetRange(int min, int max, int which_number_field=0); + void SetRange(double min, double max, int which_number_field=0); + void SetFirstRange(int min, int max) {SetRange(min,max,0);} + void SetSecondRange(int min, int max) {SetRange(min,max,1);} + + double SetValue(double v, int which_number_field=0); + void SetFirstValue(int v) {SetValue(v,0);} + void SetSecondValue(int v) {SetValue(v,1);} + void SetFirstValue(double v) {SetValue(v,0);} + void SetSecondValue(double v) {SetValue(v,1);} + + // double SetNumber(int v, int which_number_field=0); + double SetNumber(double v, int which_number_field=0); + void SetFirstNumber(int v) {SetNumber(v,0);} + void SetSecondNumber(int v) {SetNumber(v,1);} + void SetFirstNumber(double v) {SetNumber(v,0);} + void SetSecondNumber(double v) {SetNumber(v,1);} + + int SetComboBoxIndex(int index); + + void CheckBoxClicked(); + void PrintTheValue(); + + void RefreshFirstNumberEntry(); + void RefreshSecondNumberEntry(); + void RefreshNumberEntery(int number_field=0); + + signals: + void CheckBoxChanged(bool state); + void CheckBoxChanged(SlsQtNumberEntry* ptr); + void AValueChanged(SlsQtNumberEntry* ptr); + void FirstValueChanged(int value); + void FirstValueChanged(double value); + void FirstValueChanged(SlsQtNumberEntry* ptr); + void SecondValueChanged(int value); + void SecondValueChanged(double value); + void SecondValueChanged(SlsQtNumberEntry* ptr); + void UnitChanged(double); + void UnitChanged(SlsQtNumberEntry* ptr); +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h new file mode 100644 index 000000000..197b162a2 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h @@ -0,0 +1,73 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQTVALIDATORS_H +#define SLSQTVALIDATORS_H + +#include +#include + +#include +#include + +using std::cout; +using std::endl; + +class SlsQtIntValidator:public QIntValidator{ + + public: + SlsQtIntValidator(QWidget *parent):QIntValidator(parent){} + + virtual void fixup (QString& text) const { + bool ok = 1; + int v = text.toInt(&ok); + + if(!ok){ + v = text.toDouble(&ok); + if(ok) text = QString::number(v); + else text = QString::number(0); + fixup(text); + } + + if(vtop()) text = QString::number(top()); + } + +}; + +class SlsQtDoubleValidator:public QDoubleValidator{ + + public: + SlsQtDoubleValidator(QWidget *parent):QDoubleValidator(parent){} + + virtual void fixup (QString& text) const { + + bool ok = 1; + double v = text.toDouble(&ok); + + if(!ok){ + text = QString::number(0); + fixup(text); + } + + int nd = this->decimals(); //ndigest behind zero + if(vtop()){ + v = floor(top()*pow(10,nd))/pow(10,nd); + text = QString::number(v,'g'); + }else{ + v = round(v*pow(10,nd))/pow(10,nd); + text = QString::number(v,'g'); + } + } + } + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx new file mode 100644 index 000000000..d4c355c88 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -0,0 +1,440 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SlsQt1DPlot.h" + +using namespace std; + +SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){ + Initailize(); + SetData(n,min,max,data); +} + +SlsQtH1D::SlsQtH1D(QString title,int n, double* data_x, double* data_y):QwtPlotCurve(title){ + Initailize(); + SetData(n,data_x,data_y); +} + +void SlsQtH1D::Initailize(){ + ndata=n_array=0; + x=y=0; + pen_ptr = new QPen(); + SetLineColor(); +} + +SlsQtH1D::~SlsQtH1D(){delete x;delete y;delete pen_ptr;} + +void SlsQtH1D::Attach(SlsQt1DPlot* p){ + attach((QwtPlot*) p); + p->NewHistogramAttached(this); +} + +void SlsQtH1D::Detach(SlsQt1DPlot* p){ + detach(); + p->HistogramDetached(this); +} + + +int SlsQtH1D::SetLineColor(int c){ + static int last_color = 1; + if(c<0) c=(last_color+1)%3; + + if(c==0) pen_ptr->setColor(Qt::black); + else if(c==1) pen_ptr->setColor(Qt::red); + else pen_ptr->setColor(Qt::blue); + + setPen(*pen_ptr); + + return last_color=c; +} + +int SlsQtH1D::SetLineWidth(int w){ + pen_ptr->setWidth(w); + setPen(*pen_ptr); + return w; +} + +void SlsQtH1D::SetLineStyle(int s){ + if(s==1) pen_ptr->setStyle(Qt::DashLine); + else if(s==2) pen_ptr->setStyle(Qt::DotLine); + else if(s==3) pen_ptr->setStyle(Qt::DashDotLine); + else if(s==4) pen_ptr->setStyle(Qt::DashDotDotLine); + else if(s==5) pen_ptr->setStyle(Qt::CustomDashLine); + else pen_ptr->setStyle(Qt::SolidLine); + setPen(*pen_ptr); +} + + +void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data){ + n = SetUpArrays(n); + + ndata=n; + if(xmin>xmax){ + double t=xmin; + xmin=xmax; + xmax=t; + } + + dx = (xmax-xmin)/n; + ymin=ymax= data ? data[0]:0; + firstXgt0=-1; + firstYgt0=-1; + + for(int i=0;iy[i]) ymin = y[i]; + if(data&&ymax0&&(firstXgt0<0||firstXgt0>x[i])) firstXgt0=x[i]; + if(y[i]>0&&(firstYgt0<0||firstYgt0>y[i])) firstYgt0=y[i]; + } + + // cout<0&&data_x[0]>data_x[n-1]) ? 1:0; + n = SetUpArrays(n); + + ndata=n; + dx=-1; //signifies not regular intervals + + ymin=ymax= data_y ? data_y[0]:0; + + firstXgt0=-1; + firstYgt0=-1; + + for(int i=0;iy[b]) ymin = y[b]; + if(data_y&&ymax0&&(firstXgt0<0||firstXgt0>x[b])) firstXgt0=x[b]; + if(y[b]>0&&(firstYgt0<0||firstYgt0>y[b])) firstYgt0=y[b]; + } + + setRawData(x,y,ndata); +} + +int SlsQtH1D::SetUpArrays(int n){ + n = n<1 ? 1 : n; //overflow bin + + if(n+1>n_array){ + n_array = n+1; + if(x) delete x; + if(y) delete y; + x = new double [n_array]; + y = new double [n_array]; + } + + return n; +} + +double SlsQtH1D::FillBin(int bx, double v) { + bx = CheckIndex(bx); + return SetBinContent(bx,y[bx]+v); +} +double SlsQtH1D::Fill(double x, double v){return FillBin(FindBinIndex(x),v);} + +double SlsQtH1D::SetBinContent(int bx,double v){ + bx = CheckIndex(bx); + y[bx]=v; + if(bx0&&(firstYgt0<=0||y[bx]ymax) ymax = y[bx]; + } + return y[bx]; +} + +double SlsQtH1D::SetContent(double x,double v) {return SetBinContent(FindBinIndex(x),v); } + +int SlsQtH1D::FindBinIndex(double px){ + if(dx>0) CheckIndex(int((px-x[0])/dx)); + + //find closest bin + int b=0; for(;bpx) break; + + if(b==0) return 0; + else if(fabs(px-x[b-1])ndata) ? ndata : bx;}//ndata is the overflow bin + +SlsQtH1D* SlsQtH1D::Add(double v){ for(int bx=0;bxthe_hist) return hist; //already added + if(!hl->the_next) break; + hl=hl->the_next; + } + if(hl->the_hist) hl->the_next = new SlsQtH1DList(hist); + else hl->the_hist = hist; + + // Print(); + + return hist; +} + +void SlsQtH1DList::Print(){ + // cout<<"Printing List"<the_hist<<" "<the_next<the_next; + if(i>10) break; + } +} + +void SlsQtH1DList::Remove(SlsQtH1D* hist){ + // cout<<"Removing: "<the_hist!=hist) hl = hl->the_next; + else{ //match + if(!hl->the_next) hl->the_hist=0; // first the_hist is zero when there's no next + else{ + SlsQtH1DList* t = hl->the_next; + hl->the_hist = t->the_hist; + hl->the_next = t->the_next; + t->the_next = 0; + delete t; + } + } + } + // Print(); +} + + + +//1d plot stuff +SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){ + // n_histograms_attached=0; + hline=vline=0; + hist_list = new SlsQtH1DList(); + + UnknownStuff(); + alignScales(); + SetupZoom(); + + // Assign a title + insertLegend(new QwtLegend(), QwtPlot::RightLegend); + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); +} + +SlsQt1DPlot::~SlsQt1DPlot(){ + delete hist_list; + + if(hline) delete hline; + if(vline) delete vline; +} + +void SlsQt1DPlot::CalculateNResetZoomBase(){ + if(hist_list->Hist()) zoomer->SetZoomBase(hist_list->Hist()); + SlsQtH1DList* hl = hist_list->Next(); + while(hl){ + if(hl->Hist()) zoomer->ExtendZoomBase(hl->Hist()); + hl=hl->Next(); + } +} + +void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){ + hist_list->Add(h); + CalculateNResetZoomBase(); + if(!hist_list->Next()) UnZoom(); + Update(); +} + +void SlsQt1DPlot::HistogramDetached(SlsQtH1D* h){ + hist_list->Remove(h); + CalculateNResetZoomBase(); + Update(); +} + +void SlsQt1DPlot::Update(){ + replot(); +} + +void SlsQt1DPlot::SetTitle(const char* title){ + setTitle(title); +} + +void SlsQt1DPlot::SetXTitle(const char* title){ + setAxisTitle(QwtPlot::xBottom,title); +} +void SlsQt1DPlot::SetYTitle(const char* title){ + setAxisTitle(QwtPlot::yLeft,title); +} + +void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);} +void SlsQt1DPlot::SetLogY(bool yes){ SetLog(QwtPlot::yLeft,yes);} +void SlsQt1DPlot::SetLog(int axisId, bool yes){ + if(axisId==QwtPlot::xBottom) zoomer->SetLogX(yes); + if(axisId==QwtPlot::yLeft) zoomer->SetLogY(yes); + + zoomer->ResetZoomBase(); //needs to be done before setting Engine + + //the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp + if(yes) setAxisScaleEngine(axisId,new QwtLog10ScaleEngine()); + else setAxisScaleEngine(axisId,new QwtLinearScaleEngine()); + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); + + Update(); +} + +void SlsQt1DPlot::UnZoom(){ + setAxisScale(QwtPlot::xBottom,zoomer->x(),zoomer->x()+zoomer->w()); + setAxisScale(QwtPlot::yLeft,zoomer->y(),zoomer->y()+zoomer->h()); + + zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. + Update(); +} + +void SlsQt1DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){ + setAxisScale(QwtPlot::xBottom,xmin,xmin+x_width); + setAxisScale(QwtPlot::yLeft ,ymin,ymin+y_width); + Update(); +} + +void SlsQt1DPlot::RemoveHLine(){ + if(hline) hline->detach(); + delete hline; + hline=0; +} + +void SlsQt1DPlot::InsertHLine(double y){ + if(!hline){ + hline = new QwtPlotMarker(); + hline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); + hline->setLineStyle(QwtPlotMarker::HLine); + hline->attach(this); + } + hline->setYValue(y); +} + +void SlsQt1DPlot::RemoveVLine(){ + if(vline) vline->detach(); + delete vline; + vline=0; +} + +void SlsQt1DPlot::InsertVLine(double x){ + if(!vline){ + vline = new QwtPlotMarker(); + vline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); + vline->setLineStyle(QwtPlotMarker::VLine); + vline->attach(this); + } + vline->setXValue(x); +} + + + + +void SlsQt1DPlot::SetupZoom(){ + // LeftButton for the zooming + // MidButton for the panning + // RightButton: zoom out by 1 + // Ctrl+RighButton: zoom out to full size + + zoomer = new SlsQt1DZoomer(canvas()); + +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + + panner = new QwtPlotPanner(canvas()); + panner->setAxisEnabled(QwtPlot::yRight, false); + panner->setMouseButton(Qt::MidButton); + + // Avoid jumping when labels with more/less digits + // appear/disappear when scrolling vertically + + const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font()); + QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft); + sd->setMinimumExtent( fm.width("100.00") ); + + const QColor c(Qt::darkBlue); + zoomer->setRubberBandPen(c); + zoomer->setTrackerPen(c); +} + + +// Set a plain canvas frame and align the scales to it +void SlsQt1DPlot::alignScales(){ + // The code below shows how to align the scales to + // the canvas frame, but is also a good example demonstrating + // why the spreaded API needs polishing. + + canvas()->setFrameStyle(QFrame::Box | QFrame::Plain ); + canvas()->setLineWidth(1); + + for(int i = 0; i < QwtPlot::axisCnt; i++ ){ + QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i); + if(scaleWidget) scaleWidget->setMargin(0); + QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i); + if(scaleDraw) scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false); + } +} + +void SlsQt1DPlot::UnknownStuff(){ + // Disable polygon clipping + QwtPainter::setDeviceClipping(false); + // We don't need the cache here + canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); + canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); + +#if QT_VERSION >= 0x040000 +#ifdef Q_WS_X11 + // Qt::WA_PaintOnScreen is only supported for X11, but leads + // to substantial bugs with Qt 4.2.x/Windows + canvas()->setAttribute(Qt::WA_PaintOnScreen, true); +#endif +#endif +} + diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx new file mode 100644 index 000000000..942bd13c4 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx @@ -0,0 +1,99 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#include + +#include +#include + +#include "SlsQt1DPlot.h" +#include "SlsQt1DZoomer.h" + +using namespace std; + +void SlsQt1DZoomer::ResetZoomBase(){ + SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots +} + +void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){ + if(xIsLog&&xmin<=0){ + double xmax = xmin+x_width; + xmin = firstXgt0*0.98; + if(xmax<=xmin) x_width=firstXgt0; + else x_width=xmax-xmin; + } + if(yIsLog&&ymin<=0){ + double ymax = ymin+y_width; + ymin = firstYgt0*0.98; + if(ymax<=ymin) y_width=firstYgt0; + else y_width=ymax-ymin; + } + + if(plot()){ + if(xIsLog){ + #if QWT_VERSION < 0x50200 + float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); + float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); + #else + float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); + float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); + #endif + if(xmin_currxmin+x_width) xmax_curr=xmin+x_width; + plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr); + } + if(yIsLog){ + #if QWT_VERSION < 0x50200 + float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); + float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); + #else + float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); + float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); + #endif + if(ymin_currymin+y_width) ymax_curr=ymin+y_width; + plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr); + } + plot()->replot(); + } + + setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); +} + +void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){ + x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02; + x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02; + y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02; + y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02; + + firstXgt0 = h->GetFirstXgtZero(); //for log plots + firstYgt0 = h->GetFirstYgtZero(); //for log plots + + ResetZoomBase(); +} + +void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){ + double h_x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02; + double h_x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02; + double h_y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02; + double h_y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02; + + if(h_x0x1) x1 = h_x1; + if(h_y0y1) y1 = h_y1; + + if(h->GetFirstXgtZero()GetFirstXgtZero(); + if(h->GetFirstYgtZero()GetFirstYgtZero(); + + // cout<<"extend "< + +#include "SlsQt2DHist.h" + +using std::cout; +using std::endl; + +SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){ + interp=0; + nx_array=ny_array=0;data=0; + SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); +} + + +SlsQt2DHist::~SlsQt2DHist(){if(data) delete data;} + +int SlsQt2DHist::GetBinIndex(int bx, int by){ + int b = bx*ny+by; + if(b<0 || b>=nb){ + cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<nx_array*ny_array){ + if(data) delete data; + data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin + nx_array = nbinsx; + ny_array = nbinsy; + } + nx=nbinsx; + ny=nbinsy; + nb=nx*ny; + data[nb]=0;//set over flow to zero + + if(d){ + memcpy(data,d,nb*sizeof(double)); + SetMinMax(zmin,zmax); + } +} + +void SlsQt2DHist::SetMinMax(double zmin,double zmax){ + if(zminz_max) z_max=data[i]; + z_mean+=data[i]; + } + z_mean/=nb; + if(z_min>0) z_min/=1.02; else z_min*=1.02; + if(z_max>0) z_max*=1.02; else z_max/=1.02; + } +} + +double SlsQt2DHist::GetMean(){ + if(!z_mean_has_been_calculated){ + z_mean_has_been_calculated = 1; + z_mean=0; + for(int i=0;i0&&data[i] +#include +#include + +#if QT_VERSION >= 0x040000 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SlsQt2DPlot.h" + +using namespace std; + +SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); + + d_spectrogram = new QwtPlotSpectrogram(); + + hist = new SlsQt2DHist(); + + SetupZoom(); + SetupColorMap(); + + d_spectrogram->setData(*hist); + d_spectrogram->attach(this); + + plotLayout()->setAlignCanvasToScales(true); + + FillTestPlot(); + Update(); + +} + + +void SlsQt2DPlot::SetupColorMap(){ + + colorMapLinearScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); + colorMapLinearScale->addColorStop(0.1, Qt::cyan); + colorMapLinearScale->addColorStop(0.4, Qt::blue); + colorMapLinearScale->addColorStop(0.6, Qt::green); + colorMapLinearScale->addColorStop(0.95, Qt::yellow); + d_spectrogram->setColorMap(*colorMapLinearScale); + + + colorMapLogScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); + colorMapLogScale->addColorStop((pow(10,2*0.10)-1)/99.0, Qt::cyan); //linear scale goes from 0 to 2 and log scale goes from 1 to 100 + colorMapLogScale->addColorStop((pow(10,2*0.40)-1)/99.0,Qt::blue); + colorMapLogScale->addColorStop((pow(10,2*0.60)-1)/99.0,Qt::green); + colorMapLogScale->addColorStop((pow(10,2*0.95)-1)/99.0,Qt::yellow); + + contourLevelsLinear = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; + d_spectrogram->setContourLevels(*contourLevelsLinear); + contourLevelsLog = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; + + + // A color bar on the right axis + rightAxis = axisWidget(QwtPlot::yRight); + rightAxis->setTitle("Intensity"); + rightAxis->setColorBarEnabled(true); + enableAxis(QwtPlot::yRight); +} + +void SlsQt2DPlot::FillTestPlot(int mode){ + static int nx = 50; + static int ny = 50; + static double *the_data=0; + if(the_data==0) the_data = new double [nx*ny]; + + double dmax = sqrt(pow(nx/2.0-0.5,2) + pow(ny/2.0-0.5,2)); + for(int i=0;iSetData(nx,200,822,ny,-0.5,ny-0.5,the_data); +} + +void SlsQt2DPlot::SetupZoom(){ + // LeftButton for the zooming + // MidButton for the panning + // RightButton: zoom out by 1 + // Ctrl+RighButton: zoom out to full size + + zoomer = new SlsQt2DZoomer(canvas()); + zoomer->SetHist(hist); + +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + + panner = new QwtPlotPanner(canvas()); + panner->setAxisEnabled(QwtPlot::yRight, false); + panner->setMouseButton(Qt::MidButton); + + // Avoid jumping when labels with more/less digits + // appear/disappear when scrolling vertically + + const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font()); + QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft); + sd->setMinimumExtent( fm.width("100.00") ); + + const QColor c(Qt::darkBlue); + zoomer->setRubberBandPen(c); + zoomer->setTrackerPen(c); +} + +void SlsQt2DPlot::UnZoom(){ + + zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin())); + + zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. + // zoomer->zoom(0); +} + +void SlsQt2DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){ + zoomer->setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); +} + +void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ + hist->SetMinMax(zmin,zmax); +} + + +void SlsQt2DPlot::Update(){ + rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); + if(!zoomer->zoomRectIndex()) UnZoom(); + setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), + d_spectrogram->data().range().maxValue()); + replot(); +} + + + +void SlsQt2DPlot::showContour(bool on){ + d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode,on); + Update(); +} + +void SlsQt2DPlot::showSpectrogram(bool on){ + // static int io=0; + // FillTestPlot(io++); + d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, on); + d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen)); + Update(); +} + +void SlsQt2DPlot::InterpolatedPlot(bool on){ + hist->Interpolate(on); + Update(); +} + + +void SlsQt2DPlot::LogZ(bool on){ + if(on){ + //if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero(); + d_spectrogram->setColorMap(*colorMapLogScale); + setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); + d_spectrogram->setContourLevels(*contourLevelsLog); + }else{ + d_spectrogram->setColorMap(*colorMapLinearScale); + setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); + d_spectrogram->setContourLevels(*contourLevelsLinear); + } + Update(); + +} + + + +/* +void SlsQt2DPlot::printPlot(){ + QPrinter printer; + printer.setOrientation(QPrinter::Landscape); +#if QT_VERSION < 0x040000 + printer.setColorMode(QPrinter::Color); + printer.setOutputFileName("spectrogram.ps"); + if (printer.setup()) +#else + printer.setOutputFileName("spectrogram.pdf"); + QPrintDialog dialog(&printer); + if ( dialog.exec() ) +#endif + { + print(printer); + } +} + +*/ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx new file mode 100644 index 000000000..5205ae8e9 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -0,0 +1,212 @@ +/** + * @author Ian Johnson + * @version 1.0 + */ +/* + + +#include + +#include +//#include +//#include + + +#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 + */ + + +#include + + +#include +#include +#include + +#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->SetNDecimalsOfDoubleValidators(2); + z_range_ne->setFixedWidth(402); + z_range_ne->hide(); + + logsChecked = false; + + Layout(); + ConnectSignalsAndSlots(); +} + +SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){ + + if(the_layout) delete the_layout; + + + delete the_plot; + delete z_range_ne; +} + + +void SlsQt2DPlotLayout::Layout(){ + if(the_layout) delete the_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(){ + connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool))); + connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool))); + connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange())); + connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange())); + +} + +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(logsChecked) 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){ + logsChecked=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); +} + diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx new file mode 100644 index 000000000..1779f8461 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx @@ -0,0 +1,506 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "SlsQtNumberEntry.h" + +using namespace std; + +SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent, int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string):QWidget(parent){ + SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,n_units,units,unit_factors,end_string); +} + +//without unit drop box +SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type,char* end_string):QWidget(parent){ + SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,0,0,0,end_string); +} + +void SlsQtNumberEntry::SetupNumberEntry(int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string){ + + layout = 0; + + check_box = 0; + front_text = 0; + num_field[0] = 0; + spin_box[0] = 0; + validator_int[0] = 0; + validator_double[0] = 0; + middle_text = 0; + num_field[1] = 0; + spin_box[1] = 0; + validator_int[1] = 0; + validator_double[1] = 0; + unit_cbb = 0; + factors = 0; + back_text = 0; + if(with_checkbox) AddCheckBox(); + SetFrontText(start_string); + + SetupNumberField(num_type,0); + SetMiddleText(middle_string); + SetupNumberField(num2_type,1); + SetUnits(n_units,units,unit_factors); + SetBackText(end_string); + + SetLayout(); + +} + + +SlsQtNumberEntry::~SlsQtNumberEntry(){ + + if(check_box) delete check_box; + if(front_text) delete front_text; + if(middle_text) delete middle_text; + if(validator_int[0]) delete validator_int[0]; + if(validator_double[0]) delete validator_double[0]; + if(num_field[0]) delete num_field[0]; + if(spin_box[0]) delete spin_box[0]; + if(validator_int[1]) delete validator_int[1]; + if(validator_double[1]) delete validator_double[1]; + if(num_field[1]) delete num_field[1]; + if(spin_box[1]) delete spin_box[1]; + if(unit_cbb) delete unit_cbb; + if(factors) delete factors; + if(back_text) delete back_text; + +} + +void SlsQtNumberEntry::AddCheckBox(){ + if(check_box) delete check_box; + check_box = new QCheckBox(this); + connect(check_box,SIGNAL(clicked()),this,SLOT(CheckBoxClicked())); + SetLayout(); +} + +void SlsQtNumberEntry::SetFrontText(char* s) {SetText(s,&front_text); SetLayout();} +void SlsQtNumberEntry::SetMiddleText(char* s) {SetText(s,&middle_text); SetLayout();} +void SlsQtNumberEntry::SetBackText(char* s) {SetText(s,&back_text); SetLayout();}; +void SlsQtNumberEntry::SetText(char* s, QLabel** pp){ + if(*pp){delete *pp; *pp=0;} + if(s){ + *pp = new QLabel(this); + (*pp)->setText(s); + } + SetLayout(); +} + + +void SlsQtNumberEntry::SetupNumberField(int type, int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + num_field_enabled[i]=1; + if(spin_box[i]) { delete spin_box[i]; spin_box[i]=0;} + if(validator_int[i]) { delete validator_int[i]; validator_int[i]=0;} + if(validator_double[i]) { delete validator_double[i]; validator_double[i]=0;} + if(num_field[i]) { delete num_field[i]; num_field[i]=0;} + + if(type>0&&type<3){ + num_field[i] = new QLineEdit(this); + num_field[i]->setAlignment(Qt::AlignRight); + SetMinimumNumberWidth(3,i); + if(type==1){ + validator_int[i] = new SlsQtIntValidator(num_field[i]); + num_field[i]->setValidator(validator_int[i]); + SetNumber(0,i); + }else{ + validator_double[i] = new SlsQtDoubleValidator(num_field[i]); + num_field[i]->setValidator(validator_double[i]); + //default settings + SetNDecimalsOfDoubleValidator(3,i); //defalut value + SetNumber(0,i); + } + + num_field[i]->setAlignment(Qt::AlignRight); + + if(i==0){ + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshFirstNumberEntry())); + connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(FirstValueEntered())); + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered())); + }else{ + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshSecondNumberEntry())); + connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(SecondValueEntered())); + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(SecondValueEntered())); + } + }else if(type==3){ + spin_box[i] = new QSpinBox(); + if(i==0) connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(FirstValueEntered())); + else connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(SecondValueEntered())); + spin_box[i]->setAlignment(Qt::AlignRight); + } + + SetLayout(); +} + +void SlsQtNumberEntry::SetUnits(int n_units, char** units, double* unit_factors){ + if(unit_cbb){ delete unit_cbb; unit_cbb=0;} + if(factors) { delete factors; factors=0;} + + if(n_units>0&&units&&unit_factors){ + unit_cbb = new QComboBox(this); + factors = new double [n_units]; + + for(int i=0;iinsertItem(i,units[i]); + factors[i] = unit_factors[i]; + } + + connect(unit_cbb,SIGNAL(activated(int)),this,SLOT(UnitSelected())); + } + + SetLayout(); +} + +void SlsQtNumberEntry::SetLayout(){ + if(layout) delete layout; + layout = new QGridLayout(this); + + int i = 0; + if(check_box) layout->addWidget(check_box,1,i++); + if(front_text) layout->addWidget(front_text,1,i++); + if(num_field[0]) layout->addWidget(num_field[0],1,i++); + if(spin_box[0]) layout->addWidget(spin_box[0],1,i++); + if(middle_text) layout->addWidget(middle_text,1,i++); + if(num_field[1]) layout->addWidget(num_field[1],1,i++); + if(spin_box[1]) layout->addWidget(spin_box[1],1,i++); + if(unit_cbb) layout->addWidget(unit_cbb,1,i++); + if(back_text) layout->addWidget(back_text,1,i++); + + CheckBoxClicked(); +} + + +void SlsQtNumberEntry::SetMinimumNumberWidth(int nchar_width,int which_number_field){ + if(num_field[which_number_field]) num_field[which_number_field] + ->setMinimumWidth(nchar_width*num_field[which_number_field]->minimumSizeHint().width()); + if(spin_box[which_number_field]) spin_box[which_number_field] + ->setMinimumWidth(nchar_width*spin_box[which_number_field]->minimumSizeHint().width()); +} + +void SlsQtNumberEntry::SetNDecimalsOfDoubleValidators(int ndecimals){ + SetNDecimalsOfDoubleValidator(ndecimals,0); + SetNDecimalsOfDoubleValidator(ndecimals,1); +} + +void SlsQtNumberEntry::SetNDecimalsOfDoubleValidator(int ndecimals, int which_number_field){ + //0 -> standard, 1->scientific + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(validator_double[i]){ + validator_double[i]->setDecimals(ndecimals); + SetNumber(GetNumber(i),i); + } +} + +void SlsQtNumberEntry::SetMinimumUnitWidth(int nchar_width){ + if(unit_cbb) unit_cbb->setMinimumWidth(nchar_width*unit_cbb->minimumSizeHint().width()); +} + + +/* +double SlsQtNumberEntry::SetNumber(int v,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(num_field[i]){ + if(validator_int[i]){ + QString s = QString::number(v); + validator_int[i]->fixup(s); + num_field[i]->setText(s); + } + if(validator_double[i]){ + QString s = QString::number(v); + validator_double[i]->fixup(s); + num_field[i]->setText(s); + } + }else if(spin_box[i]){ + spin_box[i]->setValue(v); + }else return 0; + + return GetNumber(i); +} +*/ + +double SlsQtNumberEntry::SetNumber(double v,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(num_field[i]){ + if(validator_int[i]){ + QString s = QString::number(v); + validator_int[i]->fixup(s); + num_field[i]->setText(s); + } + if(validator_double[i]){ + QString s = QString::number(v); + validator_double[i]->fixup(s); + num_field[i]->setText(s); + } + }else if(spin_box[i]){ + spin_box[i]->setValue(round(v)); + }else return 0; + + return GetNumber(i); +} + + +void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(min>max){ + cout<<"Waring: SetRange(int,int) no effect min > max"<setRange(min,max); + if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals()); + if(spin_box[i]) spin_box[i]->setRange(min,max); + SetNumber(GetNumber(i),i); + } +} + + +void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(min>max){ + cout<<"Waring: SetRange(double,double) no effect min >= max"<setRange(min,max,validator_double[i]->decimals()); + if(spin_box[i]) spin_box[i]->setRange(min,max); + SetNumber(GetNumber(i),i); + } + +} + +bool SlsQtNumberEntry::CheckBoxState(){ + if(check_box&&check_box->checkState()) return 1; + return 0; +} + +void SlsQtNumberEntry::CheckBoxClicked(){ + if(check_box){ + if(check_box->checkState()) Enable(); + else Disable(); + + emit CheckBoxChanged(check_box->checkState()); + emit CheckBoxChanged(this); + } + +} + +void SlsQtNumberEntry::Disable(){ Enable(0); } +void SlsQtNumberEntry::Enable(bool en_flag){ + if(check_box) check_box->setChecked(en_flag); + if(front_text) front_text->setEnabled(en_flag); + if(num_field[0]) num_field[0]->setEnabled(en_flag&&num_field_enabled[0]); + if(spin_box[0]) spin_box[0]->setEnabled(en_flag&&num_field_enabled[0]); + if(middle_text) middle_text->setEnabled(en_flag); + if(num_field[1]) num_field[1]->setEnabled(en_flag&&num_field_enabled[1]); + if(spin_box[1]) spin_box[1]->setEnabled(en_flag&&num_field_enabled[1]); + if(unit_cbb) unit_cbb->setEnabled(en_flag); + if(back_text) back_text->setEnabled(en_flag); +} + +void SlsQtNumberEntry::DisableNumberField(int which_number_field){ EnableNumberField(which_number_field,0); } +void SlsQtNumberEntry::EnableNumberField(int which_number_field,bool en_flag){ + if(which_number_field>=0||which_number_field<=1){ + num_field_enabled[which_number_field]=en_flag; + if(num_field[which_number_field]) num_field[which_number_field]->setEnabled(num_field_enabled[which_number_field]); + if(spin_box[which_number_field]) spin_box[which_number_field]->setEnabled(num_field_enabled[which_number_field]); + } +} + +void SlsQtNumberEntry::UnitSelected(){ + emit UnitChanged(GetComboBoxValue()); + emit UnitChanged(this); + emit AValueChanged(this); + emit FirstValueChanged(GetValueInt(0)); + emit FirstValueChanged(GetValue(0)); + emit FirstValueChanged(this); + emit SecondValueChanged(GetValueInt(1)); + emit SecondValueChanged(GetValue(1)); + emit SecondValueChanged(this); +} + +void SlsQtNumberEntry::RefreshFirstNumberEntry() { RefreshNumberEntery(0);} +void SlsQtNumberEntry::RefreshSecondNumberEntry() { RefreshNumberEntery(1);} +void SlsQtNumberEntry::RefreshNumberEntery(int which_number_field){ + //does not apply to spin boxes + if(num_field[which_number_field]){ + SetNumber(GetNumber(which_number_field),which_number_field); + } + //refreshes the entery in a general format for ints and fixes doubles, + //for example removes leading zeros + //However, also moves curser position +} + +void SlsQtNumberEntry::FirstValueEntered(){ + emit AValueChanged(this); + emit FirstValueChanged(GetValue(0)); + emit FirstValueChanged(GetValueInt(0)); + emit FirstValueChanged(this); +} + +void SlsQtNumberEntry::SecondValueEntered(){ + emit AValueChanged(this); + emit SecondValueChanged(GetValue(1)); + emit SecondValueChanged(GetValueInt(1)); + emit SecondValueChanged(this); +} + + +bool SlsQtNumberEntry::Enabled(){ + if(check_box && !check_box->checkState()) return 0; + return 1; +} + +bool SlsQtNumberEntry::IsValueOk(int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + bool ok=0; + if(validator_int[i]) num_field[i]->text().toInt(&ok); + if(validator_double[i]) num_field[i]->text().toDouble(&ok); + if(spin_box[i]) ok=true; + + return ok; +} + +const char* SlsQtNumberEntry::GetFrontText(){ + if(front_text) return front_text->text().toStdString().c_str(); + return 0; +} +const char* SlsQtNumberEntry::GetMiddleText(){ + if(middle_text) return middle_text->text().toStdString().c_str(); + return 0; +} +const char* SlsQtNumberEntry::GetBackText(){ + if(back_text) back_text->text().toStdString().c_str(); + return 0; +} + +int SlsQtNumberEntry::GetNumberInt(int which_number_field,bool* ok){ + return round(GetNumber(which_number_field,ok)); +} + +double SlsQtNumberEntry::GetNumber(int which_number_field,bool* ok){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(ok) *ok = 1; + + if(num_field[i]){ + if(validator_int[i]) return num_field[i]->text().toInt(ok); + else return num_field[i]->text().toDouble(ok); + } + else if(spin_box[i]) return spin_box[i]->value(); + else {if(ok) *ok=0;} + + return 0; +} + + + +double SlsQtNumberEntry::SetValue(double v,int which_number_field){ + if(unit_cbb) SetNumber(round(v/GetComboBoxValue()),which_number_field); + else SetNumber(v,which_number_field); + + return GetValue(which_number_field); +} + + +int SlsQtNumberEntry::GetValueInt(int which_number_field,bool* ok){ + return round(GetValue(which_number_field,ok)); +} + +double SlsQtNumberEntry::GetValue(int which_number_field,bool* ok){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + double v; + if(ok) *ok = 1; + + if(num_field[i]){ + if(validator_int[i]) v = num_field[i]->text().toInt(ok); + else v = num_field[i]->text().toDouble(ok); + } + else if(spin_box[i]) v = spin_box[i]->value(); + else v = 1; //incase there is only a unit pulldown + + + if(unit_cbb) v *= GetComboBoxValue(); + + if(!num_field[i]&&!spin_box[i]&&!unit_cbb){v=0; if(ok) *ok=0;} + + return v; +} + + +int SlsQtNumberEntry::SetComboBoxIndex(int index){ + if(unit_cbb){ + if(index<0||index>=unit_cbb->count()){ + cout<<"usage error : can not set combo box index, index out of range."<setCurrentIndex(index); + } + } + else cout<<"usage error : can not set combo box index, no combo box."<currentIndex(); + + cout<<"usage error : can not get combo box index, no combo box."<currentIndex()]; + + cout<<"usage error : can not get combo box value, no combo box."< +#include +#include + +/** C++ Include Headers */ +#include +#include +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){ + + QGroupBox *cloneBox = new QGroupBox(this); + QGridLayout *gridClone = new QGridLayout(cloneBox); + cloneBox->setLayout(gridClone); + cloneBox->setFlat(1); + cloneBox->setTitle("Startup Image"); + cloneBox->resize(fSize); + + if(numDim==1){ + cloneplot1D = plot1D; + gridClone->addWidget(cloneplot1D,0,0); + }else{ + cloneplot2D = plot2D; + gridClone->addWidget(cloneplot2D,0,0); + } + + +} + + +qCloneWidget::~qCloneWidget(){ + delete cloneplot1D; + delete cloneplot2D; +} + + +void qCloneWidget::closeEvent(QCloseEvent* event){ + emit CloneClosedSignal(id); + event->accept(); +} diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp new file mode 100644 index 000000000..ecc465456 --- /dev/null +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -0,0 +1,291 @@ +/** Qt Project Class Headers */ +#include "qDetectorMain.h" +#include "qDrawPlot.h" +#include "qTabMeasurement.h" +#include "qTabDataOutput.h" +#include "qTabPlot.h" +#include "qTabActions.h" +#include "qTabAdvanced.h" +#include "qTabSettings.h" +#include "qTabDebugging.h" +#include "qTabDeveloper.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +#include "sls_detector_defs.h" +/** Qt Include Headers */ +/** C++ Include Headers */ +#include +#include +using namespace std; + +#define Detector_Index 0 + +int main (int argc, char **argv) { + + QApplication *theApp = new QApplication(argc, argv); + qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); + det->show(); + theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); + return theApp->exec(); +} + + + + + +qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){ + myDet = 0; + setupUi(this); + SetUpWidgetWindow(); + Initialization(); + SetDeveloperMode(); + /**need to use argc and argv to determine which slsdet or multidet to use.*/ +} + + +//Qt::ScrollBarAsNeeded + + +qDetectorMain::~qDetectorMain(){ + delete myDet; + if (menubar) delete menubar; + if (centralwidget) delete centralwidget; +} + + + + + +void qDetectorMain::SetUpWidgetWindow(){ + + +/* scrollMain = new QScrollArea; + setCentralWidget(scrollMain); + scrollMain ->setWidget(centralwidget); + scrollMain->setWidgetResizable(true);*/ + + SetUpDetector(); + +/** plot setup*/ + myPlot = new qDrawPlot(framePlot,myDet); + +/**tabs setup*/ + tabs = new QTabWidget(this); + layoutTabs->addWidget(tabs); + /** creating all the tab widgets */ + tab_measurement = new qTabMeasurement (this, myDet,myPlot); + tab_dataoutput = new qTabDataOutput (this, myDet); + tab_plot = new qTabPlot (this, myDet,myPlot); + tab_actions = new qTabActions (this, myDet); + tab_advanced = new qTabAdvanced (this, myDet); + tab_Settings = new qTabSettings (this, myDet); + tab_debugging = new qTabDebugging (this, myDet); + tab_developer = new qTabDeveloper (this, myDet); + /** creating the scroll area widgets for the tabs */ + for(int i=0;isetFrameShape(QFrame::NoFrame); + } + /** setting the tab widgets to the scrollareas*/ + scroll[Measurement] ->setWidget(tab_measurement); + scroll[DataOutput] ->setWidget(tab_dataoutput); + scroll[Plot] ->setWidget(tab_plot); + scroll[Actions] ->setWidget(tab_actions); + scroll[Advanced] ->setWidget(tab_advanced); + scroll[Settings] ->setWidget(tab_Settings); + 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"); + tabs->insertTab(Plot, scroll[Plot], "Plot"); + tabs->insertTab(Actions, scroll[Actions], "Actions"); + tabs->insertTab(Advanced, scroll[Advanced], "Advanced"); + tabs->insertTab(Settings, scroll[Settings], "Settings"); + tabs->insertTab(Debugging, scroll[Debugging], "Debugging"); + tabs->insertTab(Developer, scroll[Developer], "Developer"); + +/** mode setup - to set up the tabs initially as disabled, not in form so done here */ + SetDebugMode(false); + SetBeamlineMode(false); + SetExpertMode(false); +} + + + + + +void qDetectorMain::SetUpDetector(){ + /**instantiate detector and set window title*/ + myDet = new multiSlsDetector(Detector_Index); + if(!myDet->getHostname(Detector_Index).length()){ + setWindowTitle("SLS Detector GUI : No Detector Connected"); +#ifdef VERBOSE + cout<getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str())); +#ifdef VERBOSE + cout<getDetectorsType())<<"\t\t\tDetector : "<getHostname(Detector_Index)<setOnline(slsDetectorDefs::ONLINE_FLAG); + } +} + + + +void qDetectorMain::Initialization(){ + + +/** tabs */ + connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); + /** Measurement tab*/ + /** Plot tab */ + + +/** Plotting */ + /** When the acquisition is finished, must update the meas tab */ + connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement,SLOT(UpdateFinished())); + + +/** 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))); + + + /** 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())); + +} + + +void qDetectorMain::SetDeveloperMode(){ +#ifdef VERBOSE + cout<<"Enabling Developer Mode "<setTabEnabled(Developer,true); +} + + +void qDetectorMain::SetDebugMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Debug Mode to "<setTabEnabled(Debugging,b); +} + +void qDetectorMain::SetBeamlineMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Beamline Mode to "<setTabEnabled(Advanced,b); + tabs->setTabEnabled(Settings,b); + tab_advanced->setEnabled(b); +} + + + +void qDetectorMain::refresh(int index){ + if(!tabs->isTabEnabled(index)) + tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); + else{ +; + } +} + + +void qDetectorMain::SetDockableMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Dockable Plot Mode to "<setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); + else + dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); + +} + + +void qDetectorMain::OpenSetup(){ +#ifdef VERBOSE + cout<<"Opening Setup"< +/** C++ Include Headers */ +#include +#include +using namespace std; + + +#define Detector_Index 0 + + +qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + if(myDet) { + setupUi(this); + Initialization(); + SetupWidgetWindow(); + StartStopDaqToggle(); //as default + } +} + + +qDrawPlot::~qDrawPlot(){ + /** Clear plot*/ + Clear1DPlot(); + for(QVector::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; +} + + + + +void qDrawPlot::Initialization(){ +#ifdef VERBOSE + cout<<"Setting up plot variables"<SetXTitle("x axis"); + plot1D->SetYTitle("y axis"); + plot1D->hide(); + + plot2D = new SlsQt2DPlotLayout(boxPlot); + plot2D->SetXTitle("pixel"); + plot2D->SetYTitle("pixel"); + plot2D->SetZTitle("Intensity"); + boxPlot->setFlat(1); + boxPlot->setTitle("Startup Image"); + + plotLayout = new QGridLayout(boxPlot); + plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot2D,1,1,1,1); + + + 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))); + +} + + + + +void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ + static bool running = 1; + if(running){ //stopping + StartDaq(0); + running=!running; + }else if(!stop_if_running){ //then start + StartDaq(1); + running=!running; + } +} + + + + +void qDrawPlot::StartDaq(bool start){ + if(start){ +#ifdef VERBOSE + cout<<"Start Daq(1) function"<setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); + cout<<"\tAcquisition Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); + cout<<"\tFrame Period:"<acquire(1);//acquiring + } + pthread_mutex_unlock(&gui_acquisition_start_stop_mutex); + + return gui_acquisition_thread_running; +} + + + + + + + +void* qDrawPlot::DataAcquisionThread(void *this_pointer){ + ((qDrawPlot*)this_pointer)->AcquireImages(); + return this_pointer; +} + + + + +void* qDrawPlot::AcquireImages(){ + //send data to detector + + static unsigned int nx=1280,ny=100; + static double* image_data = new double[nx*ny]; + if(!lastImageArray) lastImageArray = new double[nx*ny]; + static double* xvalues = new double [nx]; + static double* yvalues0 = new double [nx]; + static double* yvalues1 = new double [nx]; + if(!histXAxis) histXAxis = new double [nx]; + if(!histYAxis[0]) histYAxis[0] = new double [nx]; + if(!histYAxis[1]) histYAxis[1] = new double [nx]; + + + + char cIndex[200]; + + //string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_'; + //cout<<"filePath:"<readDataFile(fileName,arg)==-1); + + + ///////// + + + //readout detector + //fill and write data here + for(unsigned int px=0;pxshow(); + plot2D->hide(); + }else{ + plot1D->hide(); + plot2D->show(); + } +} + + + + +void qDrawPlot::Clear1DPlot(){ + for(QVector::iterator h = plot1D_hists.begin(); + h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot +} + + + + +void qDrawPlot::UpdatePlot(){ + //emit UpdatingPlot(); + + plot_update_timer->stop(); + + LockLastImageArray(); + //1-d plot stuff + if(GetHistNBins()){ + plot1D->SetXTitle(GetHistXAxisTitle()); + plot1D->SetYTitle(GetHistYAxisTitle()); + for(int hist_num=0;hist_numplot1D_hists.size()){ + plot1D_hists.append(h=new SlsQtH1D("1d plot",GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + h->SetData(GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num)); + } + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); + } + plot1D->UnZoom(); + } + + //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()); + //as it inherits a widget + boxPlot->setTitle(GetImageTitle()); + plot2D->SetXTitle(GetImageXAxisTitle()); + plot2D->SetYTitle(GetImageYAxisTitle()); + plot2D->SetZTitle(GetImageZAxisTitle()); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + } + } + last_plot_number=GetLastImageNumber(); + UnlockLastImageArray(); + + if(PlotInScope()==1) SelectPlot(1); + else if(PlotInScope()==2) SelectPlot(2); + + if(number_of_exposures==last_plot_number){ + StartStopDaqToggle(1); + emit UpdatingPlotFinished(); + }else{ + plot_update_timer->start(500); + } +} + + + +void qDrawPlot::StopUpdatePlot(){ + plot_update_timer->stop(); +} + + + + +void qDrawPlot::ClonePlot(){ + int i=0; + bool found = false; + for(i=0;isize(),(int)PlotInScope(),plot1D,plot2D); + if(PlotInScope()==1) + plot1D = new SlsQt1DPlot(boxPlot); + else + plot2D = new SlsQt2DPlotLayout(boxPlot); + plotLayout->addWidget(plot1D,1,1,1,1); + 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))); + connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); + winClone[i]->show(); + connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); + +} + +void qDrawPlot::CloseClones(){ + for(int i=0;iclose(); + +} + + +void qDrawPlot::CloneCloseEvent(int id){ + winClone[id]=0; +#ifdef VERBOSE + cout<<"Closing Clone Window id:"< +using namespace std; + + +#define Detector_Index 0 + + + +qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabActions::~qTabActions(){ + delete myDet; +} + + + + +void qTabActions::SetupWidgetWindow(){ +} + + + +void qTabActions::Initialization(){ +} + + + +void qTabActions::Enable(bool enable){ + //this->setEnabled(enable); + +} + + + + diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp new file mode 100644 index 000000000..0c55d2258 --- /dev/null +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -0,0 +1,84 @@ +/* + * qTabAdvanced.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabAdvanced.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabAdvanced::qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + myDetType = (int)myDet->getDetectorsType(); + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabAdvanced::~qTabAdvanced(){ + delete myDet; +} + + + + +void qTabAdvanced::SetupWidgetWindow(){ + /** Temperature */ + if(myDetType==slsDetectorDefs::GOTTHARD) + getTemperature(); //check if gotthard??? + else{ + btnTemp->setEnabled(false); + dispTempAdc->setEnabled(false); + dispTempFpga->setEnabled(false); + } +} + + + +void qTabAdvanced::Initialization(){ + /** Temperature */ + connect(btnTemp,SIGNAL(clicked()),this,SLOT(getTemperature()));//check if gotthard??? +} + + + +void qTabAdvanced::Enable(bool enable){ + btnTemp->setEnabled(enable); + dispTempAdc->setEnabled(enable); + dispTempFpga->setEnabled(enable); + pushButton->setEnabled(enable); +} + + +void qTabAdvanced::getTemperature(){ + char ctemp[200]; + /** adc */ + float tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC); + sprintf(ctemp,"%f%cC",tempadc,0x00B0); + dispTempAdc->setText(QString(ctemp)); + /** fpga */ + float tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA); + sprintf(ctemp,"%f%cC",tempfpga,0x00B0); + dispTempFpga->setText(QString(ctemp)); +#ifdef VERBOSE + cout<<"Temperature of ADC: "< +using namespace std; + + +#define Detector_Index 0 + + + +qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDataOutput::~qTabDataOutput(){ + delete myDet; +} + + + + +void qTabDataOutput::SetupWidgetWindow(){ +} + + + +void qTabDataOutput::Initialization(){ +} + + + +void qTabDataOutput::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp new file mode 100644 index 000000000..4fcf040bb --- /dev/null +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -0,0 +1,55 @@ +/* + * qTabDebugging.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabDebugging.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDebugging::~qTabDebugging(){ + delete myDet; +} + + + + +void qTabDebugging::SetupWidgetWindow(){ +} + + + +void qTabDebugging::Initialization(){ +} + + + +void qTabDebugging::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp new file mode 100644 index 000000000..6914431ae --- /dev/null +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -0,0 +1,55 @@ +/* + * qTabDeveloper.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabDeveloper.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDeveloper::~qTabDeveloper(){ + delete myDet; +} + + + + +void qTabDeveloper::SetupWidgetWindow(){ +} + + + +void qTabDeveloper::Initialization(){ +} + + + +void qTabDeveloper::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp new file mode 100644 index 000000000..00e64b9d5 --- /dev/null +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -0,0 +1,195 @@ +/* + * qTabMeasurement.cpp + * + * Created on: May 2, 2012 + * Author: l_maliakal_d + */ + +/** Qt Project Class Headers */ +#include "qTabMeasurement.h" +#include "qDefs.h" +#include "qDrawPlot.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 +#define UndefinedSettings 7 + + + +qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabMeasurement::~qTabMeasurement(){ + delete myDet; + delete myPlot; +} + + + + +void qTabMeasurement::SetupWidgetWindow(){ + /** all set initially to reflect the detector's actual parameter values*/ + + /** Settings */ + comboSettings->setCurrentIndex(myDet->getSettings(Detector_Index)); //set it to default acc to detector??? + /** Number of Measurements/Frames*/ + setNumFrames(2000); + /** Acquisition Time */ + setAcquisitionTime(); + /** Frame Period between exposures*/ + setFramePeriod(); + /** File Name*/ + setFileName("run"); + /** File Index*/ + setRunIndex(0); +} + + + +void qTabMeasurement::Initialization(){ + /** Settings */ + connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int))); + /** Number of Measurements/Frames*/ + connect(spinNumMeasurements,SIGNAL(valueChanged(int)),this,SLOT(setNumFrames(int))); + /** Acquisition Time */ + connect(spinExpTime,SIGNAL(valueChanged(double)),this,SLOT(setAcquisitionTime())); + connect(comboExpUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setAcquisitionTime())); + /** Frame Period between exposures*/ + connect(spinPeriod,SIGNAL(valueChanged(double)),this,SLOT(setFramePeriod())); + connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setFramePeriod())); + /** File Name*/ + connect(dispFileName,SIGNAL(textChanged(const QString&)),this,SLOT(setFileName(const QString&))); + /** File Index*/ + connect(spinIndex,SIGNAL(valueChanged(int)),this,SLOT(setRunIndex(int))); + /** Start/Stop Acquisition*/ + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); +} + + + + +//enabled other tabs as well?? +void qTabMeasurement::Enable(bool enable){ + //this->setEnabled(enable); + comboSettings->setEnabled(enable); + spinNumMeasurements->setEnabled(enable); + spinExpTime->setEnabled(enable); + comboExpUnit->setEnabled(enable); + spinPeriod->setEnabled(enable); + comboPeriodUnit->setEnabled(enable); + dispFileName->setEnabled(enable); + spinIndex->setEnabled(enable); + if(!enable) btnStartStop->setEnabled(true); +} + + + + +void qTabMeasurement::startStopAcquisition(){ + if(!btnStartStop->text().compare("Start")){ +#ifdef VERBOSE + cout<setText("Stop"); + Enable(0); + }else{ +#ifdef VERBOSE + cout<<"Stopping Acquisition"<setText("Start"); + Enable(1); + } + myPlot->StartStopDaqToggle(); +} + + +void qTabMeasurement::UpdateFinished(){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); +} + +void qTabMeasurement::setSettings(int index){ + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index); +#ifdef VERBOSE + cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)<setTimer(slsDetectorDefs::FRAME_NUMBER,val); +#ifdef VERBOSE + cout<<"Setting Frame number to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<currentIndex(),spinExpTime->value()); +#ifdef VERBOSE + cout<<"Setting acquisition time to " << exptime64 << " clocks" << endl; +#endif + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptime64); + + //float t=exptime64; + //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? +} + + + +void qTabMeasurement::setFramePeriod(){ + int64_t exptime64; + /** Get the 64 bit value of timer*/ + exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); +#ifdef VERBOSE + cout<<"Setting frame period between exposures to " << exptime64 << " clocks" << endl; +#endif + myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,exptime64); + + //float t=exptime64; + //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? +} + + + +void qTabMeasurement::setFileName(const QString& fName){ + // emit fileNameChanged(fName); + // thred-->fileName=s;myDet->setFileName(fName.ascii()); +#ifdef VERBOSE + cout<<"Setting File name to " << myDet->getFileName()<setFileName(fName.toAscii().data()); +} + + + + +void qTabMeasurement::setRunIndex(int index){ + myDet->setFileIndex(index); +#ifdef VERBOSE + cout<<"Setting File Index to " << myDet->getFileIndex()< +using namespace std; + + +#define Detector_Index 0 + + + +qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabPlot::~qTabPlot(){ + delete myDet; + delete myPlot; +} + + + + +void qTabPlot::SetupWidgetWindow(){ + box1D->setEnabled(false); +} + + + +void qTabPlot::Initialization(){ +/** Plot box*/ + connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); + connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); +/** 2D Plot box*/ + 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))); +} + + + +void qTabPlot::Enable(bool enable){ + boxPlot->setEnabled(enable); + box1D->setEnabled(enable); + box2D->setEnabled(enable); + boxPlotAxis->setEnabled(enable); +} + + diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp new file mode 100644 index 000000000..c43c87676 --- /dev/null +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -0,0 +1,56 @@ +/* + * qTabSettings.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#include "qTabSettings.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabSettings::~qTabSettings(){ + delete myDet; +} + + + + +void qTabSettings::SetupWidgetWindow(){ +} + + + +void qTabSettings::Initialization(){ +} + + + +void qTabSettings::Enable(bool enable){ + //this->setEnabled(enable); + +} + +