Diffstat (limited to 'noncore/multimedia/opieplayer2/skin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index ef70957..d3918d1 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -1,60 +1,59 @@ | |||
1 | 1 | ||
2 | #include "skin.h" | 2 | #include "skin.h" |
3 | 3 | ||
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | 5 | ||
6 | Skin::Skin( const QString &name, const QString &fileNameInfix ) | 6 | Skin::Skin( const QString &name, const QString &fileNameInfix ) |
7 | : m_name( name ), m_fileNameInfix( fileNameInfix ) | 7 | : m_name( name ), m_fileNameInfix( fileNameInfix ) |
8 | { | 8 | { |
9 | m_skinPath = "opieplayer2/skins/" + name; | 9 | m_skinPath = "opieplayer2/skins/" + name; |
10 | } | 10 | } |
11 | 11 | ||
12 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) | 12 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) |
13 | { | 13 | { |
14 | backgroundImage(); | 14 | backgroundImage(); |
15 | buttonUpImage(); | 15 | buttonUpImage(); |
16 | buttonDownImage(); | 16 | buttonDownImage(); |
17 | ( void )buttonMask( skinButtonInfo, buttonCount, buttonAreaSize ); | 17 | ( void )buttonMask( skinButtonInfo, buttonCount ); |
18 | } | 18 | } |
19 | 19 | ||
20 | QImage Skin::backgroundImage() const | 20 | QImage Skin::backgroundImage() const |
21 | { | 21 | { |
22 | if ( m_backgroundImage.isNull() ) | 22 | if ( m_backgroundImage.isNull() ) |
23 | m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); | 23 | m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); |
24 | return m_backgroundImage; | 24 | return m_backgroundImage; |
25 | } | 25 | } |
26 | 26 | ||
27 | QImage Skin::buttonUpImage() const | 27 | QImage Skin::buttonUpImage() const |
28 | { | 28 | { |
29 | if ( m_buttonUpImage.isNull() ) | 29 | if ( m_buttonUpImage.isNull() ) |
30 | m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | 30 | m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); |
31 | return m_buttonUpImage; | 31 | return m_buttonUpImage; |
32 | } | 32 | } |
33 | 33 | ||
34 | QImage Skin::buttonDownImage() const | 34 | QImage Skin::buttonDownImage() const |
35 | { | 35 | { |
36 | if ( m_buttonDownImage.isNull() ) | 36 | if ( m_buttonDownImage.isNull() ) |
37 | m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); | 37 | m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); |
38 | return m_buttonDownImage; | 38 | return m_buttonDownImage; |
39 | } | 39 | } |
40 | 40 | ||
41 | QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) const | 41 | QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const |
42 | { | 42 | { |
43 | if ( buttonAreaSize != m_buttonMask.size() ) | ||
44 | m_buttonMask = QImage(); | ||
45 | |||
46 | if ( !m_buttonMask.isNull() ) | 43 | if ( !m_buttonMask.isNull() ) |
47 | return m_buttonMask; | 44 | return m_buttonMask; |
48 | 45 | ||
46 | QSize buttonAreaSize = buttonUpImage().size(); | ||
47 | |||
49 | m_buttonMask = QImage( buttonAreaSize, 8, 255 ); | 48 | m_buttonMask = QImage( buttonAreaSize, 8, 255 ); |
50 | m_buttonMask.fill( 0 ); | 49 | m_buttonMask.fill( 0 ); |
51 | 50 | ||
52 | for ( uint i = 0; i < buttonCount; ++i ) | 51 | for ( uint i = 0; i < buttonCount; ++i ) |
53 | addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); | 52 | addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); |
54 | 53 | ||
55 | return m_buttonMask; | 54 | return m_buttonMask; |
56 | } | 55 | } |
57 | 56 | ||
58 | void Skin::addButtonToMask( int tag, const QImage &maskImage ) const | 57 | void Skin::addButtonToMask( int tag, const QImage &maskImage ) const |
59 | { | 58 | { |
60 | if ( maskImage.isNull() ) | 59 | if ( maskImage.isNull() ) |