author | simon <simon> | 2002-12-11 12:47:06 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 12:47:06 (UTC) |
commit | dd6a6d5345e191ffa6da3e015c4e024bd8ca67b7 (patch) (unidiff) | |
tree | 565797ef0522be6d3cff893d8bc04c4378306c16 /noncore/multimedia/opieplayer2/mediawidget.cpp | |
parent | 6f5e269efd9d6a5910251ce26750134e841f7b14 (diff) | |
download | opie-dd6a6d5345e191ffa6da3e015c4e024bd8ca67b7.zip opie-dd6a6d5345e191ffa6da3e015c4e024bd8ca67b7.tar.gz opie-dd6a6d5345e191ffa6da3e015c4e024bd8ca67b7.tar.bz2 |
- button mask composing moved to Skin class
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 4de7ea9..da0706e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -43,14 +43,13 @@ MediaWidget::~MediaWidget() | |||
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
47 | const Skin &skin, const QSize &buttonAreaSize ) | 47 | const Skin &skin, const QSize &buttonAreaSize ) |
48 | { | 48 | { |
49 | buttonMask = QImage( buttonAreaSize, 8, 255 ); | 49 | buttonMask = skin.buttonMask( skinInfo, buttonCount, buttonAreaSize ); |
50 | buttonMask.fill( 0 ); | ||
51 | 50 | ||
52 | buttons.clear(); | 51 | buttons.clear(); |
53 | buttons.reserve( buttonCount ); | 52 | buttons.reserve( buttonCount ); |
54 | 53 | ||
55 | for ( uint i = 0; i < buttonCount; ++i ) { | 54 | for ( uint i = 0; i < buttonCount; ++i ) { |
56 | Button button = setupButton( skinInfo[ i ], skin ); | 55 | Button button = setupButton( skinInfo[ i ], skin ); |
@@ -60,36 +59,17 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount | |||
60 | 59 | ||
61 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
62 | { | 61 | { |
63 | Button button; | 62 | Button button; |
64 | button.command = buttonInfo.command; | 63 | button.command = buttonInfo.command; |
65 | button.type = buttonInfo.type; | 64 | button.type = buttonInfo.type; |
66 | 65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); | |
67 | button.mask = setupButtonMask( button.command, skin.buttonMaskImage( buttonInfo.fileName ) ); | ||
68 | 66 | ||
69 | return button; | 67 | return button; |
70 | } | 68 | } |
71 | 69 | ||
72 | QBitmap MediaWidget::setupButtonMask( const Command &command, const QImage &maskImage ) | ||
73 | { | ||
74 | if ( maskImage.isNull() ) | ||
75 | return QBitmap(); | ||
76 | |||
77 | uchar **dest = buttonMask.jumpTable(); | ||
78 | for ( int y = 0; y < buttonMask.height(); y++ ) { | ||
79 | uchar *line = dest[y]; | ||
80 | for ( int x = 0; x < buttonMask.width(); x++ ) | ||
81 | if ( !qRed( maskImage.pixel( x, y ) ) ) | ||
82 | line[x] = command + 1; | ||
83 | } | ||
84 | |||
85 | // ### grmbl qt2. use constructor when switching to qt3. | ||
86 | QBitmap bm; bm = maskImage; | ||
87 | return bm; | ||
88 | } | ||
89 | |||
90 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) | 70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) |
91 | { | 71 | { |
92 | Config cfg( "OpiePlayer" ); | 72 | Config cfg( "OpiePlayer" ); |
93 | cfg.setGroup( "Options" ); | 73 | cfg.setGroup( "Options" ); |
94 | QString skin = cfg.readEntry( "Skin","default" ); | 74 | QString skin = cfg.readEntry( "Skin","default" ); |
95 | 75 | ||