summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-14 18:12:24 (UTC)
committer simon <simon>2002-12-14 18:12:24 (UTC)
commitae7a270c56fa0fff6d3f530c80532c54c51be596 (patch) (unidiff)
tree1b2012f79c9f4f8c8089fcc9732b109d494d1654
parentd73e34645e839c1aea21bd62e622788361cf866d (diff)
downloadopie-ae7a270c56fa0fff6d3f530c80532c54c51be596.zip
opie-ae7a270c56fa0fff6d3f530c80532c54c51be596.tar.gz
opie-ae7a270c56fa0fff6d3f530c80532c54c51be596.tar.bz2
- removed unused method
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/skin.h2
2 files changed, 0 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index d6f4080..a8f4ae9 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -1,288 +1,280 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include "skin.h" 23#include "skin.h"
24#include "singleton.h" 24#include "singleton.h"
25 25
26#include <qcache.h> 26#include <qcache.h>
27#include <qmap.h> 27#include <qmap.h>
28#include <qtimer.h> 28#include <qtimer.h>
29 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/config.h> 31#include <qpe/config.h>
32 32
33#include <assert.h> 33#include <assert.h>
34 34
35struct SkinData 35struct SkinData
36{ 36{
37 typedef QMap<QString, QImage> ButtonMaskImageMap; 37 typedef QMap<QString, QImage> ButtonMaskImageMap;
38 38
39 QPixmap backgroundPixmap; 39 QPixmap backgroundPixmap;
40 QImage buttonUpImage; 40 QImage buttonUpImage;
41 QImage buttonDownImage; 41 QImage buttonDownImage;
42 QImage buttonMask; 42 QImage buttonMask;
43 ButtonMaskImageMap buttonMasks; 43 ButtonMaskImageMap buttonMasks;
44}; 44};
45 45
46class SkinCache : public Singleton<SkinCache> 46class SkinCache : public Singleton<SkinCache>
47{ 47{
48public: 48public:
49 SkinCache(); 49 SkinCache();
50 50
51 SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix ); 51 SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix );
52 52
53 void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ); 53 void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data );
54 54
55private: 55private:
56 typedef QCache<SkinData> DataCache; 56 typedef QCache<SkinData> DataCache;
57 typedef QCache<QPixmap> BackgroundPixmapCache; 57 typedef QCache<QPixmap> BackgroundPixmapCache;
58 58
59 template <class CacheType> 59 template <class CacheType>
60 void store( const QCache<CacheType> &cache, const QString &key, CacheType *data ); 60 void store( const QCache<CacheType> &cache, const QString &key, CacheType *data );
61 61
62 DataCache m_cache; 62 DataCache m_cache;
63 BackgroundPixmapCache m_backgroundPixmapCache; 63 BackgroundPixmapCache m_backgroundPixmapCache;
64}; 64};
65 65
66Skin::Skin( const QString &name, const QString &fileNameInfix ) 66Skin::Skin( const QString &name, const QString &fileNameInfix )
67 : m_fileNameInfix( fileNameInfix ) 67 : m_fileNameInfix( fileNameInfix )
68{ 68{
69 init( name ); 69 init( name );
70} 70}
71 71
72Skin::Skin( const QString &fileNameInfix ) 72Skin::Skin( const QString &fileNameInfix )
73 : m_fileNameInfix( fileNameInfix ) 73 : m_fileNameInfix( fileNameInfix )
74{ 74{
75 init( defaultSkinName() ); 75 init( defaultSkinName() );
76} 76}
77 77
78Skin::~Skin() 78Skin::~Skin()
79{ 79{
80 SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); 80 SkinCache::self().store( m_skinPath, m_fileNameInfix, d );
81} 81}
82 82
83void Skin::init( const QString &name ) 83void Skin::init( const QString &name )
84{ 84{
85 m_skinPath = "opieplayer2/skins/" + name; 85 m_skinPath = "opieplayer2/skins/" + name;
86 d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); 86 d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix );
87} 87}
88 88
89void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount )
90{
91 backgroundPixmap();
92 buttonUpImage();
93 buttonDownImage();
94 ( void )buttonMask( skinButtonInfo, buttonCount );
95}
96
97QPixmap Skin::backgroundPixmap() const 89QPixmap Skin::backgroundPixmap() const
98{ 90{
99 if ( d->backgroundPixmap.isNull() ) 91 if ( d->backgroundPixmap.isNull() )
100 d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) ); 92 d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) );
101 return d->backgroundPixmap; 93 return d->backgroundPixmap;
102} 94}
103 95
104QImage Skin::buttonUpImage() const 96QImage Skin::buttonUpImage() const
105{ 97{
106 if ( d->buttonUpImage.isNull() ) 98 if ( d->buttonUpImage.isNull() )
107 d->buttonUpImage = loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); 99 d->buttonUpImage = loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) );
108 return d->buttonUpImage; 100 return d->buttonUpImage;
109} 101}
110 102
111QImage Skin::buttonDownImage() const 103QImage Skin::buttonDownImage() const
112{ 104{
113 if ( d->buttonDownImage.isNull() ) 105 if ( d->buttonDownImage.isNull() )
114 d->buttonDownImage = loadImage( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); 106 d->buttonDownImage = loadImage( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) );
115 return d->buttonDownImage; 107 return d->buttonDownImage;
116} 108}
117 109
118QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const 110QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const
119{ 111{
120 if ( !d->buttonMask.isNull() ) 112 if ( !d->buttonMask.isNull() )
121 return d->buttonMask; 113 return d->buttonMask;
122 114
123 QSize buttonAreaSize = buttonUpImage().size(); 115 QSize buttonAreaSize = buttonUpImage().size();
124 116
125 d->buttonMask = QImage( buttonAreaSize, 8, 255 ); 117 d->buttonMask = QImage( buttonAreaSize, 8, 255 );
126 d->buttonMask.fill( 0 ); 118 d->buttonMask.fill( 0 );
127 119
128 for ( uint i = 0; i < buttonCount; ++i ) 120 for ( uint i = 0; i < buttonCount; ++i )
129 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); 121 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) );
130 122
131 return d->buttonMask; 123 return d->buttonMask;
132} 124}
133 125
134void Skin::addButtonToMask( int tag, const QImage &maskImage ) const 126void Skin::addButtonToMask( int tag, const QImage &maskImage ) const
135{ 127{
136 if ( maskImage.isNull() ) 128 if ( maskImage.isNull() )
137 return; 129 return;
138 130
139 uchar **dest = d->buttonMask.jumpTable(); 131 uchar **dest = d->buttonMask.jumpTable();
140 for ( int y = 0; y < d->buttonMask.height(); y++ ) { 132 for ( int y = 0; y < d->buttonMask.height(); y++ ) {
141 uchar *line = dest[y]; 133 uchar *line = dest[y];
142 for ( int x = 0; x < d->buttonMask.width(); x++ ) 134 for ( int x = 0; x < d->buttonMask.width(); x++ )
143 if ( !qRed( maskImage.pixel( x, y ) ) ) 135 if ( !qRed( maskImage.pixel( x, y ) ) )
144 line[x] = tag; 136 line[x] = tag;
145 } 137 }
146} 138}
147 139
148QImage Skin::buttonMaskImage( const QString &fileName ) const 140QImage Skin::buttonMaskImage( const QString &fileName ) const
149{ 141{
150 SkinData::ButtonMaskImageMap::Iterator it = d->buttonMasks.find( fileName ); 142 SkinData::ButtonMaskImageMap::Iterator it = d->buttonMasks.find( fileName );
151 if ( it == d->buttonMasks.end() ) { 143 if ( it == d->buttonMasks.end() ) {
152 QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix ); 144 QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix );
153 QString path = prefix + fileName + ".png"; 145 QString path = prefix + fileName + ".png";
154 it = d->buttonMasks.insert( fileName, loadImage( path ) ); 146 it = d->buttonMasks.insert( fileName, loadImage( path ) );
155 } 147 }
156 return *it; 148 return *it;
157} 149}
158 150
159QString Skin::defaultSkinName() 151QString Skin::defaultSkinName()
160{ 152{
161 Config cfg( "OpiePlayer" ); 153 Config cfg( "OpiePlayer" );
162 cfg.setGroup( "Options" ); 154 cfg.setGroup( "Options" );
163 return cfg.readEntry( "Skin", "default" ); 155 return cfg.readEntry( "Skin", "default" );
164} 156}
165 157
166QImage Skin::loadImage( const QString &fileName ) 158QImage Skin::loadImage( const QString &fileName )
167{ 159{
168 return QImage( Resource::findPixmap( fileName ) ); 160 return QImage( Resource::findPixmap( fileName ) );
169} 161}
170 162
171SkinCache::SkinCache() 163SkinCache::SkinCache()
172{ 164{
173 // let's say we cache two skins (audio+video) at maximum 165 // let's say we cache two skins (audio+video) at maximum
174 m_cache.setMaxCost( 2 ); 166 m_cache.setMaxCost( 2 );
175 // ... and one background pixmap 167 // ... and one background pixmap
176 m_backgroundPixmapCache.setMaxCost( 1 ); 168 m_backgroundPixmapCache.setMaxCost( 1 );
177} 169}
178 170
179SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix ) 171SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix )
180{ 172{
181 QString key = skinPath + fileNameInfix; 173 QString key = skinPath + fileNameInfix;
182 174
183 SkinData *data = m_cache.take( key ); 175 SkinData *data = m_cache.take( key );
184 if ( !data ) 176 if ( !data )
185 data = new SkinData; 177 data = new SkinData;
186 else 178 else
187 qDebug( "SkinCache: hit" ); 179 qDebug( "SkinCache: hit" );
188 180
189 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); 181 QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath );
190 if ( bgPixmap ) { 182 if ( bgPixmap ) {
191 qDebug( "SkinCache: hit on bgpixmap" ); 183 qDebug( "SkinCache: hit on bgpixmap" );
192 data->backgroundPixmap = *bgPixmap; 184 data->backgroundPixmap = *bgPixmap;
193 } 185 }
194 else 186 else
195 data->backgroundPixmap = QPixmap(); 187 data->backgroundPixmap = QPixmap();
196 188
197 return data; 189 return data;
198} 190}
199 191
200void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) 192void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data )
201{ 193{
202 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); 194 QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap );
203 195
204 data->backgroundPixmap = QPixmap(); 196 data->backgroundPixmap = QPixmap();
205 197
206 QString key = skinPath + fileNameInfix; 198 QString key = skinPath + fileNameInfix;
207 199
208 if ( m_cache.find( key, false /*ref*/ ) != 0 || 200 if ( m_cache.find( key, false /*ref*/ ) != 0 ||
209 !m_cache.insert( key, data ) ) 201 !m_cache.insert( key, data ) )
210 delete data; 202 delete data;
211 203
212 if ( m_backgroundPixmapCache.find( skinPath, false /*ref*/ ) != 0 || 204 if ( m_backgroundPixmapCache.find( skinPath, false /*ref*/ ) != 0 ||
213 !m_backgroundPixmapCache.insert( skinPath, backgroundPixmap ) ) 205 !m_backgroundPixmapCache.insert( skinPath, backgroundPixmap ) )
214 delete backgroundPixmap; 206 delete backgroundPixmap;
215} 207}
216 208
217SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) 209SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info )
218 : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) 210 : m_skin( info.skinName, info.fileNameInfix ), m_info( info )
219{ 211{
220 m_currentState = LoadBackgroundPixmap; 212 m_currentState = LoadBackgroundPixmap;
221} 213}
222 214
223SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep() 215SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep()
224{ 216{
225 switch ( m_currentState ) { 217 switch ( m_currentState ) {
226 case LoadBackgroundPixmap: 218 case LoadBackgroundPixmap:
227 qDebug( "load bgpixmap" ); 219 qDebug( "load bgpixmap" );
228 m_skin.backgroundPixmap(); 220 m_skin.backgroundPixmap();
229 m_currentState = LoadButtonUpImage; 221 m_currentState = LoadButtonUpImage;
230 break; 222 break;
231 case LoadButtonUpImage: 223 case LoadButtonUpImage:
232 qDebug( "load upimage" ); 224 qDebug( "load upimage" );
233 m_skin.buttonUpImage(); 225 m_skin.buttonUpImage();
234 m_currentState = LoadButtonDownImage; 226 m_currentState = LoadButtonDownImage;
235 break; 227 break;
236 case LoadButtonDownImage: 228 case LoadButtonDownImage:
237 qDebug( "load downimage" ); 229 qDebug( "load downimage" );
238 m_skin.buttonDownImage(); 230 m_skin.buttonDownImage();
239 m_currentState = LoadButtonMasks; 231 m_currentState = LoadButtonMasks;
240 m_currentButton = 0; 232 m_currentButton = 0;
241 break; 233 break;
242 case LoadButtonMasks: 234 case LoadButtonMasks:
243 qDebug( "load button masks %i", m_currentButton ); 235 qDebug( "load button masks %i", m_currentButton );
244 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName ); 236 m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName );
245 237
246 m_currentButton++; 238 m_currentButton++;
247 if ( m_currentButton >= m_info.buttonCount ) 239 if ( m_currentButton >= m_info.buttonCount )
248 m_currentState = LoadButtonMask; 240 m_currentState = LoadButtonMask;
249 241
250 break; 242 break;
251 case LoadButtonMask: 243 case LoadButtonMask:
252 qDebug( "load whole mask" ); 244 qDebug( "load whole mask" );
253 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount ); 245 m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount );
254 return LoadingCompleted; 246 return LoadingCompleted;
255 } 247 }
256 248
257 return MoreToCome; 249 return MoreToCome;
258} 250}
259 251
260SkinLoader::SkinLoader() 252SkinLoader::SkinLoader()
261 : m_currentLoader( 0 ), m_timerId( -1 ) 253 : m_currentLoader( 0 ), m_timerId( -1 )
262{ 254{
263} 255}
264 256
265SkinLoader::~SkinLoader() 257SkinLoader::~SkinLoader()
266{ 258{
267 qDebug( "SkinLoader::~SkinLoader()" ); 259 qDebug( "SkinLoader::~SkinLoader()" );
268 killTimers(); 260 killTimers();
269 delete m_currentLoader; 261 delete m_currentLoader;
270} 262}
271 263
272void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo ) 264void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo )
273{ 265{
274 schedule( Skin::defaultSkinName(), guiInfo ); 266 schedule( Skin::defaultSkinName(), guiInfo );
275} 267}
276 268
277void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ) 269void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo )
278{ 270{
279 pendingSkins << Info( skinName, guiInfo ); 271 pendingSkins << Info( skinName, guiInfo );
280} 272}
281 273
282void SkinLoader::start() 274void SkinLoader::start()
283{ 275{
284 assert( m_timerId == -1 ); 276 assert( m_timerId == -1 );
285 m_timerId = startTimer( 100 /* ms */ ); 277 m_timerId = startTimer( 100 /* ms */ );
286 qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() ); 278 qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() );
287} 279}
288 280
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
index 90062c2..bafebd3 100644
--- a/noncore/multimedia/opieplayer2/skin.h
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -1,124 +1,122 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
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#include <qobject.h>
29 29
30#include "mediawidget.h" 30#include "mediawidget.h"
31 31
32struct SkinData; 32struct SkinData;
33 33
34class Skin 34class Skin
35{ 35{
36public: 36public:
37 Skin( const QString &name, const QString &fileNameInfix ); 37 Skin( const QString &name, const QString &fileNameInfix );
38 Skin( const QString &fileNameInfix ); 38 Skin( const QString &fileNameInfix );
39 ~Skin(); 39 ~Skin();
40 40
41 void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount );
42
43 QPixmap backgroundPixmap() const; 41 QPixmap backgroundPixmap() const;
44 QImage buttonUpImage() const; 42 QImage buttonUpImage() const;
45 QImage buttonDownImage() const; 43 QImage buttonDownImage() const;
46 44
47 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; 45 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const;
48 46
49 QImage buttonMaskImage( const QString &fileName ) const; 47 QImage buttonMaskImage( const QString &fileName ) const;
50 48
51 static QString defaultSkinName(); 49 static QString defaultSkinName();
52 50
53private: 51private:
54 void init( const QString &name ); 52 void init( const QString &name );
55 53
56 void addButtonToMask( int tag, const QImage &maskImage ) const; 54 void addButtonToMask( int tag, const QImage &maskImage ) const;
57 55
58 static QImage loadImage( const QString &fileName ); 56 static QImage loadImage( const QString &fileName );
59 57
60 QString m_fileNameInfix; 58 QString m_fileNameInfix;
61 QString m_skinPath; 59 QString m_skinPath;
62 60
63 SkinData *d; 61 SkinData *d;
64 62
65 Skin( const Skin & ); 63 Skin( const Skin & );
66 Skin &operator=( const Skin & ); 64 Skin &operator=( const Skin & );
67}; 65};
68 66
69class SkinLoader : public QObject 67class SkinLoader : public QObject
70{ 68{
71 Q_OBJECT 69 Q_OBJECT
72public: 70public:
73 SkinLoader(); 71 SkinLoader();
74 virtual ~SkinLoader(); 72 virtual ~SkinLoader();
75 73
76 void schedule( const MediaWidget::GUIInfo &guiInfo ); 74 void schedule( const MediaWidget::GUIInfo &guiInfo );
77 void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ); 75 void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo );
78 76
79 void start(); 77 void start();
80 78
81protected: 79protected:
82 virtual void timerEvent( QTimerEvent *ev ); 80 virtual void timerEvent( QTimerEvent *ev );
83 81
84private slots: 82private slots:
85 void deleteMe(); 83 void deleteMe();
86 84
87private: 85private:
88 struct Info : public MediaWidget::GUIInfo 86 struct Info : public MediaWidget::GUIInfo
89 { 87 {
90 Info() {} 88 Info() {}
91 Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo ) 89 Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo )
92 : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName ) 90 : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName )
93 {} 91 {}
94 92
95 QString skinName; 93 QString skinName;
96 }; 94 };
97 typedef QValueList<Info> InfoList; 95 typedef QValueList<Info> InfoList;
98 96
99 class IncrementalLoader 97 class IncrementalLoader
100 { 98 {
101 public: 99 public:
102 enum LoaderResult { LoadingCompleted, MoreToCome }; 100 enum LoaderResult { LoadingCompleted, MoreToCome };
103 101
104 IncrementalLoader( const Info &info ); 102 IncrementalLoader( const Info &info );
105 103
106 LoaderResult loadStep(); 104 LoaderResult loadStep();
107 105
108 private: 106 private:
109 enum State { LoadBackgroundPixmap, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; 107 enum State { LoadBackgroundPixmap, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask };
110 108
111 Skin m_skin; 109 Skin m_skin;
112 Info m_info; 110 Info m_info;
113 State m_currentState; 111 State m_currentState;
114 uint m_currentButton; 112 uint m_currentButton;
115 }; 113 };
116 114
117 InfoList pendingSkins; 115 InfoList pendingSkins;
118 IncrementalLoader *m_currentLoader; 116 IncrementalLoader *m_currentLoader;
119 int m_timerId; 117 int m_timerId;
120}; 118};
121 119
122#endif // SKIN_H 120#endif // SKIN_H
123/* vim: et sw=4 ts=4 121/* vim: et sw=4 ts=4
124 */ 122 */