summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp139
1 files changed, 133 insertions, 6 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 038b371..ec5500f 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -35,5 +35,4 @@
#include <qaction.h>
-#include <qcursor.h>
#include <qimage.h>
#include <qfile.h>
@@ -52,4 +51,5 @@
#include <qpushbutton.h>
#include <qregexp.h>
+#include <qtextstream.h>
//#include <qtimer.h>
@@ -250,4 +250,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
+ connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
+ this,SLOT( playIt( QListViewItem *)) );
// audioView
@@ -270,6 +272,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
+
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 *)) );
tabWidget->insertTab( vTab,tr("Video"));
@@ -835,4 +840,5 @@ void PlayListWidget::btnPlay(bool b) {
case 1:
{
+// if(audioView->selectedItem()) {
addToSelection( audioView->selectedItem() );
mediaPlayerState->setPlaying(b);
@@ -842,8 +848,10 @@ void PlayListWidget::btnPlay(bool b) {
insanityBool=FALSE;
// audioView->clearSelection();
+// }
}
break;
case 2:
{
+// if(videoView->selectedItem() ) {
addToSelection( videoView->selectedItem() );
mediaPlayerState->setPlaying(b);
@@ -854,4 +862,5 @@ void PlayListWidget::btnPlay(bool b) {
insanityBool=FALSE;
// videoView->clearSelection();
+// }
}
break;
@@ -884,5 +893,7 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.insertSeparator();
+ if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
+
m.exec( QCursor::pos() );
}
@@ -907,5 +918,6 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
-// m.insertSeparator();
+// m.insertSeparator();
+// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
@@ -922,5 +934,5 @@ void PlayListWidget::listDelete() {
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
- case 0:
+ case 0:
break;
case 1:
@@ -986,4 +998,5 @@ void PlayListWidget::populateAudioView() {
}
}
+
}
@@ -1019,7 +1032,7 @@ void PlayListWidget::openFile() {
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();
-//http://205.188.234.129:8030
+// http://205.188.234.129:8030
// http://66.28.68.70:8000
- qDebug(filename);
+ qDebug("Selected filename is "+filename);
if(filename.right(3) == "m3u")
readm3u( filename);
@@ -1069,8 +1082,57 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
// doUnblank();
break;
-
+ case Key_Q: //add to playlist
+ qDebug("Add");
+ addSelected();
+ break;
+ case Key_R: //remove from playlist
+ removeSelected();
+ break;
+// case Key_P: //play
+// qDebug("Play");
+// playSelected();
+// break;
+ case Key_Space:
+ qDebug("Play");
+ playSelected();
+ break;
+ case Key_1:
+ tabWidget->setCurrentPage(0);
+ break;
+ case Key_2:
+ tabWidget->setCurrentPage(1);
+ break;
+ case Key_3:
+ tabWidget->setCurrentPage(2);
+ break;
+ case Key_4:
+ tabWidget->setCurrentPage(3);
+ break;
}
}
+void PlayListWidget::keyPressEvent( QKeyEvent *e)
+{
+// qDebug("Key press");
+// switch ( e->key() ) {
+// ////////////////////////////// Zaurus keys
+// case Key_A: //add to playlist
+// qDebug("Add");
+// addSelected();
+// break;
+// case Key_R: //remove from playlist
+// removeSelected();
+// break;
+// case Key_P: //play
+// qDebug("Play");
+// playSelected();
+// break;
+// case Key_Space:
+// qDebug("Play");
+// playSelected();
+// break;
+// }
+}
+
void PlayListWidget::doBlank() {
qDebug("do blanking");
@@ -1097,4 +1159,46 @@ void PlayListWidget::doUnblank() {
void PlayListWidget::readm3u(const QString &filename) {
+ qDebug("playlist filename is "+filename);
+ QFile f(filename);
+
+ if(f.open(IO_ReadOnly)) {
+ QTextStream t(&f);
+ QString s;//, first, second;
+ int i=0;
+ while ( !t.atEnd()) {
+// Lview->insertLine(t.readLine(),-1);
+ s=t.readLine();
+ if(s.find("#",0,TRUE) == -1) {
+ if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
+ if(s.left(2) == "E:" || s.left(2) == "P:") {
+ s=s.right(s.length()-2);
+ DocLnk lnk( s );
+ QFileInfo f(s);
+ QString name = f.baseName();
+ name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
+ lnk.setName( name);
+ s=s.replace( QRegExp("\\"),"/");
+ lnk.setFile( s);
+// lnk.setIcon(opieplayer/MPEGPlayer);
+ qDebug("add "+name);
+ d->selectedFiles->addToSelection( lnk);
+ } else { // is url
+ DocLnk lnk( s);
+ QString name = s.right( s.length() - 7);
+// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
+ lnk.setName(name);
+ lnk.setFile( s+"/");
+// lnk.setFile( filename);
+// lnk.setComment( s+"/");
+ lnk.setType("audio/x-mpegurl");
+// lnk.setIcon( "opieplayer/MPEGPlayer");
+// qDebug("add "+s);
+ d->selectedFiles->addToSelection( lnk);
+ }
+ i++;
+ }
+ }
+ }
+ }
}
@@ -1105,3 +1209,26 @@ void PlayListWidget::writem3u(const QString &filename) {
void PlayListWidget::readPls(const QString &filename) {
+ qDebug("playlist filename is "+filename);
+ QFile f(filename);
+
+ if(f.open(IO_ReadOnly)) {
+ QTextStream t(&f);
+ QString s;//, first, second;
+ int i=0;
+ while ( !t.atEnd()) {
+// Lview->insertLine(t.readLine(),-1);
+// s=t.readLine();
+// s=s.right(s.length()-2);
+// DocLnk lnk( s );
+// QFileInfo f(s);
+// QString name = f.baseName();
+// // name = name.left(name.length()-4);
+// name = name.right(name.findRev("/",0,TRUE));
+// lnk.setName( name);
+// lnk.setFile( s);
+// qDebug("add "+name);
+// d->selectedFiles->addToSelection( lnk);
+ }
+ i++;
+ }
}