Warning, file /plasma/libksysguard/processui/ProcessFilter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     KSysGuard, the KDE System Guard
0003 
0004     SPDX-FileCopyrightText: 1999, 2000 Chris Schlaeger <cs@kde.org>
0005     SPDX-FileCopyrightText: 2006 John Tapsell <john.tapsell@kdemail.net>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 
0009 */
0010 
0011 #ifndef PROCESSFILTER_H_
0012 #define PROCESSFILTER_H_
0013 
0014 #include <QObject>
0015 #include <QSortFilterProxyModel>
0016 
0017 class QModelIndex;
0018 
0019 #ifdef Q_OS_WIN
0020 // this workaround is needed to make krunner link under msvc
0021 // please keep it this way even if you port this library to have a _export.h header file
0022 #define KSYSGUARD_EXPORT
0023 #else
0024 #define KSYSGUARD_EXPORT Q_DECL_EXPORT
0025 #endif
0026 
0027 class KSYSGUARD_EXPORT ProcessFilter : public QSortFilterProxyModel
0028 {
0029     Q_OBJECT
0030     Q_ENUMS(State)
0031 
0032 public:
0033     enum State { AllProcesses = 0, AllProcessesInTreeForm, SystemProcesses, UserProcesses, OwnProcesses, ProgramsOnly };
0034     explicit ProcessFilter(QObject *parent = nullptr)
0035         : QSortFilterProxyModel(parent)
0036     {
0037         mFilter = AllProcesses;
0038     }
0039     ~ProcessFilter() override
0040     {
0041     }
0042     bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
0043     State filter() const
0044     {
0045         return mFilter;
0046     }
0047 
0048 public Q_SLOTS:
0049     void setFilter(State index);
0050 
0051 protected:
0052     bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
0053 
0054     State mFilter;
0055 };
0056 
0057 #endif