summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-14 17:30:26 (UTC)
committer simon <simon>2002-12-14 17:30:26 (UTC)
commita3b9d0a1e6ee4f1e74ac3335cb2ba67f6da30476 (patch) (unidiff)
treedde78606067af08f0e3ac8f6ccabff2661b99d08
parentbbdeff25bd0cc5ff59d52fd8bf25cdfbeac8f251 (diff)
downloadopie-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 (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
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
@@ -166,18 +166,16 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
166 killTimers(); 166 killTimers();
167 hide(); 167 hide();
168} 168}
169 169
170void AudioWidget::loadSkin() 170void 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 );
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
@@ -28,16 +28,18 @@ 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
37 setBackgroundMode( NoBackground );
36} 38}
37 39
38MediaWidget::~MediaWidget() 40MediaWidget::~MediaWidget()
39{ 41{
40} 42}
41 43
42void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 44void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
43 const Skin &skin ) 45 const Skin &skin )
@@ -86,31 +88,23 @@ void MediaWidget::closeEvent( QCloseEvent * )
86void MediaWidget::paintEvent( QPaintEvent *pe ) 88void 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
111void MediaWidget::resizeEvent( QResizeEvent *e ) 105void 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 ) {
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
@@ -159,18 +159,16 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
159 scaledHeight = 0; 159 scaledHeight = 0;
160 hide(); 160 hide();
161} 161}
162 162
163void VideoWidget::loadSkin() 163void 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 );
@@ -204,31 +202,29 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
204void VideoWidget::backToNormal() { 202void 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
210void VideoWidget::makeVisible() { 208void 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 {