9#include "AbstractStringFilter.h"
16#include "ControlMeasure.h"
17#include "ControlPoint.h"
21 AbstractStringFilter::AbstractStringFilter(
22 AbstractFilter::FilterEffectivenessFlag flag,
23 int minimumForSuccess) : AbstractFilter(flag, minimumForSuccess) {
28 AbstractStringFilter::AbstractStringFilter(
29 const AbstractStringFilter &other) : AbstractFilter(other) {
33 m_lineEdit->setText(other.m_lineEdit->text());
38 AbstractStringFilter::~AbstractStringFilter() {
40 delete m_lineEditText;
41 m_lineEditText = NULL;
46 void AbstractStringFilter::nullify() {
48 m_lineEditText = NULL;
52 void AbstractStringFilter::createWidget() {
53 m_lineEditText =
new QString;
55 m_lineEdit =
new QLineEdit;
56 m_lineEdit->setMinimumWidth(250);
57 connect(m_lineEdit, SIGNAL(textChanged(QString)),
58 this, SLOT(updateLineEditText(QString)));
59 connect(m_lineEdit, SIGNAL(textChanged(QString)),
60 this, SIGNAL(filterChanged()));
62 QHBoxLayout *layout =
new QHBoxLayout;
63 QMargins margins = layout->contentsMargins();
66 layout->setContentsMargins(margins);
67 layout->addWidget(m_lineEdit);
70 getMainLayout()->addLayout(layout);
74 bool AbstractStringFilter::evaluate(QString str)
const {
75 bool evaluation =
true;
78 QString text = *m_lineEditText;
80 if (text.size() >= 1) {
81 bool match = str.contains(text, Qt::CaseInsensitive);
84 evaluation = !(inclusive() ^ match);
91 QString AbstractStringFilter::descriptionSuffix()
const {
95 suffix +=
"containing \"";
97 suffix +=
"not containing \"";
99 suffix += *m_lineEditText;
106 void AbstractStringFilter::updateLineEditText(QString newText) {
107 *m_lineEditText = newText;
This is free and unencumbered software released into the public domain.