summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/playlistwidget.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp176
1 files changed, 89 insertions, 87 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 3609f5d..d85ce50 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -21,23 +21,25 @@
#define QTOPIA_INTERNAL_FSLP
-#include <qtoolbar.h>
+#include "playlistselection.h"
+#include "playlistwidget.h"
+#include "mediaplayerstate.h"
+#include "inputDialog.h"
+#include "audiowidget.h"
+#include "videowidget.h"
+
+/* OPIE */
#include <qpe/qpemenubar.h>
#include <qpe/lnkproperties.h>
+#include <opie2/odebug.h>
+/* QT */
+#include <qtoolbar.h>
#include <qaction.h>
#include <qlayout.h>
#include <qmessagebox.h>
-
//#include <qtimer.h>
-#include "playlistselection.h"
-#include "playlistwidget.h"
-#include "mediaplayerstate.h"
-
-#include "inputDialog.h"
-
+/* STD */
#include <stdlib.h>
-#include "audiowidget.h"
-#include "videowidget.h"
#include <unistd.h>
@@ -146,5 +148,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
tbDeletePlaylist->setFixedSize(20,20);
-
+
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
this , SLOT(addSelected()) );
@@ -193,8 +195,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
-
+
tabWidget = new QTabWidget( hbox6, "tabWidget" );
// tabWidget->setTabShape(QTabWidget::Triangular);
-
+
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
@@ -205,5 +207,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
// Add the playlist area
-
+
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
@@ -222,5 +224,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
-
+
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
@@ -242,5 +244,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
audioView->addColumn(tr("Media"),-1);
audioView->addColumn( tr( "Path" ), -1 );
-
+
audioView->setColumnAlignment(1, Qt::AlignRight);
audioView->setColumnAlignment(2, Qt::AlignRight);
@@ -250,5 +252,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
audioView->setSelectionMode( QListView::Extended);
audioView->setSorting( 3, TRUE );
-
+
tabWidget->insertTab(aTab,tr("Audio"));
@@ -258,5 +260,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
// populateAudioView();
// videowidget
-
+
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
@@ -267,5 +269,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
layoutV->setMargin( 2);
layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
-
+
videoView->addColumn(tr("Title"),-1);
videoView->addColumn(tr("Size"),-1);
@@ -304,5 +306,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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*)) );
@@ -338,5 +340,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
loadList(DocLnk( currentPlayList));
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList)));
-
+
initializeStates();
}
@@ -390,5 +392,5 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
QString entryName;
entryName.sprintf( "File%i", noOfFiles + 1 );
-// qDebug(entryName);
+// odebug << entryName << oendl;
cfg.writeEntry( entryName, lnk->linkFile() );
// if this link does exist, add it so we have the file
@@ -407,5 +409,5 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
// }
- }
+ }
noOfFiles++;
}
@@ -447,5 +449,5 @@ void PlayListWidget::addAllToList() {
d->selectedFiles->addToSelection( **Adit );
tabWidget->setCurrentPage(0);
-
+
writeCurrentM3u();
d->selectedFiles->first();
@@ -455,9 +457,9 @@ void PlayListWidget::addAllToList() {
void PlayListWidget::addAllMusicToList() {
QListIterator<DocLnk> dit( files.children() );
- for ( ; dit.current(); ++dit )
+ for ( ; dit.current(); ++dit )
if(QFileInfo(dit.current()->file()).exists())
d->selectedFiles->addToSelection( **dit );
tabWidget->setCurrentPage(0);
-
+
writeCurrentM3u();
d->selectedFiles->first();
@@ -471,5 +473,5 @@ void PlayListWidget::addAllVideoToList() {
d->selectedFiles->addToSelection( **dit );
tabWidget->setCurrentPage(0);
-
+
writeCurrentM3u();
d->selectedFiles->first();
@@ -484,5 +486,5 @@ void PlayListWidget::setDocument(const QString& fileref) {
void PlayListWidget::setDocumentEx(const QString& fileref) {
- qDebug("opieplayer receive "+fileref);
+ odebug << "opieplayer receive "+fileref << oendl;
clearList();
DocLnk lnk;
@@ -493,5 +495,5 @@ void PlayListWidget::setDocumentEx(const QString& fileref) {
return;
}
- // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref);
+ // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl;
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1) { //is m3u
@@ -535,5 +537,5 @@ void PlayListWidget::setDocumentEx(const QString& fileref) {
void PlayListWidget::setActiveWindow() {
- // qDebug("SETTING active window");
+ // odebug << "SETTING active window" << oendl;
// When we get raised we need to ensure that it switches views
char origView = mediaPlayerState->view();
@@ -552,5 +554,5 @@ const DocLnk *PlayListWidget::current() { // this is fugly
case 0: //playlist
{
- // qDebug("playlist");
+ // odebug << "playlist" << oendl;
if ( mediaPlayerState->playlist() ) {
return d->selectedFiles->current();
@@ -565,5 +567,5 @@ const DocLnk *PlayListWidget::current() { // this is fugly
case 1://audio
{
- // qDebug("audioView");
+ // odebug << "audioView" << oendl;
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
@@ -573,5 +575,5 @@ const DocLnk *PlayListWidget::current() { // this is fugly
}
}
- }
+ }
break;
case 2: // video
@@ -661,9 +663,9 @@ void PlayListWidget::saveList() {
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name = lnk.name();
- // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
+ // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name << oendl;
if( name.length()>0) {
setCaption("OpiePlayer: "+name);
- // qDebug("<<<<<<<<<<<<load list "+ lnk.file());
+ // odebug << "<<<<<<<<<<<<load list "+ lnk.file() << oendl;
clearList();
readm3u(lnk.file());
@@ -673,5 +675,5 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
void PlayListWidget::setPlaylist( bool shown ) {
- if ( shown )
+ if ( shown )
d->playListFrame->show();
else
@@ -708,5 +710,5 @@ void PlayListWidget::addSelected() {
}
break;
-
+
case 2: { // video
QListViewItemIterator it( videoView );
@@ -725,5 +727,5 @@ void PlayListWidget::addSelected() {
};
// tabWidget->setCurrentPage(0);
- writeCurrentM3u();
+ writeCurrentM3u();
}
@@ -758,9 +760,9 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
-
+
if(tabWidget->currentPageIndex() == 0)
- writeCurrentM3u();
+ writeCurrentM3u();
// tabWidget->setCurrentPage(0);
-
+
}
}
@@ -819,5 +821,5 @@ void PlayListWidget::btnPlay(bool b) {
mediaPlayerState->setPlaying(b);
insanityBool=FALSE;
- qDebug("insanity");
+ odebug << "insanity" << oendl;
// }
}
@@ -831,10 +833,10 @@ void PlayListWidget::btnPlay(bool b) {
d->selectedFiles->unSelect();
tabWidget->setCurrentPage(1);
- insanityBool=FALSE;
+ insanityBool=FALSE;
}// audioView->clearSelection();
break;
case 2:
{
-
+
addToSelection( videoView->currentItem() );
mediaPlayerState->setPlaying( b);
@@ -847,5 +849,5 @@ void PlayListWidget::btnPlay(bool b) {
break;
};
-
+
}
@@ -875,7 +877,7 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.insertSeparator();
- if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
+ if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
-
+
m.exec( QCursor::pos() );
}
@@ -894,5 +896,5 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
switch (mouse) {
case 1:
-
+
break;
case 2:{
@@ -916,5 +918,5 @@ void PlayListWidget::listDelete() {
// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
- case 0:
+ case 0:
break;
case 1:
@@ -952,5 +954,5 @@ void PlayListWidget::listDelete() {
void PlayListWidget::scanForAudio() {
- // qDebug("scan for audio");
+ // odebug << "scan for audio" << oendl;
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
@@ -962,5 +964,5 @@ void PlayListWidget::scanForAudio() {
}
void PlayListWidget::scanForVideo() {
- // qDebug("scan for video");
+ // odebug << "scan for video" << oendl;
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
@@ -995,7 +997,7 @@ void PlayListWidget::populateAudioView() {
if( dit.current()->file().left(4) == "http" )
size=0;
- else
+ else
size = QFile( dit.current()->file() ).size();
- // qDebug(dit.current()->name());
+ // odebug << dit.current()->name() << oendl;
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
QString::number(size ), storage, dit.current()->file());
@@ -1041,5 +1043,5 @@ void PlayListWidget::openFile() {
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
- // qDebug( "Selected filename is " + filename );
+ // odebug << "Selected filename is " + filename << oendl;
DocLnk lnk;
Config cfg( "OpiePlayer" );
@@ -1076,5 +1078,5 @@ void PlayListWidget::openFile() {
}
}
-
+
if( fileDlg ) {
delete fileDlg;
@@ -1085,6 +1087,6 @@ void PlayListWidget::openFile() {
/*
reads m3u and shows files/urls to playlist widget */
-void PlayListWidget::readm3u( const QString &filename ) {
- // qDebug( "read m3u filename " + filename );
+void PlayListWidget::readm3u( const QString &filename ) {
+ // odebug << "read m3u filename " + filename << oendl;
Om3u *m3uList;
@@ -1095,5 +1097,5 @@ void PlayListWidget::readm3u( const QString &filename ) {
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
- // qDebug("reading "+ s);
+ // odebug << "reading "+ s << oendl;
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
@@ -1106,15 +1108,15 @@ void PlayListWidget::readm3u( const QString &filename ) {
else
lnk.setFile( s ); //sets file name
-
+
} else {
// if( QFileInfo( s ).exists() ) {
lnk.setName( fullBaseName ( QFileInfo(s)));
// if(s.right(4) == '.') {//if regular file
- if(s.left(1) != "/") {
- // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
+ if(s.left(1) != "/") {
+ // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl;
lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
lnk.setIcon("SoundPlayer");
} else {
- // qDebug("set link2 "+s);
+ // odebug << "set link2 "+s << oendl;
lnk.setFile( s);
lnk.setIcon("SoundPlayer");
@@ -1136,5 +1138,5 @@ void PlayListWidget::readm3u( const QString &filename ) {
d->selectedFiles->setSelectedItem( s);
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename)));
-
+
}
@@ -1143,5 +1145,5 @@ reads pls and adds files/urls to playlist */
void PlayListWidget::readPls( const QString &filename ) {
- // qDebug( "pls filename is " + filename );
+ // odebug << "pls filename is " + filename << oendl;
Om3u *m3uList;
QString s, name;
@@ -1186,5 +1188,5 @@ void PlayListWidget::readPls( const QString &filename ) {
writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
- // qDebug("writing to current m3u");
+ // odebug << "writing to current m3u" << oendl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
@@ -1195,9 +1197,9 @@ void PlayListWidget::writeCurrentM3u() {
if( d->selectedFiles->first()) {
do {
- // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
+ // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
- // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
+ // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
m3uList->write();
m3uList->close();
@@ -1218,5 +1220,5 @@ void PlayListWidget::writem3u() {
if( fileDlg->result() == 1 ) {
name = fileDlg->text();
- // qDebug( filename );
+ // odebug << filename << oendl;
if( name.find("/",0,true) != -1) {// assume they specify a file path
filename = name;
@@ -1228,5 +1230,5 @@ void PlayListWidget::writem3u() {
if( filename.right( 3 ) != "m3u" ) //needs filename extension
filename += ".m3u";
-
+
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
@@ -1236,9 +1238,9 @@ void PlayListWidget::writem3u() {
}
while ( d->selectedFiles->next() );
- // qDebug( list );
+ // odebug << list << oendl;
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
-
+
if(fileDlg) delete fileDlg;
@@ -1248,13 +1250,13 @@ void PlayListWidget::writem3u() {
lnk.setName( name); //sets file name
- // qDebug(filename);
+ // odebug << filename << oendl;
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
-
+
config.writeEntry("CurrentPlaylist",filename);
currentPlayList=filename;
if(!lnk.writeLink()) {
- // qDebug("Writing doclink did not work");
+ // odebug << "Writing doclink did not work" << oendl;
}
@@ -1292,5 +1294,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
break;
// case Key_P: //play
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
@@ -1308,5 +1310,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
break;
case Key_4:
- tabWidget->setCurrentPage(3);
+ tabWidget->setCurrentPage(3);
break;
case Key_Down:
@@ -1320,5 +1322,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
break;
-
+
}
}
@@ -1326,9 +1328,9 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
void PlayListWidget::keyPressEvent( QKeyEvent *)
{
-// qDebug("Key press");
+// odebug << "Key press" << oendl;
// switch ( e->key() ) {
// ////////////////////////////// Zaurus keys
// case Key_A: //add to playlist
-// qDebug("Add");
+// odebug << "Add" << oendl;
// addSelected();
// break;
@@ -1337,9 +1339,9 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
// break;
// case Key_P: //play
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
// case Key_Space:
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
@@ -1348,5 +1350,5 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
void PlayListWidget::doBlank() {
- // qDebug("do blanking");
+ // odebug << "do blanking" << oendl;
#ifdef QT_QWS_DEVFS
fd=open("/dev/fb/0",O_RDWR);
@@ -1364,5 +1366,5 @@ void PlayListWidget::doUnblank() {
// int fd;
// fd=open("/dev/fb0",O_RDWR);
- // qDebug("do unblanking");
+ // odebug << "do unblanking" << oendl;
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
@@ -1389,5 +1391,5 @@ void PlayListWidget::populateSkinsMenu() {
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
- // qDebug( fi->fileName() );
+ // odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
@@ -1415,5 +1417,5 @@ void PlayListWidget::skinsMenuActivated( int item ) {
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
- // qDebug("qcop message "+msg );
+ // odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
@@ -1424,7 +1426,7 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
mediaPlayerState->togglePaused();
} else if ( msg == "next()" ) { //select next in lis
- mediaPlayerState->setNext();
+ mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
- mediaPlayerState->setPrev();
+ mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
mediaPlayerState->toggleLooping();