summaryrefslogtreecommitdiff
Unidiff
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
@@ -126,98 +126,96 @@ void AudioWidget::resizeEvent( QResizeEvent *e ) {
126 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 126 slider.setBackgroundOrigin( QWidget::ParentOrigin );
127 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 127 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
128 128
129 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 129 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
130 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 130 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
131 131
132 MediaWidget::resizeEvent( e ); 132 MediaWidget::resizeEvent( e );
133} 133}
134 134
135void AudioWidget::sliderPressed() { 135void AudioWidget::sliderPressed() {
136 audioSliderBeingMoved = TRUE; 136 audioSliderBeingMoved = TRUE;
137} 137}
138 138
139 139
140void AudioWidget::sliderReleased() { 140void AudioWidget::sliderReleased() {
141 audioSliderBeingMoved = FALSE; 141 audioSliderBeingMoved = FALSE;
142 if ( slider.width() == 0 ) 142 if ( slider.width() == 0 )
143 return; 143 return;
144 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 144 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
145 mediaPlayerState.setPosition( val ); 145 mediaPlayerState.setPosition( val );
146} 146}
147 147
148void AudioWidget::setPosition( long i ) { 148void AudioWidget::setPosition( long i ) {
149 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 149 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
150 updateSlider( i, mediaPlayerState.length() ); 150 updateSlider( i, mediaPlayerState.length() );
151} 151}
152 152
153 153
154void AudioWidget::setLength( long max ) { 154void AudioWidget::setLength( long max ) {
155 updateSlider( mediaPlayerState.position(), max ); 155 updateSlider( mediaPlayerState.position(), max );
156} 156}
157 157
158 158
159void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 159void 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
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 );
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" ) );
192 190
193 time.setFocusPolicy( QWidget::NoFocus ); 191 time.setFocusPolicy( QWidget::NoFocus );
194 time.setAlignment( Qt::AlignCenter ); 192 time.setAlignment( Qt::AlignCenter );
195 193
196// time.setFrame(FALSE); 194// time.setFrame(FALSE);
197// changeTextColor( &time ); 195// changeTextColor( &time );
198 196
199 resizeEvent( 0 ); 197 resizeEvent( 0 );
200} 198}
201 199
202void AudioWidget::setSeekable( bool isSeekable ) { 200void AudioWidget::setSeekable( bool isSeekable ) {
203 201
204 if ( !isSeekable ) { 202 if ( !isSeekable ) {
205 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 203 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
206 if( !slider.isHidden()) { 204 if( !slider.isHidden()) {
207 slider.hide(); 205 slider.hide();
208 } 206 }
209 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 207 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
210 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 208 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
211 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 209 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
212 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 210 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
213 } else { 211 } else {
214 // this stops the slider from being moved, thus 212 // this stops the slider from being moved, thus
215 // does not stop stream when it reaches the end 213 // does not stop stream when it reaches the end
216 slider.show(); 214 slider.show();
217 qDebug( " CONNECT SET POSTION " ); 215 qDebug( " CONNECT SET POSTION " );
218 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 216 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
219 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 217 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
220 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 218 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
221 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 219 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
222 } 220 }
223} 221}
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
@@ -1,156 +1,150 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
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
27MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 27MediaWidget::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
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 )
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 );
52 buttons.push_back( button ); 54 buttons.push_back( button );
53 } 55 }
54} 56}
55 57
56MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 58MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
57{ 59{
58 Button button; 60 Button button;
59 button.command = buttonInfo.command; 61 button.command = buttonInfo.command;
60 button.type = buttonInfo.type; 62 button.type = buttonInfo.type;
61 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 63 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
62 64
63 return button; 65 return button;
64} 66}
65 67
66void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 68void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
67{ 69{
68 Skin skin( guiInfo.fileNameInfix ); 70 Skin skin( guiInfo.fileNameInfix );
69 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 71 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
70} 72}
71 73
72void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 74void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
73{ 75{
74 backgroundPixmap = skin.backgroundImage(); 76 backgroundPixmap = skin.backgroundImage();
75 buttonUpImage = skin.buttonUpImage(); 77 buttonUpImage = skin.buttonUpImage();
76 buttonDownImage = skin.buttonDownImage(); 78 buttonDownImage = skin.buttonDownImage();
77 79
78 setupButtons( skinInfo, buttonCount, skin ); 80 setupButtons( skinInfo, buttonCount, skin );
79} 81}
80 82
81void MediaWidget::closeEvent( QCloseEvent * ) 83void MediaWidget::closeEvent( QCloseEvent * )
82{ 84{
83 mediaPlayerState.setList(); 85 mediaPlayerState.setList();
84} 86}
85 87
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 ) {
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
125 QWidget::resizeEvent( e ); 119 QWidget::resizeEvent( e );
126} 120}
127 121
128MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) 122MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position )
129{ 123{
130 if ( position.x() <= 0 || position.y() <= 0 || 124 if ( position.x() <= 0 || position.y() <= 0 ||
131 position.x() >= buttonMask.width() || 125 position.x() >= buttonMask.width() ||
132 position.y() >= buttonMask.height() ) 126 position.y() >= buttonMask.height() )
133 return 0; 127 return 0;
134 128
135 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); 129 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() );
136 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) 130 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
137 if ( it->command + 1 == pixelIdx ) 131 if ( it->command + 1 == pixelIdx )
138 return &( *it ); 132 return &( *it );
139 133
140 return 0; 134 return 0;
141} 135}
142 136
143void MediaWidget::mousePressEvent( QMouseEvent *event ) 137void MediaWidget::mousePressEvent( QMouseEvent *event )
144{ 138{
145 Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); 139 Button *button = buttonAt( event->pos() - upperLeftOfButtonMask );
146 140
147 if ( !button ) { 141 if ( !button ) {
148 QWidget::mousePressEvent( event ); 142 QWidget::mousePressEvent( event );
149 return; 143 return;
150 } 144 }
151 145
152 switch ( button->command ) { 146 switch ( button->command ) {
153 case VolumeUp: emit moreClicked(); return; 147 case VolumeUp: emit moreClicked(); return;
154 case VolumeDown: emit lessClicked(); return; 148 case VolumeDown: emit lessClicked(); return;
155 case Back: emit backClicked(); return; 149 case Back: emit backClicked(); return;
156 case Forward: emit forwardClicked(); return; 150 case Forward: emit forwardClicked(); return;
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
@@ -119,156 +119,152 @@ void VideoWidget::resizeEvent( QResizeEvent *e ) {
119 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 119 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
120 if(w>h) 120 if(w>h)
121 upperLeftOfButtonMask.ry() = 0; 121 upperLeftOfButtonMask.ry() = 0;
122 else 122 else
123 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 123 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
124 124
125 MediaWidget::resizeEvent( e ); 125 MediaWidget::resizeEvent( e );
126} 126}
127 127
128void VideoWidget::sliderPressed() { 128void VideoWidget::sliderPressed() {
129 videoSliderBeingMoved = TRUE; 129 videoSliderBeingMoved = TRUE;
130} 130}
131 131
132void VideoWidget::sliderReleased() { 132void VideoWidget::sliderReleased() {
133 videoSliderBeingMoved = FALSE; 133 videoSliderBeingMoved = FALSE;
134 if ( slider->width() == 0 ) { 134 if ( slider->width() == 0 ) {
135 return; 135 return;
136 } 136 }
137 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 137 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
138 mediaPlayerState.setPosition( val ); 138 mediaPlayerState.setPosition( val );
139} 139}
140 140
141void VideoWidget::setPosition( long i ) { 141void VideoWidget::setPosition( long i ) {
142 updateSlider( i, mediaPlayerState.length() ); 142 updateSlider( i, mediaPlayerState.length() );
143} 143}
144 144
145 145
146void VideoWidget::setLength( long max ) { 146void VideoWidget::setLength( long max ) {
147 updateSlider( mediaPlayerState.position(), max ); 147 updateSlider( mediaPlayerState.position(), max );
148} 148}
149 149
150void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 150void 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
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 );
177} 175}
178 176
179void VideoWidget::updateSlider( long i, long max ) { 177void 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
196void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 194void 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
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 {
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() ) );
251 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 247 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
252 } 248 }
253 } 249 }
254} 250}
255 251
256void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 252void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
257 switch ( e->key() ) { 253 switch ( e->key() ) {
258////////////////////////////// Zaurus keys 254////////////////////////////// Zaurus keys
259 case Key_Home: 255 case Key_Home:
260 break; 256 break;
261 case Key_F9: //activity 257 case Key_F9: //activity
262 break; 258 break;
263 case Key_F10: //contacts 259 case Key_F10: //contacts
264// hide(); 260// hide();
265 break; 261 break;
266 case Key_F11: //menu 262 case Key_F11: //menu
267 break; 263 break;
268 case Key_F12: //home 264 case Key_F12: //home
269 break; 265 break;
270 case Key_F13: //mail 266 case Key_F13: //mail
271 break; 267 break;
272 case Key_Space: { 268 case Key_Space: {
273 if(mediaPlayerState.isPlaying()) { 269 if(mediaPlayerState.isPlaying()) {
274 mediaPlayerState.setPlaying(FALSE); 270 mediaPlayerState.setPlaying(FALSE);