summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp100
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp92
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp2
7 files changed, 127 insertions, 75 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 040e965..446fa45 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -454,4 +454,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
454 setToggleButton( i, FALSE ); 454 setToggleButton( i, FALSE );
455 } 455 }
456 qDebug("mouseEvent %d", i);
456 switch (i) { 457 switch (i) {
457 case AudioPlay: 458 case AudioPlay:
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp
index 9edb1d3..62240b2 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.cpp
+++ b/noncore/multimedia/opieplayer2/inputDialog.cpp
@@ -26,4 +26,5 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags
26 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 26 LineEdit1 = new QLineEdit( this, "LineEdit1" );
27 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); 27 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
28 LineEdit1->setFocus();
28} 29}
29/* 30/*
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index bf2acc8..553e3c1 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -4,4 +4,5 @@
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h>
6 7
7#include <qmainwindow.h> 8#include <qmainwindow.h>
@@ -76,6 +77,6 @@ void MediaPlayer::pauseCheck( bool b ) {
76 77
77void MediaPlayer::play() { 78void MediaPlayer::play() {
78 mediaPlayerState->setPlaying( FALSE ); 79 mediaPlayerState->setPlaying( FALSE );
79 mediaPlayerState->setPlaying( TRUE ); 80 mediaPlayerState->setPlaying( TRUE );
80} 81}
81 82
@@ -85,40 +86,59 @@ void MediaPlayer::setPlaying( bool play ) {
85 } 86 }
86 87
87 if ( mediaPlayerState->paused() ) { 88 if ( mediaPlayerState->paused() ) {
88 mediaPlayerState->setPaused( FALSE ); 89 mediaPlayerState->setPaused( FALSE );
89 return; 90 return;
90 }
91
92 const DocLnk *playListCurrent = playList->current();
93 if ( playListCurrent != NULL ) {
94 currentFile = playListCurrent;
95 } 91 }
96 92
97 xineControl->play( currentFile->file() ); 93 QString tickerText, time, fileName;
98 94 if( playList->whichList() == 0 ) { //check for filelist
99 long seconds = mediaPlayerState->length();// 95 const DocLnk *playListCurrent = playList->current();
100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 96 if ( playListCurrent != NULL ) {
101 qDebug(time); 97 currentFile = playListCurrent;
102 98 }
103 QString tickerText; 99 xineControl->play( currentFile->file() );
104 if( currentFile->file().left(4) == "http" ) 100 fileName = currentFile->name();
105 tickerText= tr( " File: " ) + currentFile->name(); 101 long seconds = mediaPlayerState->length();//
106 else 102 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 103 qDebug(time);
108 104
109 audioUI->setTickerText( currentFile->file( ) ); 105 } else { //if playing in file list.. play in a different way
106 // random and looping settings enabled causes problems here,
107 // since there is no selected file in the playlist, but a selected file in the file list,
108 // so we remember and shutoff
109 l = mediaPlayerState->looping();
110 if(l)
111 mediaPlayerState->setLooping( false );
112 r = mediaPlayerState->shuffled();
113 mediaPlayerState->setShuffled(false);
114
115 fileName = playList->currentFileListPathName();
116 xineControl->play( fileName);
117 long seconds = mediaPlayerState->length();//
118 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
119 qDebug(time);
120 if( fileName.left(4) != "http" )
121 fileName = QFileInfo( fileName).baseName();
110 122
123 }
124 if( fileName.left(4) == "http" )
125 tickerText= tr( " File: " ) + fileName;
126 else
127 tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time;
128 audioUI->setTickerText( tickerText );
111} 129}
112 130
113 131
114void MediaPlayer::prev() { 132void MediaPlayer::prev() {
115 if ( playList->prev() ) { 133 if(playList->whichList() == 0) { //if using the playlist
116 play(); 134 if ( playList->prev() ) {
117 } else if ( mediaPlayerState->looping() ) {
118 if ( playList->last() ) {
119 play(); 135 play();
136 } else if ( mediaPlayerState->looping() ) {
137 if ( playList->last() ) {
138 play();
139 }
140 } else {
141 mediaPlayerState->setList();
120 } 142 }
121 } else {
122 mediaPlayerState->setList();
123 } 143 }
124} 144}
@@ -126,13 +146,23 @@ void MediaPlayer::prev() {
126 146
127void MediaPlayer::next() { 147void MediaPlayer::next() {
128 if ( playList->next() ) { 148
129 play(); 149 if(playList->whichList() == 0) { //if using the playlist
130 } else if ( mediaPlayerState->looping() ) { 150 if ( playList->next() ) {
131 if ( playList->first() ) {
132 play(); 151 play();
152 } else if ( mediaPlayerState->looping() ) {
153 if ( playList->first() ) {
154 play();
155 }
156 } else {
157 mediaPlayerState->setList();
133 } 158 }
134 } else { 159 } else { //if playing from file list, let's just stop
135 mediaPlayerState->setList(); 160 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
161 mediaPlayerState->setPlaying(false);
162 mediaPlayerState->setView('l');
163 if(l) mediaPlayerState->setLooping(l);
164 if(r) mediaPlayerState->setShuffled(r);
136 } 165 }
166 qApp->processEvents();
137} 167}
138 168
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 81fab88..05be128 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -18,5 +18,4 @@ public:
18 MediaPlayer( QObject *parent, const char *name ); 18 MediaPlayer( QObject *parent, const char *name );
19 ~MediaPlayer(); 19 ~MediaPlayer();
20
21private slots: 20private slots:
22 void setPlaying( bool ); 21 void setPlaying( bool );
@@ -35,5 +34,5 @@ protected:
35 void keyReleaseEvent( QKeyEvent *e); 34 void keyReleaseEvent( QKeyEvent *e);
36private: 35private:
37 bool isBlanked; 36 bool isBlanked, l, r;
38 int fd; 37 int fd;
39 int volumeDirection; 38 int volumeDirection;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 3bd04bc..15c70c3 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -322,5 +322,5 @@ void PlayListWidget::useSelectedDocument() {
322 322
323const DocLnk *PlayListWidget::current() { // this is fugly 323const DocLnk *PlayListWidget::current() { // this is fugly
324 switch ( tabWidget->currentPageIndex() ) { 324 switch ( whichList() ) {
325 case 0: //playlist 325 case 0: //playlist
326 { 326 {
@@ -395,5 +395,6 @@ bool PlayListWidget::prev() {
395 395
396bool PlayListWidget::next() { 396bool PlayListWidget::next() {
397 if ( mediaPlayerState->playlist() ) { 397qDebug("<<<<<<<<<<<<next()");
398 if ( mediaPlayerState->playlist() ) {
398 if ( mediaPlayerState->shuffled() ) { 399 if ( mediaPlayerState->shuffled() ) {
399 return prev(); 400 return prev();
@@ -498,5 +499,5 @@ void PlayListWidget::addSelected() {
498 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 499 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
499 500
500 switch (tabWidget->currentPageIndex()) { 501 switch (whichList()) {
501 case 0: //playlist 502 case 0: //playlist
502 break; 503 break;
@@ -558,5 +559,5 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
558 559
559 if(it) { 560 if(it) {
560 switch (tabWidget->currentPageIndex()) { 561 switch ( whichList()) {
561 case 1: { 562 case 1: {
562 QListIterator<DocLnk> dit( files.children() ); 563 QListIterator<DocLnk> dit( files.children() );
@@ -589,5 +590,5 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
589void PlayListWidget::tabChanged(QWidget *) { 590void PlayListWidget::tabChanged(QWidget *) {
590 591
591 switch ( tabWidget->currentPageIndex()) { 592 switch ( whichList()) {
592 case 0: 593 case 0:
593 { 594 {
@@ -635,33 +636,32 @@ void PlayListWidget::tabChanged(QWidget *) {
635 636
636void PlayListWidget::btnPlay(bool b) { 637void PlayListWidget::btnPlay(bool b) {
637 // mediaPlayerState->setPlaying(b); 638 mediaPlayerState->setPlaying(b);
638 switch ( tabWidget->currentPageIndex()) { 639 qApp->processEvents();
639 case 0: 640 insanityBool=FALSE;
640 { 641// switch ( whichList()) {
641 mediaPlayerState->setPlaying(b); 642// case 0:
642 } 643// {
643 break; 644// mediaPlayerState->setPlaying(b);
644 case 1: 645// }
645 { 646// break;
646 addToSelection( audioView->currentItem() ); 647// case 1:
647 mediaPlayerState->setPlaying(b); 648// {
648 d->selectedFiles->removeSelected( ); 649// mediaPlayerState->setPlaying(b);
649 tabWidget->setCurrentPage(1); 650// qApp->processEvents();
650 d->selectedFiles->unSelect(); 651// insanityBool=FALSE;
651 insanityBool=FALSE; 652// }// audioView->clearSelection();
652 }// audioView->clearSelection(); 653// break;
653 break; 654// case 2:
654 case 2: 655// {
655 { 656// // addToSelection( videoView->currentItem() );
656 addToSelection( videoView->currentItem() ); 657// mediaPlayerState->setPlaying(b);
657 mediaPlayerState->setPlaying(b); 658// qApp->processEvents();
658 qApp->processEvents(); 659// // d->selectedFiles->removeSelected( );
659 d->selectedFiles->removeSelected( ); 660// // tabWidget->setCurrentPage(2);
660 tabWidget->setCurrentPage(2); 661// // d->selectedFiles->unSelect();
661 d->selectedFiles->unSelect(); 662// insanityBool=FALSE;
662 insanityBool=FALSE; 663// }// videoView->clearSelection();
663 }// videoView->clearSelection(); 664// break;
664 break; 665// };
665 };
666 666
667} 667}
@@ -737,5 +737,6 @@ void PlayListWidget::populateAudioView() {
737 else 737 else
738 size = QFile( dit.current()->file() ).size(); 738 size = QFile( dit.current()->file() ).size();
739 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); 739 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
740 QString::number(size ), storage, dit.current()->file());
740 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 741 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
741 } 742 }
@@ -756,5 +757,5 @@ void PlayListWidget::populateVideoView() {
756 QListIterator<FileSystem> it ( fs ); 757 QListIterator<FileSystem> it ( fs );
757 videoView->clear(); 758 videoView->clear();
758 QString storage; 759 QString storage, pathName;
759 for ( ; Vdit.current(); ++Vdit ) { 760 for ( ; Vdit.current(); ++Vdit ) {
760 for( ; it.current(); ++it ) { 761 for( ; it.current(); ++it ) {
@@ -763,4 +764,5 @@ void PlayListWidget::populateVideoView() {
763 if( Vdit.current()->file().find(path) != -1 ) { 764 if( Vdit.current()->file().find(path) != -1 ) {
764 storage=name; 765 storage=name;
766 pathName=path;
765 } 767 }
766 } 768 }
@@ -769,5 +771,5 @@ void PlayListWidget::populateVideoView() {
769 if ( QFile( Vdit.current()->file() ).exists() ) { 771 if ( QFile( Vdit.current()->file() ).exists() ) {
770 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 772 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
771 QString::number( QFile( Vdit.current()->file() ).size() ), storage ); 773 QString::number( QFile( Vdit.current()->file() ).size() ), storage, Vdit.current()->file());
772 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 774 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
773 } 775 }
@@ -1063,2 +1065,18 @@ void PlayListWidget::skinsMenuActivated( int item ) {
1063 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1065 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1064} 1066}
1067
1068int PlayListWidget::whichList() {
1069 return tabWidget->currentPageIndex();
1070}
1071
1072QString PlayListWidget::currentFileListPathName() {
1073 switch (whichList()) {
1074 case 1:
1075 return audioView->currentItem()->text(3);
1076 break;
1077 case 2:
1078 return videoView->currentItem()->text(3);
1079 break;
1080 };
1081 return "";
1082}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index dcfdd48..2873dca 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -67,4 +67,5 @@ public:
67 void useSelectedDocument(); 67 void useSelectedDocument();
68 int selected; 68 int selected;
69 int whichList();
69 70
70public slots: 71public slots:
@@ -74,5 +75,5 @@ public slots:
74 bool prev(); 75 bool prev();
75 void writeConfig( Config& cfg ) const; 76 void writeConfig( Config& cfg ) const;
76 77 QString currentFileListPathName();
77protected: 78protected:
78 void keyReleaseEvent( QKeyEvent *e); 79 void keyReleaseEvent( QKeyEvent *e);
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 250833c..f073102 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -156,4 +156,5 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags
156 audioView->addColumn( tr( "Size" ), -1 ); 156 audioView->addColumn( tr( "Size" ), -1 );
157 audioView->addColumn( tr( "Media" ), -1 ); 157 audioView->addColumn( tr( "Media" ), -1 );
158 audioView->addColumn( tr( "Path" ), 0 );
158 audioView->setColumnAlignment( 1, Qt::AlignRight ); 159 audioView->setColumnAlignment( 1, Qt::AlignRight );
159 audioView->setColumnAlignment( 2, Qt::AlignRight ); 160 audioView->setColumnAlignment( 2, Qt::AlignRight );
@@ -177,4 +178,5 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags
177 videoView->addColumn( tr( "Size" ), -1 ); 178 videoView->addColumn( tr( "Size" ), -1 );
178 videoView->addColumn(tr( "Media" ), -1 ); 179 videoView->addColumn(tr( "Media" ), -1 );
180 videoView->addColumn(tr( "Path" ), 0 );
179 videoView->setColumnAlignment( 1, Qt::AlignRight ); 181 videoView->setColumnAlignment( 1, Qt::AlignRight );
180 videoView->setColumnAlignment( 2, Qt::AlignRight ); 182 videoView->setColumnAlignment( 2, Qt::AlignRight );