-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index f7a22a3..edef2a7 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -28,97 +28,97 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
29 | { | 29 | { |
30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
33 | this, SLOT( setLength( long ) ) ); | 33 | this, SLOT( setLength( long ) ) ); |
34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
35 | this, SLOT( setPlaying( bool ) ) ); | 35 | this, SLOT( setPlaying( bool ) ) ); |
36 | 36 | ||
37 | setBackgroundMode( NoBackground ); | 37 | setBackgroundMode( NoBackground ); |
38 | } | 38 | } |
39 | 39 | ||
40 | MediaWidget::~MediaWidget() | 40 | MediaWidget::~MediaWidget() |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 44 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
45 | const Skin &skin ) | 45 | const Skin &skin ) |
46 | { | 46 | { |
47 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); | 47 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
48 | 48 | ||
49 | buttons.clear(); | 49 | buttons.clear(); |
50 | buttons.reserve( buttonCount ); | 50 | buttons.reserve( buttonCount ); |
51 | 51 | ||
52 | for ( uint i = 0; i < buttonCount; ++i ) { | 52 | for ( uint i = 0; i < buttonCount; ++i ) { |
53 | Button button = setupButton( skinInfo[ i ], skin ); | 53 | Button button = setupButton( skinInfo[ i ], skin ); |
54 | buttons.push_back( button ); | 54 | buttons.push_back( button ); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 58 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
59 | { | 59 | { |
60 | Button button; | 60 | Button button; |
61 | button.command = buttonInfo.command; | 61 | button.command = buttonInfo.command; |
62 | button.type = buttonInfo.type; | 62 | button.type = buttonInfo.type; |
63 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); | 63 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); |
64 | 64 | ||
65 | return button; | 65 | return button; |
66 | } | 66 | } |
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 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); | 71 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) | 74 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) |
75 | { | 75 | { |
76 | backgroundPixmap = skin.backgroundImage(); | 76 | backgroundPixmap = skin.backgroundPixmap(); |
77 | buttonUpImage = skin.buttonUpImage(); | 77 | buttonUpImage = skin.buttonUpImage(); |
78 | buttonDownImage = skin.buttonDownImage(); | 78 | buttonDownImage = skin.buttonDownImage(); |
79 | 79 | ||
80 | setupButtons( skinInfo, buttonCount, skin ); | 80 | setupButtons( skinInfo, buttonCount, skin ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void MediaWidget::closeEvent( QCloseEvent * ) | 83 | void MediaWidget::closeEvent( QCloseEvent * ) |
84 | { | 84 | { |
85 | mediaPlayerState.setList(); | 85 | mediaPlayerState.setList(); |
86 | } | 86 | } |
87 | 87 | ||
88 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 88 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
89 | { | 89 | { |
90 | QPainter p( this ); | 90 | QPainter p( this ); |
91 | 91 | ||
92 | if ( mediaPlayerState.isFullscreen() ) { | 92 | if ( mediaPlayerState.isFullscreen() ) { |
93 | // Clear the background | 93 | // Clear the background |
94 | p.setBrush( QBrush( Qt::black ) ); | 94 | p.setBrush( QBrush( Qt::black ) ); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | 97 | ||
98 | QPixmap buffer( size() ); | 98 | QPixmap buffer( size() ); |
99 | QPainter bufferedPainter( &buffer ); | 99 | QPainter bufferedPainter( &buffer ); |
100 | bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); | 100 | bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); |
101 | paintAllButtons( bufferedPainter ); | 101 | paintAllButtons( bufferedPainter ); |
102 | p.drawPixmap( 0, 0, buffer ); | 102 | p.drawPixmap( 0, 0, buffer ); |
103 | } | 103 | } |
104 | 104 | ||
105 | void MediaWidget::resizeEvent( QResizeEvent *e ) | 105 | void MediaWidget::resizeEvent( QResizeEvent *e ) |
106 | { | 106 | { |
107 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); | 107 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); |
108 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); | 108 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); |
109 | 109 | ||
110 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 110 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
111 | Button &button = *it; | 111 | Button &button = *it; |
112 | 112 | ||
113 | if ( button.mask.isNull() ) | 113 | if ( button.mask.isNull() ) |
114 | continue; | 114 | continue; |
115 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); | 115 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); |
116 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); | 116 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); |
117 | } | 117 | } |
118 | 118 | ||
119 | QWidget::resizeEvent( e ); | 119 | QWidget::resizeEvent( e ); |
120 | } | 120 | } |
121 | 121 | ||
122 | MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) | 122 | MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) |
123 | { | 123 | { |
124 | if ( position.x() <= 0 || position.y() <= 0 || | 124 | if ( position.x() <= 0 || position.y() <= 0 || |