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 @@ -16,27 +16,27 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #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: Skin( const QString &name, const QString &fileNameInfix ); Skin( const QString &fileNameInfix ); ~Skin(); void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); @@ -57,49 +57,68 @@ private: static QImage loadImage( const QString &fileName ); QString m_fileNameInfix; QString m_skinPath; 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 */ |