-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 |
3 files changed, 8 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index cd5bea4..5d929cb 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -158,34 +158,32 @@ void AudioWidget::setLength( long max ) { | |||
158 | 158 | ||
159 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 159 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
160 | if ( mediaType == MediaPlayerState::Audio ) { | 160 | if ( mediaType == MediaPlayerState::Audio ) { |
161 | // startTimer( 150 ); | 161 | // startTimer( 150 ); |
162 | showMaximized(); | 162 | showMaximized(); |
163 | return; | 163 | return; |
164 | } | 164 | } |
165 | 165 | ||
166 | killTimers(); | 166 | killTimers(); |
167 | hide(); | 167 | hide(); |
168 | } | 168 | } |
169 | 169 | ||
170 | void AudioWidget::loadSkin() | 170 | void AudioWidget::loadSkin() |
171 | { | 171 | { |
172 | loadDefaultSkin( guiInfo() ); | 172 | loadDefaultSkin( guiInfo() ); |
173 | 173 | ||
174 | setBackgroundPixmap( backgroundPixmap ); | ||
175 | |||
176 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 174 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
177 | // changeTextColor( &songInfo ); | 175 | // changeTextColor( &songInfo ); |
178 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 176 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
179 | // songInfo.setFrameStyle( QFrame::NoFrame); | 177 | // songInfo.setFrameStyle( QFrame::NoFrame); |
180 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 178 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
181 | // songInfo.setForegroundColor(Qt::white); | 179 | // songInfo.setForegroundColor(Qt::white); |
182 | 180 | ||
183 | slider.setFixedHeight( 20 ); | 181 | slider.setFixedHeight( 20 ); |
184 | slider.setMinValue( 0 ); | 182 | slider.setMinValue( 0 ); |
185 | slider.setMaxValue( 1 ); | 183 | slider.setMaxValue( 1 ); |
186 | slider.setFocusPolicy( QWidget::NoFocus ); | 184 | slider.setFocusPolicy( QWidget::NoFocus ); |
187 | slider.setBackgroundPixmap( backgroundPixmap ); | 185 | slider.setBackgroundPixmap( backgroundPixmap ); |
188 | 186 | ||
189 | // Config cofg("qpe"); | 187 | // Config cofg("qpe"); |
190 | // cofg.setGroup("Appearance"); | 188 | // cofg.setGroup("Appearance"); |
191 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 189 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 702e6d7..f7a22a3 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -20,32 +20,34 @@ | |||
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "mediawidget.h" | 23 | #include "mediawidget.h" |
24 | #include "playlistwidget.h" | 24 | #include "playlistwidget.h" |
25 | #include "skin.h" | 25 | #include "skin.h" |
26 | 26 | ||
27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
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 | |||
37 | setBackgroundMode( NoBackground ); | ||
36 | } | 38 | } |
37 | 39 | ||
38 | MediaWidget::~MediaWidget() | 40 | MediaWidget::~MediaWidget() |
39 | { | 41 | { |
40 | } | 42 | } |
41 | 43 | ||
42 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 44 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
43 | const Skin &skin ) | 45 | const Skin &skin ) |
44 | { | 46 | { |
45 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); | 47 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
46 | 48 | ||
47 | buttons.clear(); | 49 | buttons.clear(); |
48 | buttons.reserve( buttonCount ); | 50 | buttons.reserve( buttonCount ); |
49 | 51 | ||
50 | for ( uint i = 0; i < buttonCount; ++i ) { | 52 | for ( uint i = 0; i < buttonCount; ++i ) { |
51 | Button button = setupButton( skinInfo[ i ], skin ); | 53 | Button button = setupButton( skinInfo[ i ], skin ); |
@@ -78,47 +80,39 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co | |||
78 | setupButtons( skinInfo, buttonCount, skin ); | 80 | setupButtons( skinInfo, buttonCount, skin ); |
79 | } | 81 | } |
80 | 82 | ||
81 | void MediaWidget::closeEvent( QCloseEvent * ) | 83 | void MediaWidget::closeEvent( QCloseEvent * ) |
82 | { | 84 | { |
83 | mediaPlayerState.setList(); | 85 | mediaPlayerState.setList(); |
84 | } | 86 | } |
85 | 87 | ||
86 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 88 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
87 | { | 89 | { |
88 | QPainter p( this ); | 90 | QPainter p( this ); |
89 | 91 | ||
90 | if ( mediaPlayerState.isFullscreen() ) { | 92 | if ( mediaPlayerState.isFullscreen() ) { |
91 | // Clear the background | 93 | // Clear the background |
92 | p.setBrush( QBrush( Qt::black ) ); | 94 | p.setBrush( QBrush( Qt::black ) ); |
93 | return; | 95 | return; |
94 | } | ||
95 | |||
96 | if ( !pe->erased() ) { | ||
97 | // Combine with background and double buffer | ||
98 | QPixmap pix( pe->rect().size() ); | ||
99 | QPainter p( &pix ); | ||
100 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | ||
101 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); | ||
102 | paintAllButtons( p ); | ||
103 | QPainter p2( this ); | ||
104 | p2.drawPixmap( pe->rect().topLeft(), pix ); | ||
105 | } else { | ||
106 | QPainter p( this ); | ||
107 | paintAllButtons( p ); | ||
108 | } | 96 | } |
97 | |||
98 | QPixmap buffer( size() ); | ||
99 | QPainter bufferedPainter( &buffer ); | ||
100 | bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); | ||
101 | paintAllButtons( bufferedPainter ); | ||
102 | p.drawPixmap( 0, 0, buffer ); | ||
109 | } | 103 | } |
110 | 104 | ||
111 | void MediaWidget::resizeEvent( QResizeEvent *e ) | 105 | void MediaWidget::resizeEvent( QResizeEvent *e ) |
112 | { | 106 | { |
113 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); | 107 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); |
114 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); | 108 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); |
115 | 109 | ||
116 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 110 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
117 | Button &button = *it; | 111 | Button &button = *it; |
118 | 112 | ||
119 | if ( button.mask.isNull() ) | 113 | if ( button.mask.isNull() ) |
120 | continue; | 114 | continue; |
121 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); | 115 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); |
122 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); | 116 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); |
123 | } | 117 | } |
124 | 118 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 2300630..755cd22 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -151,34 +151,32 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
151 | { | 151 | { |
152 | if ( displayType == MediaPlayerState::Video ) { | 152 | if ( displayType == MediaPlayerState::Video ) { |
153 | makeVisible(); | 153 | makeVisible(); |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | 156 | ||
157 | // Effectively blank the view next time we show it so it looks nicer | 157 | // Effectively blank the view next time we show it so it looks nicer |
158 | scaledWidth = 0; | 158 | scaledWidth = 0; |
159 | scaledHeight = 0; | 159 | scaledHeight = 0; |
160 | hide(); | 160 | hide(); |
161 | } | 161 | } |
162 | 162 | ||
163 | void VideoWidget::loadSkin() | 163 | void VideoWidget::loadSkin() |
164 | { | 164 | { |
165 | loadDefaultSkin( guiInfo() ); | 165 | loadDefaultSkin( guiInfo() ); |
166 | 166 | ||
167 | setBackgroundPixmap( backgroundPixmap ); | ||
168 | |||
169 | delete slider; | 167 | delete slider; |
170 | slider = new QSlider( Qt::Horizontal, this ); | 168 | slider = new QSlider( Qt::Horizontal, this ); |
171 | slider->setMinValue( 0 ); | 169 | slider->setMinValue( 0 ); |
172 | slider->setMaxValue( 1 ); | 170 | slider->setMaxValue( 1 ); |
173 | slider->setBackgroundPixmap( backgroundPixmap ); | 171 | slider->setBackgroundPixmap( backgroundPixmap ); |
174 | //slider->setFocusPolicy( QWidget::NoFocus ); | 172 | //slider->setFocusPolicy( QWidget::NoFocus ); |
175 | 173 | ||
176 | resizeEvent( 0 ); | 174 | resizeEvent( 0 ); |
177 | } | 175 | } |
178 | 176 | ||
179 | void VideoWidget::updateSlider( long i, long max ) { | 177 | void VideoWidget::updateSlider( long i, long max ) { |
180 | // Will flicker too much if we don't do this | 178 | // Will flicker too much if we don't do this |
181 | if ( max == 0 ) { | 179 | if ( max == 0 ) { |
182 | return; | 180 | return; |
183 | } | 181 | } |
184 | int width = slider->width(); | 182 | int width = slider->width(); |
@@ -196,47 +194,45 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
196 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 194 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
197 | if ( mediaPlayerState.isFullscreen() ) { | 195 | if ( mediaPlayerState.isFullscreen() ) { |
198 | mediaPlayerState.setFullscreen( FALSE ); | 196 | mediaPlayerState.setFullscreen( FALSE ); |
199 | makeVisible(); | 197 | makeVisible(); |
200 | } | 198 | } |
201 | MediaWidget::mouseReleaseEvent( event ); | 199 | MediaWidget::mouseReleaseEvent( event ); |
202 | } | 200 | } |
203 | 201 | ||
204 | void VideoWidget::backToNormal() { | 202 | void VideoWidget::backToNormal() { |
205 | mediaPlayerState.setFullscreen( FALSE ); | 203 | mediaPlayerState.setFullscreen( FALSE ); |
206 | makeVisible(); | 204 | makeVisible(); |
207 | setToggleButton( FullScreen, false ); | 205 | setToggleButton( FullScreen, false ); |
208 | } | 206 | } |
209 | 207 | ||
210 | void VideoWidget::makeVisible() { | 208 | void VideoWidget::makeVisible() { |
211 | if ( mediaPlayerState.isFullscreen() ) { | 209 | if ( mediaPlayerState.isFullscreen() ) { |
212 | setBackgroundMode( QWidget::NoBackground ); | ||
213 | showFullScreen(); | 210 | showFullScreen(); |
214 | resize( qApp->desktop()->size() ); | 211 | resize( qApp->desktop()->size() ); |
215 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 212 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
216 | 213 | ||
217 | slider->hide(); | 214 | slider->hide(); |
218 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 215 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
219 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 216 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
220 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 217 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
221 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 218 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
222 | 219 | ||
223 | } else { | 220 | } else { |
224 | showNormal(); | 221 | showNormal(); |
225 | showMaximized(); | 222 | showMaximized(); |
226 | setBackgroundPixmap( backgroundPixmap ); | ||
227 | QWidget *d = QApplication::desktop(); | 223 | QWidget *d = QApplication::desktop(); |
228 | int w = d->width(); | 224 | int w = d->width(); |
229 | int h = d->height(); | 225 | int h = d->height(); |
230 | 226 | ||
231 | if(w>h) { | 227 | if(w>h) { |
232 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 228 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
233 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 229 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
234 | } else { | 230 | } else { |
235 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 231 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
236 | } | 232 | } |
237 | 233 | ||
238 | if ( !mediaPlayerState.isSeekable() ) { | 234 | if ( !mediaPlayerState.isSeekable() ) { |
239 | if( !slider->isHidden()) { | 235 | if( !slider->isHidden()) { |
240 | slider->hide(); | 236 | slider->hide(); |
241 | } | 237 | } |
242 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 238 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |