author | harlekin <harlekin> | 2002-08-05 16:43:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-05 16:43:59 (UTC) |
commit | af5168ac637f2f5b871cc73a69151dd3d829fec0 (patch) (unidiff) | |
tree | 2cc8dad511ee01709a6c19699206b6ad20184a76 | |
parent | c4a390e38fe72eeafa0620fc1f8299f561958d21 (diff) | |
download | opie-af5168ac637f2f5b871cc73a69151dd3d829fec0.zip opie-af5168ac637f2f5b871cc73a69151dd3d829fec0.tar.gz opie-af5168ac637f2f5b871cc73a69151dd3d829fec0.tar.bz2 |
seeking is working now
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 23f4329..0e9e7ea 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -75,9 +75,9 @@ MediaButton audioButtons[] = { | |||
75 | { FALSE, FALSE, FALSE }, // volume down | 75 | { FALSE, FALSE, FALSE }, // volume down |
76 | { TRUE, FALSE, FALSE }, // repeat/loop | 76 | { TRUE, FALSE, FALSE }, // repeat/loop |
77 | { FALSE, FALSE, FALSE }, // playlist | 77 | { FALSE, FALSE, FALSE }, // playlist |
78 | { FALSE, FALSE, FALSE }, // forward | 78 | { FALSE, FALSE, FALSE }, // forward |
79 | { FALSE, FALSE, FALSE } // back | 79 | { FALSE, FALSE, FALSE } // back |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *skin_mask_file_names[11] = { | 82 | const char *skin_mask_file_names[11] = { |
83 | "play", "stop", "pause", "next", "prev", "up", | 83 | "play", "stop", "pause", "next", "prev", "up", |
@@ -97,9 +97,9 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | |||
97 | 97 | ||
98 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 98 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
99 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 99 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
100 | setCaption( tr("OpiePlayer") ); | 100 | setCaption( tr("OpiePlayer") ); |
101 | 101 | ||
102 | Config cfg("OpiePlayer"); | 102 | Config cfg("OpiePlayer"); |
103 | cfg.setGroup("AudioWidget"); | 103 | cfg.setGroup("AudioWidget"); |
104 | skin = cfg.readEntry("Skin","default"); | 104 | skin = cfg.readEntry("Skin","default"); |
105 | //skin = "scaleTest"; | 105 | //skin = "scaleTest"; |
@@ -121,10 +121,10 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
121 | QImage imgMask = masks[i]->convertToImage(); | 121 | QImage imgMask = masks[i]->convertToImage(); |
122 | uchar **dest = imgButtonMask->jumpTable(); | 122 | uchar **dest = imgButtonMask->jumpTable(); |
123 | for ( int y = 0; y < imgUp->height(); y++ ) { | 123 | for ( int y = 0; y < imgUp->height(); y++ ) { |
124 | uchar *line = dest[y]; | 124 | uchar *line = dest[y]; |
125 | for ( int x = 0; x < imgUp->width(); x++ ) | 125 | for ( int x = 0; x < imgUp->width(); x++ ) |
126 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 126 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
127 | line[x] = i + 1; | 127 | line[x] = i + 1; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
@@ -160,9 +160,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
160 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 160 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
161 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 161 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
162 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 162 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
163 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 163 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
164 | 164 | ||
165 | // Intialise state | 165 | // Intialise state |
166 | setLength( mediaPlayerState->length() ); | 166 | setLength( mediaPlayerState->length() ); |
167 | setPosition( mediaPlayerState->position() ); | 167 | setPosition( mediaPlayerState->position() ); |
168 | setLooping( mediaPlayerState->fullscreen() ); | 168 | setLooping( mediaPlayerState->fullscreen() ); |
@@ -171,9 +171,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | AudioWidget::~AudioWidget() { | 174 | AudioWidget::~AudioWidget() { |
175 | 175 | ||
176 | for ( int i = 0; i < 11; i++ ) { | 176 | for ( int i = 0; i < 11; i++ ) { |
177 | delete buttonPixUp[i]; | 177 | delete buttonPixUp[i]; |
178 | delete buttonPixDown[i]; | 178 | delete buttonPixDown[i]; |
179 | } | 179 | } |
@@ -273,9 +273,9 @@ void AudioWidget::setView( char view ) { | |||
273 | // disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 273 | // disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
274 | // } else { | 274 | // } else { |
275 | // this stops the slider from being moved, thus | 275 | // this stops the slider from being moved, thus |
276 | // does not stop stream when it reaches the end | 276 | // does not stop stream when it reaches the end |
277 | slider.show(); | 277 | // slider.show(); |
278 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 278 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
279 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 279 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
280 | // } | 280 | // } |
281 | 281 | ||
@@ -298,9 +298,9 @@ static QString timeAsString( long length ) { | |||
298 | void AudioWidget::updateSlider( long i, long max ) { | 298 | void AudioWidget::updateSlider( long i, long max ) { |
299 | 299 | ||
300 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 300 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
301 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 301 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
302 | 302 | ||
303 | if ( max == 0 ) { | 303 | if ( max == 0 ) { |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | // Will flicker too much if we don't do this | 306 | // Will flicker too much if we don't do this |
@@ -359,18 +359,18 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
359 | 359 | ||
360 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 360 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
361 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 361 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
362 | 362 | ||
363 | if ( isOnButton && i == AudioVolumeUp ) | 363 | if ( isOnButton && i == AudioVolumeUp ) |
364 | qDebug("on up"); | 364 | qDebug("on up"); |
365 | 365 | ||
366 | if ( isOnButton && !audioButtons[i].isHeld ) { | 366 | if ( isOnButton && !audioButtons[i].isHeld ) { |
367 | audioButtons[i].isHeld = TRUE; | 367 | audioButtons[i].isHeld = TRUE; |
368 | toggleButton(i); | 368 | toggleButton(i); |
369 | switch (i) { | 369 | switch (i) { |
370 | case AudioVolumeUp: | 370 | case AudioVolumeUp: |
371 | qDebug("more clicked"); | 371 | qDebug("more clicked"); |
372 | emit moreClicked(); | 372 | emit moreClicked(); |
373 | return; | 373 | return; |
374 | case AudioVolumeDown: emit lessClicked(); return; | 374 | case AudioVolumeDown: emit lessClicked(); return; |
375 | } | 375 | } |
376 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 376 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 33889d0..d08ff04 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -45,9 +45,8 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
45 | 45 | ||
46 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | 46 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); |
47 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 47 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
48 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 48 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
49 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( setPosition( long ) ) ); | ||
50 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 49 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 50 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
52 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
53 | 52 | ||
@@ -57,8 +56,9 @@ XineControl::~XineControl() { | |||
57 | delete libXine; | 56 | delete libXine; |
58 | } | 57 | } |
59 | 58 | ||
60 | void XineControl::play( const QString& fileName ) { | 59 | void XineControl::play( const QString& fileName ) { |
60 | m_fileName = fileName; | ||
61 | libXine->play( fileName ); | 61 | libXine->play( fileName ); |
62 | mediaPlayerState->setPlaying( true ); | 62 | mediaPlayerState->setPlaying( true ); |
63 | // default to audio view until we know how to handle video | 63 | // default to audio view until we know how to handle video |
64 | // MediaDetect mdetect; | 64 | // MediaDetect mdetect; |
@@ -110,9 +110,9 @@ void XineControl::length() { | |||
110 | } | 110 | } |
111 | 111 | ||
112 | long XineControl::position() { | 112 | long XineControl::position() { |
113 | m_position = ( currentTime() ); | 113 | m_position = ( currentTime() ); |
114 | mediaPlayerState->setPosition( m_position ); | 114 | mediaPlayerState->updatePosition( m_position ); |
115 | long emitPos = (long)m_position; | 115 | long emitPos = (long)m_position; |
116 | emit positionChanged( emitPos ); | 116 | emit positionChanged( emitPos ); |
117 | if(mediaPlayerState->isPlaying) | 117 | if(mediaPlayerState->isPlaying) |
118 | // needs to be stopped the media is stopped | 118 | // needs to be stopped the media is stopped |
@@ -125,9 +125,10 @@ void XineControl::setFullscreen( bool isSet ) { | |||
125 | libXine->showVideoFullScreen( isSet); | 125 | libXine->showVideoFullScreen( isSet); |
126 | } | 126 | } |
127 | 127 | ||
128 | void XineControl::seekTo( long second ) { | 128 | void XineControl::seekTo( long second ) { |
129 | // libXine-> | 129 | qDebug("seek triggered!!"); |
130 | libXine->play( m_fileName , 0, (int)second ); | ||
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
133 | void XineControl::videoResized ( const QSize &s ) | 134 | void XineControl::videoResized ( const QSize &s ) |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 4a61f32..c7aefd4 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -62,9 +62,9 @@ private: | |||
62 | XINE::Lib *libXine; | 62 | XINE::Lib *libXine; |
63 | MediaDetect mdetect; | 63 | MediaDetect mdetect; |
64 | long m_currentTime; | 64 | long m_currentTime; |
65 | long m_position; | 65 | long m_position; |
66 | 66 | QString m_fileName; | |
67 | signals: | 67 | signals: |
68 | void positionChanged( long ); | 68 | void positionChanged( long ); |
69 | 69 | ||
70 | }; | 70 | }; |