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

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1