Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
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 | |||
@@ -143,108 +143,104 @@ void VideoWidget::setPosition( long i ) { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void VideoWidget::setLength( long max ) { | 146 | void VideoWidget::setLength( long max ) { |
147 | updateSlider( mediaPlayerState.position(), max ); | 147 | updateSlider( mediaPlayerState.position(), max ); |
148 | } | 148 | } |
149 | 149 | ||
150 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 150 | 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(); |
185 | int val = int((double)i * width / max); | 183 | int val = int((double)i * width / max); |
186 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 184 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
187 | if ( slider->value() != val ) { | 185 | if ( slider->value() != val ) { |
188 | slider->setValue( val ); | 186 | slider->setValue( val ); |
189 | } | 187 | } |
190 | if ( slider->maxValue() != width ) { | 188 | if ( slider->maxValue() != width ) { |
191 | slider->setMaxValue( width ); | 189 | slider->setMaxValue( width ); |
192 | } | 190 | } |
193 | } | 191 | } |
194 | } | 192 | } |
195 | 193 | ||
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) ) ); |
243 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 239 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
244 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 240 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
245 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 241 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
246 | } else { | 242 | } else { |
247 | slider->show(); | 243 | slider->show(); |
248 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 244 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
249 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 245 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
250 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 246 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |