summaryrefslogtreecommitdiffstats
path: root/src/sessionsiconholder.h
blob: 3284bf75d70ffa69138d5126c68f9e5cf5eea9bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * sessionsiconholder.h
 *
 *  Created on: Mar 7, 2014
 *      Author: nils
 */

#ifndef SESSIONSICONHOLDER_H_
#define SESSIONSICONHOLDER_H_

#include <QHash>
#include <QtDebug>
#include <QFile>
#include <QIcon>
#include <QResource>
#include <QFileInfo>

#include "globals.h"
#include "sessionsiconholder.h"
#include "filedownloader.h"

class SessionTreeModel;

class SessionsIconHolder : public QObject {
	Q_OBJECT

private:
	QHash<QString, QIcon> icons;
	SessionsIconHolder();
	static SessionsIconHolder* instance;

signals:
	void iconDownloaded(const QUrl& url, const QIcon& icon);

public:
	QIcon getIcon(const QString& name);
	QIcon getIcon(const QUrl& url);
	static SessionsIconHolder* get() { if (instance == NULL) instance = new SessionsIconHolder(); return instance; }

public slots:
	void afterDownload(const QUrl& url, const QByteArray& downloadedData);
};

#endif /* SESSIONSICONHOLDER_H_ */