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/loopcontrol.cpp4
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp4
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp4
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp48
4 files changed, 30 insertions, 30 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 82242a3..4ed5921 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -396,90 +396,90 @@ bool LoopControl::init( const QString& filename ) {
// qDebug("total samples %d", total_audio_samples);
mediaPlayerState->setLength( total_audio_samples );
freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
// qDebug( "LC- frequency = %d", freq );
audioSampleCounter = 0;
int bits_per_sample;
if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
// qDebug("using stupid hack");
} else {
bits_per_sample=0;
}
audioDevice = new AudioDevice( freq, channels, bits_per_sample);
audioBuffer = new char[ audioDevice->bufferSize() ];
channels = audioDevice->channels();
//### must check which frequency is actually used.
static const int size = 1;
short int buf[size];
long samplesRead = 0;
mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
}
if ( hasVideoChannel ) {
total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
mediaPlayerState->setLength( total_video_frames );
framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
if ( framerate <= 1.0 ) {
DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
framerate = 25;
}
if ( total_video_frames == 1 ) {
DecodeLoopDebug(( "Cannot seek to frame" ));
}
}
current_frame = 0;
prev_frame = -1;
- connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) );
- connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) );
+ connect( mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( setPosition(long) ) );
+ connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
audioMutex->unlock();
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)" )
<< ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif
playtime.start();
startTimers();
}
void LoopControl::setMute( bool on ) {
if ( on != isMuted ) {
isMuted = on;
if ( !on ) {
// Force an update of the position
mediaPlayerState->setPosition( mediaPlayerState->position() + 1 );
mediaPlayerState->setPosition( mediaPlayerState->position() - 1 );
// Resume playing audio
moreAudio = TRUE;
}
}
}
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index 3796549..0a1fc17 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -536,89 +536,89 @@ bool LoopControl::init( const QString& filename ) {
if ( !total_audio_samples )
total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
mediaPlayerState->setLength( total_audio_samples );
freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
DecodeLoopDebug(( "frequency = %d\n", freq ));
audioSampleCounter = 0;
static const int bytes_per_sample = 2; //16 bit
audioDevice = new AudioDevice( freq, channels, bytes_per_sample );
audioBuffer = new char[ audioDevice->bufferSize() ];
channels = audioDevice->channels();
//### must check which frequency is actually used.
static const int size = 1;
short int buf[size];
long samplesRead = 0;
mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
}
if ( hasVideoChannel ) {
total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
mediaPlayerState->setLength( total_video_frames );
framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
if ( framerate <= 1.0 ) {
DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
framerate = 25;
}
if ( total_video_frames == 1 ) {
DecodeLoopDebug(( "Cannot seek to frame" ));
}
}
videoMutex->lock();
current_frame = 0;
prev_frame = -1;
videoMutex->unlock();
- connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) );
- connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) );
+ connect( mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( setPosition(long) ) );
+ connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
//setBackgroundColor( black );
return TRUE;
}
void LoopControl::play() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
// Stop the screen from blanking and power saving state
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
<< ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif
//begin = clock();
playtime.start();
startTimers();
//updateGeometry();
}
void LoopControl::setMute( bool on ) {
if ( isMuted != on ) {
isMuted = on;
if ( isMuted ) {
} else {
int frame = current_frame; // mediaPlayerState->curDecoder()->videoGetFrame( stream );
playtime.restart();
playtime = playtime.addMSecs( -frame * 1000 / framerate );
//begin = clock() - (double)frame * CLOCKS_PER_SEC / framerate;
mediaPlayerState->curDecoder()->audioSetSample( frame*freq/framerate, stream );
}
}
}
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index b77708c..6c743ec 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -1,94 +1,94 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 <qmessagebox.h>
#include "mediaplayer.h"
#include "playlistwidget.h"
#include "audiowidget.h"
#include "loopcontrol.h"
#include "audiodevice.h"
#include "mediaplayerstate.h"
extern AudioWidget *audioUI;
extern PlayListWidget *playList;
extern LoopControl *loopControl;
extern MediaPlayerState *mediaPlayerState;
MediaPlayer::MediaPlayer( QObject *parent, const char *name )
: QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
// QPEApplication::grabKeyboard();
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
- connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
- connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
+ connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
+ connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
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() )
mediaPlayerState->setPaused( FALSE );
}
void MediaPlayer::play() {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
void MediaPlayer::setPlaying( bool play ) {
// qDebug("MediaPlayer setPlaying %d", play);
if ( !play ) {
mediaPlayerState->setPaused( FALSE );
loopControl->stop( FALSE );
return;
}
if ( mediaPlayerState->paused() ) {
mediaPlayerState->setPaused( FALSE );
return;
}
// qDebug("about to ctrash");
const DocLnk *playListCurrent = playList->current();
if ( playListCurrent != NULL ) {
loopControl->stop( TRUE );
currentFile = playListCurrent;
}
if ( currentFile == NULL ) {
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index a359843..efb5df3 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -74,163 +74,163 @@ 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;
fromSetDocument = FALSE;
insanityBool=FALSE;
audioScan = FALSE;
videoScan = FALSE;
// menuTimer = new QTimer( this ,"menu timer"),
// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
channel = new QCopChannel( "QPE/Application/opieplayer", this );
- connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
- this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
+ connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
+ this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
setBackgroundMode( PaletteButton );
setCaption( tr("OpiePlayer") );
setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
setToolBarsMovable( FALSE );
// Create Toolbar
QToolBar *toolbar = new QToolBar( this );
toolbar->setHorizontalStretchable( TRUE );
// Create Menubar
QMenuBar *menu = new QMenuBar( toolbar );
menu->setMargin( 0 );
QToolBar *bar = new QToolBar( this );
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);
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 );
+// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
this , SLOT( btnPlay(bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
mediaPlayerState, SLOT(setLooping(bool)), TRUE );
tbDeletePlaylist->hide();
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() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
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);
fullScreenButton->addTo(pmView);
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
scaleButton->addTo(pmView);
skinsMenu = new QPopupMenu( this );
menu->insertItem( tr( "Skins" ), skinsMenu );
skinsMenu->isCheckable();
- connect( skinsMenu, SIGNAL( activated( int ) ) ,
- this, SLOT( skinsMenuActivated( int ) ) );
+ connect( skinsMenu, SIGNAL( activated(int) ) ,
+ this, SLOT( skinsMenuActivated(int) ) );
populateSkinsMenu();
QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
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, "playlistview" );
// playlistView->setMinimumSize(236,260);
tabWidget->insertTab( pTab,"Playlist");
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
QGridLayout *layoutF = new QGridLayout( pTab );
layoutF->setSpacing( 2);
layoutF->setMargin( 2);
layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 );
QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
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()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
QWidget *aTab;
aTab = new QWidget( tabWidget, "aTab" );
audioView = new QListView( aTab, "Audioview" );
QGridLayout *layoutA = new QGridLayout( aTab );
layoutA->setSpacing( 2);
@@ -251,128 +251,128 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
audioView->setSorting( 3, TRUE );
tabWidget->insertTab(aTab,tr("Audio"));
QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
// audioView
// populateAudioView();
// videowidget
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
videoView = new QListView( vTab, "Videoview" );
QGridLayout *layoutV = new QGridLayout( vTab );
layoutV->setSpacing( 2);
layoutV->setMargin( 2);
layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
videoView->addColumn(tr("Title"),-1);
videoView->addColumn(tr("Size"),-1);
videoView->addColumn(tr("Media"),-1);
videoView->addColumn(tr( "Path" ), -1 );
videoView->setColumnAlignment(1, Qt::AlignRight);
videoView->setColumnAlignment(2, Qt::AlignRight);
videoView->setAllColumnsShowFocus(TRUE);
videoView->setMultiSelection( TRUE );
videoView->setSelectionMode( QListView::Extended);
QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
tabWidget->insertTab( vTab,tr("Video"));
QWidget *LTab;
LTab = new QWidget( tabWidget, "LTab" );
playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE);
QGridLayout *layoutL = new QGridLayout( LTab );
layoutL->setSpacing( 2);
layoutL->setMargin( 2);
layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
tabWidget->insertTab(LTab,tr("Lists"));
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( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
+ this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int)) );
///audioView
- connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
- this,SLOT( viewPressed(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( audioView, SIGNAL( returnPressed(QListViewItem*)),
+ this,SLOT( playIt(QListViewItem*)) );
+ connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) );
//videoView
- 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( 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*) ) );
//playlists
- connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
+ 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( 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( 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 *) ) );
+ connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( playIt(QListViewItem*) ) );
setCentralWidget( vbox5 );
Config cfg( "OpiePlayer" );
readConfig( cfg );
currentPlayList = cfg.readEntry("CurrentPlaylist","default");
loadList(DocLnk( currentPlayList));
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList)));
initializeStates();
}
PlayListWidget::~PlayListWidget() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
if ( d->current )
delete d->current;
if(d) delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
setPlaylist( true);
}
void PlayListWidget::readConfig( Config& cfg ) {
cfg.setGroup("PlayList");
QString currentString = cfg.readEntry("current", "" );
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
for ( int i = 0; i < noOfFiles; i++ ) {
QString entryName;
entryName.sprintf( "File%i", i + 1 );
QString linkFile = cfg.readEntry( entryName );
DocLnk lnk( linkFile );
if ( lnk.isValid() ) {
d->selectedFiles->addToSelection( lnk );
}
}
d->selectedFiles->setSelectedItem( currentString);
}
@@ -895,97 +895,97 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
// m.insertSeparator();
// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::listDelete() {
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
currentPlayList = cfg.readEntry("CurrentPlaylist","");
QString file;
// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
case 0:
break;
case 1:
{
file = audioView->currentItem()->text(0);
QListIterator<DocLnk> Pdit( files.children() );
for ( ; Pdit.current(); ++Pdit ) {
if( Pdit.current()->name() == file) {
LnkProperties prop( Pdit.current() );
QPEApplication::execDialog( &prop );
}
}
populateAudioView();
}
break;
case 2:
{
// file = videoView->selectedItem()->text(0);
// for ( int i = 0; i < noOfFiles; i++ ) {
// QString entryName;
// entryName.sprintf( "File%i", i + 1 );
// QString linkFile = cfg.readEntry( entryName );
// AppLnk lnk( AppLnk(linkFile));
// if( lnk.name() == file ) {
// LnkProperties prop( &lnk);
- // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
+ // // connect(&prop, SIGNAL(select(const AppLnk*)), this, SLOT(externalSelected(const AppLnk*)));
// prop.showMaximized();
// prop.exec();
// }
// }
}
break;
};
}
void PlayListWidget::scanForAudio() {
// qDebug("scan for audio");
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments( &files, audioMimes);
audioScan = true;
}
void PlayListWidget::scanForVideo() {
// qDebug("scan for video");
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments(&vFiles, "video/*");
videoScan = true;
}
void PlayListWidget::populateAudioView() {
audioView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!audioScan) scanForAudio();
QListIterator<DocLnk> dit( files.children() );
QListIterator<FileSystem> it ( fs );
QString storage;
for ( ; dit.current(); ++dit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if(dit.current()->file().find(path) != -1 ) storage=name;
}