Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.h') (more/less context) (show 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 @@ | |||
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qdict.h> | ||
7 | 8 | ||
8 | #include "mediawidget.h" | 9 | #include "mediawidget.h" |
10 | #include "threadutil.h" | ||
11 | #include "singleton.h" | ||
9 | 12 | ||
@@ -47,2 +50,51 @@ private: | |||
47 | 50 | ||
51 | class SkinCache : public Singleton<SkinCache> | ||
52 | { | ||
53 | public: | ||
54 | SkinCache(); | ||
55 | |||
56 | QImage loadImage( const QString &name ); | ||
57 | |||
58 | private: | ||
59 | typedef QDict<QImage> ImageCache; | ||
60 | |||
61 | ImageCache m_cache; | ||
62 | |||
63 | ThreadUtil::Mutex m_cacheGuard; | ||
64 | }; | ||
65 | |||
66 | class SkinLoader : public ThreadUtil::Thread | ||
67 | { | ||
68 | public: | ||
69 | SkinLoader(); | ||
70 | |||
71 | void schedule( const QString &skinName, const QString &fileNameInfix, | ||
72 | const MediaWidget::SkinButtonInfo *skinButtonInfo, const uint buttonCount ); | ||
73 | |||
74 | protected: | ||
75 | virtual void run(); | ||
76 | |||
77 | private: | ||
78 | struct Info | ||
79 | { | ||
80 | Info() : skinButtonInfo( 0 ), buttonCount( 0 ) {} | ||
81 | Info( const QString &_skinName, const QString &_fileNameInfix, | ||
82 | const MediaWidget::SkinButtonInfo *_skinButtonInfo, const uint _buttonCount ) | ||
83 | : skinName( _skinName ), fileNameInfix( _fileNameInfix ), | ||
84 | skinButtonInfo( _skinButtonInfo ), buttonCount( _buttonCount ) | ||
85 | {} | ||
86 | |||
87 | const QString skinName; | ||
88 | const QString fileNameInfix; | ||
89 | const MediaWidget::SkinButtonInfo *skinButtonInfo; | ||
90 | const uint buttonCount; | ||
91 | }; | ||
92 | typedef QValueList<Info> InfoList; | ||
93 | |||
94 | void load( const Info &nfo ); | ||
95 | |||
96 | InfoList pendingSkins; | ||
97 | ThreadUtil::Mutex guard; | ||
98 | }; | ||
99 | |||
48 | #endif // SKIN_H | 100 | #endif // SKIN_H |