00001 00002 #ifndef _Q_GUI_PULSER_MAIN_HH_ 00003 #define _Q_GUI_PULSER_MAIN_HH_ 00004 00005 #include <TGFrame.h> 00006 00007 #include "QGuiUtils.hh" 00008 00009 class QGPBoardFrame; 00010 class QGPTimingFrame; 00011 class QGPButtonsFrame; 00012 class QPulserGuiInterface; 00013 class TThread; 00014 class TGTab; 00015 class QVdt; 00016 class QGuiPulseNotifier; 00017 00018 #include <string> 00019 #include <map> 00020 00028 class QGuiPulserMain: public TGMainFrame 00029 { 00030 public: 00031 QGuiPulserMain(); 00032 ~QGuiPulserMain(); 00033 00034 void CleanExit(); 00035 00036 void Closed() {Emit("Closed()"); } //*SIGNAL* 00037 00039 UInt_t GetNumEnabledChannels() const { return fNumEnabledChannels; } 00040 00048 void UpdateNumEnabledChannels(); 00049 00055 void CheckPeriod(); 00060 void CheckPeriodRange(); 00061 00066 void CheckDelay(); 00067 00072 void LoadFromFile(); 00073 00078 void WriteConfigFile(); 00079 00081 void PromptForBasket(); 00082 00084 void StartStop(); 00085 00087 void FireSingleShot(Long_t board, Long_t ch); 00088 00090 void Blink(Long_t); 00091 00092 private: 00093 00095 std::map<unsigned int, QGPBoardFrame*> fBoardFrame; 00096 TGTab *fTabFrame; 00097 QGPTimingFrame* fTimingFrame; 00098 QGPButtonsFrame* fButtonsFrame; 00099 00101 QGuiPulseNotifier *fNotifier; 00102 00104 TThread* fThread; 00105 QPulserGuiInterface *fHandler; 00106 00107 UInt_t fNumEnabledChannels; 00108 00109 size_t fSettingsBasket; 00110 const int kCfgVersion; 00111 std::string fLastCfgName; 00112 std::map<std::string, QVdt> fRcMap; 00113 00118 struct PulserCfg_t { 00119 Bool_t enable; 00120 UInt_t amplitude; 00121 }; 00122 00124 void CreateWindow(); 00125 00127 static void* MakeThread(void* arg); 00128 00133 void Init(); 00134 00136 void StartPulserController(); 00138 void StopPulserController(); 00139 00140 void SetGuiStatus(QGuiStatus_t status); 00141 00142 void LockBoards(Bool_t doLock); 00143 00144 void Lock(); 00145 void Unlock(); 00146 00148 void UpdateSettingsBasket(); 00149 00151 void UpdateRcFile() const; 00152 00154 void ReadRcFile(); 00155 00161 void ProcessRcMap(); 00162 00164 void SetSettingsBasket(size_t basket); 00165 00167 Bool_t LoadFromFile(const std::string& filename); 00168 00170 Bool_t WriteConfigFile(const std::string& filename); 00171 00172 const char* RcFileName() const; 00173 00174 ClassDef(QGuiPulserMain,0) 00175 }; 00176 00177 #endif