summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-05 16:43:59 (UTC)
committer harlekin <harlekin>2002-08-05 16:43:59 (UTC)
commitaf5168ac637f2f5b871cc73a69151dd3d829fec0 (patch) (side-by-side diff)
tree2cc8dad511ee01709a6c19699206b6ad20184a76
parentc4a390e38fe72eeafa0620fc1f8299f561958d21 (diff)
downloadopie-af5168ac637f2f5b871cc73a69151dd3d829fec0.zip
opie-af5168ac637f2f5b871cc73a69151dd3d829fec0.tar.gz
opie-af5168ac637f2f5b871cc73a69151dd3d829fec0.tar.bz2
seeking is working now
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h2
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
@@ -73,13 +73,13 @@ MediaButton audioButtons[] = {
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // volume up
{ FALSE, FALSE, FALSE }, // volume down
{ TRUE, FALSE, FALSE }, // repeat/loop
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
- { FALSE, FALSE, FALSE } // back
+ { FALSE, FALSE, FALSE } // back
};
const char *skin_mask_file_names[11] = {
"play", "stop", "pause", "next", "prev", "up",
"down", "loop", "playlist", "forward", "back"
};
@@ -95,13 +95,13 @@ static void changeTextColor( QWidget *w ) {
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
setCaption( tr("OpiePlayer") );
-
+
Config cfg("OpiePlayer");
cfg.setGroup("AudioWidget");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
@@ -119,14 +119,14 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
- for ( int x = 0; x < imgUp->width(); x++ )
- if ( !qRed( imgMask.pixel( x, y ) ) )
+ for ( int x = 0; x < imgUp->width(); x++ )
+ if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
@@ -158,24 +158,24 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
-
+
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
-
+
for ( int i = 0; i < 11; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
delete pixBg;
delete imgUp;
@@ -271,13 +271,13 @@ void AudioWidget::setView( char view ) {
// if( !slider.isHidden()) slider.hide();
// disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
// disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
// } else {
// this stops the slider from being moved, thus
// does not stop stream when it reaches the end
- slider.show();
+ // slider.show();
connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
// }
if ( view == 'a' ) {
startTimer( 150 );
@@ -296,13 +296,13 @@ static QString timeAsString( long length ) {
}
void AudioWidget::updateSlider( long i, long max ) {
time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
-
+
if ( max == 0 ) {
return;
}
// Will flicker too much if we don't do this
// Scale to something reasonable
int width = slider.width();
@@ -357,22 +357,22 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
int x = event->pos().x() - xoff;
int y = event->pos().y() - yoff;
bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
&& y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
- if ( isOnButton && i == AudioVolumeUp )
+ if ( isOnButton && i == AudioVolumeUp )
qDebug("on up");
if ( isOnButton && !audioButtons[i].isHeld ) {
audioButtons[i].isHeld = TRUE;
toggleButton(i);
switch (i) {
- case AudioVolumeUp:
+ case AudioVolumeUp:
qDebug("more clicked");
- emit moreClicked();
+ emit moreClicked();
return;
case AudioVolumeDown: emit lessClicked(); return;
}
} else if ( !isOnButton && audioButtons[i].isHeld ) {
audioButtons[i].isHeld = FALSE;
toggleButton(i);
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
@@ -43,24 +43,24 @@ XineControl::XineControl( QObject *parent, const char *name )
: QObject( parent, name ) {
libXine = new XINE::Lib(videoUI->vidWidget() );
connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
- connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( setPosition( long ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
}
XineControl::~XineControl() {
delete libXine;
}
void XineControl::play( const QString& fileName ) {
+ m_fileName = fileName;
libXine->play( fileName );
mediaPlayerState->setPlaying( true );
// default to audio view until we know how to handle video
// MediaDetect mdetect;
char whichGui = mdetect.videoOrAudio( fileName );
if (whichGui == 'f') {
@@ -108,13 +108,13 @@ void XineControl::length() {
m_length = libXine->length();
mediaPlayerState->setLength( m_length );
}
long XineControl::position() {
m_position = ( currentTime() );
- mediaPlayerState->setPosition( m_position );
+ mediaPlayerState->updatePosition( m_position );
long emitPos = (long)m_position;
emit positionChanged( emitPos );
if(mediaPlayerState->isPlaying)
// needs to be stopped the media is stopped
QTimer::singleShot( 1000, this, SLOT( position() ) );
// qDebug("POSITION : %d", m_position);
@@ -123,13 +123,14 @@ long XineControl::position() {
void XineControl::setFullscreen( bool isSet ) {
libXine->showVideoFullScreen( isSet);
}
void XineControl::seekTo( long second ) {
- // libXine->
+ qDebug("seek triggered!!");
+ libXine->play( m_fileName , 0, (int)second );
}
void XineControl::videoResized ( const QSize &s )
{
libXine-> resize ( 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
@@ -60,13 +60,13 @@ public slots:
private:
XINE::Lib *libXine;
MediaDetect mdetect;
long m_currentTime;
long m_position;
-
+ QString m_fileName;
signals:
void positionChanged( long );
};