File indexing completed on 2024-05-12 05:35:47
0001 /* 0002 SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org> 0003 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> 0004 SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #pragma once 0010 0011 #include <KNSCore/Entry> 0012 #include <KPackage/Package> 0013 #include <KQuickManagedConfigModule> 0014 #include <QAbstractProxyModel> 0015 0016 class QStandardItemModel; 0017 class QSortFilterProxyModel; 0018 class QProcess; 0019 class SplashScreenSettings; 0020 class SplashScreenData; 0021 0022 class KCMSplashScreen : public KQuickManagedConfigModule 0023 { 0024 Q_OBJECT 0025 Q_PROPERTY(SplashScreenSettings *splashScreenSettings READ splashScreenSettings CONSTANT) 0026 Q_PROPERTY(QAbstractProxyModel *splashSortedModel READ splashSortedModel CONSTANT) 0027 Q_PROPERTY(bool testing READ testing NOTIFY testingChanged) 0028 0029 public: 0030 enum Roles { 0031 PluginNameRole = Qt::UserRole + 1, 0032 ScreenshotRole, 0033 DescriptionRole, 0034 UninstallableRole, 0035 PendingDeletionRole, 0036 }; 0037 0038 KCMSplashScreen(QObject *parent, const KPluginMetaData &metaData); 0039 0040 SplashScreenSettings *splashScreenSettings() const; 0041 QAbstractProxyModel *splashSortedModel() const; 0042 bool testing() const; 0043 0044 Q_INVOKABLE int sortModelPluginIndex(const QString &pluginName) const; 0045 Q_INVOKABLE void ghnsEntryChanged(const KNSCore::Entry &wrapper); 0046 QStringList pendingDeletions(); 0047 0048 public Q_SLOTS: 0049 void save() override; 0050 void load() override; 0051 void defaults() override; 0052 void test(const QString &plugin); 0053 0054 Q_SIGNALS: 0055 void testingChanged(); 0056 void testingFailed(const QString &processErrorOutput); 0057 void error(const QString &message); 0058 0059 private: 0060 QList<KPackage::Package> availablePackages(const QString &component); 0061 int pluginIndex(const QString &pluginName) const; 0062 void addKPackageToModel(const KPackage::Package &pkg); 0063 0064 SplashScreenData *const m_data; 0065 QStandardItemModel *const m_model; 0066 0067 QProcess *m_testProcess = nullptr; 0068 QString m_packageRoot; 0069 QSortFilterProxyModel *m_sortModel = nullptr; 0070 };