transmission 2.83
[tomato.git] / release / src-rt-6.x.4708 / router / transmission / qt / favicon.h
blob232371d38799180cbc41f36734757a3d3592a45d
1 /*
2 * This file Copyright (C) 2012-2014 Mnemosyne LLC
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
7 * $Id: favicon.h 14241 2014-01-21 03:10:30Z jordan $
8 */
10 #ifndef FAVICON_CACHE_H
11 #define FAVICON_CACHE_H
13 class QNetworkAccessManager;
14 class QNetworkReply;
15 class QUrl;
17 #include <QMap>
18 #include <QString>
19 #include <QObject>
20 #include <QPixmap>
22 class Favicons: public QObject
24 Q_OBJECT;
26 public:
28 static QString getHost( const QUrl& url );
30 public:
32 Favicons();
33 virtual ~Favicons();
35 // returns a cached pixmap, or a NULL pixmap if there's no match in the cache
36 QPixmap find (const QUrl& url);
38 // returns a cached pixmap, or a NULL pixmap if there's no match in the cache
39 QPixmap findFromHost (const QString& host);
41 // this will emit a signal when (if) the icon becomes ready
42 void add (const QUrl& url);
44 signals:
46 void pixmapReady (const QString& host);
48 private:
50 QNetworkAccessManager * myNAM;
51 QMap<QString,QPixmap> myPixmaps;
53 QString getCacheDir ();
54 void ensureCacheDirHasBeenScanned ();
56 private slots:
58 void onRequestFinished (QNetworkReply * reply);
61 #endif