File indexing completed on 2024-12-01 04:37:40

0001 /*
0002     SPDX-FileCopyrightText: 2024 Ralf Habacker ralf.habacker @freenet.de
0003 
0004     This file is part of libalkimia.
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef ALKNEWSTUFFENGINE_H
0010 #define ALKNEWSTUFFENGINE_H
0011 
0012 #include <alkimia/alk_export.h>
0013 
0014 #include <QList>
0015 #include <QStringList>
0016 #include <QObject>
0017 
0018 /**
0019  * Platform independent wrapper for new stuff entry
0020  *
0021  * @author Ralf Habacker
0022  */
0023 class ALK_EXPORT AlkNewStuffEntry
0024 {
0025 public:
0026     enum Status {
0027         Invalid,
0028         Downloadable,
0029         Installed,
0030         Updateable,
0031         Deleted,
0032         Installing,
0033         Updating
0034     };
0035 
0036     QString category;
0037     QString id;
0038     QString name;
0039     QString providerId;
0040     QString version;
0041     QStringList installedFiles;
0042     Status status;
0043 };
0044 
0045 typedef QList<AlkNewStuffEntry> AlkNewStuffEntryList;
0046 
0047 const char *toString(AlkNewStuffEntry::Status status);
0048 
0049 /**
0050  * Platform independent wrapper for the new stuff engine
0051  *
0052  * @author Ralf Habacker
0053  */
0054 class ALK_EXPORT AlkNewStuffEngine : public QObject
0055 {
0056     Q_OBJECT
0057 public:
0058     explicit AlkNewStuffEngine(QObject *parent = nullptr);
0059     /**
0060      * Initialization of the new stuff engine
0061      * @param configFile path to the configuration file (.knsrc)
0062      * @return true - the engine was initialized
0063      * @return false - the engine could not be initialized
0064      */
0065     bool init(const QString &configFile);
0066 
0067     /**
0068      * Start check for updates and return
0069      * Update results are obtained using the updatesAvailable() signal.
0070      */
0071     void checkForUpdates();
0072 
0073     AlkNewStuffEntryList installedEntries() const;
0074 
0075 Q_SIGNALS:
0076     void updatesAvailable(const AlkNewStuffEntryList &entries);
0077 
0078 private:
0079     class Private;
0080     Private *const d;
0081 };
0082 
0083 #endif // ALKNEWSTUFFENGINE_H