Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index fb1c9c4..7d05d80 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -11,5 +11,16 @@ Skin::Skin( const QString &name, const QString &fileNameInfix ) | |||
11 | 11 | ||
12 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) | ||
13 | { | ||
14 | backgroundImage(); | ||
15 | buttonUpImage(); | ||
16 | buttonDownImage(); | ||
17 | for ( uint i = 0; i < buttonCount; ++i ) | ||
18 | ( void )buttonMaskImage( skinButtonInfo[ i ].fileName ); | ||
19 | } | ||
20 | |||
12 | QImage Skin::backgroundImage() const | 21 | QImage Skin::backgroundImage() const |
13 | { | 22 | { |
14 | return QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); | 23 | if ( m_backgroundImage.isNull() ) |
24 | m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); | ||
25 | return m_backgroundImage; | ||
15 | } | 26 | } |
@@ -18,3 +29,5 @@ QImage Skin::buttonUpImage() const | |||
18 | { | 29 | { |
19 | return QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | 30 | if ( m_buttonUpImage.isNull() ) |
31 | m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | ||
32 | return m_buttonUpImage; | ||
20 | } | 33 | } |
@@ -23,3 +36,5 @@ QImage Skin::buttonDownImage() const | |||
23 | { | 36 | { |
24 | return QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | 37 | if ( m_buttonDownImage.isNull() ) |
38 | m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | ||
39 | return m_buttonDownImage; | ||
25 | } | 40 | } |
@@ -28,5 +43,9 @@ QImage Skin::buttonMaskImage( const QString &fileName ) const | |||
28 | { | 43 | { |
29 | QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix ); | 44 | ButtonMaskImageMap::Iterator it = m_buttonMasks.find( fileName ); |
30 | QString path = prefix + fileName + ".png"; | 45 | if ( it == m_buttonMasks.end() ) { |
31 | return QImage( Resource::findPixmap( path ) ); | 46 | QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix ); |
47 | QString path = prefix + fileName + ".png"; | ||
48 | it = m_buttonMasks.insert( fileName, QImage( Resource::findPixmap( path ) ) ); | ||
49 | } | ||
50 | return *it; | ||
32 | } | 51 | } |