Added method used to retrieve and load image files from/into global application pixmap cache.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4339 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
dc434fea6d
commit
0aac201c77
|
@ -3973,6 +3973,28 @@ bool QtClient::sendEvent(QEvent& e, QObject* parent, const QString& name)
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retrieve a pixmap from global application cache.
|
||||||
|
// Load and add it to the cache if not found
|
||||||
|
bool QtClient::getPixmapFromCache(QPixmap& pixmap, const QString& file)
|
||||||
|
{
|
||||||
|
if (file.isEmpty())
|
||||||
|
return false;
|
||||||
|
QPixmap* cached = QPixmapCache::find(file);
|
||||||
|
if (cached) {
|
||||||
|
pixmap = *cached;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!pixmap.load(file))
|
||||||
|
return false;
|
||||||
|
#ifdef XDEBUG
|
||||||
|
String f;
|
||||||
|
getUtf8(f,file);
|
||||||
|
Debug(ClientDriver::self(),DebugAll,"Loaded '%s' in pixmap cache",f.c_str());
|
||||||
|
#endif
|
||||||
|
QPixmapCache::insert(file,pixmap);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QtDriver
|
* QtDriver
|
||||||
|
|
|
@ -500,6 +500,15 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool sendEvent(QEvent& e, QObject* parent, const QString& name);
|
static bool sendEvent(QEvent& e, QObject* parent, const QString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a pixmap from global application cache.
|
||||||
|
* Load and add it to the cache if not found
|
||||||
|
* @param pixmap Destination pixmap to set
|
||||||
|
* @param file File name to retrieve or load
|
||||||
|
* @return True on success, false if failed to load
|
||||||
|
*/
|
||||||
|
static bool getPixmapFromCache(QPixmap& pixmap, const QString& file);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void loadWindows(const char* file = 0);
|
virtual void loadWindows(const char* file = 0);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue