author | simon <simon> | 2002-12-11 17:18:17 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 17:18:17 (UTC) |
commit | 75f0ed4978579eb4b27cdece64c597741ed24b79 (patch) (side-by-side diff) | |
tree | 6443323e08a9639ad0db7b5b1852d3804172e70a /noncore/multimedia/opieplayer2/skin.h | |
parent | 94461696cfdcf8cdbaabec1400300e546edc447e (diff) | |
download | opie-75f0ed4978579eb4b27cdece64c597741ed24b79.zip opie-75f0ed4978579eb4b27cdece64c597741ed24b79.tar.gz opie-75f0ed4978579eb4b27cdece64c597741ed24b79.tar.bz2 |
- added a skin cache and a threaded skin loader. looks like the latter
we have to disable though, because pure image loading with qt is
anything but threadsafe :(
Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h index 58f1849..c15d9dc 100644 --- a/noncore/multimedia/opieplayer2/skin.h +++ b/noncore/multimedia/opieplayer2/skin.h @@ -6,4 +6,7 @@ #include <qmap.h> +#include <qdict.h> #include "mediawidget.h" +#include "threadutil.h" +#include "singleton.h" @@ -47,2 +50,51 @@ private: +class SkinCache : public Singleton<SkinCache> +{ +public: + SkinCache(); + + QImage loadImage( const QString &name ); + +private: + typedef QDict<QImage> ImageCache; + + ImageCache m_cache; + + ThreadUtil::Mutex m_cacheGuard; +}; + +class SkinLoader : public ThreadUtil::Thread +{ +public: + SkinLoader(); + + void schedule( const QString &skinName, const QString &fileNameInfix, + const MediaWidget::SkinButtonInfo *skinButtonInfo, const uint buttonCount ); + +protected: + virtual void run(); + +private: + struct Info + { + Info() : skinButtonInfo( 0 ), buttonCount( 0 ) {} + Info( const QString &_skinName, const QString &_fileNameInfix, + const MediaWidget::SkinButtonInfo *_skinButtonInfo, const uint _buttonCount ) + : skinName( _skinName ), fileNameInfix( _fileNameInfix ), + skinButtonInfo( _skinButtonInfo ), buttonCount( _buttonCount ) + {} + + const QString skinName; + const QString fileNameInfix; + const MediaWidget::SkinButtonInfo *skinButtonInfo; + const uint buttonCount; + }; + typedef QValueList<Info> InfoList; + + void load( const Info &nfo ); + + InfoList pendingSkins; + ThreadUtil::Mutex guard; +}; + #endif // SKIN_H |