Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index 9ad5f3f..06453f9 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -12,41 +12,57 @@ | |||
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 | 25 | ||
25 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
26 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
27 | 28 | ||
28 | #include <assert.h> | 29 | #include <assert.h> |
29 | 30 | ||
30 | struct SkinData | 31 | struct SkinData |
31 | { | 32 | { |
32 | typedef QMap<QString, QImage> ButtonMaskImageMap; | 33 | typedef QMap<QString, QImage> ButtonMaskImageMap; |
33 | 34 | ||
34 | QImage backgroundImage; | 35 | QImage backgroundImage; |
35 | QImage buttonUpImage; | 36 | QImage buttonUpImage; |
36 | QImage buttonDownImage; | 37 | QImage buttonDownImage; |
37 | QImage buttonMask; | 38 | QImage buttonMask; |
38 | ButtonMaskImageMap buttonMasks; | 39 | ButtonMaskImageMap buttonMasks; |
39 | }; | 40 | }; |
40 | 41 | ||
42 | class SkinCache : public Singleton<SkinCache> | ||
43 | { | ||
44 | public: | ||
45 | SkinCache(); | ||
46 | |||
47 | QImage loadImage( const QString &name ); | ||
48 | |||
49 | private: | ||
50 | typedef QDict<QImage> ImageCache; | ||
51 | |||
52 | ImageCache m_cache; | ||
53 | |||
54 | ThreadUtil::Mutex m_cacheGuard; | ||
55 | }; | ||
56 | |||
41 | Skin::Skin( const QString &name, const QString &fileNameInfix ) | 57 | Skin::Skin( const QString &name, const QString &fileNameInfix ) |
42 | : m_fileNameInfix( fileNameInfix ) | 58 | : m_fileNameInfix( fileNameInfix ) |
43 | { | 59 | { |
44 | init( name ); | 60 | init( name ); |
45 | } | 61 | } |
46 | 62 | ||
47 | Skin::Skin( const QString &fileNameInfix ) | 63 | Skin::Skin( const QString &fileNameInfix ) |
48 | : m_fileNameInfix( fileNameInfix ) | 64 | : m_fileNameInfix( fileNameInfix ) |
49 | { | 65 | { |
50 | init( defaultSkinName() ); | 66 | init( defaultSkinName() ); |
51 | } | 67 | } |
52 | 68 | ||