Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h index 9180067..a43a1d0 100644 --- a/noncore/multimedia/opieplayer2/skin.h +++ b/noncore/multimedia/opieplayer2/skin.h | |||
@@ -22,15 +22,15 @@ | |||
22 | 22 | ||
23 | #ifndef SKIN_H | 23 | #ifndef SKIN_H |
24 | #define SKIN_H | 24 | #define SKIN_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qimage.h> | 27 | #include <qimage.h> |
28 | #include <qobject.h> | ||
28 | 29 | ||
29 | #include "mediawidget.h" | 30 | #include "mediawidget.h" |
30 | #include "threadutil.h" | ||
31 | 31 | ||
32 | struct SkinData; | 32 | struct SkinData; |
33 | 33 | ||
34 | class Skin | 34 | class Skin |
35 | { | 35 | { |
36 | public: | 36 | public: |
@@ -63,43 +63,62 @@ private: | |||
63 | SkinData *d; | 63 | SkinData *d; |
64 | 64 | ||
65 | Skin( const Skin & ); | 65 | Skin( const Skin & ); |
66 | Skin &operator=( const Skin & ); | 66 | Skin &operator=( const Skin & ); |
67 | }; | 67 | }; |
68 | 68 | ||
69 | class SkinLoader : public ThreadUtil::Thread | 69 | class SkinLoader : public QObject |
70 | { | 70 | { |
71 | Q_OBJECT | ||
71 | public: | 72 | public: |
72 | SkinLoader(); | 73 | SkinLoader(); |
74 | virtual ~SkinLoader(); | ||
73 | 75 | ||
74 | void schedule( const QString &skinName, const QString &fileNameInfix, | 76 | void schedule( const MediaWidget::GUIInfo &guiInfo ); |
75 | const MediaWidget::SkinButtonInfo *skinButtonInfo, const uint buttonCount ); | 77 | void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ); |
78 | |||
79 | void start(); | ||
76 | 80 | ||
77 | protected: | 81 | protected: |
78 | virtual void run(); | 82 | virtual void timerEvent( QTimerEvent *ev ); |
83 | |||
84 | private slots: | ||
85 | void deleteMe(); | ||
79 | 86 | ||
80 | private: | 87 | private: |
81 | struct Info | 88 | struct Info : public MediaWidget::GUIInfo |
82 | { | 89 | { |
83 | Info() : skinButtonInfo( 0 ), buttonCount( 0 ) {} | 90 | Info() {} |
84 | Info( const QString &_skinName, const QString &_fileNameInfix, | 91 | Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo ) |
85 | const MediaWidget::SkinButtonInfo *_skinButtonInfo, const uint _buttonCount ) | 92 | : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName ) |
86 | : skinName( _skinName ), fileNameInfix( _fileNameInfix ), | ||
87 | skinButtonInfo( _skinButtonInfo ), buttonCount( _buttonCount ) | ||
88 | {} | 93 | {} |
89 | 94 | ||
90 | const QString skinName; | 95 | QString skinName; |
91 | const QString fileNameInfix; | ||
92 | const MediaWidget::SkinButtonInfo *skinButtonInfo; | ||
93 | const uint buttonCount; | ||
94 | }; | 96 | }; |
95 | typedef QValueList<Info> InfoList; | 97 | typedef QValueList<Info> InfoList; |
96 | 98 | ||
97 | void load( const Info &nfo ); | 99 | class IncrementalLoader |
100 | { | ||
101 | public: | ||
102 | enum LoaderResult { LoadingCompleted, MoreToCome }; | ||
103 | |||
104 | IncrementalLoader( const Info &info ); | ||
105 | |||
106 | LoaderResult loadStep(); | ||
107 | |||
108 | private: | ||
109 | enum State { LoadBackgroundImage, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; | ||
110 | |||
111 | Skin m_skin; | ||
112 | Info m_info; | ||
113 | State m_currentState; | ||
114 | uint m_currentButton; | ||
115 | }; | ||
98 | 116 | ||
99 | InfoList pendingSkins; | 117 | InfoList pendingSkins; |
100 | ThreadUtil::Mutex guard; | 118 | IncrementalLoader *m_currentLoader; |
119 | int m_timerId; | ||
101 | }; | 120 | }; |
102 | 121 | ||
103 | #endif // SKIN_H | 122 | #endif // SKIN_H |
104 | /* vim: et sw=4 ts=4 | 123 | /* vim: et sw=4 ts=4 |
105 | */ | 124 | */ |