File indexing completed on 2024-05-12 05:06:16

0001 /*
0002     SPDX-FileCopyrightText: 2020 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SCHEDULEPROXYMODEL_H
0007 #define SCHEDULEPROXYMODEL_H
0008 
0009 #include "kmm_models_export.h"
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 #include <QSortFilterProxyModel>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 #include <QSortFilterProxyModel>
0023 
0024 /**
0025   * A proxy model for the schedules view to filter and sort schedule items
0026   *
0027   * @author Thomas Baumgart
0028   *
0029   */
0030 
0031 class ScheduleProxyModelPrivate;
0032 class KMM_MODELS_EXPORT ScheduleProxyModel : public QSortFilterProxyModel
0033 {
0034     Q_OBJECT
0035     Q_DISABLE_COPY(ScheduleProxyModel)
0036 
0037 public:
0038     explicit ScheduleProxyModel (QObject *parent = nullptr);
0039     virtual ~ScheduleProxyModel ();
0040 
0041     void setHideFinishedSchedules(bool hide);
0042 
0043 protected:
0044     virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
0045     virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
0046 
0047 protected:
0048     QScopedPointer<ScheduleProxyModelPrivate> d;
0049 };
0050 
0051 #undef QSortFilterProxyModel
0052 
0053 #endif // SCHEDULEPROXYMODEL_H