summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/playlistwidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 36f77be..d73f0cd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -181,18 +181,16 @@ void PlayListWidget::writeDefaultPlaylist() {
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
QString filename=QPEApplication::documentDir() + "/default.m3u";
QString currentString = config.readEntry( "CurrentPlaylist", filename);
if( currentString == filename) {
- Om3u *m3uList;
- // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
+ Om3u *m3uList;
if( d->selectedFiles->first() ) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
do {
- // odebug << d->selectedFiles->current()->file() << oendl;
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
m3uList->write();
m3uList->close();
@@ -205,13 +203,12 @@ void PlayListWidget::writeDefaultPlaylist() {
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = FALSE;
if( QFileInfo( lnk.file() ).exists() ||
lnk.file().left(4) == "http" ) {
d->selectedFiles->addToSelection( lnk );
}
-// writeCurrentM3u();
}
void PlayListWidget::clearList() {
while ( first() ) {
d->selectedFiles->removeSelected();
@@ -325,20 +322,20 @@ void PlayListWidget::addAllVideoToList() {
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::setDocument( const QString& _fileref ) {
- // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
+ // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
QString fileref = _fileref;
fromSetDocument = TRUE;
-
+
DocLnk lnk(_fileref);
if(lnk.isValid())
fileref = lnk.file();
-
+
QFileInfo fileInfo(fileref);
if ( !fileInfo.exists() ) {
QMessageBox::warning( this, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
@@ -407,13 +404,13 @@ bool PlayListWidget::prev() {
return TRUE;
}
}
bool PlayListWidget::next() {
-//odebug << "<<<<<<<<<<<<next()" << oendl;
+//odebug << "<<<<<<<<<<<<next()" << oendl;
if ( mediaPlayerState->isShuffled() ) {
return prev();
} else {
if ( !d->selectedFiles->next() ) {
if ( mediaPlayerState->isLooping() ) {
return d->selectedFiles->first();
@@ -618,13 +615,13 @@ void PlayListWidget::openURL() {
QString filename, name;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
- odebug << "Selected filename is " + filename << oendl;
+ odebug << "Selected filename is " + filename << oendl;
// Om3u *m3uList;
DocLnk lnk;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
if(filename.left(4) == "http") {
@@ -694,13 +691,13 @@ void PlayListWidget::openFile() {
str=str.right(str.length()-1);
}
cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
if( !str.isEmpty() ) {
- odebug << "Selected filename is " + str << oendl;
+ odebug << "Selected filename is " + str << oendl;
filename = str;
DocLnk lnk;
if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
readListFromFile( filename );
} else {
@@ -712,26 +709,26 @@ void PlayListWidget::openFile() {
}
}
}
void PlayListWidget::readListFromFile( const QString &filename ) {
- odebug << "read list filename " + filename << oendl;
+ odebug << "read list filename " + filename << oendl;
QFileInfo fi(filename);
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
if(fi.extension(false).find("m3u",0,false) != -1 )
m3uList->readM3u();
else if(fi.extension(false).find("pls",0,false) != -1 )
m3uList->readPls();
DocLnk lnk;
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
- // odebug << s << oendl;
+ // odebug << s << oendl;
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
lnk.setFile( s ); //sets file name
} else { //is file
@@ -759,27 +756,27 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
}
// writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
- odebug << "writing to current m3u" << oendl;
+ odebug << "writing to current m3u" << oendl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
Om3u *m3uList;
m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
if( d->selectedFiles->first()) {
do {
- // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
+ // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
- // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
+ // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
m3uList->write();
m3uList->close();
}
delete m3uList;
}
@@ -818,13 +815,13 @@ void PlayListWidget::writem3u() {
QString name, filename, list;
Om3u *m3uList;
if( !str.isEmpty() ) {
name = str;
// name = fileDlg->text();
-// odebug << filename << oendl;
+// 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 );
}
else //otherwise dump it somewhere noticable
filename = QPEApplication::documentDir() + "/" + name;
@@ -836,33 +833,33 @@ void PlayListWidget::writem3u() {
m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
- // odebug << list << oendl;
+ // odebug << list << oendl;
m3uList->write();
m3uList->close();
delete m3uList;
//delete fileDlg;
DocLnk lnk;
lnk.setFile( filename);
lnk.setIcon("opieplayer2/playlist2");
lnk.setName( name); //sets file name
- // odebug << filename << oendl;
+ // odebug << filename << oendl;
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
currentPlayList=filename;
if(!lnk.writeLink()) {
- odebug << "Writing doclink did not work" << oendl;
+ odebug << "Writing doclink did not work" << oendl;
}
setCaption(tr("OpiePlayer: ") + name);
}
}
}
@@ -890,13 +887,13 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
addSelected();
break;
case Key_R: //remove from playlist
removeSelected();
break;
// case Key_P: //play
- // odebug << "Play" << oendl;
+ // odebug << "Play" << oendl;
// playSelected();
// break;
case Key_Space:
// playSelected(); puh
break;
case Key_1:
@@ -920,13 +917,13 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
// d->selectedFiles->last();
break;
}
}
void PlayListWidget::pmViewActivated(int index) {
-// odebug << "" << index << "" << oendl;
+// odebug << "" << index << "" << oendl;
switch(index) {
case -16:
{
mediaPlayerState->toggleFullscreen();
bool b=mediaPlayerState->isFullscreen();
pmView->setItemChecked( index, b);
@@ -950,13 +947,13 @@ void PlayListWidget::populateSkinsMenu() {
skinsDir.setSorting(QDir::Name );
const QFileInfoList *skinslist = skinsDir.entryInfoList();
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
-// odebug << fi->fileName() << oendl;
+// odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
defaultSkinIndex = item;
}
@@ -1006,13 +1003,13 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const
QString PlayListWidget::currentFileListPathName() const {
return currentFileListView->currentItem()->text( 3 );
}
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
- odebug << "qcop message "+msg << oendl;
+ odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
btnPlay( true);
} else if ( msg == "stop()" ) {
mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {