level_panel.cpp
Go to the documentation of this file.
1 
29 
30 namespace log_view {
31 
33  wattron(window_, A_REVERSE);
34  wattron(window_, A_BOLD);
35  std::string clear(width_, ' ');
36  mvwprintw(window_, 0, 0, clear.c_str());
37  mvwprintw(window_, 0, 0, " debug info warn error fatal all nodes");
38  wattroff(window_, A_BOLD);
39  mvwprintw(window_, 0, width_ - 17, "CTRL+h: view help");
40  wattroff(window_, A_REVERSE);
41 
42  wattron(window_, COLOR_PAIR(CP_DEFAULT_GREY));
43  if (!filter_.getDebugLevel()) {
44  mvwprintw(window_, 0, 0, " debug ");
45  }
46  if (!filter_.getInfoLevel()) {
47  mvwprintw(window_, 0, 7, " info ");
48  }
49  if (!filter_.getWarnLevel()) {
50  mvwprintw(window_, 0, 13, " warn ");
51  }
52  if (!filter_.getErrorLevel()) {
53  mvwprintw(window_, 0, 19, " error ");
54  }
55  if (!filter_.getFatalLevel()) {
56  mvwprintw(window_, 0, 26, " fatal ");
57  }
59  mvwprintw(window_, 0, 37, " all nodes ");
60  }
61  wattroff(window_, COLOR_PAIR(CP_DEFAULT_GREY));
62 }
63 
64 bool LevelPanel::handleMouse(const MEVENT& event) {
65  if (hidden() || !encloses(event.y, event.x)) {
66  return false;
67  }
68 
69  if (event.bstate & BUTTON1_PRESSED) {
70  if (event.x < 7) {
71  toggleDebug();
72  }
73  else if (event.x < 13) {
74  toggleInfo();
75  }
76  else if (event.x < 19) {
77  toggleWarn();
78  }
79  else if (event.x < 26) {
80  toggleError();
81  }
82  else if (event.x < 33) {
83  toggleFatal();
84  }
85  else if (event.x > 36 && event.x < 48) {
87  }
88  }
89  return true;
90 }
91 
94  refresh();
95 }
96 
99  refresh();
100 }
101 
104  refresh();
105 }
106 
109  refresh();
110 }
111 
114  refresh();
115 }
116 
119  refresh();
120 }
121 
122 } // namespace log_view
bool getInfoLevel() const
Definition: log_filter.h:61
virtual bool encloses(int y, int x)
bool getWarnLevel() const
Definition: log_filter.h:62
virtual void toggleError()
void setDebugLevel(bool enable)
Definition: log_filter.cpp:74
void setEnableNodeFilter(bool enable)
Definition: log_filter.cpp:109
void setErrorLevel(bool enable)
Definition: log_filter.cpp:95
void setInfoLevel(bool enable)
Definition: log_filter.cpp:81
bool getErrorLevel() const
Definition: log_filter.h:63
virtual void refresh()
Definition: level_panel.cpp:32
virtual void toggleWarn()
virtual void toggleFatal()
virtual bool hidden() const
virtual void toggleAllNodes()
void setFatalLevel(bool enable)
Definition: log_filter.cpp:102
bool getFatalLevel() const
Definition: log_filter.h:64
bool getEnableNodeFilter() const
Definition: log_filter.h:65
LogFilter & filter_
Definition: level_panel.h:51
virtual void toggleInfo()
Definition: level_panel.cpp:97
virtual bool handleMouse(const MEVENT &event)
Definition: level_panel.cpp:64
bool getDebugLevel() const
Definition: log_filter.h:60
void setWarnLevel(bool enable)
Definition: log_filter.cpp:88
virtual void toggleDebug()
Definition: level_panel.cpp:92


log_view
Author(s): Marc Alban
autogenerated on Thu Mar 4 2021 03:21:52