File indexing completed on 2024-11-17 04:55:38

0001 /*
0002  *   SPDX-FileCopyrightText: 2022 Suhaas Joshi <joshiesuhaas0@gmail.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QAbstractListModel>
0010 #include <QString>
0011 #include <QVariant>
0012 #include <QVector>
0013 
0014 class FlatpakPermission
0015 {
0016 public:
0017     FlatpakPermission(QString brief, QString description, QString icon);
0018     QString icon() const;
0019     QString brief() const;
0020     QString description() const;
0021 
0022 private:
0023     QString m_brief;
0024     QString m_description;
0025     QString m_icon;
0026 };
0027 
0028 class FlatpakPermissionsModel : public QAbstractListModel
0029 {
0030 public:
0031     FlatpakPermissionsModel(QVector<FlatpakPermission> permissions);
0032 
0033     enum Roles {
0034         BriefRole = Qt::UserRole + 1,
0035         DescriptionRole,
0036         ListRole,
0037         IconRole,
0038     };
0039 
0040     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0041     QVariant data(const QModelIndex &index, int role) const override;
0042     virtual QHash<int, QByteArray> roleNames() const override;
0043 
0044 private:
0045     QVector<FlatpakPermission> m_permissions;
0046 };