author | simon <simon> | 2002-12-14 18:18:20 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-14 18:18:20 (UTC) |
commit | 7c854ad1b909f37c7314ef4ac2061500d02af16d (patch) (unidiff) | |
tree | 24528d72c0f2d36d6777090d7d93e2536ffb120d /noncore/multimedia | |
parent | ae7a270c56fa0fff6d3f530c80532c54c51be596 (diff) | |
download | opie-7c854ad1b909f37c7314ef4ac2061500d02af16d.zip opie-7c854ad1b909f37c7314ef4ac2061500d02af16d.tar.gz opie-7c854ad1b909f37c7314ef4ac2061500d02af16d.tar.bz2 |
- reduce memory usage a little bit by not storing the images after they
got converted to pixmaps
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index edef2a7..46e7b6e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -67,8 +67,9 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, | |||
67 | 67 | ||
68 | void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) | 68 | void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) |
69 | { | 69 | { |
70 | Skin skin( guiInfo.fileNameInfix ); | 70 | Skin skin( guiInfo.fileNameInfix ); |
71 | skin.setCachable( false ); | ||
71 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); | 72 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); |
72 | } | 73 | } |
73 | 74 | ||
74 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) | 75 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) |
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index a8f4ae9..44f5ca2 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -76,13 +76,17 @@ Skin::Skin( const QString &fileNameInfix ) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | Skin::~Skin() | 78 | Skin::~Skin() |
79 | { | 79 | { |
80 | if ( m_isCachable ) | ||
80 | SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); | 81 | SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); |
82 | else | ||
83 | delete d; | ||
81 | } | 84 | } |
82 | 85 | ||
83 | void Skin::init( const QString &name ) | 86 | void Skin::init( const QString &name ) |
84 | { | 87 | { |
88 | m_isCachable = true; | ||
85 | m_skinPath = "opieplayer2/skins/" + name; | 89 | m_skinPath = "opieplayer2/skins/" + name; |
86 | d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); | 90 | d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); |
87 | } | 91 | } |
88 | 92 | ||
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 | |||
@@ -37,8 +37,11 @@ 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 | ||
@@ -56,8 +59,9 @@ private: | |||
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 & ); |