Now we are able to search our effects based on their name

and their description
This commit is contained in:
Antonis Tsiapaliokas 2013-09-09 17:51:59 +03:00 committed by Martin Gräßlin
parent 853c817c80
commit afcc19815e
2 changed files with 3 additions and 11 deletions

View file

@ -223,15 +223,6 @@ int EffectModel::findRowByServiceName(const QString &serviceName)
return -1;
}
bool EffectModel::effectListContains(const QString &effectFilter, int source_row)
{
EffectData effect;
effect = m_effectsList.at(source_row);
return effect.name.contains(effectFilter, Qt::CaseInsensitive);
}
void EffectModel::syncEffectsToKWin()
{
QDBusInterface interface(QStringLiteral("org.kde.kwin"), QStringLiteral("/Effects"));
@ -348,7 +339,9 @@ bool EffectFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sour
return true;
}
if (m_effectModel->effectListContains(m_filter, source_row)) {
if (m_effectModel->data(index, EffectModel::NameRole).toString().contains(m_filter, Qt::CaseInsensitive)) {
return true;
} else if (m_effectModel->data(index, EffectModel::DescriptionRole).toString().contains(m_filter, Qt::CaseInsensitive)) {
return true;
}

View file

@ -71,7 +71,6 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
QString serviceName(const QString &effectName);
bool effectListContains(const QString &effectFilter, int source_row);
virtual QHash< int, QByteArray > roleNames() const override;