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