summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/playlistwidget.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp90
1 files changed, 46 insertions, 44 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
@@ -19,27 +19,29 @@
**********************************************************************/
// code added by L. J. Potter Sat 03-02-2002 06:17:54
#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>
#include <sys/file.h>
#include <sys/ioctl.h>
@@ -388,9 +390,9 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
const DocLnk *lnk = d->selectedFiles->current();
if ( lnk ) {
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
// next time...
if ( !QFile::exists( lnk->linkFile() ) ) {
@@ -482,18 +484,18 @@ void PlayListWidget::setDocument(const QString& fileref) {
setDocumentEx(fileref);
}
void PlayListWidget::setDocumentEx(const QString& fileref) {
- qDebug("opieplayer receive "+fileref);
+ odebug << "opieplayer receive "+fileref << oendl;
clearList();
DocLnk lnk;
QFileInfo fileInfo(fileref);
if ( !fileInfo.exists() ) {
QMessageBox::critical( 0, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
}
- // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref);
+ // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl;
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1) { //is m3u
readm3u( fileref);
}
@@ -533,9 +535,9 @@ 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();
mediaPlayerState->setView( 'l' ); // invalidate
mediaPlayerState->setView( origView ); // now switch back
@@ -550,9 +552,9 @@ void PlayListWidget::useSelectedDocument() {
const DocLnk *PlayListWidget::current() { // this is fugly
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
{
- // qDebug("playlist");
+ // odebug << "playlist" << oendl;
if ( mediaPlayerState->playlist() ) {
return d->selectedFiles->current();
}
else if ( d->setDocumentUsed && d->current ) {
@@ -563,9 +565,9 @@ const DocLnk *PlayListWidget::current() { // this is fugly
}
break;
case 1://audio
{
- // qDebug("audioView");
+ // odebug << "audioView" << oendl;
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
insanityBool=TRUE;
@@ -659,13 +661,13 @@ 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());
tabWidget->setCurrentPage(0);
}
@@ -817,9 +819,9 @@ void PlayListWidget::btnPlay(bool b) {
// QMessageBox::message("Note","You are trying to play\na malformed url.");
// } else {
mediaPlayerState->setPlaying(b);
insanityBool=FALSE;
- qDebug("insanity");
+ odebug << "insanity" << oendl;
// }
}
break;
case 1:
@@ -950,9 +952,9 @@ void PlayListWidget::listDelete() {
};
}
void PlayListWidget::scanForAudio() {
- // qDebug("scan for audio");
+ // odebug << "scan for audio" << oendl;
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
@@ -960,9 +962,9 @@ void PlayListWidget::scanForAudio() {
Global::findDocuments( &files, audioMimes);
audioScan = true;
}
void PlayListWidget::scanForVideo() {
- // qDebug("scan for video");
+ // odebug << "scan for video" << oendl;
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
@@ -995,9 +997,9 @@ void PlayListWidget::populateAudioView() {
if( dit.current()->file().left(4) == "http" )
size=0;
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());
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
}
@@ -1039,9 +1041,9 @@ void PlayListWidget::openFile() {
fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
- // qDebug( "Selected filename is " + filename );
+ // odebug << "Selected filename is " + filename << oendl;
DocLnk lnk;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
@@ -1084,18 +1086,18 @@ void PlayListWidget::openFile() {
/*
reads m3u and shows files/urls to playlist widget */
void PlayListWidget::readm3u( const QString &filename ) {
- // qDebug( "read m3u filename " + filename );
+ // odebug << "read m3u filename " + filename << oendl;
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readM3u();
DocLnk lnk;
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
lnk.setIcon("opieplayer2/musicfile");
@@ -1110,13 +1112,13 @@ void PlayListWidget::readm3u( const QString &filename ) {
// 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);
+ // 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");
}
}
@@ -1141,9 +1143,9 @@ void PlayListWidget::readm3u( const QString &filename ) {
/*
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;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readPls();
@@ -1184,22 +1186,22 @@ 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");
currentPlayList = cfg.readEntry("CurrentPlaylist","");
Om3u *m3uList;
m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate );
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();
if(m3uList) delete m3uList;
@@ -1216,9 +1218,9 @@ void PlayListWidget::writem3u() {
Om3u *m3uList;
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;
name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
}
@@ -1234,9 +1236,9 @@ void PlayListWidget::writem3u() {
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
- // qDebug( list );
+ // odebug << list << oendl;
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
@@ -1246,17 +1248,17 @@ void PlayListWidget::writem3u() {
lnk.setFile( filename);
lnk.setIcon("opieplayer2/playlist2");
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;
}
setCaption(tr("OpiePlayer: ") + name);
}
@@ -1290,9 +1292,9 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
case Key_R: //remove from playlist
removeSelected();
break;
// case Key_P: //play
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
case Key_Space:
// playSelected(); puh
@@ -1324,31 +1326,31 @@ 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;
// case Key_R: //remove from playlist
// removeSelected();
// break;
// case Key_P: //play
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
// case Key_Space:
-// qDebug("Play");
+// odebug << "Play" << oendl;
// playSelected();
// break;
// }
}
void PlayListWidget::doBlank() {
- // qDebug("do blanking");
+ // odebug << "do blanking" << oendl;
#ifdef QT_QWS_DEVFS
fd=open("/dev/fb/0",O_RDWR);
#else
fd=open("/dev/fb0",O_RDWR);
@@ -1362,9 +1364,9 @@ void PlayListWidget::doBlank() {
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
- // qDebug("do unblanking");
+ // odebug << "do unblanking" << oendl;
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
@@ -1387,9 +1389,9 @@ void PlayListWidget::populateSkinsMenu() {
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
- // qDebug( fi->fileName() );
+ // odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
@@ -1413,9 +1415,9 @@ void PlayListWidget::skinsMenuActivated( int item ) {
cfg.writeEntry("Skin", skinsMenu->text( 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
btnPlay( true);
} else if ( msg == "stop()" ) {