File indexing completed on 2024-02-25 16:44:40

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QSortFilterProxyModel>
0011 
0012 class LIBRUQOLACORE_EXPORT StatusModelFilterProxyModel : public QSortFilterProxyModel
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit StatusModelFilterProxyModel(QObject *parent = nullptr);
0017     ~StatusModelFilterProxyModel() override;
0018 
0019     [[nodiscard]] bool useOnlyStandardStatus() const;
0020     void setUseOnlyStandardStatus(bool useOnlyStandardStatus);
0021 
0022     [[nodiscard]] bool allowOfflineSupport() const;
0023     void setAllowOfflineSupport(bool newAllowOfflineSupport);
0024 
0025 protected:
0026     bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
0027     bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
0028 
0029 private:
0030     bool mUseOnlyStandardStatus = false;
0031     bool mAllowOfflineSupport = true;
0032 };