author | simon <simon> | 2002-12-14 17:30:26 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-14 17:30:26 (UTC) |
commit | a3b9d0a1e6ee4f1e74ac3335cb2ba67f6da30476 (patch) (unidiff) | |
tree | dde78606067af08f0e3ac8f6ccabff2661b99d08 /noncore/multimedia/opieplayer2 | |
parent | bbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251 (diff) | |
download | opie-a3b9d0a1e6ee4f1e74ac3335cb2ba67f6da30476.zip opie-a3b9d0a1e6ee4f1e74ac3335cb2ba67f6da30476.tar.gz opie-a3b9d0a1e6ee4f1e74ac3335cb2ba67f6da30476.tar.bz2 |
- kill the flickery when painting. backgroundmode is now always
NoBackground and we do full double-buffering in the paintEvent
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -168,14 +168,12 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | |||
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); |
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 | |||
@@ -30,12 +30,14 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
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 | ||
@@ -88,27 +90,19 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) | |||
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 ); |
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 | |||
@@ -161,14 +161,12 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
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 ); |
@@ -206,13 +204,12 @@ void VideoWidget::backToNormal() { | |||
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) ) ); |
@@ -220,13 +217,12 @@ void VideoWidget::makeVisible() { | |||
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 |