QGUIMain.hh

00001 /*
00002  * APOLLO: A complete DAQ and Online Data Analysis Framework for Cuore
00003  * 
00004  * A.Giachero created 28/05/07 - <Andrea.Giachero@ge.infn.it> 
00005  * 
00006  $ $Id: $
00007  * $Revision: $
00008  *
00009  * Class QGUIEleRegsCtr: Electronics Bit to Bit control 
00010  *
00011  */
00012 
00013 #ifndef _QGUI_MAIN_HH_
00014 #define _QGUI_MAIN_HH_
00015 
00016 
00017 // Apollo Includes
00018 #include "QGUIBaseFrame.hh"
00019 #include "QDaqCommonDefs.hh"
00020 
00021 // Root Includes
00022 #include "Rtypes.h"
00023 
00024 // C/C++ Includes
00025 #include <iostream> 
00026 #include <vector>
00027 #include <map>
00028 
00029 
00030 // Used Classes
00031 class QGUIDataCollector;    
00032 class QDaqClient;
00033 class TGTextButton;
00034 class TGTextEntry;
00035 class TGTextEdit; 
00036 class TTImer;
00037 class QGuiScope;
00038 class QGUIHistogramDisplay;
00039 
00040 
00041 class QGUIMain: public QGUIBaseFrame
00042 {
00043 
00044 public:
00045   
00046   // ctor
00047   QGUIMain(const TGWindow *p, size_t Width, size_t Height);
00048   
00049   // ctor with fixed dimensions
00050   QGUIMain(const TGWindow *p);
00051 
00052   // dtor
00053   virtual ~QGUIMain();
00054 
00055   //******************************** SIGNAL ****************************************
00056   
00057   // Close GUI
00058   void Close();
00059 
00060   // Start Run
00061   void StartRun();
00062 
00063   // Stop Run
00064   void StopRun();
00065   
00066   // Start Smart Scope
00067   void QScopeStart();
00068 
00069   // Smart Scope Closed
00070   void QScopeClosed();
00071 
00072   // open monitor window
00073   void OpenMonitorWindow();
00074    
00075   // close monitor window
00076   void MonitorWindowClosed();
00077 
00078   // Change Run Number
00079   void ChangeRunNumber();
00080 
00081   // Change Setting Basket
00082   void ChangeSettingBasket();
00083 
00084   // Clear Comments Field
00085   void ClearComments();
00086 
00087   // Reset all Fields
00088   void ResetFields();
00089 
00090   // If DAQ is Running Toggle Color
00091   void ToggleColor();
00092 
00093 
00094   //********************************************************************************
00095   
00096 protected:
00097 
00098 
00099 
00100 private:
00101     
00102 
00103   // Apollo Status
00104   enum QGUIStatus_t 
00105   {
00106     QGUI_WAITING_FOR_START =0,
00107     QGUI_WAITING_FOR_STOP  =1,  
00108     QGUI_UNKNOWN           =2
00109   };
00110 
00111   // Create Window
00112   void PopUp();
00113     
00114   // Set to zero all Pointers
00115   void Zeros();
00116 
00117   // Setting From DB and Socket Pointer Init
00118   bool Init();
00119 
00120   // Service Pointers
00121   QGUIDataCollector*   fStatus; // Selection Status
00122    //  QGUISocketInterface* fSocket; // GUI Socket client Interface
00123    QDaqClient* fSocket;
00124 
00125   QGuiScope* fScope;  // Smart Scope
00126   QGUIHistogramDisplay *fHistoDisplay; // online monitor histograms window
00127 
00128   //********************************* PRIVATE VARIABLES *****************************************
00129 
00130   // GUI version
00131   std::string fVersion;
00132 
00133   // GUI Status
00134   QGUIStatus_t fGUIStatus;
00135 
00136   // Timer
00137   TTimer *fTimer;
00138 
00139   // Apollo Status
00140   
00141 
00142   // Frames Pointers
00143   TGHorizontalFrame* fHTopFrame;   // Top Frame
00144   TGHorizontalFrame* fHBotFrame;   // Bottom Frame
00145   TGVerticalFrame*   fVBtnFrame;   // Buttons Frame
00146   TGVerticalFrame*   fVRunFrame;   // Run Controller Frame
00147   TGHorizontalFrame* fHRunNumb;    // Run Number Frame
00148   
00149   TGVerticalFrame*   fVBasket;     // Settin Basket Main Frame
00150   TGHorizontalFrame* fHSetting;    // Setting Basket Frame
00151   TGHorizontalFrame* fHSName;      // Setting Basket Name Frame
00152   TGVerticalFrame*   fVLabel;      // Label Name
00153   TGVerticalFrame*   fVText;       // Text Name
00154   
00155   TGHorizontalFrame* fHBottom;
00156   TGVerticalFrame*   fVRight;      // Right Frame 
00157   TGVerticalFrame*   fVLeft;       // Left Frame 
00158 
00159   // Buttons Pointer
00160   TGTextButton*  fCfgBtn;       // Configure Run 
00161   TGTextButton*  fStartBtn;     // Start Run
00162   TGTextButton*  fStopBtn;      // Stop  Run
00163   TGTextButton*  fScopeBtn;     // Start QScope
00164   TGTextButton*  fHistoBtn;     // Open monitor window
00165   TGTextButton*  fExitBtn;      // Exit and Close
00166   TGTextButton*  fRunNumbBtn;   // Change Run Number
00167   TGTextButton*  fSettingBtn;   // Change Setting Basket
00168   TGTextButton*  fResetBtn;     // Reset Fields
00169   
00170   // Status Group
00171   TGGroupFrame*      fStatusGroup;  // Status Group
00172   
00173   // Text Entries
00174   TGTextEntry*   fTxtNumber;    // Run Number Value
00175   TGTextEntry*   fTxtSetting;   // Setting Basket Value
00176   TGTextEntry*   fTxtSName;     // Setting Basket Name
00177   TGTextEntry*   fTxtDAQStatus; // Setting Basket Name
00178   TGTextEntry*   fTxtGUIStatus; // Setting Basket Name
00179   
00180   // Logger Group and Logger
00181   TGGroupFrame*      fLogGroup;      // Logger Group
00182   TGTextView*        fLogger;        // Logger
00183 
00184   // Text Editor and Editor Group
00185   TGGroupFrame*      fEdtGroup;     // Editor Group
00186   TGHorizontalFrame* fHEdtFrame;    // Editor Frame
00187   TGHorizontalFrame* fHClrFrame;    // Editor Frame
00188   TGTextEdit*        fEdtComms;     // Editor
00189   TGTextButton*      fClrBtn;       // Editor Clear Button 
00190   
00191   
00192 
00193 
00194   //*********************************************************************************************
00195 
00196 
00197 
00198 
00199 
00200   //****************************** NOT GRAPHICAL FUNCTIONS ***************************************
00201   
00202   // Get Current Apollo Status
00203    QDaqCommonDefs::QDaqState GetApolloStatus();
00204 
00205   // Set/Get Current GUI Status
00206   void SetGUIStatus(QGUIStatus_t qGui);
00207   inline const QGUIStatus_t GetGUIStatus() const {return fGUIStatus;}
00208 
00209   // Update GUI Status
00210   void UpdateGUIStatus();
00211   
00212   // Build Window Names
00213   void BuildNames();
00214 
00215   // Set/Get GUI Version
00216   inline void SetVersion(const std::string& qVersion) {fVersion=qVersion;return;}
00217   inline const std::string& GetVersion() const {return fVersion;}
00218 
00219   // Get Comments from Comments Field
00220   std::string GetComments();
00221 
00222 
00223   // Set Message on Logger
00224   void SetMessage(TGTextView* qLog, const std::string& qMsg, bool without);
00225   void SetMessage(TGTextView* qLog, const std::string& qMsg) {return SetMessage(qLog,qMsg,false);}
00226 
00227   
00228   // Start Timer
00229   void StartTimer();
00230 
00231   // Stop Timer
00232   void StopTimer();
00233 
00234   //*********************************************************************************************
00235 
00236 
00237 
00238 
00239   
00240   //******************************** GRAPHICAL FUNCTIONS ****************************************
00241   
00242   // Create all GUI Frames
00243   void CreateFrames();
00244 
00245   // Create Buttons Frame
00246   void CreateButtonsFrame();
00247 
00248   // Create Run Control Frame
00249   void CreateRunControlFrame();
00250 
00251   // Create Logger Frame
00252   void CreateLoggerFrame();
00253   
00254   // Add Run Control Buttons
00255   void AddButtons(TGVerticalFrame* qWhere);
00256 
00257   // Add Comments Editor
00258   void AddCommentsEditor(TGVerticalFrame* qWhere, const std::string& qFunctionName);
00259 
00260   // Add GUI status Wigets
00261   void AddGUIStatusDisplay(TGVerticalFrame* qWhere);
00262 
00263   // Create Display Widget Groups (with Button)
00264   void CreateDisplay(TGHorizontalFrame* qWhere, const std::string& qLabel, TGTextEntry* &qText, 
00265                      TGTextButton* &qBtn, const std::string& qFunctionName);
00266  
00267   // Create Display Widget Groups (without Button)
00268   void CreateDisplay(TGHorizontalFrame* qWhere, const std::string& qLabel, TGTextEntry* &qText);
00269 
00270   //*********************************************************************************************
00271 
00272   
00273 
00274   
00275   // To integrate QEleRegsCtrl class into the ROOT system
00276   ClassDef(QGUIMain,0)
00277 
00278 };
00279 
00280 #endif // _QGUI_MAIN_HH_

Generated on Tue Nov 16 10:49:55 2010 for CUORE Software by  doxygen 1.5.6