summaryrefslogtreecommitdiffstats
path: root/src/sessionsiconholder.h
blob: 048236a23fc1a9aa3809d1df4ab9cfdde4d11ec2 (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
/*
 * 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"

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 == nullptr) instance = new SessionsIconHolder(); return instance; }
};

#endif /* SESSIONSICONHOLDER_H_ */