File indexing completed on 2024-04-28 16:49:54

0001 /*
0002     SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
0003     SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QAbstractListModel>
0011 
0012 namespace KSysGuard
0013 {
0014 class ExtendedProcesses;
0015 class ProcessAttribute;
0016 
0017 /**
0018  * Presents a list of available attributes that can be
0019  * enabled on a ProceessDataModel
0020  */
0021 class Q_DECL_EXPORT ProcessAttributeModel : public QAbstractListModel
0022 {
0023     Q_OBJECT
0024 public:
0025     enum class Role {
0026         Name = Qt::DisplayRole, /// Human readable translated name of the attribute
0027         Id = Qt::UserRole, /// Computer readable ID of the attribute
0028         ShortName = Qt::UserRole + 1, /// A shorter human readable translated name of the attribute
0029         Description, /// A longer, sentence-based description of the attribute
0030         Unit, /// The unit, of type KSysGuard::Unit
0031         Minimum, /// Smallest value this attribute can be in normal situations. A hint for graphing utilities
0032         Maximum, /// Largest value this attribute can be in normal situations. A hint for graphing utilities
0033     };
0034     Q_ENUM(Role)
0035 
0036     ProcessAttributeModel(const QVector<ProcessAttribute *> &attributes, QObject *parent = nullptr);
0037     ~ProcessAttributeModel() override;
0038 
0039     int rowCount(const QModelIndex &parent) const override;
0040     QVariant data(const QModelIndex &index, int role) const override;
0041     QHash<int, QByteArray> roleNames() const override;
0042 
0043 private:
0044     class Private;
0045     QScopedPointer<Private> d;
0046 };
0047 
0048 }