summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediadetect.cpp38
-rw-r--r--noncore/multimedia/opieplayer2/mediadetect.h31
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp357
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp20
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h2
6 files changed, 200 insertions, 252 deletions
diff --git a/noncore/multimedia/opieplayer2/mediadetect.cpp b/noncore/multimedia/opieplayer2/mediadetect.cpp
new file mode 100644
index 0000000..7deeb2f
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/mediadetect.cpp
@@ -0,0 +1,38 @@
1#include <qstring.h>
2#include "mediadetect.h"
3
4
5MediaDetect::MediaDetect() {
6}
7
8MediaDetect::~MediaDetect() {
9}
10
11char MediaDetect::videoOrAudio( const QString& fileName ) {
12 if( fileName.right(4) == ".avi" ||
13 fileName.right(4) == ".mpg" ||
14 fileName.right(4) == ".asf" ||
15 fileName.right(4) == ".mov" ||
16 fileName.right(5) == ".mpeg" ) {
17 return 'v';
18 } else if ( fileName.right(4) == ".avi" ||
19 fileName.right(4) == ".mp3" ||
20 fileName.right(4) == ".ogg" ||
21 fileName.right(4) == ".wav" ) {
22 return 'a';
23 } else {
24 return 'f';
25 }
26}
27
28bool MediaDetect::isStreaming( const QString& fileName ) {
29 // ugly
30 if( fileName.left(4) == "http" ) {
31 return true;
32 } else if (fileName.left(3) == "ftp" ) {
33 return true;
34 } else {
35 return false;
36 }
37}
38
diff --git a/noncore/multimedia/opieplayer2/mediadetect.h b/noncore/multimedia/opieplayer2/mediadetect.h
new file mode 100644
index 0000000..bd5ea1d
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/mediadetect.h
@@ -0,0 +1,31 @@
1
2#ifndef MEDIADETECT_H
3#define MEDIADETECT_H
4
5
6class QString;
7class MediaDetect {
8
9public:
10 MediaDetect();
11 ~MediaDetect();
12
13 /**
14 * Look at the filename and decide which gui is to be used
15 *
16 * @param filename the filename
17 * @return the char - a for audio gui, v for video, f for error
18 */
19 char videoOrAudio( const QString& fileName );
20
21 /**
22 * Find out if it is a streaming media file
23 *
24 * @param filename the filename
25 * @return if it is a streaming url or not
26 */
27 bool isStreaming( const QString& fileName );
28
29};
30
31#endif
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index bcd9b92..37208ef 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -4,3 +4,3 @@ CONFIG = qt warn_on release
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h\ 5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\
6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ 6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \
@@ -8,3 +8,3 @@ HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h\
8SOURCES = main.cpp \ 8SOURCES = main.cpp \
9 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp\ 9 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\
10 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ 10 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 0390c99..9373f6b 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -36,3 +36,2 @@
36 36
37//#include <qtimer.h>
38 37
@@ -63,9 +62,5 @@
63 62
64extern AudioWidget *audioUI;
65extern VideoWidget *videoUI;
66extern MediaPlayerState *mediaPlayerState; 63extern MediaPlayerState *mediaPlayerState;
67 64
68// class myFileSelector {
69 65
70// };
71class PlayListWidgetPrivate { 66class PlayListWidgetPrivate {
@@ -84,3 +79,3 @@ public:
84 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 79 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
85 : QToolButton( parent, name ) { 80 : QToolButton( parent, name ) {
86 setTextLabel( name ); 81 setTextLabel( name );
@@ -107,3 +102,3 @@ public:
107PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 102PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
108 : QMainWindow( parent, name, fl ) { 103 : QMainWindow( parent, name, fl ) {
109 104
@@ -116,4 +111,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
116 videoScan = FALSE; 111 videoScan = FALSE;
117// menuTimer = new QTimer( this ,"menu timer"),
118// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
119 112
@@ -126,3 +119,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
126 119
127 // Create Toolbar 120 // Create Toolbar
128 QPEToolBar *toolbar = new QPEToolBar( this ); 121 QPEToolBar *toolbar = new QPEToolBar( this );
@@ -130,3 +123,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
130 123
131 // Create Menubar 124 // Create Menubar
132 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 125 QPEMenuBar *menu = new QPEMenuBar( toolbar );
@@ -136,4 +129,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
136 bar->setLabel( tr( "Play Operations" ) ); 129 bar->setLabel( tr( "Play Operations" ) );
137// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 130
138// this , SLOT( addSelected()) );
139 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 131 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
@@ -146,3 +138,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
146 this , SLOT(removeSelected()) ); 138 this , SLOT(removeSelected()) );
147// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
148 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 139 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
@@ -188,4 +179,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
188 pTab = new QWidget( tabWidget, "pTab" ); 179 pTab = new QWidget( tabWidget, "pTab" );
189// playlistView = new QListView( pTab, "playlistview" );
190// playlistView->setMinimumSize(236,260);
191 tabWidget->insertTab( pTab,"Playlist"); 180 tabWidget->insertTab( pTab,"Playlist");
@@ -193,3 +182,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
193 182
194 // Add the playlist area 183 // Add the playlist area
195 184
@@ -206,4 +195,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
206 195
207
208
209 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 196 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
@@ -232,6 +219,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
232 219
233// audioView
234// populateAudioView();
235// videowidget
236
237 QWidget *vTab; 220 QWidget *vTab;
@@ -253,5 +236,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
253 tabWidget->insertTab( vTab,tr("Video")); 236 tabWidget->insertTab( vTab,tr("Video"));
254// populateVideoView();
255 237
256//playlists list 238 //playlists list
257 QWidget *LTab; 239 QWidget *LTab;
@@ -262,14 +244,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
262 244
263// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
264
265// add the library area
266
267// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
268// this, SLOT( fauxPlay( QListViewItem *) ) );
269// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
270// this, SLOT( fauxPlay( QListViewItem *)) );
271
272// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
273// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
274
275 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 245 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
@@ -279,6 +249,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
279 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 249 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
280
281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 250 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 251 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
283
284 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 252 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
@@ -286,3 +254,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
286 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 254 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
287
288 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 255 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
@@ -292,8 +259,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
292 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 259 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
293
294 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 260 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
295
296
297 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 261 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
298
299 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 262 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
@@ -302,5 +265,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
302 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 265 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
303
304 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 266 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
305// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
306 267
@@ -311,3 +272,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
311 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 272 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
312// qDebug("currentList is "+currentPlaylist);
313 loadList(DocLnk( currentPlaylist)); 273 loadList(DocLnk( currentPlaylist));
@@ -323,5 +283,5 @@ PlayListWidget::~PlayListWidget() {
323 283
324 284 if ( d->current ) {
325 if ( d->current )
326 delete d->current; 285 delete d->current;
286 }
327 delete d; 287 delete d;
@@ -335,9 +295,3 @@ void PlayListWidget::initializeStates() {
335 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 295 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
336// d->tbFull->setOn( mediaPlayerState->fullscreen() );
337// d->tbScale->setOn( mediaPlayerState->scaled() );
338// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
339// setPlaylist( mediaPlayerState->playlist() );
340 setPlaylist( true); 296 setPlaylist( true);
341// d->selectedFiles->first();
342
343} 297}
@@ -359,3 +313,2 @@ void PlayListWidget::readConfig( Config& cfg ) {
359 d->selectedFiles->setSelectedItem( currentString); 313 d->selectedFiles->setSelectedItem( currentString);
360// d->selectedFiles->setSelectedItem( (const QString &)currentString);
361} 314}
@@ -374,3 +327,2 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
374 entryName.sprintf( "File%i", noOfFiles + 1 ); 327 entryName.sprintf( "File%i", noOfFiles + 1 );
375// qDebug(entryName);
376 cfg.writeEntry( entryName, lnk->linkFile() ); 328 cfg.writeEntry( entryName, lnk->linkFile() );
@@ -400,8 +352,2 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
400void PlayListWidget::addToSelection( const DocLnk& lnk ) { 352void PlayListWidget::addToSelection( const DocLnk& lnk ) {
401// qDebug("add");
402// if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
403// QMessageBox::message("Note","You are trying to play\na malformed url.");
404
405// } else {
406
407 d->setDocumentUsed = FALSE; 353 d->setDocumentUsed = FALSE;
@@ -413,3 +359,2 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
413 mediaPlayerState->setPlaying( TRUE ); 359 mediaPlayerState->setPlaying( TRUE );
414// }
415} 360}
@@ -418,4 +363,5 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
418void PlayListWidget::clearList() { 363void PlayListWidget::clearList() {
419 while ( first() ) 364 while ( first() ) {
420 d->selectedFiles->removeSelected(); 365 d->selectedFiles->removeSelected();
366 }
421} 367}
@@ -427,5 +373,7 @@ void PlayListWidget::addAllToList() {
427 QListIterator<DocLnk> Adit( filesAll.children() ); 373 QListIterator<DocLnk> Adit( filesAll.children() );
428 for ( ; Adit.current(); ++Adit ) 374 for ( ; Adit.current(); ++Adit ) {
429 if(QFileInfo(Adit.current()->file()).exists()) 375 if(QFileInfo(Adit.current()->file()).exists()) {
430 d->selectedFiles->addToSelection( **Adit ); 376 d->selectedFiles->addToSelection( **Adit );
377 }
378 }
431} 379}
@@ -435,5 +383,7 @@ void PlayListWidget::addAllMusicToList() {
435 QListIterator<DocLnk> dit( files.children() ); 383 QListIterator<DocLnk> dit( files.children() );
436 for ( ; dit.current(); ++dit ) 384 for ( ; dit.current(); ++dit ) {
437 if(QFileInfo(dit.current()->file()).exists()) 385 if(QFileInfo(dit.current()->file()).exists()) {
438 d->selectedFiles->addToSelection( **dit ); 386 d->selectedFiles->addToSelection( **dit );
387 }
388 }
439} 389}
@@ -456,10 +406,8 @@ void PlayListWidget::setDocument(const QString& fileref) {
456 } 406 }
457// qDebug("setDocument "+fileref); 407
458 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u 408 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
459 readm3u( fileref); 409 readm3u( fileref);
460 } 410 } else if(fileref.find("pls",0,TRUE) != -1) { //is pls
461 else if(fileref.find("pls",0,TRUE) != -1) { //is pls
462 readPls( fileref); 411 readPls( fileref);
463 } 412 } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
464 else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
465 clearList(); 413 clearList();
@@ -481,3 +429,3 @@ void PlayListWidget::setDocument(const QString& fileref) {
481void PlayListWidget::setActiveWindow() { 429void PlayListWidget::setActiveWindow() {
482 // When we get raised we need to ensure that it switches views 430 // When we get raised we need to ensure that it switches views
483 char origView = mediaPlayerState->view(); 431 char origView = mediaPlayerState->view();
@@ -495,16 +443,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly
495 443
496// if( fromSetDocument) {
497// qDebug("from setDoc");
498// DocLnkSet files;
499// Global::findDocuments(&files, "video/*;audio/*");
500// QListIterator<DocLnk> dit( files.children() );
501// for ( ; dit.current(); ++dit ) {
502// if(dit.current()->linkFile() == setDocFileRef) {
503// qDebug(setDocFileRef);
504// return dit;
505// }
506// }
507// } else
508
509
510 switch (tabWidget->currentPageIndex()) { 444 switch (tabWidget->currentPageIndex()) {
@@ -515,4 +449,3 @@ const DocLnk *PlayListWidget::current() { // this is fugly
515 return d->selectedFiles->current(); 449 return d->selectedFiles->current();
516 } 450 } else if ( d->setDocumentUsed && d->current ) {
517 else if ( d->setDocumentUsed && d->current ) {
518 return d->current; 451 return d->current;
@@ -627,3 +560,3 @@ void PlayListWidget::saveList() {
627 filename = fileDlg->LineEdit1->text();//+".playlist"; 560 filename = fileDlg->LineEdit1->text();//+".playlist";
628// qDebug("saving playlist "+filename+".playlist"); 561 // qDebug("saving playlist "+filename+".playlist");
629 Config cfg( filename +".playlist"); 562 Config cfg( filename +".playlist");
@@ -632,3 +565,2 @@ void PlayListWidget::saveList() {
632 DocLnk lnk; 565 DocLnk lnk;
633// lnk.setComment( "");
634 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 566 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
@@ -637,5 +569,6 @@ void PlayListWidget::saveList() {
637 lnk.setName( filename); //sets file name 569 lnk.setName( filename); //sets file name
638// qDebug(filename); 570 // qDebug(filename);
639 if(!lnk.writeLink()) 571 if(!lnk.writeLink()) {
640 qDebug("Writing doclink did not work"); 572 qDebug("Writing doclink did not work");
573 }
641 } 574 }
@@ -645,4 +578,5 @@ void PlayListWidget::saveList() {
645 d->selectedFiles->first(); 578 d->selectedFiles->first();
646 if(fileDlg) 579 if(fileDlg) {
647 delete fileDlg; 580 delete fileDlg;
581 }
648} 582}
@@ -651,6 +585,6 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
651 QString name= lnk.name(); 585 QString name= lnk.name();
652// qDebug("currentList is "+name); 586 // qDebug("currentList is "+name);
653 if( name.length()>1) { 587 if( name.length()>1) {
654 setCaption("OpiePlayer: "+name); 588 setCaption("OpiePlayer: "+name);
655// qDebug("load list "+ name+".playlist"); 589 // qDebug("load list "+ name+".playlist");
656 clearList(); 590 clearList();
@@ -663,3 +597,3 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
663 config.writeEntry("CurrentPlaylist", name); 597 config.writeEntry("CurrentPlaylist", name);
664// d->selectedFiles->first(); 598 // d->selectedFiles->first();
665 } 599 }
@@ -669,6 +603,7 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
669void PlayListWidget::setPlaylist( bool shown ) { 603void PlayListWidget::setPlaylist( bool shown ) {
670 if ( shown ) 604 if ( shown ) {
671 d->playListFrame->show(); 605 d->playListFrame->show();
672 else 606 } else {
673 d->playListFrame->hide(); 607 d->playListFrame->hide();
608 }
674} 609}
@@ -693,5 +628,2 @@ void PlayListWidget::addSelected() {
693 case 1: { //audio 628 case 1: { //audio
694// QString entryName;
695// entryName.sprintf( "File%i", i + 1 );
696// QString linkFile = cfg.readEntry( entryName );
697 QListViewItemIterator it( audioView ); 629 QListViewItemIterator it( audioView );
@@ -723,3 +655,2 @@ void PlayListWidget::addSelected() {
723 } 655 }
724
725 videoView->setSelected( it.current(),FALSE); 656 videoView->setSelected( it.current(),FALSE);
@@ -727,15 +658,2 @@ void PlayListWidget::addSelected() {
727 } 658 }
728// for ( int i = 0; i < noOfFiles; i++ ) {
729// QString entryName;
730// entryName.sprintf( "File%i", i + 1 );
731// QString linkFile = cfg.readEntry( entryName );
732// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
733// int result= QMessageBox::warning(this,tr("OpiePlayer"),
734// tr("This is all ready in your playlist.\nContinue?"),
735// tr("Yes"),tr("No"),0,0,1);
736// if (result !=0)
737// return;
738// }
739// }
740// addToSelection( videoView->selectedItem() );
741 tabWidget->setCurrentPage(0); 659 tabWidget->setCurrentPage(0);
@@ -751,4 +669,2 @@ void PlayListWidget::removeSelected() {
751void PlayListWidget::playIt( QListViewItem *it) { 669void PlayListWidget::playIt( QListViewItem *it) {
752// d->setDocumentUsed = FALSE;
753// mediaPlayerState->curPosition =0;
754 qDebug("playIt"); 670 qDebug("playIt");
@@ -835,33 +751,28 @@ void PlayListWidget::btnPlay(bool b) {
835 switch ( tabWidget->currentPageIndex()) { 751 switch ( tabWidget->currentPageIndex()) {
836 case 0: 752 case 0:
837 {
838// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
839// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
840// QMessageBox::message("Note","You are trying to play\na malformed url.");
841// } else {
842 mediaPlayerState->setPlaying(b);
843// }
844 }
845 break;
846 case 1:
847 { 753 {
848 addToSelection( audioView->currentItem() );
849 mediaPlayerState->setPlaying(b); 754 mediaPlayerState->setPlaying(b);
850 d->selectedFiles->removeSelected( ); 755 }
851 tabWidget->setCurrentPage(1);
852 d->selectedFiles->unSelect();
853 insanityBool=FALSE;
854 }// audioView->clearSelection();
855 break;
856 case 2:
857 {
858 addToSelection( videoView->currentItem() );
859 mediaPlayerState->setPlaying(b);
860 qApp->processEvents();
861 d->selectedFiles->removeSelected( );
862 tabWidget->setCurrentPage(2);
863 d->selectedFiles->unSelect();
864 insanityBool=FALSE;
865 }// videoView->clearSelection();
866 break; 756 break;
757 case 1:
758 {
759 addToSelection( audioView->currentItem() );
760 mediaPlayerState->setPlaying(b);
761 d->selectedFiles->removeSelected( );
762 tabWidget->setCurrentPage(1);
763 d->selectedFiles->unSelect();
764 insanityBool=FALSE;
765 }// audioView->clearSelection();
766 break;
767 case 2:
768 {
769 addToSelection( videoView->currentItem() );
770 mediaPlayerState->setPlaying(b);
771 qApp->processEvents();
772 d->selectedFiles->removeSelected( );
773 tabWidget->setCurrentPage(2);
774 d->selectedFiles->unSelect();
775 insanityBool=FALSE;
776 }// videoView->clearSelection();
777 break;
867 }; 778 };
@@ -884,4 +795,3 @@ void PlayListWidget::deletePlaylist() {
884 795
885void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 796void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) {
886{
887 switch (mouse) { 797 switch (mouse) {
@@ -890,3 +800,2 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
890 case 2:{ 800 case 2:{
891
892 QPopupMenu m; 801 QPopupMenu m;
@@ -895,5 +804,3 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
895 m.insertSeparator(); 804 m.insertSeparator();
896 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 805 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
897 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
898
899 m.exec( QCursor::pos() ); 806 m.exec( QCursor::pos() );
@@ -904,10 +811,7 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
904 811
905void PlayListWidget::playSelected() 812void PlayListWidget::playSelected() {
906{
907 btnPlay( TRUE); 813 btnPlay( TRUE);
908// d->selectedFiles->unSelect();
909} 814}
910 815
911void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 816void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) {
912{
913 switch (mouse) { 817 switch (mouse) {
@@ -916,3 +820,4 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const
916 break; 820 break;
917 case 2:{ 821 case 2:
822 {
918 QPopupMenu m; 823 QPopupMenu m;
@@ -920,4 +825,2 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const
920 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 825 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
921// m.insertSeparator();
922// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
923 m.exec( QCursor::pos() ); 826 m.exec( QCursor::pos() );
@@ -926,3 +829,2 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const
926 }; 829 };
927
928} 830}
@@ -941,4 +843,2 @@ void PlayListWidget::listDelete() {
941 file = audioView->selectedItem()->text(0); 843 file = audioView->selectedItem()->text(0);
942// Global::findDocuments(&files, "audio/*");
943// AppLnkSet appFiles;
944 QListIterator<DocLnk> dit( files.children() ); 844 QListIterator<DocLnk> dit( files.children() );
@@ -946,5 +846,4 @@ void PlayListWidget::listDelete() {
946 if( dit.current()->name() == file) { 846 if( dit.current()->name() == file) {
947// qDebug(file); 847 // qDebug(file);
948 LnkProperties prop( dit.current() ); 848 LnkProperties prop( dit.current() );
949// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
950 prop.showMaximized(); 849 prop.showMaximized();
@@ -958,15 +857,3 @@ void PlayListWidget::listDelete() {
958 { 857 {
959// file = videoView->selectedItem()->text(0); 858
960// for ( int i = 0; i < noOfFiles; i++ ) {
961// QString entryName;
962// entryName.sprintf( "File%i", i + 1 );
963// QString linkFile = cfg.readEntry( entryName );
964// AppLnk lnk( AppLnk(linkFile));
965// if( lnk.name() == file ) {
966// LnkProperties prop( &lnk);
967// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
968// prop.showMaximized();
969// prop.exec();
970// }
971// }
972 } 859 }
@@ -1017,3 +904,3 @@ void PlayListWidget::populateAudioView() {
1017 if ( QFile( dit.current()->file()).exists() ) { 904 if ( QFile( dit.current()->file()).exists() ) {
1018// qDebug(dit.current()->name()); 905 // qDebug(dit.current()->name());
1019 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 906 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
@@ -1060,36 +947,31 @@ void PlayListWidget::openFile() {
1060 filename = fileDlg->LineEdit1->text(); 947 filename = fileDlg->LineEdit1->text();
1061// http://205.188.234.129:8030 948
1062// http://66.28.68.70:8000 949 qDebug("Selected filename is "+filename);
1063// filename.replace(QRegExp("%20")," "); 950 if(filename.right(3) == "m3u") {
1064 if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { 951 readm3u( filename );
1065 QMessageBox::message("Note","Spaces in urls are not allowed."); 952 } else if(filename.right(3) == "pls") {
1066 return; 953 readPls( filename );
1067 } else { 954 } else {
1068 qDebug("Selected filename is "+filename); 955 DocLnk lnk;
1069 if(filename.right(3) == "m3u")
1070 readm3u( filename);
1071 else if(filename.right(3) == "pls")
1072 readPls( filename);
1073 else {
1074 DocLnk lnk;
1075
1076 lnk.setName(filename); //sets file name
1077 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
1078 filename += "/";
1079 lnk.setFile(filename); //sets File property
1080 956
1081 lnk.setType("audio/x-mpegurl"); 957 lnk.setName(filename); //sets file name
1082 lnk.setExec("opieplayer"); 958 // probably not needed anymore either
1083 lnk.setIcon("opieplayer/MPEGPlayer"); 959 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") {
960 filename += "/";
961 }
962 lnk.setFile(filename); //sets File property
963
964 lnk.setType("audio/x-mpegurl");
965 lnk.setExec("opieplayer");
966 lnk.setIcon("opieplayer/MPEGPlayer");
1084 967
1085 if(!lnk.writeLink()) 968 if(!lnk.writeLink()) {
1086 qDebug("Writing doclink did not work"); 969 qDebug("Writing doclink did not work");
1087 d->selectedFiles->addToSelection( lnk);
1088// if(fileDlg2)
1089// delete fileDlg2;
1090 } 970 }
971 d->selectedFiles->addToSelection( lnk);
1091 } 972 }
1092 } 973 }
1093 if(fileDlg) 974 if(fileDlg) {
1094 delete fileDlg; 975 delete fileDlg;
976 }
1095} 977}
@@ -1190,5 +1072,5 @@ void PlayListWidget::doBlank() {
1190void PlayListWidget::doUnblank() { 1072void PlayListWidget::doUnblank() {
1191 // this crashes opieplayer with a segfault 1073 // this crashes opieplayer with a segfault
1192// int fd; 1074 // int fd;
1193// fd=open("/dev/fb0",O_RDWR); 1075 // fd=open("/dev/fb0",O_RDWR);
1194 qDebug("do unblanking"); 1076 qDebug("do unblanking");
@@ -1212,8 +1094,5 @@ void PlayListWidget::readm3u(const QString &filename) {
1212 while ( !t.atEnd()) { 1094 while ( !t.atEnd()) {
1213// Lview->insertLine(t.readLine(),-1);
1214 s=t.readLine(); 1095 s=t.readLine();
1215 if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { 1096
1216 QMessageBox::message("Note","Spaces in urls are not allowed."); 1097 if(s.find("#",0,TRUE) == -1) {
1217 }
1218 else if(s.find("#",0,TRUE) == -1) {
1219 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat 1098 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
@@ -1224,8 +1103,7 @@ void PlayListWidget::readm3u(const QString &filename) {
1224 QString name = f.baseName(); 1103 QString name = f.baseName();
1225 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1104 name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 );
1226 lnk.setName( name); 1105 lnk.setName( name );
1227 s=s.replace( QRegExp("\\"),"/"); 1106 s=s.replace( QRegExp("\\"),"/");
1228 lnk.setFile( s); 1107 lnk.setFile( s );
1229 lnk.writeLink(); 1108 lnk.writeLink();
1230// lnk.setIcon(opieplayer/MPEGPlayer);
1231 qDebug("add "+name); 1109 qDebug("add "+name);
@@ -1233,22 +1111,18 @@ void PlayListWidget::readm3u(const QString &filename) {
1233 } else { // is url 1111 } else { // is url
1234
1235 s.replace(QRegExp("%20")," "); 1112 s.replace(QRegExp("%20")," ");
1236 DocLnk lnk( s); 1113 DocLnk lnk( s );
1237 QString name; 1114 QString name;
1238 if(name.left(4)=="http") 1115 if(name.left(4)=="http") {
1239 name = s.right( s.length() - 7); 1116 name = s.right( s.length() - 7);
1240 else 1117 } else {
1241 name=s; 1118 name = s;
1242// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1119 }
1243 lnk.setName(name); 1120 lnk.setName(name);
1244 if(s.at(s.length()-4) == '.') 1121 if(s.at(s.length()-4) == '.') {
1245 lnk.setFile( s); 1122 lnk.setFile( s);
1246 else 1123 } else {
1247 lnk.setFile( s+"/"); 1124 lnk.setFile( s+"/");
1248// lnk.setFile( filename); 1125 }
1249// lnk.setComment( s+"/");
1250 lnk.setType("audio/x-mpegurl"); 1126 lnk.setType("audio/x-mpegurl");
1251 lnk.writeLink(); 1127 lnk.writeLink();
1252// lnk.setIcon( "opieplayer/MPEGPlayer");
1253// qDebug("add "+s);
1254 d->selectedFiles->addToSelection( lnk); 1128 d->selectedFiles->addToSelection( lnk);
@@ -1275,4 +1149,4 @@ void PlayListWidget::writem3u() {
1275 do { 1149 do {
1276// we dont check for existance because of url's 1150 // we dont check for existance because of url's
1277// qDebug(d->selectedFiles->current()->file()); 1151 // qDebug(d->selectedFiles->current()->file());
1278 list += d->selectedFiles->current()->file()+"\n"; 1152 list += d->selectedFiles->current()->file()+"\n";
@@ -1310,9 +1184,8 @@ void PlayListWidget::readPls(const QString &filename) {
1310 qDebug("adding "+s+" to playlist"); 1184 qDebug("adding "+s+" to playlist");
1311// numberofentries=2 1185 // numberofentries=2
1312// File1=http 1186 // File1=http
1313// Title 1187 // Title
1314// Length 1188 // Length
1315// Version 1189 // Version
1316// File2=http 1190 // File2=http
1317
1318 s=s.replace( QRegExp("\\"),"/"); 1191 s=s.replace( QRegExp("\\"),"/");
@@ -1326,6 +1199,2 @@ void PlayListWidget::readPls(const QString &filename) {
1326 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1199 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1327// QFileInfo f(s);
1328// QString name = f.baseName();
1329// name = name.left(name.length()-4);
1330// name = name.right(name.findRev("/",0,TRUE));
1331 lnk.setName( name); 1200 lnk.setName( name);
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 5b674f8..7407e4e 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -4,2 +4,3 @@
4 4
5
5extern MediaPlayerState *mediaPlayerState; 6extern MediaPlayerState *mediaPlayerState;
@@ -24,6 +25,14 @@ void XineControl::play( const QString& fileName ) {
24 // default to audio view until we know how to handle video 25 // default to audio view until we know how to handle video
25 mediaPlayerState->setView('a'); 26 // MediaDetect mdetect;
26 // determines of slider is shown 27 char whichGui = mdetect.videoOrAudio( fileName );
27 // mediaPlayerState->setIsStreaming( false ); 28 if (whichGui == 'f') {
28 // hier dann schaun welcher view 29 qDebug("Nicht erkannter Dateityp");
30 return;
31 }
32
33 // which gui (video / audio)
34 mediaPlayerState->setView( whichGui );
35
36 // determine if slider is shown
37 mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
29} 38}
@@ -33,3 +42,3 @@ void XineControl::stop( bool isSet ) {
33 libXine->stop(); 42 libXine->stop();
34 mediaPlayerState->setNext(); 43 mediaPlayerState->setList();
35 //mediaPlayerState->setPlaying( false ); 44 //mediaPlayerState->setPlaying( false );
@@ -41,3 +50,2 @@ void XineControl::stop( bool isSet ) {
41void XineControl::pause( bool isSet) { 50void XineControl::pause( bool isSet) {
42
43 libXine->pause(); 51 libXine->pause();
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index e45f1df..aab00cd 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -5,2 +5,3 @@
5#include "lib.h" 5#include "lib.h"
6#include "mediadetect.h"
6#include <qobject.h> 7#include <qobject.h>
@@ -27,2 +28,3 @@ private:
27 XINE::Lib *libXine; 28 XINE::Lib *libXine;
29 MediaDetect mdetect;
28 int m_length; 30 int m_length;