$treeview $search $mathjax $extrastylesheet
artdaq_mfextensions
v1_03_03
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef MSGVIEWERDLG_H 00002 #define MSGVIEWERDLG_H 00003 00004 #include "mfextensions/Binaries/ReceiverManager.hh" 00005 #include "mfextensions/Extensions/suppress.hh" 00006 #include "mfextensions/Extensions/throttle.hh" 00007 #include "mfextensions/Receivers/qt_mf_msg.hh" 00008 #include "ui_msgviewerdlgui.h" 00009 00010 #include <QtCore/QMutex> 00011 #include <QtCore/QTimer> 00012 00013 #include <boost/regex.hpp> 00014 00015 #include <list> 00016 #include <map> 00017 #include <string> 00018 #include <vector> 00019 00020 namespace fhicl { 00021 class ParameterSet; 00022 } 00023 00027 class msgViewerDlg : public QDialog, private Ui::MsgViewerDlg { 00028 Q_OBJECT 00029 00030 public: 00036 msgViewerDlg(std::string const& conf, QDialog* parent = 0); 00037 00038 virtual ~msgViewerDlg(); 00039 00040 public slots: 00041 00043 void pause(); 00044 00046 void exit(); 00047 00049 void clear(); 00050 00052 void shortMode(); 00053 00055 void changeSeverity(int sev); 00056 00057 protected: 00062 void closeEvent(QCloseEvent* event); 00063 00064 private slots: 00065 00066 void onNewMsg(qt_mf_msg const& mfmsg); 00067 00068 void setFilter(); 00069 00070 void renderMode(); 00071 00072 void setSevError(); 00073 00074 void setSevWarning(); 00075 00076 void setSevInfo(); 00077 00078 void setSevDebug(); 00079 00080 void searchMsg(); 00081 00082 void searchClear(); 00083 00084 void setSuppression(QAction* act); 00085 00086 void setThrottling(QAction* act); 00087 00088 void tabWidgetCurrentChanged(int newTab); 00089 00090 void tabCloseRequested(int tabIndex); 00091 00092 //--------------------------------------------------------------------------- 00093 00094 private: 00095 // Display all messages stored in the buffer 00096 void displayMsg(int display); 00097 00098 void UpdateTextAreaDisplay(QString text, QTextEdit* widget); 00099 00100 void updateDisplays(); 00101 00102 void removeMsg(msgs_t::iterator it); 00103 00104 // test if the message is suppressed or throttled 00105 bool msg_throttled(qt_mf_msg const& mfmsg); 00106 00107 unsigned int update_index(msgs_t::iterator it); 00108 00109 // Update the list. Returns true if there's a change in the selection 00110 // before and after the update. e.g., the selected entry has been deleted 00111 // during the process of updateMap(); otherwise it returns a false. 00112 template <typename M> 00113 bool updateList(QListWidget* lw, M const& map); 00114 00115 void displayMsg(msgs_t::const_iterator it, int display); 00116 00117 void readSettings(); 00118 00119 void writeSettings(); 00120 00121 void parseConf(fhicl::ParameterSet const& conf); 00122 00123 QStringList toQStringList(QList<QListWidgetItem*> in); 00124 00125 msg_iters_t list_intersect(msg_iters_t const& l1, msg_iters_t const& l2); 00126 00127 //--------------------------------------------------------------------------- 00128 00129 private: 00130 bool paused; 00131 bool shortMode_; 00132 00133 // # of received messages 00134 int nMsgs; 00135 int nSupMsgs; // suppressed msgs 00136 int nThrMsgs; // throttled msgs 00137 int nFilters; 00138 size_t maxMsgs; // Maximum number of messages to store 00139 size_t maxDeletedMsgs; // Maximum number of deleted messages to display 00140 int nDeleted; 00141 00142 // Rendering messages in speed mode or full mode 00143 bool simpleRender; 00144 00145 // suppression regex 00146 std::vector<suppress> e_sup_host; 00147 std::vector<suppress> e_sup_app; 00148 std::vector<suppress> e_sup_cat; 00149 00150 // throttling regex 00151 std::vector<throttle> e_thr_host; 00152 std::vector<throttle> e_thr_app; 00153 std::vector<throttle> e_thr_cat; 00154 00155 // search string 00156 QString searchStr; 00157 00158 // msg pool storing the formatted text body 00159 msgs_t msg_pool_; 00160 00161 // map of a key to a list of msg iters 00162 msg_iters_map_t host_msgs_; 00163 msg_iters_map_t cat_msgs_; 00164 msg_iters_map_t app_msgs_; 00165 00166 // context menu for "suppression" and "throttling" button 00167 QMenu* sup_menu; 00168 QMenu* thr_menu; 00169 00170 // Receiver Plugin Manager 00171 mfviewer::ReceiverManager receivers_; 00172 00173 struct MsgFilterDisplay { 00174 int nDisplayMsgs; 00175 int nDisplayedDeletedMsgs; 00176 msg_iters_t msgs; 00177 QStringList hostFilter; 00178 QStringList appFilter; 00179 QStringList catFilter; 00180 QTextEdit* txtDisplay; 00181 00182 // severity threshold 00183 sev_code_t sevThresh; 00184 }; 00185 std::vector<MsgFilterDisplay> msgFilters_; 00186 00187 mutable std::mutex updating_mutex_; 00188 }; 00189 00190 enum list_mask_t { LIST_APP = 0x01, LIST_CAT = 0x02, LIST_HOST = 0x04 }; 00191 00192 #endif