summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-29 04:06:17 (UTC)
committer llornkcor <llornkcor>2002-06-29 04:06:17 (UTC)
commit869bbb0b53c6ce941906a05a1536ad3eb130163e (patch) (side-by-side diff)
tree068db89509c58effd9e2e0af879b761784042e1a
parent3c187ccc9f1b684453c978ca9e56ff3137cb15ec (diff)
downloadopie-869bbb0b53c6ce941906a05a1536ad3eb130163e.zip
opie-869bbb0b53c6ce941906a05a1536ad3eb130163e.tar.gz
opie-869bbb0b53c6ce941906a05a1536ad3eb130163e.tar.bz2
how about some key action on the playlist
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 4926287..b9b63c7 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1092,134 +1092,145 @@ void PlayListWidget::openFile() {
DocLnk lnk;
lnk.setName(filename); //sets file name
if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
filename += "/";
lnk.setFile(filename); //sets File property
lnk.setType("audio/x-mpegurl");
lnk.setExec("opieplayer");
lnk.setIcon("opieplayer/MPEGPlayer");
if(!lnk.writeLink())
qDebug("Writing doclink did not work");
d->selectedFiles->addToSelection( lnk);
// if(fileDlg2)
// delete fileDlg2;
}
}
}
if(fileDlg)
delete fileDlg;
}
void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
{
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_F9: //activity
// if(audioUI->isHidden())
// audioUI->showMaximized();
break;
case Key_F10: //contacts
// if( videoUI->isHidden())
// videoUI->showMaximized();
break;
case Key_F11: //menu
break;
case Key_F12: //home
// doBlank();
break;
case Key_F13: //mail
// 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(); puh
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;
+ case Key_3:
+ tabWidget->setCurrentPage(2);
+ break;
+ case Key_4:
+ tabWidget->setCurrentPage(3);
+ break;
+ case Key_Down:
+ if ( !d->selectedFiles->next() )
+ d->selectedFiles->first();
+
+ break;
+ case Key_Up:
+ if ( !d->selectedFiles->prev() )
+ d->selectedFiles->last();
+
+ 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");
fd=open("/dev/fb0",O_RDWR);
if (fd != -1) {
ioctl(fd,FBIOBLANK,1);
// close(fd);
}
}
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
qDebug("do unblanking");
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
QCopEnvelope h("QPE/System", "setBacklight(int)");
h <<-3;// v[1]; // -3 Force on
}
void PlayListWidget::readm3u(const QString &filename) {
qDebug("m3u 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 || s.find("%20",0,TRUE) != -1) {
QMessageBox::message("Note","Spaces in urls are not allowed.");
}
else if(s.find("#",0,TRUE) == -1) {
@@ -1275,83 +1286,81 @@ void PlayListWidget::writem3u() {
fileDlg->exec();
QString filename,list;
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();
qDebug(filename);
int noOfFiles = 0;
d->selectedFiles->first();
do {
// we dont check for existance because of url's
// qDebug(d->selectedFiles->current()->file());
list += d->selectedFiles->current()->file()+"\n";
noOfFiles++;
}
while ( d->selectedFiles->next() );
qDebug(list);
if(filename.left(1) != "/")
filename=QPEApplication::documentDir()+"/"+filename;
if(filename.right(3) != "m3u")
filename=filename+".m3u";
QFile f(filename);
f.open(IO_WriteOnly);
f.writeBlock(list, list.length());
f.close();
}
if(fileDlg) delete fileDlg;
}
void PlayListWidget::readPls(const QString &filename) {
qDebug("pls filename is "+filename);
QFile f(filename);
if(f.open(IO_ReadOnly)) {
QTextStream t(&f);
QString s;//, first, second;
int i=0;
while ( !t.atEnd()) {
s=t.readLine();
if(s.left(4) == "File") {
s=s.right(s.length() - 6);
s.replace(QRegExp("%20")," ");
qDebug("adding "+s+" to playlist");
// numberofentries=2
// File1=http
// Title
// Length
// Version
// File2=http
s=s.replace( QRegExp("\\"),"/");
DocLnk lnk( s );
QFileInfo f(s);
QString name = f.baseName();
if(name.left(4)=="http")
name = s.right( s.length() - 7);
else
name=s;
name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
// QFileInfo f(s);
// QString name = f.baseName();
// name = name.left(name.length()-4);
// name = name.right(name.findRev("/",0,TRUE));
lnk.setName( name);
- if(s.at(s.length()-4) == '.')
- lnk.setFile( s);
- else {
- if( name.right(1).find('/') == -1)
- s+="/";
- // if(s.right(1) != '/')
- lnk.setFile( s);
-
+ if(s.at(s.length()-4) == '.') // if this is probably a file
+ lnk.setFile( s);
+ else { //if its a url
+ if( name.right(1).find('/') == -1)
+ s+="/";
+ lnk.setFile( s);
}
lnk.setType("audio/x-mpegurl");
qDebug("DocLnk add "+name);
d->selectedFiles->addToSelection( lnk);
}
}
i++;
}
}