File indexing completed on 2024-04-28 05:31:37

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 #include "processcore_export.h"
0013 
0014 namespace KSysGuard
0015 {
0016 class ExtendedProcesses;
0017 class ProcessAttribute;
0018 
0019 /**
0020  * Presents a list of available attributes that can be
0021  * enabled on a ProceessDataModel
0022  */
0023 class PROCESSCORE_EXPORT ProcessAttributeModel : public QAbstractListModel
0024 {
0025     Q_OBJECT
0026 public:
0027     enum class Role {
0028         Name = Qt::DisplayRole, /// Human readable translated name of the attribute
0029         Id = Qt::UserRole, /// Computer readable ID of the attribute
0030         ShortName = Qt::UserRole + 1, /// A shorter human readable translated name of the attribute
0031         Description, /// A longer, sentence-based description of the attribute
0032         Unit, /// The unit, of type KSysGuard::Unit
0033         Minimum, /// Smallest value this attribute can be in normal situations. A hint for graphing utilities
0034         Maximum, /// Largest value this attribute can be in normal situations. A hint for graphing utilities
0035     };
0036     Q_ENUM(Role)
0037 
0038     ProcessAttributeModel(const QList<ProcessAttribute *> &attributes, QObject *parent = nullptr);
0039     ~ProcessAttributeModel() override;
0040 
0041     int rowCount(const QModelIndex &parent) const override;
0042     QVariant data(const QModelIndex &index, int role) const override;
0043     QHash<int, QByteArray> roleNames() const override;
0044 
0045 private:
0046     class Private;
0047     QScopedPointer<Private> d;
0048 };
0049 
0050 }