00001 #ifndef MSGVIEWERDLG_H
00002 #define MSGVIEWERDLG_H
00003
00004 #include "ui_msgviewerdlgui.h"
00005 #include "mfextensions/Extensions/throttle.hh"
00006 #include "mfextensions/Extensions/suppress.hh"
00007 #include "mfextensions/Receivers/qt_mf_msg.hh"
00008 #include "mfextensions/Binaries/ReceiverManager.hh"
00009
00010 #include <QtCore/QTimer>
00011 #include <QtCore/QMutex>
00012
00013 #include <boost/regex.hpp>
00014
00015 #include <string>
00016 #include <vector>
00017 #include <map>
00018 #include <list>
00019
00020 namespace fhicl
00021 {
00022 class ParameterSet;
00023 }
00024
00028 class msgViewerDlg : public QDialog, private Ui::MsgViewerDlg
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 msgViewerDlg(std::string const& conf, QDialog* parent = 0);
00034
00035 virtual ~msgViewerDlg();
00036
00037
00038 public slots:
00039
00040 void pause();
00041
00042 void exit();
00043
00044 void clear();
00045
00046 void shortMode();
00047
00048 void changeSeverity(int sev);
00049
00050 protected:
00051 void closeEvent(QCloseEvent* event);
00052
00053 private slots:
00054
00055 void onNewMsg(qt_mf_msg const& mfmsg);
00056
00057 void setFilter();
00058
00059 void renderMode();
00060
00061 void setSevError();
00062
00063 void setSevWarning();
00064
00065 void setSevInfo();
00066
00067 void setSevDebug();
00068
00069 void searchMsg();
00070
00071 void searchClear();
00072
00073 void setSuppression(QAction* act);
00074
00075 void setThrottling(QAction* act);
00076
00077 void tabWidgetCurrentChanged(int newTab);
00078
00079 void tabCloseRequested(int tabIndex);
00080
00081
00082
00083 private:
00084
00085
00086 void displayMsg(int display);
00087
00088 void updateDisplays();
00089
00090
00091 bool msg_throttled(qt_mf_msg const& mfmsg);
00092
00093 unsigned int update_index(msgs_t::iterator it);
00094
00095
00096
00097
00098 template <typename M>
00099 bool updateList(QListWidget* lw, M const& map);
00100
00101 void displayMsg(msgs_t::const_iterator it, int display);
00102
00103 void readSettings();
00104
00105 void writeSettings();
00106
00107 void parseConf(fhicl::ParameterSet const& conf);
00108
00109 QStringList toQStringList(QList<QListWidgetItem *> in);
00110
00111 msg_iters_t list_intersect(msg_iters_t const& l1, msg_iters_t const& l2);
00112
00113
00114
00115 private:
00116 bool updating;
00117 bool paused;
00118 bool shortMode_;
00119
00120
00121 int nMsgs;
00122 int nSupMsgs;
00123 int nThrMsgs;
00124 int nFilters;
00125
00126
00127 bool simpleRender;
00128
00129
00130 sev_code_t sevThresh;
00131
00132
00133 std::vector<suppress> e_sup_host;
00134 std::vector<suppress> e_sup_app;
00135 std::vector<suppress> e_sup_cat;
00136
00137
00138 std::vector<throttle> e_thr_host;
00139 std::vector<throttle> e_thr_app;
00140 std::vector<throttle> e_thr_cat;
00141
00142
00143 QString searchStr;
00144
00145
00146 msgs_t msg_pool_;
00147
00148
00149 msg_iters_map_t host_msgs_;
00150 msg_iters_map_t cat_msgs_;
00151 msg_iters_map_t app_msgs_;
00152
00153
00154 QMenu* sup_menu;
00155 QMenu* thr_menu;
00156
00157
00158 mfviewer::ReceiverManager receivers_;
00159
00160 struct MsgFilterDisplay
00161 {
00162 int nDisplayMsgs;
00163 msg_iters_t msgs;
00164 QStringList hostFilter;
00165 QStringList appFilter;
00166 QStringList catFilter;
00167 QTextEdit* txtDisplay;
00168 };
00169 std::vector<MsgFilterDisplay> msgFilters_;
00170 };
00171
00172 enum list_mask_t
00173 {
00174 LIST_APP = 0x01,
00175 LIST_CAT = 0x02,
00176 LIST_HOST = 0x04
00177 };
00178
00179 #endif