mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 04:29:22 +01:00
merging refactor (replacing)
This commit is contained in:
310
slsDetectorGui/include/qDetectorMain.h
Normal file → Executable file
310
slsDetectorGui/include/qDetectorMain.h
Normal file → Executable file
@@ -1,202 +1,200 @@
|
||||
/*
|
||||
* qDetectorMain.h
|
||||
* Main Window of the GUI
|
||||
* Created on: Apr 30, 2012
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
#ifndef QDETECTORMAIN_H
|
||||
#define QDETECTORMAIN_H
|
||||
#pragma once
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_detectormain.h"
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "ui_form_detectormain.h"
|
||||
class qTabPlot;
|
||||
class qTabActions;
|
||||
class qTabAdvanced;
|
||||
class qTabSettings;
|
||||
class qTabDebugging;
|
||||
class qTabDeveloper;
|
||||
class qTabMessages;
|
||||
class qServer;
|
||||
/** Project Class Headers */
|
||||
|
||||
class multiSlsDetector;
|
||||
/** Qt Include Headers */
|
||||
#include <QScrollArea>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
/** To Over-ride the QTabWidget class to get the tabBar */
|
||||
class MyTabWidget:public QTabWidget{
|
||||
public:
|
||||
MyTabWidget(QWidget* parent = 0) {setParent(parent);}
|
||||
class MyTabWidget : public QTabWidget {
|
||||
public:
|
||||
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
||||
/** Overridden method from QTabWidget */
|
||||
QTabBar* tabBar(){return QTabWidget::tabBar();}
|
||||
QTabBar *tabBar() { return QTabWidget::tabBar(); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*@short Main window of the GUI.
|
||||
*/
|
||||
class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{
|
||||
Q_OBJECT
|
||||
class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Main Window constructor.
|
||||
* This is mainly used to create detector object and all the tabs
|
||||
* @param argc number of command line arguments for server options
|
||||
* @param argv server options
|
||||
* @param app the qapplication3
|
||||
* @param parent makes the parent window 0 by default
|
||||
*/
|
||||
qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent = 0);
|
||||
|
||||
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 qapplication3
|
||||
* @param ret OK or FAIL of constructor (from command line arguments)
|
||||
* @param parent makes the parent window 0 by default
|
||||
* */
|
||||
qDetectorMain(int argc, char **argv, QApplication *app, int& ret, QWidget *parent = 0);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~qDetectorMain();
|
||||
|
||||
/**Destructor
|
||||
* */
|
||||
~qDetectorMain();
|
||||
/**
|
||||
* Starts or stops Acquisition From gui client
|
||||
* @param start 1 for start and 0 to stop
|
||||
* @returns success or fail
|
||||
*/
|
||||
int StartStopAcquisitionFromClient(bool start);
|
||||
|
||||
/** Starts or stops Acquisition From gui client
|
||||
* @param start 1 for start and 0 to stop
|
||||
/returns success or fail
|
||||
*/
|
||||
int StartStopAcquisitionFromClient(bool start);
|
||||
/**
|
||||
* Returns if plot is running
|
||||
*/
|
||||
bool isPlotRunning();
|
||||
|
||||
/** Returns if plot is running
|
||||
*/
|
||||
bool isPlotRunning(){return myPlot->isRunning();};
|
||||
/**
|
||||
* Returns progress bar value
|
||||
*/
|
||||
int GetProgress();
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return tab_measurement->GetProgress();};
|
||||
/**
|
||||
* Verifies if output directories for all the receivers exist
|
||||
*/
|
||||
int DoesOutputDirExist();
|
||||
|
||||
/** Returns file path */
|
||||
QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;};
|
||||
private slots:
|
||||
/**
|
||||
* Enables modes as selected -Debug, Expert, Dockable: calls setdockablemode
|
||||
*/
|
||||
void EnableModes(QAction *action);
|
||||
|
||||
/** Verifies if output directories for all the receivers exist */
|
||||
int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();};
|
||||
/**
|
||||
* Executes actions in the utilities menu as selected
|
||||
*/
|
||||
void ExecuteUtilities(QAction *action);
|
||||
|
||||
bool isCurrentlyTabDeveloper();
|
||||
/**
|
||||
* Executes actions in the utilities menu as selected
|
||||
*/
|
||||
void ExecuteHelp(QAction *action);
|
||||
|
||||
private:
|
||||
/** The Qt Application */
|
||||
QApplication *theApp;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** sls detector id */
|
||||
int detID;
|
||||
/** true for mythen and eiger */
|
||||
bool digitalDetector;
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
/**Tab Widget */
|
||||
MyTabWidget *tabs;
|
||||
/**Layout of the central Widget */
|
||||
QGridLayout *layoutTabs;
|
||||
/** default height of Plot Window when docked */
|
||||
int heightPlotWindow;
|
||||
/** default height of central widgetwhen plot Window when docked */
|
||||
int heightCentralWidget;
|
||||
/** The default zooming tool tip */
|
||||
QString zoomToolTip;
|
||||
/**
|
||||
* Refreshes the tab each time the tab is changed. Also displays the next
|
||||
* enabled tab
|
||||
*/
|
||||
void Refresh(int index);
|
||||
|
||||
/** The default tab heading color */
|
||||
QColor defaultTabColor;
|
||||
/** enumeration of the tabs */
|
||||
enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, Messages, NumberOfTabs };
|
||||
/* Scroll Area for the tabs**/
|
||||
QScrollArea *scroll[NumberOfTabs];
|
||||
/**Measurement tab */
|
||||
qTabMeasurement *tab_measurement;
|
||||
/**DataOutput tab */
|
||||
qTabDataOutput *tab_dataoutput;
|
||||
/**Plot tab */
|
||||
qTabPlot *tab_plot;
|
||||
/**Actions tab */
|
||||
qTabActions *tab_actions;
|
||||
/**Settings tab */
|
||||
qTabSettings *tab_settings;
|
||||
/**Advanced tab */
|
||||
qTabAdvanced *tab_advanced;
|
||||
/**Debugging tab */
|
||||
qTabDebugging *tab_debugging;
|
||||
/**Developer tab */
|
||||
qTabDeveloper *tab_developer;
|
||||
/**Messages tab */
|
||||
qTabMessages *tab_messages;
|
||||
/**
|
||||
* Resizes the main window if the plot is docked/undocked
|
||||
* @param b bool TRUE if undocked(outside main window), FALSE docked
|
||||
*/
|
||||
void ResizeMainWindow(bool b);
|
||||
|
||||
/** server object*/
|
||||
qServer *myServer;
|
||||
/**
|
||||
* Enables/disables tabs depending on if acquisition is currently in
|
||||
* progress
|
||||
*/
|
||||
void EnableTabs();
|
||||
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
/**
|
||||
* Set the tool tip of mouse controlled zooming depening on if its
|
||||
* enabled/disabled
|
||||
*/
|
||||
void SetZoomToolTip(bool disable);
|
||||
|
||||
/**Sets up the layout of the widget
|
||||
* */
|
||||
void SetUpWidgetWindow();
|
||||
/**
|
||||
* Uncheck the Listen to gui client mode when the server has exited
|
||||
*/
|
||||
void UncheckServer();
|
||||
|
||||
/**Sets up detector
|
||||
* @param fName file name of the config file at start up
|
||||
* */
|
||||
void SetUpDetector(const string fName);
|
||||
protected:
|
||||
/**
|
||||
* Adjust the resizing to resize plot
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
/**Sets up the signals and the slots
|
||||
* */
|
||||
void Initialization();
|
||||
private:
|
||||
/**
|
||||
* Sets up the layout of the widget
|
||||
*/
|
||||
void SetUpWidgetWindow();
|
||||
|
||||
/** Loads config file at start up
|
||||
* */
|
||||
void LoadConfigFile(const string fName);
|
||||
/**
|
||||
* Sets up detector
|
||||
* @param fName file name of the config file at start up
|
||||
* @param multi detector ID
|
||||
*/
|
||||
void SetUpDetector(const std::string fName, int multiID);
|
||||
|
||||
/**
|
||||
* Sets up the signals and the slots
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
private slots:
|
||||
/** Enables modes as selected -Debug, Expert, Dockable(calls setdockablemode())
|
||||
* */
|
||||
void EnableModes(QAction *action);
|
||||
|
||||
/** Executes actions in the utilities menu as selected
|
||||
* */
|
||||
void ExecuteUtilities(QAction *action);
|
||||
|
||||
/** Executes actions in the utilities menu as selected
|
||||
* */
|
||||
void ExecuteHelp(QAction *action);
|
||||
|
||||
/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab
|
||||
* */
|
||||
void Refresh(int index);
|
||||
|
||||
/** Resizes the main window if the plot is docked/undocked
|
||||
* @param b bool TRUE if undocked(outside main window), FALSE docked
|
||||
* */
|
||||
void ResizeMainWindow(bool b);
|
||||
|
||||
/** Enables/disables tabs depending on if acquisition is currently in progress
|
||||
* */
|
||||
void EnableTabs();
|
||||
|
||||
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled
|
||||
* */
|
||||
void SetZoomToolTip(bool disable);
|
||||
|
||||
/** Uncheck the Listen to gui client mode when the server has exited
|
||||
*/
|
||||
void UncheckServer();
|
||||
|
||||
protected:
|
||||
/** Adjust the resizing to resize plot, except for actions tab
|
||||
* */
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
/**
|
||||
* Loads config file at start up
|
||||
*/
|
||||
void LoadConfigFile(const std::string fName);
|
||||
|
||||
/** enumeration of the tabs */
|
||||
enum {
|
||||
MEASUREMENT,
|
||||
SETTINGS,
|
||||
DATAOUTPUT,
|
||||
PLOT,
|
||||
ADVANCED,
|
||||
DEBUGGING,
|
||||
DEVELOPER,
|
||||
MESSAGES,
|
||||
NumberOfTabs
|
||||
};
|
||||
/** Detector Type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/** The sls detector object */
|
||||
multiSlsDetector* myDet;
|
||||
/** The Plot widget */
|
||||
qDrawPlot* myPlot;
|
||||
/**Tab Widget */
|
||||
MyTabWidget* tabs;
|
||||
/**Measurement tab */
|
||||
qTabMeasurement* tabMeasurement;
|
||||
/**DataOutput tab */
|
||||
qTabDataOutput* tabDataOutput;
|
||||
/**Plot tab */
|
||||
qTabPlot* tabPlot;
|
||||
/**Settings tab */
|
||||
qTabSettings* tabSettings;
|
||||
/**Advanced tab */
|
||||
qTabAdvanced* tabAdvanced;
|
||||
/**Debugging tab */
|
||||
qTabDebugging* tabDebugging;
|
||||
/**Developer tab */
|
||||
qTabDeveloper* tabDeveloper;
|
||||
/**Messages tab */
|
||||
qTabMessages* tabMessages;
|
||||
/** server object*/
|
||||
qServer* myServer;
|
||||
/**if the developer tab should be enabled,known from command line */
|
||||
int isDeveloper;
|
||||
/** default height of Plot Window when docked */
|
||||
int heightPlotWindow;
|
||||
/** default height of central widgetwhen plot Window when docked */
|
||||
int heightCentralWidget;
|
||||
/** The default zooming tool tip */
|
||||
QString zoomToolTip;
|
||||
/** The default tab heading color */
|
||||
QColor defaultTabColor;
|
||||
};
|
||||
|
||||
#endif /* QDETECTORMAIN_H */
|
||||
|
||||
Reference in New Issue
Block a user