mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Add resources prop to caches
This commit is contained in:
parent
d78338330c
commit
3c86191a59
2 changed files with 13 additions and 0 deletions
|
@ -56,6 +56,16 @@ void ResourceCache::refresh(const QUrl& url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QVariantList ResourceCache::getResourceList() const {
|
||||||
|
QVariantList list;
|
||||||
|
auto resources = _resources.uniqueKeys();
|
||||||
|
list.reserve(resources.size());
|
||||||
|
for (auto& resource : resources) {
|
||||||
|
list << resource;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
void ResourceCache::setRequestLimit(int limit) {
|
void ResourceCache::setRequestLimit(int limit) {
|
||||||
_requestLimit = limit;
|
_requestLimit = limit;
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ class ResourceCache : public QObject {
|
||||||
Q_PROPERTY(int numCached READ getNumCachedResources NOTIFY dirty)
|
Q_PROPERTY(int numCached READ getNumCachedResources NOTIFY dirty)
|
||||||
Q_PROPERTY(qint64 sizeTotal READ getSizeTotalResources NOTIFY dirty)
|
Q_PROPERTY(qint64 sizeTotal READ getSizeTotalResources NOTIFY dirty)
|
||||||
Q_PROPERTY(qint64 sizeCached READ getSizeCachedResources NOTIFY dirty)
|
Q_PROPERTY(qint64 sizeCached READ getSizeCachedResources NOTIFY dirty)
|
||||||
|
Q_PROPERTY(QVariantList resources READ getResourceList NOTIFY dirty)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getNumTotalResources() const { return _resources.size(); }
|
int getNumTotalResources() const { return _resources.size(); }
|
||||||
|
@ -91,6 +92,8 @@ public:
|
||||||
int getNumCachedResources() const { return _unusedResources.size(); }
|
int getNumCachedResources() const { return _unusedResources.size(); }
|
||||||
qint64 getSizeCachedResources() const { return _unusedResourcesSize; }
|
qint64 getSizeCachedResources() const { return _unusedResourcesSize; }
|
||||||
|
|
||||||
|
const QVariantList getResourceList() const;
|
||||||
|
|
||||||
static void setRequestLimit(int limit);
|
static void setRequestLimit(int limit);
|
||||||
static int getRequestLimit() { return _requestLimit; }
|
static int getRequestLimit() { return _requestLimit; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue