Warning, file /plasma/kdeplasma-addons/applets/comic/engine/comic.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *   SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0003  *   SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de>
0004  *
0005  *   SPDX-License-Identifier: LGPL-2.0-only
0006  */
0007 
0008 #ifndef COMIC_ENGINE_H
0009 #define COMIC_ENGINE_H
0010 
0011 // Qt
0012 #include <QIcon>
0013 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0014 #include <QNetworkConfigurationManager>
0015 #endif
0016 #include <QSet>
0017 #include <QUrl>
0018 #include <QVariant>
0019 
0020 #include "types.h"
0021 
0022 class ComicProvider;
0023 
0024 /**
0025  * This class provides the comic strip.
0026  *
0027  * The query keys have the following structure:
0028  *   \<comic_identifier\>:\<suffix\>
0029  * usually the suffix is the date
0030  * e.g.
0031  *   userfriendly:2007-07-19
0032  * but some other comics uses numerical identifiers, like
0033  *   xkcd:378
0034  * if the suffix is empty the latest comic will be returned
0035  *
0036  */
0037 class ComicEngine : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     ComicEngine(QObject *parent);
0043 
0044     QList<ComicProviderInfo> loadProviders();
0045 
0046     void setMaxComicLimit(int maxComicLimit);
0047     bool requestSource(const QString &identifier);
0048 
0049 Q_SIGNALS:
0050     void requestFinished(const ComicMetaData &data);
0051 
0052 private:
0053     void finished(ComicProvider *);
0054     void error(ComicProvider *);
0055     ComicMetaData metaDataFromProvider(ComicProvider *provider);
0056     QString lastCachedIdentifier(const QString &identifier) const;
0057     bool isOnline() const;
0058 
0059 private:
0060     bool mEmptySuffix;
0061     QString mIdentifierError;
0062     QHash<QString, ComicProvider *> m_jobs;
0063 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0064     QT_WARNING_PUSH
0065     QT_WARNING_DISABLE_DEPRECATED
0066     QNetworkConfigurationManager m_networkConfigurationManager;
0067     QT_WARNING_POP
0068 #endif
0069     QSet<QString> mProviders;
0070 };
0071 
0072 #endif