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:
00038 msgViewerDlg(std::string const& conf, QDialog* parent = 0);
00039
00040 virtual ~msgViewerDlg();
00041
00042
00043 public slots:
00044
00046 void pause();
00047
00049 void exit();
00050
00052 void clear();
00053
00055 void shortMode();
00056
00058 void changeSeverity(int sev);
00059
00060 protected:
00065 void closeEvent(QCloseEvent* event);
00066
00067 private slots:
00068
00069 void onNewMsg(qt_mf_msg const& mfmsg);
00070
00071 void setFilter();
00072
00073 void renderMode();
00074
00075 void setSevError();
00076
00077 void setSevWarning();
00078
00079 void setSevInfo();
00080
00081 void setSevDebug();
00082
00083 void searchMsg();
00084
00085 void searchClear();
00086
00087 void setSuppression(QAction* act);
00088
00089 void setThrottling(QAction* act);
00090
00091 void tabWidgetCurrentChanged(int newTab);
00092
00093 void tabCloseRequested(int tabIndex);
00094
00095
00096
00097 private:
00098
00099
00100 void displayMsg(int display);
00101
00102 void UpdateTextAreaDisplay(QString text, QTextEdit* widget);
00103
00104 void updateDisplays();
00105
00106
00107 bool msg_throttled(qt_mf_msg const& mfmsg);
00108
00109 unsigned int update_index(msgs_t::iterator it);
00110
00111
00112
00113
00114 template <typename M>
00115 bool updateList(QListWidget* lw, M const& map);
00116
00117 void displayMsg(msgs_t::const_iterator it, int display);
00118
00119 void readSettings();
00120
00121 void writeSettings();
00122
00123 void parseConf(fhicl::ParameterSet const& conf);
00124
00125 QStringList toQStringList(QList<QListWidgetItem *> in);
00126
00127 msg_iters_t list_intersect(msg_iters_t const& l1, msg_iters_t const& l2);
00128
00129
00130
00131 private:
00132 bool updating;
00133 bool paused;
00134 bool shortMode_;
00135
00136
00137 int nMsgs;
00138 int nSupMsgs;
00139 int nThrMsgs;
00140 int nFilters;
00141
00142
00143 bool simpleRender;
00144
00145
00146 sev_code_t sevThresh;
00147
00148
00149 std::vector<suppress> e_sup_host;
00150 std::vector<suppress> e_sup_app;
00151 std::vector<suppress> e_sup_cat;
00152
00153
00154 std::vector<throttle> e_thr_host;
00155 std::vector<throttle> e_thr_app;
00156 std::vector<throttle> e_thr_cat;
00157
00158
00159 QString searchStr;
00160
00161
00162 msgs_t msg_pool_;
00163
00164
00165 msg_iters_map_t host_msgs_;
00166 msg_iters_map_t cat_msgs_;
00167 msg_iters_map_t app_msgs_;
00168
00169
00170 QMenu* sup_menu;
00171 QMenu* thr_menu;
00172
00173
00174 mfviewer::ReceiverManager receivers_;
00175
00176 struct MsgFilterDisplay
00177 {
00178 int nDisplayMsgs;
00179 msg_iters_t msgs;
00180 QStringList hostFilter;
00181 QStringList appFilter;
00182 QStringList catFilter;
00183 QTextEdit* txtDisplay;
00184 };
00185 std::vector<MsgFilterDisplay> msgFilters_;
00186 };
00187
00188 enum list_mask_t
00189 {
00190 LIST_APP = 0x01,
00191 LIST_CAT = 0x02,
00192 LIST_HOST = 0x04
00193 };
00194
00195 #endif