author | simon <simon> | 2002-12-11 23:12:16 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 23:12:16 (UTC) |
commit | d4a0626f01fae21ed19d0eea88d8eca1935c6bc8 (patch) (side-by-side diff) | |
tree | 9747bdd478c1bd93f46eaa49c95381404a6fd55b /noncore/multimedia/opieplayer2/skin.h | |
parent | 8d5ae95e770bc387420fc094c54d8ac55e64e04b (diff) | |
download | opie-d4a0626f01fae21ed19d0eea88d8eca1935c6bc8.zip opie-d4a0626f01fae21ed19d0eea88d8eca1935c6bc8.tar.gz opie-d4a0626f01fae21ed19d0eea88d8eca1935c6bc8.tar.bz2 |
- skins are now pre-loaded in the background (step by step)
Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.h') (more/less context) (ignore 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 @@ #ifndef SKIN_H #define SKIN_H #include <qstring.h> #include <qimage.h> +#include <qobject.h> #include "mediawidget.h" -#include "threadutil.h" struct SkinData; class Skin { public: @@ -63,43 +63,62 @@ private: SkinData *d; Skin( const Skin & ); Skin &operator=( const Skin & ); }; -class SkinLoader : public ThreadUtil::Thread +class SkinLoader : public QObject { + Q_OBJECT public: SkinLoader(); + virtual ~SkinLoader(); - void schedule( const QString &skinName, const QString &fileNameInfix, - const MediaWidget::SkinButtonInfo *skinButtonInfo, const uint buttonCount ); + void schedule( const MediaWidget::GUIInfo &guiInfo ); + void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ); + + void start(); protected: - virtual void run(); + virtual void timerEvent( QTimerEvent *ev ); + +private slots: + void deleteMe(); private: - struct Info + struct Info : public MediaWidget::GUIInfo { - 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 ) + Info() {} + Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo ) + : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName ) {} - const QString skinName; - const QString fileNameInfix; - const MediaWidget::SkinButtonInfo *skinButtonInfo; - const uint buttonCount; + QString skinName; }; typedef QValueList<Info> InfoList; - void load( const Info &nfo ); + class IncrementalLoader + { + public: + enum LoaderResult { LoadingCompleted, MoreToCome }; + + IncrementalLoader( const Info &info ); + + LoaderResult loadStep(); + + private: + enum State { LoadBackgroundImage, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; + + Skin m_skin; + Info m_info; + State m_currentState; + uint m_currentButton; + }; InfoList pendingSkins; - ThreadUtil::Mutex guard; + IncrementalLoader *m_currentLoader; + int m_timerId; }; #endif // SKIN_H /* vim: et sw=4 ts=4 */ |