File indexing completed on 2024-11-10 06:43:15
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2021 Julius Künzel <jk.kdedev@smartlab.uber.space> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef KABOUT_APPLICATION_COMPONENT_MODEL_H 0009 #define KABOUT_APPLICATION_COMPONENT_MODEL_H 0010 0011 #include <KAboutData> 0012 0013 #include <QAbstractListModel> 0014 0015 namespace KDEPrivate 0016 { 0017 enum { 0018 LINK_HEIGHT = 32, 0019 }; 0020 class KAboutApplicationComponentProfile; 0021 0022 class KAboutApplicationComponentModel : public QAbstractListModel 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit KAboutApplicationComponentModel(const QList<KAboutComponent> &personList, QObject *parent = nullptr); 0027 0028 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0029 int columnCount(const QModelIndex &parent = QModelIndex()) const override 0030 { 0031 Q_UNUSED(parent) 0032 return 1; 0033 } 0034 QVariant data(const QModelIndex &index, int role) const override; 0035 0036 Qt::ItemFlags flags(const QModelIndex &index) const override; 0037 0038 private: 0039 const QList<KAboutComponent> m_componentList; 0040 QList<KAboutApplicationComponentProfile> m_profileList; 0041 }; 0042 0043 class KAboutApplicationComponentProfile 0044 { 0045 public: 0046 KAboutApplicationComponentProfile() 0047 : m_name() 0048 , m_description() 0049 , m_version() 0050 , m_webAdress() 0051 , m_license() 0052 { 0053 } // needed for QVariant 0054 0055 KAboutApplicationComponentProfile(const QString &name, 0056 const QString &description, 0057 const QString &version, 0058 const QString &webAdress, 0059 const KAboutLicense &license) 0060 : m_name(name) 0061 , m_description(description) 0062 , m_version(version) 0063 , m_webAdress(webAdress) 0064 , m_license(license) 0065 { 0066 } 0067 0068 const QString &name() const 0069 { 0070 return m_name; 0071 } 0072 const QString &description() const 0073 { 0074 return m_description; 0075 } 0076 const QString &version() const 0077 { 0078 return m_version; 0079 } 0080 const QString &webAdress() const 0081 { 0082 return m_webAdress; 0083 } 0084 const KAboutLicense &license() const 0085 { 0086 return m_license; 0087 } 0088 0089 private: 0090 QString m_name; 0091 QString m_description; 0092 QString m_version; 0093 QString m_webAdress; 0094 KAboutLicense m_license; 0095 }; 0096 0097 } // namespace KDEPrivate 0098 0099 Q_DECLARE_METATYPE(KDEPrivate::KAboutApplicationComponentProfile) 0100 #endif // KABOUT_APPLICATION_COMPONENT_MODEL_H