author | llornkcor <llornkcor> | 2002-08-15 16:32:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-15 16:32:17 (UTC) |
commit | 07ea5f165a2f17f818147b2e8afb02af2c269b55 (patch) (unidiff) | |
tree | 94059e0b4910f5a681be601f554c5c3a6c26de4b /noncore/multimedia/opieplayer2/mediaplayer.cpp | |
parent | 747a98bb3b2a92b6f3577fa383fc44a8644a7ce2 (diff) | |
download | opie-07ea5f165a2f17f818147b2e8afb02af2c269b55.zip opie-07ea5f165a2f17f818147b2e8afb02af2c269b55.tar.gz opie-07ea5f165a2f17f818147b2e8afb02af2c269b55.tar.bz2 |
added useAudio() and useVideo()
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 106 |
1 files changed, 75 insertions, 31 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index a3238f0..51fbb8b 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "mediaplayer.h" | 11 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 12 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "videowidget.h" | ||
14 | #include "volumecontrol.h" | 15 | #include "volumecontrol.h" |
15 | 16 | ||
16 | #include "mediaplayerstate.h" | 17 | #include "mediaplayerstate.h" |
@@ -18,6 +19,7 @@ | |||
18 | 19 | ||
19 | 20 | ||
20 | extern AudioWidget *audioUI; | 21 | extern AudioWidget *audioUI; |
22 | extern VideoWidget *videoUI; | ||
21 | extern PlayListWidget *playList; | 23 | extern PlayListWidget *playList; |
22 | extern MediaPlayerState *mediaPlayerState; | 24 | extern MediaPlayerState *mediaPlayerState; |
23 | 25 | ||
@@ -42,6 +44,11 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
42 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
43 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
44 | 46 | ||
47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
51 | |||
45 | volControl = new VolumeControl; | 52 | volControl = new VolumeControl; |
46 | 53 | ||
47 | } | 54 | } |
@@ -151,9 +158,17 @@ void MediaPlayer::stopChangingVolume() { | |||
151 | // Get rid of the on-screen display stuff | 158 | // Get rid of the on-screen display stuff |
152 | drawnOnScreenDisplay = FALSE; | 159 | drawnOnScreenDisplay = FALSE; |
153 | onScreenDisplayVolume = 0; | 160 | onScreenDisplayVolume = 0; |
154 | int w = audioUI->width(); | 161 | int w=0; |
155 | int h = audioUI->height(); | 162 | int h=0; |
156 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 163 | if( !xineControl->hasVideo()) { |
164 | w = audioUI->width(); | ||
165 | h = audioUI->height(); | ||
166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | ||
167 | } else { | ||
168 | w = videoUI->width(); | ||
169 | h = videoUI->height(); | ||
170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | ||
171 | } | ||
157 | } | 172 | } |
158 | 173 | ||
159 | 174 | ||
@@ -165,42 +180,71 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
165 | } | 180 | } |
166 | 181 | ||
167 | 182 | ||
168 | // TODO FIXME | 183 | // TODO FIXME |
169 | int v; | 184 | int v; |
170 | v = volControl->getVolume(); | 185 | v = volControl->getVolume(); |
171 | v = v / 10; | 186 | v = v / 10; |
172 | 187 | ||
173 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
174 | return; | 189 | return; |
175 | } | ||
176 | |||
177 | int w = audioUI->width(); | ||
178 | int h = audioUI->height(); | ||
179 | |||
180 | if ( drawnOnScreenDisplay ) { | ||
181 | if ( onScreenDisplayVolume > v ) { | ||
182 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | ||
183 | } | ||
184 | } | 190 | } |
185 | 191 | ||
186 | drawnOnScreenDisplay = TRUE; | 192 | int w=0; int h=0; |
187 | onScreenDisplayVolume = v; | 193 | if( !xineControl->hasVideo()) { |
194 | w = audioUI->width(); | ||
195 | h = audioUI->height(); | ||
188 | 196 | ||
189 | QPainter p( audioUI ); | 197 | if ( drawnOnScreenDisplay ) { |
190 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 198 | if ( onScreenDisplayVolume > v ) { |
191 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
192 | 200 | } | |
193 | QFont f; | 201 | } |
194 | f.setPixelSize( 20 ); | 202 | drawnOnScreenDisplay = TRUE; |
195 | f.setBold( TRUE ); | 203 | onScreenDisplayVolume = v; |
196 | p.setFont( f ); | 204 | QPainter p( audioUI ); |
197 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | ||
207 | |||
208 | QFont f; | ||
209 | f.setPixelSize( 20 ); | ||
210 | f.setBold( TRUE ); | ||
211 | p.setFont( f ); | ||
212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | ||
213 | |||
214 | for ( unsigned int i = 0; i < 10; i++ ) { | ||
215 | if ( v > i ) { | ||
216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | ||
217 | } else { | ||
218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | ||
219 | } | ||
220 | } | ||
221 | } else { | ||
222 | w = videoUI->width(); | ||
223 | h = videoUI->height(); | ||
198 | 224 | ||
199 | for ( unsigned int i = 0; i < 10; i++ ) { | 225 | if ( drawnOnScreenDisplay ) { |
200 | if ( v > i ) { | 226 | if ( onScreenDisplayVolume > v ) { |
201 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
202 | } else { | 228 | } |
203 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 229 | } |
230 | drawnOnScreenDisplay = TRUE; | ||
231 | onScreenDisplayVolume = v; | ||
232 | QPainter p( videoUI ); | ||
233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | ||
234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | ||
235 | |||
236 | QFont f; | ||
237 | f.setPixelSize( 20 ); | ||
238 | f.setBold( TRUE ); | ||
239 | p.setFont( f ); | ||
240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | ||
241 | |||
242 | for ( unsigned int i = 0; i < 10; i++ ) { | ||
243 | if ( v > i ) { | ||
244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | ||
245 | } else { | ||
246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | ||
247 | } | ||
204 | } | 248 | } |
205 | } | 249 | } |
206 | } | 250 | } |