summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-12 12:15:30 (UTC)
committer llornkcor <llornkcor>2002-05-12 12:15:30 (UTC)
commitc1cc5edca5d6d71350f841892fb7828f7be9ed9f (patch) (unidiff)
tree014224506a39db65d54c41b18c5f7c1096cb7a92
parent06e723cc7942af2691828e7fdc6a6ec47b44edab (diff)
downloadopie-c1cc5edca5d6d71350f841892fb7828f7be9ed9f.zip
opie-c1cc5edca5d6d71350f841892fb7828f7be9ed9f.tar.gz
opie-c1cc5edca5d6d71350f841892fb7828f7be9ed9f.tar.bz2
added a few keyboard shorts
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp133
1 files changed, 130 insertions, 3 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
@@ -34,7 +34,6 @@
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35 35
36#include <qaction.h> 36#include <qaction.h>
37#include <qcursor.h>
38#include <qimage.h> 37#include <qimage.h>
39#include <qfile.h> 38#include <qfile.h>
40#include <qdir.h> 39#include <qdir.h>
@@ -51,6 +50,7 @@
51#include <qlineedit.h> 50#include <qlineedit.h>
52#include <qpushbutton.h> 51#include <qpushbutton.h>
53#include <qregexp.h> 52#include <qregexp.h>
53#include <qtextstream.h>
54 54
55//#include <qtimer.h> 55//#include <qtimer.h>
56 56
@@ -249,6 +249,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
249 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 249 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
250 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 250 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
251 251
252 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
253 this,SLOT( playIt( QListViewItem *)) );
252 254
253// audioView 255// audioView
254 populateAudioView(); 256 populateAudioView();
@@ -269,8 +271,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
269 videoView->setSelectionMode( QListView::Extended); 271 videoView->setSelectionMode( QListView::Extended);
270 272
271 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 273 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
274
272 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 275 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
273 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 276 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
277 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
278 this,SLOT( playIt( QListViewItem *)) );
274 279
275 tabWidget->insertTab( vTab,tr("Video")); 280 tabWidget->insertTab( vTab,tr("Video"));
276populateVideoView(); 281populateVideoView();
@@ -834,6 +839,7 @@ void PlayListWidget::btnPlay(bool b) {
834 break; 839 break;
835 case 1: 840 case 1:
836 { 841 {
842// if(audioView->selectedItem()) {
837 addToSelection( audioView->selectedItem() ); 843 addToSelection( audioView->selectedItem() );
838 mediaPlayerState->setPlaying(b); 844 mediaPlayerState->setPlaying(b);
839 d->selectedFiles->removeSelected( ); 845 d->selectedFiles->removeSelected( );
@@ -841,10 +847,12 @@ void PlayListWidget::btnPlay(bool b) {
841 d->selectedFiles->unSelect(); 847 d->selectedFiles->unSelect();
842 insanityBool=FALSE; 848 insanityBool=FALSE;
843// audioView->clearSelection(); 849// audioView->clearSelection();
850// }
844 } 851 }
845 break; 852 break;
846 case 2: 853 case 2:
847 { 854 {
855// if(videoView->selectedItem() ) {
848 addToSelection( videoView->selectedItem() ); 856 addToSelection( videoView->selectedItem() );
849 mediaPlayerState->setPlaying(b); 857 mediaPlayerState->setPlaying(b);
850 qApp->processEvents(); 858 qApp->processEvents();
@@ -853,6 +861,7 @@ void PlayListWidget::btnPlay(bool b) {
853 d->selectedFiles->unSelect(); 861 d->selectedFiles->unSelect();
854 insanityBool=FALSE; 862 insanityBool=FALSE;
855// videoView->clearSelection(); 863// videoView->clearSelection();
864// }
856 } 865 }
857 break; 866 break;
858 }; 867 };
@@ -883,7 +892,9 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
883 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 892 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
884 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 893 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
885 m.insertSeparator(); 894 m.insertSeparator();
895 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
886 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 896 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
897
887 m.exec( QCursor::pos() ); 898 m.exec( QCursor::pos() );
888 } 899 }
889 break; 900 break;
@@ -907,6 +918,7 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const
907 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 918 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
908 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 919 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
909// m.insertSeparator(); 920// m.insertSeparator();
921// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
910 m.exec( QCursor::pos() ); 922 m.exec( QCursor::pos() );
911 } 923 }
912 break; 924 break;
@@ -985,6 +997,7 @@ void PlayListWidget::populateAudioView() {
985 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); 997 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
986 } 998 }
987 } 999 }
1000
988} 1001}
989 1002
990void PlayListWidget::populateVideoView() { 1003void PlayListWidget::populateVideoView() {
@@ -1020,7 +1033,7 @@ void PlayListWidget::openFile() {
1020 filename = fileDlg->LineEdit1->text(); 1033 filename = fileDlg->LineEdit1->text();
1021//http://205.188.234.129:8030 1034//http://205.188.234.129:8030
1022// http://66.28.68.70:8000 1035// http://66.28.68.70:8000
1023 qDebug(filename); 1036 qDebug("Selected filename is "+filename);
1024 if(filename.right(3) == "m3u") 1037 if(filename.right(3) == "m3u")
1025 readm3u( filename); 1038 readm3u( filename);
1026 else if(filename.right(3) == "pls") 1039 else if(filename.right(3) == "pls")
@@ -1068,10 +1081,59 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1068 case Key_F13: //mail 1081 case Key_F13: //mail
1069// doUnblank(); 1082// doUnblank();
1070 break; 1083 break;
1071 1084 case Key_Q: //add to playlist
1085 qDebug("Add");
1086 addSelected();
1087 break;
1088 case Key_R: //remove from playlist
1089 removeSelected();
1090 break;
1091// case Key_P: //play
1092// qDebug("Play");
1093// playSelected();
1094// break;
1095 case Key_Space:
1096 qDebug("Play");
1097 playSelected();
1098 break;
1099 case Key_1:
1100 tabWidget->setCurrentPage(0);
1101 break;
1102 case Key_2:
1103 tabWidget->setCurrentPage(1);
1104 break;
1105 case Key_3:
1106 tabWidget->setCurrentPage(2);
1107 break;
1108 case Key_4:
1109 tabWidget->setCurrentPage(3);
1110 break;
1072 } 1111 }
1073} 1112}
1074 1113
1114void PlayListWidget::keyPressEvent( QKeyEvent *e)
1115{
1116// qDebug("Key press");
1117// switch ( e->key() ) {
1118// ////////////////////////////// Zaurus keys
1119// case Key_A: //add to playlist
1120// qDebug("Add");
1121// addSelected();
1122// break;
1123// case Key_R: //remove from playlist
1124// removeSelected();
1125// break;
1126// case Key_P: //play
1127// qDebug("Play");
1128// playSelected();
1129// break;
1130// case Key_Space:
1131// qDebug("Play");
1132// playSelected();
1133// break;
1134// }
1135}
1136
1075void PlayListWidget::doBlank() { 1137void PlayListWidget::doBlank() {
1076 qDebug("do blanking"); 1138 qDebug("do blanking");
1077 fd=open("/dev/fb0",O_RDWR); 1139 fd=open("/dev/fb0",O_RDWR);
@@ -1096,6 +1158,48 @@ void PlayListWidget::doUnblank() {
1096 1158
1097void PlayListWidget::readm3u(const QString &filename) { 1159void PlayListWidget::readm3u(const QString &filename) {
1098 1160
1161 qDebug("playlist filename is "+filename);
1162 QFile f(filename);
1163
1164 if(f.open(IO_ReadOnly)) {
1165 QTextStream t(&f);
1166 QString s;//, first, second;
1167 int i=0;
1168 while ( !t.atEnd()) {
1169// Lview->insertLine(t.readLine(),-1);
1170 s=t.readLine();
1171 if(s.find("#",0,TRUE) == -1) {
1172 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
1173 if(s.left(2) == "E:" || s.left(2) == "P:") {
1174 s=s.right(s.length()-2);
1175 DocLnk lnk( s );
1176 QFileInfo f(s);
1177 QString name = f.baseName();
1178 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1179 lnk.setName( name);
1180 s=s.replace( QRegExp("\\"),"/");
1181 lnk.setFile( s);
1182// lnk.setIcon(opieplayer/MPEGPlayer);
1183 qDebug("add "+name);
1184 d->selectedFiles->addToSelection( lnk);
1185 } else { // is url
1186 DocLnk lnk( s);
1187 QString name = s.right( s.length() - 7);
1188// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1189 lnk.setName(name);
1190 lnk.setFile( s+"/");
1191// lnk.setFile( filename);
1192// lnk.setComment( s+"/");
1193 lnk.setType("audio/x-mpegurl");
1194// lnk.setIcon( "opieplayer/MPEGPlayer");
1195// qDebug("add "+s);
1196 d->selectedFiles->addToSelection( lnk);
1197 }
1198 i++;
1199 }
1200 }
1201 }
1202 }
1099} 1203}
1100 1204
1101void PlayListWidget::writem3u(const QString &filename) { 1205void PlayListWidget::writem3u(const QString &filename) {
@@ -1104,4 +1208,27 @@ void PlayListWidget::writem3u(const QString &filename) {
1104 1208
1105void PlayListWidget::readPls(const QString &filename) { 1209void PlayListWidget::readPls(const QString &filename) {
1106 1210
1211 qDebug("playlist filename is "+filename);
1212 QFile f(filename);
1213
1214 if(f.open(IO_ReadOnly)) {
1215 QTextStream t(&f);
1216 QString s;//, first, second;
1217 int i=0;
1218 while ( !t.atEnd()) {
1219// Lview->insertLine(t.readLine(),-1);
1220// s=t.readLine();
1221// s=s.right(s.length()-2);
1222// DocLnk lnk( s );
1223// QFileInfo f(s);
1224// QString name = f.baseName();
1225// // name = name.left(name.length()-4);
1226// name = name.right(name.findRev("/",0,TRUE));
1227// lnk.setName( name);
1228// lnk.setFile( s);
1229// qDebug("add "+name);
1230// d->selectedFiles->addToSelection( lnk);
1231 }
1232 i++;
1233 }
1107} 1234}