1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-14 09:44:51 +01:00

Simplify return

This commit is contained in:
Jonas Kvinge 2021-08-25 02:58:54 +02:00
parent c1c34017e4
commit 75b6669371
2 changed files with 3 additions and 14 deletions

View File

@ -236,10 +236,7 @@ class OrFilter : public FilterTree {
~OrFilter() override { qDeleteAll(children_); }
virtual void add(FilterTree *child) { children_.append(child); }
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
if (std::any_of(children_.begin(), children_.end(), [row, parent, model](FilterTree *child) { return child->accept(row, parent, model); })) {
return true;
}
return false;
return std::any_of(children_.begin(), children_.end(), [row, parent, model](FilterTree *child) { return child->accept(row, parent, model); });
}
FilterType type() override { return Or; }
private:
@ -251,10 +248,7 @@ class AndFilter : public FilterTree {
~AndFilter() override { qDeleteAll(children_); }
virtual void add(FilterTree *child) { children_.append(child); }
bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const override {
if (std::any_of(children_.begin(), children_.end(), [row, parent, model](FilterTree *child) { return !child->accept(row, parent, model); })) {
return false;
}
return true;
return !std::any_of(children_.begin(), children_.end(), [row, parent, model](FilterTree *child) { return !child->accept(row, parent, model); });
}
FilterType type() override { return And; }
private:

View File

@ -56,12 +56,7 @@ class SmartPlaylistQueryWizardPlugin::SearchPage : public QWizardPage { // claz
if (ui_->type->currentIndex() == 2) { // All songs
return true;
}
if (std::any_of(terms_.begin(), terms_.end(), [](SmartPlaylistSearchTermWidget *widget) { return !widget->Term().is_valid(); })) {
return false;
}
return true;
return !std::any_of(terms_.begin(), terms_.end(), [](SmartPlaylistSearchTermWidget *widget) { return !widget->Term().is_valid(); });
}
QVBoxLayout *layout_;