9 #include <QStandardItem>
12 #include "dependency.h"
21 static QList<QStandardItem*>
rootNode(std::string name, std::string type,
bool enabled,
bool inverted) {
22 QList<QStandardItem*> item;
23 item <<
new QStandardItem(QString::fromStdString(name))
24 <<
new QStandardItem(QString::fromStdString(type))
25 <<
new QStandardItem((inverted ?
"Exclude" :
"Include"));
26 item[0]->setCheckable(
true);
27 item[0]->setCheckState((enabled ? Qt::Checked : Qt::Unchecked));
28 item[0]->setEditable(
false);
29 item[1]->setEditable(
false);
30 item[2]->setEditable(
false);
38 static void empty_filter(QStandardItem& parent, std::string type) {
39 if(type.compare(
"regex") == 0) {
40 FilterModel::regex(parent);
41 }
else if(type.compare(
"dependency_degree") == 0) {
42 FilterModel::dependency_degree(parent);
43 }
else if(type.compare(
"run_block") == 0) {
44 FilterModel::run_block(parent);
45 }
else if(type.compare(
"lpm_ldm") == 0) {
46 FilterModel::lpm_ldm(parent, 0);
47 }
else if(type.compare(
"diff") == 0){
48 FilterModel::diff(parent);
52 static void diff(QStandardItem& parent, std::string type =
""){
53 QList<QStandardItem*> keyValue;
54 keyValue <<
new QStandardItem(
"Difference")
55 <<
new QStandardItem(QString::fromStdString(type));
57 keyValue.first()->setEditable(
false);
58 keyValue[0]->setSelectable(
false);
59 keyValue[1]->setSelectable(
false);
60 parent.appendRow(keyValue);
63 static void regex(QStandardItem& parent, std::string pattern=
"") {
64 QList<QStandardItem*> keyValue;
65 keyValue <<
new QStandardItem(
"Regular Expression")
66 <<
new QStandardItem(QString::fromStdString(pattern));
68 keyValue.first()->setEditable(
false);
69 keyValue[0]->setSelectable(
false);
70 keyValue[1]->setSelectable(
false);
71 parent.appendRow(keyValue);
74 static void dependency_degree(QStandardItem& parent,
int min_degree=-1,
int max_degree=-1) {
75 QList<QStandardItem*> minValue;
76 minValue <<
new QStandardItem(
"Min Degree")
77 <<
new QStandardItem(QString::number(min_degree));
78 minValue.first()->setEditable(
false);
79 minValue[0]->setSelectable(
false);
80 minValue[1]->setSelectable(
false);
81 parent.appendRow(minValue);
83 QList<QStandardItem*> maxValue;
84 maxValue <<
new QStandardItem(
"Max Degree")
85 <<
new QStandardItem(QString::number(max_degree));
86 maxValue.first()->setEditable(
false);
87 maxValue[0]->setSelectable(
false);
88 maxValue[1]->setSelectable(
false);
89 parent.appendRow(maxValue);
92 template<
typename DepType>
93 static void lpm_ldm(QStandardItem& parent, DepType dep_type = GraphTool::UNDEFINED) {
94 QList<QStandardItem*> keyValue;
95 keyValue <<
new QStandardItem(
"Type");
96 if(dep_type == GraphTool::LPM) {
97 keyValue <<
new QStandardItem(
"LPM");
99 else if(dep_type == GraphTool::LDM) {
100 keyValue <<
new QStandardItem(
"LDM");
102 else if(dep_type == GraphTool::LDM_LPM) {
103 keyValue <<
new QStandardItem(
"Both");
106 keyValue <<
new QStandardItem(
"Undefined");
109 keyValue.first()->setEditable(
false);
110 keyValue[0]->setSelectable(
false);
111 keyValue[1]->setSelectable(
false);
112 parent.appendRow(keyValue);
115 static void run_block(QStandardItem& parent, std::string query_string=
"") {
116 QList<QStandardItem*> keyValue;
117 keyValue <<
new QStandardItem(
"Query String")
118 <<
new QStandardItem(QString::fromStdString(query_string));
120 keyValue.first()->setEditable(
false);
121 keyValue[0]->setSelectable(
false);
122 keyValue[1]->setSelectable(
false);
123 parent.appendRow(keyValue);
129 static void formatting_properties(QStandardItem& parent, std::string opacityStr=
"255", std::string colorStr=
"red",
bool hide=
false) {
130 QList<QStandardItem*> opacity;
131 opacity <<
new QStandardItem(
"Opacity")
132 <<
new QStandardItem(QString::fromStdString(opacityStr));
133 opacity.first()->setEditable(
false);
134 opacity[0]->setSelectable(
false);
135 opacity[1]->setSelectable(
false);
136 parent.appendRow(opacity);
138 QList<QStandardItem*> color;
139 color <<
new QStandardItem(
"Color")
140 <<
new QStandardItem(QString::fromStdString(colorStr));
141 color.first()->setEditable(
false);
142 color[0]->setSelectable(
false);
143 color[1]->setSelectable(
false);
144 parent.appendRow(color);
146 QList<QStandardItem*> hidden;
147 hidden <<
new QStandardItem(
"Hide");
149 hidden <<
new QStandardItem(
"Yes");
151 hidden <<
new QStandardItem(
"No");
152 hidden.first()->setEditable(
false);
153 hidden[0]->setSelectable(
false);
154 hidden[1]->setSelectable(
false);
155 parent.appendRow(hidden);
162 std::map<std::string, std::string> ret;
163 ret[
"Dependency Degree"] =
"dependency_degree";
164 ret[
"LPM/LDM"] =
"lpm_ldm";
165 ret[
"Run block"] =
"run_block";
166 ret[
"Regular Expression"] =
"regex";
167 ret[
"Difference"] =
"diff";
static QList< QStandardItem * > rootNode(std::string name, std::string type, bool enabled, bool inverted)
Definition: filter_model.h:21
static std::map< std::string, std::string > filter_types()
Definition: filter_model.h:161
static void empty_filter(QStandardItem &parent, std::string type)
Definition: filter_model.h:38
static void formatting_properties(QStandardItem &parent, std::string opacityStr="255", std::string colorStr="red", bool hide=false)
Definition: filter_model.h:129
Definition: filter_model.h:15