summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp8
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp16
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp47
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h12
4 files changed, 44 insertions, 39 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 59136af..11fd9e8 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -64,186 +64,186 @@ class AudioDevicePrivate {
public:
int handle;
unsigned int frequency;
unsigned int channels;
unsigned int bytesPerSample;
unsigned int bufferSize;
#ifndef Q_OS_WIN32
bool can_GETOSPACE;
char* unwrittenBuffer;
unsigned int unwritten;
#endif
static int dspFd;
static bool muted;
static unsigned int leftVolume;
static unsigned int rightVolume;
};
#ifdef Q_WS_QWS
// This is for keeping the device open in-between playing files when
// the device makes clicks and it starts to drive you insane! :)
// Best to have the device not open when not using it though
//#define KEEP_DEVICE_OPEN
#endif
int AudioDevicePrivate::dspFd = 0;
bool AudioDevicePrivate::muted = FALSE;
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" );
+// 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
}
void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) {
AudioDevicePrivate::muted = muted;
if ( muted ) {
AudioDevicePrivate::leftVolume = leftVolume;
AudioDevicePrivate::rightVolume = 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" );
+// 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);
int mixerHandle = 0;
if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1)
perror("ioctl(\"MIXER_WRITE\")");
close( mixerHandle );
} else
perror("open(\"/dev/mixer\")");
# else
// This is the way this has to be done now I guess, doesn't allow for
// independant right and left channel setting, or setting for different outputs
Config cfg("Sound");
cfg.setGroup("System");
cfg.writeEntry("Volume",(int)rV);
# 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
}
AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
d = new AudioDevicePrivate;
d->frequency = f;
d->channels = chs;
d->bytesPerSample = bps;
- qDebug("%d",bps);
+// qDebug("%d",bps);
int format=0;
if( bps == 8) format = AFMT_U8;
else if( bps <= 0) format = AFMT_S16_LE;
else format = AFMT_S16_LE;
- qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
+// qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
int fragments = 0x10000 * 8 + sound_fragment_shift;
int capabilities = 0;
#ifdef KEEP_DEVICE_OPEN
if ( AudioDevicePrivate::dspFd == 0 ) {
#endif
if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) {
perror("open(\"/dev/dsp\") sending to /dev/null instead");
d->handle = ::open( "/dev/null", O_WRONLY );
}
#ifdef KEEP_DEVICE_OPEN
AudioDevicePrivate::dspFd = d->handle;
} else {
d->handle = AudioDevicePrivate::dspFd;
}
#endif
if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1)
perror("ioctl(\"SNDCTL_DSP_GETCAPS\")");
if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1)
perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1)
perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
qDebug("freq %d", d->frequency);
if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1)
perror("ioctl(\"SNDCTL_DSP_SPEED\")");
qDebug("channels %d",d->channels);
if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) {
d->channels = ( d->channels == 1 ) ? 2 : d->channels;
if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1)
perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
}
d->bufferSize = sound_fragment_bytes;
d->unwrittenBuffer = new char[d->bufferSize];
d->unwritten = 0;
d->can_GETOSPACE = TRUE; // until we find otherwise
//if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels );
//if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency );
//if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" );
//if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" );
//if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" );
//if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" );
}
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 859a67a..1ae0059 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -190,104 +190,104 @@ void LoopControl::startVideo() {
current_frame = long( playtime.elapsed() * framerate / 1000 );
if ( prev_frame != -1 && current_frame <= prev_frame )
return;
} else {
// Don't skip
current_frame++;
}
if ( prev_frame == -1 || current_frame > prev_frame ) {
if ( current_frame > prev_frame + 1 ) {
mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
}
moreVideo = videoUI->playVideo();
prev_frame = current_frame;
}
} else {
moreVideo = FALSE;
killTimer( videoId );
}
}
}
void LoopControl::startAudio() {
audioMutex->lock();
if ( moreAudio ) {
if ( !isMuted && mediaPlayerState->curDecoder() ) {
currentSample = audioSampleCounter + 1;
if ( currentSample != audioSampleCounter + 1 )
qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
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;
-// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 5000 ) ) {
-// 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 );
audioSampleCounter = currentSample + samplesRead - 1;
moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
} else {
moreAudio = FALSE;
}
}
audioMutex->unlock();
}
void LoopControl::killTimers() {
audioMutex->lock();
if ( hasVideoChannel )
killTimer( videoId );
killTimer( sliderId );
threadOkToGo = FALSE;
audioMutex->unlock();
}
void LoopControl::startTimers() {
audioMutex->lock();
moreVideo = FALSE;
moreAudio = FALSE;
if ( hasVideoChannel ) {
moreVideo = TRUE;
int mSecsBetweenFrames = (int)(100 / framerate); // 10% of the real value
videoId = startTimer( mSecsBetweenFrames );
}
if ( hasAudioChannel ) {
moreAudio = TRUE;
threadOkToGo = TRUE;
}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 4e1543e..269aed8 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,150 +1,150 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/fileselector.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qaction.h>
#include <qimage.h>
#include <qfile.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qlist.h>
#include <qlistbox.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <qpoint.h>
-#include <qtimer.h>
+//#include <qtimer.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include <stdlib.h>
#define BUTTONS_ON_TOOLBAR
#define SIDE_BUTTONS
#define CAN_SAVE_LOAD_PLAYLISTS
extern MediaPlayerState *mediaPlayerState;
// class myFileSelector {
// };
class PlayListWidgetPrivate {
public:
QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
QFrame *playListFrame;
FileSelector *files;
PlayListSelection *selectedFiles;
bool setDocumentUsed;
DocLnk *current;
};
class ToolButton : public QToolButton {
public:
ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
: QToolButton( parent, name ) {
setTextLabel( name );
setPixmap( Resource::loadPixmap( icon ) );
setAutoRaise( TRUE );
setFocusPolicy( QWidget::NoFocus );
setToggleButton( t );
connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
QPEMenuToolFocusManager::manager()->addWidget( this );
}
};
class MenuItem : public QAction {
public:
MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
: QAction( text, QString::null, 0, 0 ) {
connect( this, SIGNAL( activated() ), handler, slot );
addTo( parent );
}
};
PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl ) {
d = new PlayListWidgetPrivate;
d->setDocumentUsed = FALSE;
d->current = NULL;
- menuTimer = new QTimer( this ,"menu timer"),
- connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
+// menuTimer = new QTimer( this ,"menu timer"),
+// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
setBackgroundMode( PaletteButton );
setCaption( tr("OpiePlayer") );
setIcon( Resource::loadPixmap( "MPEGPlayer" ) );
setToolBarsMovable( FALSE );
// Create Toolbar
QPEToolBar *toolbar = new QPEToolBar( this );
toolbar->setHorizontalStretchable( TRUE );
// Create Menubar
QPEMenuBar *menu = new QPEMenuBar( toolbar );
menu->setMargin( 0 );
QPEToolBar *bar = new QPEToolBar( this );
bar->setLabel( tr( "Play Operations" ) );
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist",
this , SLOT(addSelected()) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist",
this , SLOT(removeSelected()) );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play",
mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle",
mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ), "mpegplayer/loop",
mediaPlayerState, SLOT(setLooping(bool)), TRUE );
// d->tbFull = new ToolButton( bar, tr( "Fullscreen" ), "fullscreen", mediaPlayerState, SLOT(setFullscreen(bool)), TRUE );
// d->tbScale = new ToolButton( bar, tr( "Scale" ), "mpegplayer/scale", mediaPlayerState, SLOT(setScaled(bool)), TRUE );
QPopupMenu *pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
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);
@@ -159,126 +159,131 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
// libString->setBackgroundMode( QButton::PaletteButton );
// libString->setFont( QFont( "Helvetica", 8, QFont::Bold ) );
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
tabWidget = new QTabWidget( hbox6, "tabWidget" );
tabWidget->setTabShape(QTabWidget::Triangular);
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
playlistView = new QListView( pTab, "Videoview" );
playlistView->setMinimumSize(236,260);
tabWidget->insertTab( pTab,"Playlist");
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
d->playListFrame ->setMinimumSize(235,260);
QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
QWidget *aTab;
aTab = new QWidget( tabWidget, "aTab" );
audioView = new QListView( aTab, "Audioview" );
audioView->setMinimumSize(233,260);
audioView->addColumn( "Title",150);
audioView->addColumn("Size", 45);
audioView->addColumn("Media",35);
audioView->setColumnAlignment(1, Qt::AlignRight);
audioView->setColumnAlignment(2, Qt::AlignRight);
tabWidget->insertTab(aTab,"Audio");
// audioView
Global::findDocuments(&files, "audio/*");
QListIterator<DocLnk> dit( files.children() );
QString storage;
for ( ; dit.current(); ++dit ) {
QListViewItem * newItem;
if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
+ else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD";
else storage="RAM";
-
+ if ( QFile( dit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" ));
+ }
}
// videowidget
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
videoView = new QListView( vTab, "Videoview" );
videoView->setMinimumSize(233,260);
videoView->addColumn("Title",150);
videoView->addColumn("Size",45);
videoView->addColumn("Media",35);
videoView->setColumnAlignment(1, Qt::AlignRight);
videoView->setColumnAlignment(2, Qt::AlignRight);
tabWidget->insertTab( vTab,"Video");
Global::findDocuments(&vFiles, "video/*");
QListIterator<DocLnk> Vdit( vFiles.children() );
for ( ; Vdit.current(); ++Vdit ) {
if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
+ else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD";
else storage="RAM";
QListViewItem * newItem;
+ if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
+ }
}
// d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE );
// d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
// add the library area
// d->files->setBackgroundMode( PaletteButton );
// QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton );
// #ifdef SIDE_BUTTONS
// QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch
// #endif
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ),
this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) );
connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ),
this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) );
connect( playlistView, SIGNAL( pressed( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
// connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
// connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
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( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) );
// connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) );
// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
setCentralWidget( vbox5 );
Config cfg( "MediaPlayer" );
readConfig( cfg );
initializeStates();
}
@@ -618,76 +623,76 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 2: {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
qDebug(dit.current()->name());
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 0:
break;
};
tabWidget->setCurrentPage(0);
// mediaPlayerState->setPlaying( TRUE );
}
}
void PlayListWidget::tabChanged(QWidget *widg) {
int tabPage=tabWidget->currentPageIndex();
switch (tabPage) {
case 0:
{
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
}
break;
case 1:
{
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 2:
{
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
};
}
-void PlayListWidget::cancelMenuTimer() {
- if( menuTimer->isActive() )
- menuTimer->stop();
-}
+// void PlayListWidget::cancelMenuTimer() {
+// if( menuTimer->isActive() )
+// menuTimer->stop();
+// }
-void PlayListWidget::showFileMenu() {
+// void PlayListWidget::showFileMenu() {
-}
+// }
-void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
-{
-// QListView::contentsMousePressEvent( e );
- menuTimer->start( 750, TRUE );
-}
+// void PlayListWidget::contentsMousePressEvent( QMouseEvent * e )
+// {
+// // QListView::contentsMousePressEvent( e );
+// menuTimer->start( 750, TRUE );
+// }
-void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e )
-{
-// QListView::contentsMouseReleaseEvent( e );
- menuTimer->stop();
-}
-// void PlayListWidget::setFullScreen() {
+// void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e )
+// {
+// // QListView::contentsMouseReleaseEvent( e );
+// menuTimer->stop();
+// }
+// // void PlayListWidget::setFullScreen() {
// mediaPlayerState->toggleFullscreen( );
// }
// void PlayListWidget::setScaled() {
// mediaPlayerState->toggleScaled();
// }
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 3a52dd5..6fe2211 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -1,97 +1,97 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PLAY_LIST_WIDGET_H
#define PLAY_LIST_WIDGET_H
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qtabwidget.h>
-#include <qtimer.h>
+/* #include <qtimer.h> */
class PlayListWidgetPrivate;
class Config;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
class PlayListWidget : public QMainWindow {
Q_OBJECT
public:
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidget();
QTabWidget * tabWidget;
QAction *fullScreenButton, *scaleButton;
DocLnkSet files;
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
- QTimer * menuTimer;
+/* QTimer * menuTimer; */
public slots:
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist
void setActiveWindow(); // need to handle this to show the right view
void setPlaylist( bool ); // Show/Hide the playlist
void setView( char );
void clearList();
void addAllToList();
void addAllMusicToList();
void addAllVideoToList();
void saveList(); // Save the playlist
void loadList(); // Load a playlist
void playIt( QListViewItem *);
bool first();
bool last();
bool next();
bool prev();
void addSelected();
void removeSelected();
void tabChanged(QWidget*);
/* void setFullScreen(); */
/* void setScaled(); */
protected:
- void contentsMousePressEvent( QMouseEvent * e );
- void contentsMouseReleaseEvent( QMouseEvent * e );
+/* void contentsMousePressEvent( QMouseEvent * e ); */
+/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
private:
void initializeStates();
void readConfig( Config& cfg );
void writeConfig( Config& cfg ) const;
PlayListWidgetPrivate *d; // Private implementation data
protected slots:
- void cancelMenuTimer();
- void showFileMenu();
+/* void cancelMenuTimer(); */
+/* void showFileMenu(); */
};
#endif // PLAY_LIST_WIDGET_H