File indexing completed on 2024-10-06 12:23:27

0001 /*
0002     This file is part of KNewStuff2.
0003     SPDX-FileCopyrightText: 2007 Josef Spillner <spillner@kde.org>
0004     SPDX-FileCopyrightText: 2018 Dan Leinir Turthra Jensen <admin@leinir.dk>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef KHOTNEWSTUFF_TEST_H
0010 #define KHOTNEWSTUFF_TEST_H
0011 
0012 #include <KNSCore/EntryInternal>
0013 #include <KNSCore/Provider>
0014 
0015 #include <QObject>
0016 #include <QStandardItemModel>
0017 
0018 namespace KNSCore
0019 {
0020 class Engine;
0021 }
0022 
0023 class KNewStuff2Test : public QObject
0024 {
0025     Q_OBJECT
0026     Q_PROPERTY(bool testAll READ testAll WRITE setTestAll NOTIFY testAllChanged)
0027 public:
0028     KNewStuff2Test(const QString &configFile);
0029 
0030     void setTestAll(bool testall);
0031     bool testAll() const;
0032     Q_SIGNAL void testAllChanged();
0033 
0034     Q_INVOKABLE void entryTest();
0035     Q_INVOKABLE void providerTest();
0036     Q_INVOKABLE void engineTest();
0037 
0038     Q_INVOKABLE QObject *messages();
0039     void addMessage(const QString &message, const QString &iconName = QString());
0040 
0041 public Q_SLOTS:
0042     void slotProvidersLoaded();
0043     void slotEngineError(const KNSCore::ErrorCode &errorCode, const QString &message, const QVariant &metadata);
0044     void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries);
0045     void slotInstallationFinished();
0046 
0047 private:
0048     KNSCore::Engine *m_engine;
0049     bool m_testall;
0050     QString m_configFile;
0051     QStandardItemModel *m_messages;
0052 };
0053 
0054 #endif