File indexing completed on 2024-05-12 05:37:17

0001 /*
0002     SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0003     SPDX-FileCopyrightText: 2008 Marco Martin <notmart@gmail.com>
0004     SPDX-FileCopyrightText: 2013 Andrea Scarpino <scarpino@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QObject>
0012 
0013 class QImage;
0014 
0015 /**
0016  * This class provides a favicon for a given url
0017  */
0018 class FaviconProvider : public QObject
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     /**
0024      * Creates a new favicon provider.
0025      *
0026      * @param parent The parent object.
0027      * @param url The provider URL.
0028      */
0029     FaviconProvider(QObject *parent, const QString &url);
0030 
0031     /**
0032      * Destroys the favicon provider.
0033      */
0034     ~FaviconProvider() override;
0035 
0036     /**
0037      * Returns the requested image.
0038      *
0039      * @note This method returns only a valid image after the
0040      *       finished() signal has been emitted.
0041      */
0042     QImage image() const;
0043 
0044     /**
0045      * Returns the identifier of the comic request (name + date).
0046      */
0047     QString identifier() const;
0048 
0049 Q_SIGNALS:
0050     /**
0051      * This signal is emitted whenever a request has been finished
0052      * successfully.
0053      *
0054      * @param provider The provider which emitted the signal.
0055      */
0056     void finished(FaviconProvider *provider);
0057 
0058     /**
0059      * This signal is emitted whenever an error has occurred.
0060      *
0061      * @param provider The provider which emitted the signal.
0062      */
0063     void error(FaviconProvider *provider);
0064 
0065 private:
0066     QString m_url;
0067 
0068     class Private;
0069     Private *const d;
0070 };