summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-08-15 16:32:17 (UTC)
committer llornkcor <llornkcor>2002-08-15 16:32:17 (UTC)
commit07ea5f165a2f17f818147b2e8afb02af2c269b55 (patch) (unidiff)
tree94059e0b4910f5a681be601f554c5c3a6c26de4b
parent747a98bb3b2a92b6f3577fa383fc44a8644a7ce2 (diff)
downloadopie-07ea5f165a2f17f818147b2e8afb02af2c269b55.zip
opie-07ea5f165a2f17f818147b2e8afb02af2c269b55.tar.gz
opie-07ea5f165a2f17f818147b2e8afb02af2c269b55.tar.bz2
added useAudio() and useVideo()
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp106
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h5
3 files changed, 85 insertions, 32 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
20extern AudioWidget *audioUI; 21extern AudioWidget *audioUI;
22extern VideoWidget *videoUI;
21extern PlayListWidget *playList; 23extern PlayListWidget *playList;
22extern MediaPlayerState *mediaPlayerState; 24extern 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}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 84ef3f3..17112a2 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -68,6 +68,8 @@ XineControl::~XineControl() {
68} 68}
69 69
70void XineControl::play( const QString& fileName ) { 70void XineControl::play( const QString& fileName ) {
71 hasVideoChannel=FALSE;
72 hasAudioChannel=FALSE;
71 m_fileName = fileName; 73 m_fileName = fileName;
72 libXine->play( fileName ); 74 libXine->play( fileName );
73 mediaPlayerState->setPlaying( true ); 75 mediaPlayerState->setPlaying( true );
@@ -81,8 +83,10 @@ void XineControl::play( const QString& fileName ) {
81 83
82 if (whichGui == 'a') { 84 if (whichGui == 'a') {
83 libXine->setShowVideo( false ); 85 libXine->setShowVideo( false );
86 hasAudioChannel=TRUE;
84 } else { 87 } else {
85 libXine->setShowVideo( true ); 88 libXine->setShowVideo( true );
89 hasVideoChannel=TRUE;
86 } 90 }
87 91
88 // determine if slider is shown 92 // determine if slider is shown
@@ -192,5 +196,5 @@ void XineControl::seekTo( long second ) {
192} 196}
193 197
194void XineControl::videoResized ( const QSize &s ) { 198void XineControl::videoResized ( const QSize &s ) {
195 libXine-> resize ( s ); 199 libXine-> resize ( s );
196} 200}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 9ad221e..88458be 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -45,6 +45,9 @@ public:
45 ~XineControl(); 45 ~XineControl();
46 int m_length; 46 int m_length;
47 47
48 bool hasVideo() const { return hasVideoChannel; }
49 bool hasAudio() const { return hasAudioChannel; }
50
48public slots: 51public slots:
49 void play( const QString& fileName ); 52 void play( const QString& fileName );
50 void stop( bool ); 53 void stop( bool );
@@ -65,6 +68,8 @@ private:
65 long m_position; 68 long m_position;
66 QString m_fileName; 69 QString m_fileName;
67 bool disabledSuspendScreenSaver; 70 bool disabledSuspendScreenSaver;
71 bool hasVideoChannel;
72 bool hasAudioChannel;
68signals: 73signals:
69 void positionChanged( long ); 74 void positionChanged( long );
70 75