-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 31 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 15 |
4 files changed, 34 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 6a38adc..74ab2e3 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -28,17 +28,17 @@ extern AudioWidget *audioUI; | |||
28 | extern VideoWidget *videoUI; | 28 | extern VideoWidget *videoUI; |
29 | extern PlayListWidget *playList; | 29 | extern PlayListWidget *playList; |
30 | extern MediaPlayerState *mediaPlayerState; | 30 | extern MediaPlayerState *mediaPlayerState; |
31 | 31 | ||
32 | 32 | ||
33 | #define FBIOBLANK 0x4611 | 33 | #define FBIOBLANK 0x4611 |
34 | 34 | ||
35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 36 | : QObject( parent, name ), volumeDirection( 0 ) { |
37 | 37 | ||
38 | fd=-1;fl=-1; | 38 | fd=-1;fl=-1; |
39 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); | 39 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); |
40 | 40 | ||
41 | qApp->processEvents(); | 41 | qApp->processEvents(); |
42 | // QPEApplication::grabKeyboard(); // EVIL | 42 | // QPEApplication::grabKeyboard(); // EVIL |
43 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 43 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
44 | 44 | ||
@@ -90,51 +90,38 @@ void MediaPlayer::setPlaying( bool play ) { | |||
90 | } | 90 | } |
91 | 91 | ||
92 | if ( mediaPlayerState->isPaused() ) { | 92 | if ( mediaPlayerState->isPaused() ) { |
93 | mediaPlayerState->setPaused( FALSE ); | 93 | mediaPlayerState->setPaused( FALSE ); |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | 96 | ||
97 | QString tickerText, time, fileName; | 97 | QString tickerText, time, fileName; |
98 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //check for filelist | 98 | if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { |
99 | const DocLnk *playListCurrent = playList->current(); | ||
100 | if ( playListCurrent != NULL ) { | ||
101 | currentFile = playListCurrent; | ||
102 | } | ||
103 | xineControl->play( currentFile->file() ); | ||
104 | fileName = currentFile->name(); | ||
105 | long seconds = mediaPlayerState->length();// | ||
106 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
107 | //qDebug(time); | ||
108 | |||
109 | } else { | ||
110 | //if playing in file list.. play in a different way | 99 | //if playing in file list.. play in a different way |
111 | // random and looping settings enabled causes problems here, | 100 | // random and looping settings enabled causes problems here, |
112 | // since there is no selected file in the playlist, but a selected file in the file list, | 101 | // since there is no selected file in the playlist, but a selected file in the file list, |
113 | // so we remember and shutoff | 102 | // so we remember and shutoff |
114 | l = mediaPlayerState->isLooping(); | 103 | l = mediaPlayerState->isLooping(); |
115 | if(l) { | 104 | if(l) { |
116 | mediaPlayerState->setLooping( false ); | 105 | mediaPlayerState->setLooping( false ); |
117 | } | 106 | } |
118 | r = mediaPlayerState->isShuffled(); | 107 | r = mediaPlayerState->isShuffled(); |
119 | mediaPlayerState->setShuffled( false ); | 108 | mediaPlayerState->setShuffled( false ); |
109 | } | ||
120 | 110 | ||
121 | fileName = playList->currentFileListPathName(); | 111 | PlayListWidget::Entry playListEntry = playList->currentEntry(); |
122 | xineControl->play( fileName ); | 112 | fileName = playListEntry.name; |
123 | long seconds = mediaPlayerState->length(); | 113 | xineControl->play( playListEntry.file ); |
124 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
125 | //qDebug(time); | ||
126 | if( fileName.left(4) != "http" ) { | ||
127 | fileName = QFileInfo( fileName ).baseName(); | ||
128 | } | ||
129 | 114 | ||
130 | } | 115 | long seconds = mediaPlayerState->length(); |
116 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
131 | 117 | ||
132 | if( fileName.left(4) == "http" ) { | 118 | if( fileName.left(4) == "http" ) { |
119 | fileName = QFileInfo( fileName ).baseName(); | ||
133 | if ( xineControl->getMetaInfo().isEmpty() ) { | 120 | if ( xineControl->getMetaInfo().isEmpty() ) { |
134 | tickerText = tr( " File: " ) + fileName; | 121 | tickerText = tr( " File: " ) + fileName; |
135 | } else { | 122 | } else { |
136 | tickerText = xineControl->getMetaInfo(); | 123 | tickerText = xineControl->getMetaInfo(); |
137 | } | 124 | } |
138 | } else { | 125 | } else { |
139 | if ( xineControl->getMetaInfo().isEmpty() ) { | 126 | if ( xineControl->getMetaInfo().isEmpty() ) { |
140 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 127 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 002311a..1e34c88 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -63,16 +63,15 @@ private slots: | |||
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | void timerEvent( QTimerEvent *e ); | 65 | void timerEvent( QTimerEvent *e ); |
66 | void keyReleaseEvent( QKeyEvent *e); | 66 | void keyReleaseEvent( QKeyEvent *e); |
67 | private: | 67 | private: |
68 | bool isBlanked, l, r; | 68 | bool isBlanked, l, r; |
69 | int fd, fl; | 69 | int fd, fl; |
70 | int volumeDirection; | 70 | int volumeDirection; |
71 | const DocLnk *currentFile; | ||
72 | XineControl *xineControl; | 71 | XineControl *xineControl; |
73 | VolumeControl *volControl; | 72 | VolumeControl *volControl; |
74 | }; | 73 | }; |
75 | 74 | ||
76 | 75 | ||
77 | #endif // MEDIA_PLAYER_H | 76 | #endif // MEDIA_PLAYER_H |
78 | 77 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index fd256b7..ce73252 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -419,17 +419,17 @@ void PlayListWidget::setDocument( const QString& fileref ) { | |||
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
422 | void PlayListWidget::useSelectedDocument() { | 422 | void PlayListWidget::useSelectedDocument() { |
423 | d->setDocumentUsed = FALSE; | 423 | d->setDocumentUsed = FALSE; |
424 | } | 424 | } |
425 | 425 | ||
426 | 426 | ||
427 | const DocLnk *PlayListWidget::current() { // this is fugly | 427 | const DocLnk *PlayListWidget::current() const { // this is fugly |
428 | assert( currentTab() == CurrentPlayList ); | 428 | assert( currentTab() == CurrentPlayList ); |
429 | 429 | ||
430 | // qDebug("playlist"); | 430 | // qDebug("playlist"); |
431 | if ( mediaPlayerState->isUsingPlaylist() ) { | 431 | if ( mediaPlayerState->isUsingPlaylist() ) { |
432 | return d->selectedFiles->current(); | 432 | return d->selectedFiles->current(); |
433 | } else if ( d->setDocumentUsed && d->current ) { | 433 | } else if ( d->setDocumentUsed && d->current ) { |
434 | return d->current; | 434 | return d->current; |
435 | } else { | 435 | } else { |
@@ -1136,11 +1136,21 @@ PlayListWidget::TabType PlayListWidget::currentTab() const | |||
1136 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 1136 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1137 | 1137 | ||
1138 | int index = tabWidget->currentPageIndex(); | 1138 | int index = tabWidget->currentPageIndex(); |
1139 | assert( index < TabTypeCount && index >= 0 ); | 1139 | assert( index < TabTypeCount && index >= 0 ); |
1140 | 1140 | ||
1141 | return indexToTabType[ index ]; | 1141 | return indexToTabType[ index ]; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | PlayListWidget::Entry PlayListWidget::currentEntry() const | ||
1145 | { | ||
1146 | if ( currentTab() == CurrentPlayList ) { | ||
1147 | const DocLnk *lnk = current(); | ||
1148 | return Entry( lnk->name(), lnk->file() ); | ||
1149 | } | ||
1150 | |||
1151 | return Entry( currentFileListPathName() ); | ||
1152 | } | ||
1153 | |||
1144 | QString PlayListWidget::currentFileListPathName() const { | 1154 | QString PlayListWidget::currentFileListPathName() const { |
1145 | return currentFileListView()->currentItem()->text( 3 ); | 1155 | return currentFileListView()->currentItem()->text( 3 ); |
1146 | } | 1156 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 2e2ff89..511a192 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -53,29 +53,42 @@ class QAction; | |||
53 | class QLabel; | 53 | class QLabel; |
54 | 54 | ||
55 | class PlayListWidget : public PlayListWidgetGui { | 55 | class PlayListWidget : public PlayListWidgetGui { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 58 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
59 | enum { TabTypeCount = 4 }; | 59 | enum { TabTypeCount = 4 }; |
60 | 60 | ||
61 | struct Entry | ||
62 | { | ||
63 | Entry( const QString &_name, const QString &_fileName ) | ||
64 | : name( _name ), file( _fileName ) {} | ||
65 | Entry( const QString &_fileName ) | ||
66 | : name( _fileName ), file( _fileName ) {} | ||
67 | |||
68 | QString name; | ||
69 | QString file; | ||
70 | }; | ||
71 | |||
61 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 72 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
62 | ~PlayListWidget(); | 73 | ~PlayListWidget(); |
63 | DocLnkSet files; | 74 | DocLnkSet files; |
64 | DocLnkSet vFiles; | 75 | DocLnkSet vFiles; |
65 | bool fromSetDocument; | 76 | bool fromSetDocument; |
66 | bool insanityBool; | 77 | bool insanityBool; |
67 | QString setDocFileRef, currentPlayList; | 78 | QString setDocFileRef, currentPlayList; |
68 | // retrieve the current playlist entry (media file link) | 79 | // retrieve the current playlist entry (media file link) |
69 | const DocLnk *current(); | 80 | const DocLnk *current() const; |
70 | void useSelectedDocument(); | 81 | void useSelectedDocument(); |
71 | int selected; | 82 | int selected; |
72 | TabType currentTab() const; | 83 | TabType currentTab() const; |
73 | 84 | ||
85 | Entry currentEntry() const; | ||
86 | |||
74 | public slots: | 87 | public slots: |
75 | bool first(); | 88 | bool first(); |
76 | bool last(); | 89 | bool last(); |
77 | bool next(); | 90 | bool next(); |
78 | bool prev(); | 91 | bool prev(); |
79 | void writeDefaultPlaylist( ); | 92 | void writeDefaultPlaylist( ); |
80 | QString currentFileListPathName() const; | 93 | QString currentFileListPathName() const; |
81 | protected: | 94 | protected: |