summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp162
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp2
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp26
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp1
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp0
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp39
6 files changed, 120 insertions, 110 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 3262e38..4c5f12d 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -27,54 +27,53 @@
#include "audiodevice.h"
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include "qpe/qcopenvelope_qws.h"
#endif
-#ifdef Q_WS_WIN
-#include <windows.h>
-#include <mmsystem.h>
-#include <mmreg.h>
-#endif
-
+// #ifdef Q_WS_WIN
+// #include <windows.h>
+// #include <mmsystem.h>
+// #include <mmreg.h>
+// #endif
#if defined(Q_WS_X11) || defined(Q_WS_QWS)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
-#if defined(Q_OS_WIN32)
-static const int expectedBytesPerMilliSecond = 2 * 2 * 44000 / 1000;
-static const int timerResolutionMilliSeconds = 30;
-static const int sound_fragment_bytes = timerResolutionMilliSeconds * expectedBytesPerMilliSecond;
-#else
+// #if defined(Q_OS_WIN32)
+// static const int expectedBytesPerMilliSecond = 2 * 2 * 44000 / 1000;
+// static const int timerResolutionMilliSeconds = 30;
+// static const int sound_fragment_bytes = timerResolutionMilliSeconds * expectedBytesPerMilliSecond;
+// #else
# if defined(QT_QWS_IPAQ)
static const int sound_fragment_shift = 14;
# else
static const int sound_fragment_shift = 16;
# endif
static const int sound_fragment_bytes = (1<<sound_fragment_shift);
-#endif
+//#endif
class AudioDevicePrivate {
public:
int handle;
unsigned int frequency;
unsigned int channels;
unsigned int bytesPerSample;
unsigned int bufferSize;
-#ifndef Q_OS_WIN32
+//#ifndef Q_OS_WIN32
bool can_GETOSPACE;
char* unwrittenBuffer;
unsigned int unwritten;
-#endif
+//#endif
static int dspFd;
static bool muted;
static unsigned int leftVolume;
static unsigned int rightVolume;
};
@@ -94,39 +93,39 @@ unsigned int AudioDevicePrivate::leftVolume = 0;
unsigned int AudioDevicePrivate::rightVolume = 0;
void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) {
muted = AudioDevicePrivate::muted;
unsigned int volume;
-#ifdef Q_OS_WIN32
- HWAVEOUT handle;
- WAVEFORMATEX formatData;
- formatData.cbSize = sizeof(WAVEFORMATEX);
- formatData.wFormatTag = WAVE_FORMAT_PCM;
- formatData.nAvgBytesPerSec = 4 * 44000;
- formatData.nBlockAlign = 4;
- formatData.nChannels = 2;
- formatData.nSamplesPerSec = 44000;
- formatData.wBitsPerSample = 16;
- waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
- if ( waveOutGetVolume( handle, (LPDWORD)&volume ) )
-// qDebug( "get volume of audio device failed" );
- waveOutClose( handle );
- leftVolume = volume & 0xFFFF;
- rightVolume = volume >> 16;
-#else
+// #ifdef Q_OS_WIN32
+// HWAVEOUT handle;
+// WAVEFORMATEX formatData;
+// formatData.cbSize = sizeof(WAVEFORMATEX);
+// formatData.wFormatTag = WAVE_FORMAT_PCM;
+// formatData.nAvgBytesPerSec = 4 * 44000;
+// formatData.nBlockAlign = 4;
+// formatData.nChannels = 2;
+// formatData.nSamplesPerSec = 44000;
+// formatData.wBitsPerSample = 16;
+// waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
+// if ( waveOutGetVolume( handle, (LPDWORD)&volume ) )
+// // qDebug( "get volume of audio device failed" );
+// waveOutClose( handle );
+// leftVolume = volume & 0xFFFF;
+// rightVolume = volume >> 16;
+// #else
int mixerHandle = open( "/dev/mixer", O_RDWR );
if ( mixerHandle >= 0 ) {
if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1)
perror("ioctl(\"MIXER_READ\")");
close( mixerHandle );
} else
perror("open(\"/dev/mixer\")");
leftVolume = ((volume & 0x00FF) << 16) / 101;
rightVolume = ((volume & 0xFF00) << 8) / 101;
-#endif
+//#endif
}
void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) {
AudioDevicePrivate::muted = muted;
if ( muted ) {
@@ -135,28 +134,28 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
leftVolume = 0;
rightVolume = 0;
} else {
leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume );
rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume );
}
-#ifdef Q_OS_WIN32
- HWAVEOUT handle;
- WAVEFORMATEX formatData;
- formatData.cbSize = sizeof(WAVEFORMATEX);
- formatData.wFormatTag = WAVE_FORMAT_PCM;
- formatData.nAvgBytesPerSec = 4 * 44000;
- formatData.nBlockAlign = 4;
- formatData.nChannels = 2;
- formatData.nSamplesPerSec = 44000;
- formatData.wBitsPerSample = 16;
- waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
- unsigned int volume = (rightVolume << 16) | leftVolume;
- if ( waveOutSetVolume( handle, volume ) )
-// qDebug( "set volume of audio device failed" );
- waveOutClose( handle );
-#else
+// #ifdef Q_OS_WIN32
+// HWAVEOUT handle;
+// WAVEFORMATEX formatData;
+// formatData.cbSize = sizeof(WAVEFORMATEX);
+// formatData.wFormatTag = WAVE_FORMAT_PCM;
+// formatData.nAvgBytesPerSec = 4 * 44000;
+// formatData.nBlockAlign = 4;
+// formatData.nChannels = 2;
+// formatData.nSamplesPerSec = 44000;
+// formatData.wBitsPerSample = 16;
+// waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
+// unsigned int volume = (rightVolume << 16) | leftVolume;
+// if ( waveOutSetVolume( handle, volume ) )
+// // qDebug( "set volume of audio device failed" );
+// waveOutClose( handle );
+// #else
// Volume can be from 0 to 100 which is 101 distinct values
unsigned int rV = (rightVolume * 101) >> 16;
# if 0
unsigned int lV = (leftVolume * 101) >> 16;
unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF);
@@ -173,13 +172,13 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
// independant right and left channel setting, or setting for different outputs
Config cfg("Sound");
cfg.setGroup("System");
cfg.writeEntry("Volume",(int)rV);
# endif
-#endif
+//#endif
// qDebug( "setting volume to: 0x%x", volume );
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
// Send notification that the volume has changed
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
#endif
}
@@ -253,55 +252,56 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
AudioDevice::~AudioDevice() {
qDebug("destryo audiodevice");
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
-#ifdef Q_OS_WIN32
- waveOutClose( (HWAVEOUT)d->handle );
-#else
+// #ifdef Q_OS_WIN32
+// waveOutClose( (HWAVEOUT)d->handle );
+// #else
# ifndef KEEP_DEVICE_OPEN
close( d->handle ); // Now it should be safe to shut the handle
# endif
delete d->unwrittenBuffer;
delete d;
-#endif
+//#endif
+ QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
}
void AudioDevice::volumeChanged( bool muted )
{
AudioDevicePrivate::muted = muted;
}
void AudioDevice::write( char *buffer, unsigned int length )
{
-#ifdef Q_OS_WIN32
- // returns immediately and (to be implemented) emits completedIO() when finished writing
- WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) );
- // maybe the buffer should be copied so that this fool proof, but its a performance hit
- lpWaveHdr->lpData = buffer;
- lpWaveHdr->dwBufferLength = length;
- lpWaveHdr->dwFlags = 0L;
- lpWaveHdr->dwLoops = 0L;
- waveOutPrepareHeader( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) );
- // waveOutWrite returns immediately. the data is sent in the background.
- if ( waveOutWrite( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ) )
- qDebug( "failed to write block to audio device" );
- // emit completedIO();
-#else
+// #ifdef Q_OS_WIN32
+// // returns immediately and (to be implemented) emits completedIO() when finished writing
+// WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) );
+// // maybe the buffer should be copied so that this fool proof, but its a performance hit
+// lpWaveHdr->lpData = buffer;
+// lpWaveHdr->dwBufferLength = length;
+// lpWaveHdr->dwFlags = 0L;
+// lpWaveHdr->dwLoops = 0L;
+// waveOutPrepareHeader( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) );
+// // waveOutWrite returns immediately. the data is sent in the background.
+// if ( waveOutWrite( (HWAVEOUT)d->handle, lpWaveHdr, sizeof(WAVEHDR) ) )
+// qDebug( "failed to write block to audio device" );
+// // emit completedIO();
+// #else
int t = ::write( d->handle, buffer, length );
if ( t<0 ) t = 0;
if ( t != (int)length) {
qDebug("Ahhh!! memcpys 1");
memcpy(d->unwrittenBuffer,buffer+t,length-t);
d->unwritten = length-t;
}
-#endif
+//#endif
}
unsigned int AudioDevice::channels() const
{
return d->channels;
@@ -324,15 +324,15 @@ unsigned int AudioDevice::bufferSize() const
{
return d->bufferSize;
}
unsigned int AudioDevice::canWrite() const
{
-#ifdef Q_OS_WIN32
- return bufferSize(); // Any better?
-#else
+// #ifdef Q_OS_WIN32
+// return bufferSize(); // Any better?
+// #else
audio_buf_info info;
if ( d->can_GETOSPACE && ioctl(d->handle,SNDCTL_DSP_GETOSPACE,&info) ) {
d->can_GETOSPACE = FALSE;
fcntl( d->handle, F_SETFL, O_NONBLOCK );
}
if ( d->can_GETOSPACE ) {
@@ -351,28 +351,28 @@ unsigned int AudioDevice::canWrite() const
}
if ( d->unwritten )
return 0;
else
return d->bufferSize;
}
-#endif
+//#endif
}
int AudioDevice::bytesWritten() {
-#ifdef Q_OS_WIN32
- MMTIME pmmt = { TIME_BYTES, 0 };
- if ( ( waveOutGetPosition( (HWAVEOUT)d->handle, &pmmt, sizeof(MMTIME) ) != MMSYSERR_NOERROR ) || ( pmmt.wType != TIME_BYTES ) ) {
- qDebug( "failed to get audio device position" );
- return -1;
- }
- return pmmt.u.cb;
-#else
+// #ifdef Q_OS_WIN32
+// MMTIME pmmt = { TIME_BYTES, 0 };
+// if ( ( waveOutGetPosition( (HWAVEOUT)d->handle, &pmmt, sizeof(MMTIME) ) != MMSYSERR_NOERROR ) || ( pmmt.wType != TIME_BYTES ) ) {
+// qDebug( "failed to get audio device position" );
+// return -1;
+// }
+// return pmmt.u.cb;
+// #else
int buffered = 0;
if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) {
qDebug( "failed to get audio device position" );
return -1;
}
return buffered;
-#endif
+//#endif
}
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index ac8c935..54e7ceb 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -140,23 +140,23 @@ void AudioWidget::sliderReleased() {
long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
mediaPlayerState->setPosition( val );
}
void AudioWidget::setPosition( long i ) {
+// qDebug("set position %d",i);
updateSlider( i, mediaPlayerState->length() );
}
void AudioWidget::setLength( long max ) {
updateSlider( mediaPlayerState->position(), max );
}
void AudioWidget::setView( char view ) {
-
if (mediaPlayerState->isStreaming) {
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
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 3171c4b..70e4a78 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -150,13 +150,13 @@ void LoopControl::timerEvent( QTimerEvent *te ) {
}
}
void LoopControl::setPosition( long pos ) {
audioMutex->lock();
-
+// qDebug("Loop control %d", pos);
if ( hasVideoChannel && hasAudioChannel ) {
playtime.restart();
playtime = playtime.addMSecs( long((double)-pos * 1000.0 / framerate) );
current_frame = pos + 1;
mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
prev_frame = current_frame - 1;
@@ -217,13 +217,12 @@ void LoopControl::startVideo() {
}
}
void LoopControl::startAudio() {
-//qDebug("start audio");
audioMutex->lock();
if ( moreAudio ) {
if ( !isMuted && mediaPlayerState->curDecoder() ) {
currentSample = audioSampleCounter + 1;
@@ -234,20 +233,20 @@ void LoopControl::startAudio() {
long samplesRead = 0;
bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
long sampleWaitTime = currentSample - sampleWeShouldBeAt;
// this causes drop outs not sure why its even here
- if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
- usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
- }
- else if ( sampleWaitTime <= -5000 ) {
- qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
-// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
- currentSample = sampleWeShouldBeAt;
- }
+// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
+// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
+// }
+// else if ( sampleWaitTime <= -5000 ) {
+// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
+// // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
+// currentSample = sampleWeShouldBeAt;
+// }
audioDevice->write( audioBuffer, samplesRead * 2 * channels );
if( mediaPlayerState->isStreaming == FALSE)
audioSampleCounter = currentSample + samplesRead - 1;
@@ -342,20 +341,21 @@ void LoopControl::stop( bool willPlayAgainShortly ) {
delete audioBuffer;
audioDevice = 0;
audioBuffer = 0;
}
audioMutex->unlock();
-
}
+ audioSampleCounter=0;
+ current_frame=0;
+ total_audio_samples=0;
}
bool LoopControl::init( const QString& filename ) {
stop();
-
audioMutex->lock();
fileName = filename;
stream = 0; // only play stream 0 for now
current_frame = total_video_frames = total_audio_samples = 0;
@@ -447,12 +447,14 @@ bool LoopControl::init( const QString& filename ) {
return TRUE;
}
void LoopControl::play() {
qDebug("LC- play");
+ mediaPlayerState->setPosition( 0); //uglyhack
+
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
disabledSuspendScreenSaver = TRUE;
previousSuspendMode = hasVideoChannel;
// Stop the screen from blanking and power saving state
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index b9e438b..64fdc01 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -59,12 +59,13 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
}
MediaPlayer::~MediaPlayer() {
+
}
void MediaPlayer::pauseCheck( bool b ) {
// Only pause if playing
if ( b && !mediaPlayerState->playing() )
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index 3ac9ac4..cf166d6 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 200ec16..35208e4 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -154,13 +154,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
bar->setLabel( tr( "Play Operations" ) );
// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
// this , SLOT( addSelected()) );
tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
tbDeletePlaylist->setFlat(TRUE);
tbDeletePlaylist->setFixedSize(20,20);
- connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
this , SLOT(addSelected()) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
this , SLOT(removeSelected()) );
// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
@@ -187,16 +186,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
QPopupMenu *pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
- connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
fullScreenButton->addTo(pmView);
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
- connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
scaleButton->addTo(pmView);
QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
@@ -221,14 +218,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
- connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
- this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
@@ -248,17 +243,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
audioView->setMultiSelection( TRUE );
audioView->setSelectionMode( QListView::Extended);
tabWidget->insertTab(aTab,tr("Audio"));
QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
- connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
- this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
-
- connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
- this,SLOT( playIt( QListViewItem *)) );
// audioView
// populateAudioView();
// videowidget
QWidget *vTab;
@@ -274,44 +264,58 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
videoView->setAllColumnsShowFocus(TRUE);
videoView->setMultiSelection( TRUE );
videoView->setSelectionMode( QListView::Extended);
QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
- connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
- this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
- connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
- this,SLOT( playIt( QListViewItem *)) );
-
tabWidget->insertTab( vTab,tr("Video"));
// populateVideoView();
//playlists list
QWidget *LTab;
LTab = new QWidget( tabWidget, "LTab" );
playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
playLists->setMinimumSize(233,260);
tabWidget->insertTab(LTab,tr("Lists"));
- connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
// add the library area
// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
// this, SLOT( fauxPlay( QListViewItem *) ) );
// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
// this, SLOT( fauxPlay( QListViewItem *)) );
// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
+ connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
+ connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
+ connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
+ connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
+ this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
+
+ connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
+ this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
+
+ connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
+ this,SLOT( playIt( QListViewItem *)) );
connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
+
+ connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
+ this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
+ connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
+ this,SLOT( playIt( QListViewItem *)) );
connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
+ connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
+
+
connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
+
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
@@ -749,12 +753,14 @@ void PlayListWidget::addSelected() {
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
}
void PlayListWidget::playIt( QListViewItem *it) {
// d->setDocumentUsed = FALSE;
+// mediaPlayerState->curPosition =0;
+ qDebug("playIt");
mediaPlayerState->setPlaying(FALSE);
mediaPlayerState->setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
@@ -832,12 +838,13 @@ void PlayListWidget::tabChanged(QWidget *widg) {
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
+
mediaPlayerState->setPlaying(b);
}
break;
case 1:
{
addToSelection( audioView->currentItem() );