graph_analysis
FilterManager.hpp
Go to the documentation of this file.
1 #ifndef FILTERMANAGER_HPP
2 #define FILTERMANAGER_HPP
3 
4 #include <vector>
5 #include <string>
6 #include <QCheckBox>
7 #include <QGraphicsView>
8 
9 #include "FilterItem.hpp"
10 
11 namespace graph_analysis {
12 namespace gui {
13 
21 class FilterManager : public QGraphicsView
22 {
23  Q_OBJECT
24 public:
26  typedef std::vector<FilterItem*> Filters;
28  typedef std::vector<QCheckBox*> CheckBoxes;
30  typedef std::map<QCheckBox*, FilterItem::filter_index_t> CheckBoxIndexMap;
31 
37  FilterManager(QWidget *checkBoxGrid, QWidget *parent = NULL);
38 
40  bool getItemSelected(void) { return mItemSelected; }
42  void setItemSelected(bool itemSelected) { mItemSelected = itemSelected; }
43 
45  FilterItem* getSelectedItem(void) { return mpSelectedItem; }
47  void setSelectedItem(FilterItem *selectedItem) { mpSelectedItem = selectedItem; }
48 
50  int filterCount() { return mFilters.size(); }
51 
57  void addFilter(const std::string& label, bool enable);
59  void addFilter(const std::string& label);
61  unsigned int createFilter(const std::string& label);
62 
66  void dieOnIndex(FilterItem::filter_index_t index, const std::string& caller = std::string());
73  void updateToolTip(FilterItem::filter_index_t index, bool witness, bool refresh = true);
79  void refreshToolTip(FilterItem::filter_index_t index, bool refresh = false);
81  void renameFilter(FilterItem::filter_index_t index, QString regexp);
83  void renameFilter(FilterItem *item, QString regexp);
87  void removeFilter(FilterItem *item);
89  void refreshView(bool updatesStatusBar = true);
91  Filters getFilters(void) { return mFilters; }
92 
93 public slots:
95  void addFilter();
97  void swapFilters();
99  void renameFilter();
101  void removeFilter();
103  void removeFilters();
105  void renameSelectedFilter();
107  void removeSelectedFilter();
109  void updateToolTip(int state);
111  void showContextMenu(const QPoint& pos);
112 private:
114  Filters mFilters;
116  QWidget *mpCheckBoxGrid;
118  CheckBoxes mCheckBoxes;
120  CheckBoxIndexMap mCheckBoxIndexMap;
122  FilterItem *mpSelectedItem;
124  bool mItemSelected;
125 };
126 
127 } // end namespace gui
128 } // end namespace graph_analysis
129 
130 #endif // FILTERMANAGER_HPP
FilterManager(QWidget *checkBoxGrid, QWidget *parent=NULL)
constructor
Definition: FilterManager.cpp:22
void refreshToolTip(FilterItem::filter_index_t index, bool refresh=false)
synchronizes the GUI toolTip-s with the current text regex information held at index &#39;index&#39; ...
Definition: FilterManager.cpp:151
void refreshView(bool updatesStatusBar=true)
orders the layers view to refresh; when updatesStatusBar is unset, this takes place silently (the sta...
Definition: FilterManager.cpp:86
widget to manage all graphical custom regexp filter items in a common scene under behavioral restrict...
Definition: FilterManager.hpp:21
void setItemSelected(bool itemSelected)
setter method for the boolean item-selection witness;
Definition: FilterManager.hpp:42
void dieOnIndex(FilterItem::filter_index_t index, const std::string &caller=std::string())
error checking method: tests for the &#39;caller&#39; whether the provided filter &#39;index&#39; is out of bounds ...
Definition: FilterManager.cpp:169
std::map< QCheckBox *, FilterItem::filter_index_t > CheckBoxIndexMap
container datatype for mapping each registered check box to its registration index (i...
Definition: FilterManager.hpp:30
void updateToolTip(FilterItem::filter_index_t index, bool witness, bool refresh=true)
synchronizes the GUI toolTip-s with the current text regex information held at index &#39;index&#39; ...
Definition: FilterManager.cpp:159
void addFilter()
listener for the filter adding button in the property dialog
Definition: FilterManager.cpp:240
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
void removeFilters()
listener for the all-filters removing button in the property dialog
Definition: FilterManager.cpp:283
void showContextMenu(const QPoint &pos)
displays context menu (upon a right click in the scene)
Definition: FilterManager.cpp:45
bool getItemSelected(void)
getter method for the boolean item-selection witness; returns true when a filter item is being hover-...
Definition: FilterManager.hpp:40
void removeFilter()
listener for the filter removing button in the property dialog
Definition: FilterManager.cpp:361
FilterItem * getSelectedItem(void)
getter method for the currently selected filter item (i.e. currently being hovered over) ...
Definition: FilterManager.hpp:45
void setSelectedItem(FilterItem *selectedItem)
setter method for the currently selected filter item (i.e. currently being hovered over) ...
Definition: FilterManager.hpp:47
graphical custom regexp filter representation class; specific to FilterManager widget in the layers t...
Definition: FilterItem.hpp:26
void removeSelectedFilter()
listener for the selected filter removing action in the context menu
Definition: FilterManager.cpp:409
std::vector< FilterItem * > Filters
container datatype for an array of filter items
Definition: FilterManager.hpp:26
void renameSelectedFilter()
listener for the selected filter renaming action in the context menu
Definition: FilterManager.cpp:390
Filters getFilters(void)
getter method for the array of filters
Definition: FilterManager.hpp:91
unsigned int filter_index_t
datatype for the filters index counter
Definition: FilterItem.hpp:34
int filterCount()
returns the number of filters currently managed by the filter manager
Definition: FilterManager.hpp:50
unsigned int createFilter(const std::string &label)
creates a new filter item with the given &#39;label&#39; as text regex and its corresponding checkbox ...
Definition: FilterManager.cpp:103
std::vector< QCheckBox * > CheckBoxes
container datatype for an array of checkboxes handles
Definition: FilterManager.hpp:28
void renameFilter()
listener for the filter renaming button in the property dialog
Definition: FilterManager.cpp:333
void swapFilters()
listener for the filters swapping button in the property dialog
Definition: FilterManager.cpp:252