Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h index bafebd3..067b6c4 100644 --- a/noncore/multimedia/opieplayer2/skin.h +++ b/noncore/multimedia/opieplayer2/skin.h | |||
@@ -1,107 +1,111 @@ | |||
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 | ||
32 | struct SkinData; | 32 | struct SkinData; |
33 | 33 | ||
34 | class Skin | 34 | class Skin |
35 | { | 35 | { |
36 | public: | 36 | public: |
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 | bool isCachable() const { return m_isCachable; } | ||
42 | void setCachable( bool cachable ) { m_isCachable = cachable; } | ||
43 | |||
41 | QPixmap backgroundPixmap() const; | 44 | QPixmap backgroundPixmap() const; |
42 | QImage buttonUpImage() const; | 45 | QImage buttonUpImage() const; |
43 | QImage buttonDownImage() const; | 46 | QImage buttonDownImage() const; |
44 | 47 | ||
45 | QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; | 48 | QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; |
46 | 49 | ||
47 | QImage buttonMaskImage( const QString &fileName ) const; | 50 | QImage buttonMaskImage( const QString &fileName ) const; |
48 | 51 | ||
49 | static QString defaultSkinName(); | 52 | static QString defaultSkinName(); |
50 | 53 | ||
51 | private: | 54 | private: |
52 | void init( const QString &name ); | 55 | void init( const QString &name ); |
53 | 56 | ||
54 | void addButtonToMask( int tag, const QImage &maskImage ) const; | 57 | void addButtonToMask( int tag, const QImage &maskImage ) const; |
55 | 58 | ||
56 | static QImage loadImage( const QString &fileName ); | 59 | static QImage loadImage( const QString &fileName ); |
57 | 60 | ||
58 | QString m_fileNameInfix; | 61 | QString m_fileNameInfix; |
59 | QString m_skinPath; | 62 | QString m_skinPath; |
63 | bool m_isCachable : 1; | ||
60 | 64 | ||
61 | SkinData *d; | 65 | SkinData *d; |
62 | 66 | ||
63 | Skin( const Skin & ); | 67 | Skin( const Skin & ); |
64 | Skin &operator=( const Skin & ); | 68 | Skin &operator=( const Skin & ); |
65 | }; | 69 | }; |
66 | 70 | ||
67 | class SkinLoader : public QObject | 71 | class SkinLoader : public QObject |
68 | { | 72 | { |
69 | Q_OBJECT | 73 | Q_OBJECT |
70 | public: | 74 | public: |
71 | SkinLoader(); | 75 | SkinLoader(); |
72 | virtual ~SkinLoader(); | 76 | virtual ~SkinLoader(); |
73 | 77 | ||
74 | void schedule( const MediaWidget::GUIInfo &guiInfo ); | 78 | void schedule( const MediaWidget::GUIInfo &guiInfo ); |
75 | void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ); | 79 | void schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ); |
76 | 80 | ||
77 | void start(); | 81 | void start(); |
78 | 82 | ||
79 | protected: | 83 | protected: |
80 | virtual void timerEvent( QTimerEvent *ev ); | 84 | virtual void timerEvent( QTimerEvent *ev ); |
81 | 85 | ||
82 | private slots: | 86 | private slots: |
83 | void deleteMe(); | 87 | void deleteMe(); |
84 | 88 | ||
85 | private: | 89 | private: |
86 | struct Info : public MediaWidget::GUIInfo | 90 | struct Info : public MediaWidget::GUIInfo |
87 | { | 91 | { |
88 | Info() {} | 92 | Info() {} |
89 | Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo ) | 93 | Info( const QString &_skinName, const MediaWidget::GUIInfo &guiInfo ) |
90 | : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName ) | 94 | : MediaWidget::GUIInfo( guiInfo ), skinName( _skinName ) |
91 | {} | 95 | {} |
92 | 96 | ||
93 | QString skinName; | 97 | QString skinName; |
94 | }; | 98 | }; |
95 | typedef QValueList<Info> InfoList; | 99 | typedef QValueList<Info> InfoList; |
96 | 100 | ||
97 | class IncrementalLoader | 101 | class IncrementalLoader |
98 | { | 102 | { |
99 | public: | 103 | public: |
100 | enum LoaderResult { LoadingCompleted, MoreToCome }; | 104 | enum LoaderResult { LoadingCompleted, MoreToCome }; |
101 | 105 | ||
102 | IncrementalLoader( const Info &info ); | 106 | IncrementalLoader( const Info &info ); |
103 | 107 | ||
104 | LoaderResult loadStep(); | 108 | LoaderResult loadStep(); |
105 | 109 | ||
106 | private: | 110 | private: |
107 | enum State { LoadBackgroundPixmap, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; | 111 | enum State { LoadBackgroundPixmap, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; |