-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimagerequestcache.cpp
More file actions
50 lines (41 loc) · 1.16 KB
/
Copy pathimagerequestcache.cpp
File metadata and controls
50 lines (41 loc) · 1.16 KB
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
45
46
47
48
49
50
#include "imagerequestcache.h"
ImageRequestCache::ImageRequestCache():
entries()
{
}
void ImageRequestCache::addRequest(const QString &gameid, const QString &channel, int width, int height)
{
if (entries.contains(gameid)) {
qCritical() << "Error! Channel image requested while previous request in progress!";
}
entries[gameid] = ImageRequestCacheEntry(channel, width, height);
}
void ImageRequestCache::setBoxartUrl(const QString &gameid, const QString &url)
{
entries[gameid].setBoxArtUrl(url);
}
void ImageRequestCache::deleteRequest(const QString &gameid)
{
entries.remove(gameid);
}
QString ImageRequestCache::getChannel(const QString &gameid) const
{
return entries[gameid].getChannel();
}
int ImageRequestCache::getWidth(const QString &gameid) const
{
return entries[gameid].getWidth();
}
int ImageRequestCache::getHeight(const QString &gameid) const
{
return entries[gameid].getHeight();
}
QString ImageRequestCache::findByUrl(const QString &url) const
{
for (const QString & gameid: entries.keys()) {
if (entries[gameid].getBoxArtUrl() == url) {
return gameid;
}
}
return QString();
}