-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 | |||
@@ -12,49 +12,49 @@ | |||
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | 18 | ||
19 | #include "mediaplayerstate.h" | 19 | #include "mediaplayerstate.h" |
20 | 20 | ||
21 | // for setBacklight() | 21 | // for setBacklight() |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 23 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | extern AudioWidget *audioUI; | 27 | 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 | ||
45 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 45 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
46 | 46 | ||
47 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 47 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
48 | 48 | ||
49 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 49 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
50 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 50 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
51 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
52 | 52 | ||
53 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 53 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
54 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 54 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
55 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 55 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
56 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 56 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
57 | 57 | ||
58 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 58 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
59 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 59 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
60 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 60 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
@@ -74,83 +74,70 @@ MediaPlayer::~MediaPlayer() { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | void MediaPlayer::pauseCheck( bool b ) { | 76 | void MediaPlayer::pauseCheck( bool b ) { |
77 | if ( b && !mediaPlayerState->isPlaying() ) { | 77 | if ( b && !mediaPlayerState->isPlaying() ) { |
78 | mediaPlayerState->setPaused( FALSE ); | 78 | mediaPlayerState->setPaused( FALSE ); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | void MediaPlayer::play() { | 82 | void MediaPlayer::play() { |
83 | mediaPlayerState->setPlaying( FALSE ); | 83 | mediaPlayerState->setPlaying( FALSE ); |
84 | mediaPlayerState->setPlaying( TRUE ); | 84 | mediaPlayerState->setPlaying( TRUE ); |
85 | } | 85 | } |
86 | 86 | ||
87 | void MediaPlayer::setPlaying( bool play ) { | 87 | void MediaPlayer::setPlaying( bool play ) { |
88 | if ( !play ) { | 88 | if ( !play ) { |
89 | return; | 89 | return; |
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 + " "; |
141 | } else { | 128 | } else { |
142 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | 129 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; |
143 | } | 130 | } |
144 | } | 131 | } |
145 | audioUI->setTickerText( tickerText ); | 132 | audioUI->setTickerText( tickerText ); |
146 | } | 133 | } |
147 | 134 | ||
148 | 135 | ||
149 | void MediaPlayer::prev() { | 136 | void MediaPlayer::prev() { |
150 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist | 137 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
151 | if ( playList->prev() ) { | 138 | if ( playList->prev() ) { |
152 | play(); | 139 | play(); |
153 | } else if ( mediaPlayerState->isLooping() ) { | 140 | } else if ( mediaPlayerState->isLooping() ) { |
154 | if ( playList->last() ) { | 141 | if ( playList->last() ) { |
155 | play(); | 142 | play(); |
156 | } | 143 | } |
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 | |||
@@ -47,32 +47,31 @@ class VolumeControl; | |||
47 | class MediaPlayer : public QObject { | 47 | class MediaPlayer : public QObject { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | MediaPlayer( QObject *parent, const char *name ); | 50 | MediaPlayer( QObject *parent, const char *name ); |
51 | ~MediaPlayer(); | 51 | ~MediaPlayer(); |
52 | private slots: | 52 | private slots: |
53 | void setPlaying( bool ); | 53 | void setPlaying( bool ); |
54 | void pauseCheck( bool ); | 54 | void pauseCheck( bool ); |
55 | void play(); | 55 | void play(); |
56 | void next(); | 56 | void next(); |
57 | void prev(); | 57 | void prev(); |
58 | void startIncreasingVolume(); | 58 | void startIncreasingVolume(); |
59 | void startDecreasingVolume(); | 59 | void startDecreasingVolume(); |
60 | void stopChangingVolume(); | 60 | void stopChangingVolume(); |
61 | void cleanUp(); | 61 | void cleanUp(); |
62 | void blank( bool ); | 62 | void blank( bool ); |
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 | |||
@@ -403,49 +403,49 @@ void PlayListWidget::setDocument( const QString& fileref ) { | |||
403 | readm3u( fileref ); | 403 | readm3u( fileref ); |
404 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 404 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
405 | readm3u( DocLnk( fileref).file() ); | 405 | readm3u( DocLnk( fileref).file() ); |
406 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 406 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
407 | readPls( fileref ); | 407 | readPls( fileref ); |
408 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 408 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
409 | readPls( DocLnk( fileref).file() ); | 409 | readPls( DocLnk( fileref).file() ); |
410 | } else { | 410 | } else { |
411 | clearList(); | 411 | clearList(); |
412 | addToSelection( DocLnk( fileref ) ); | 412 | addToSelection( DocLnk( fileref ) ); |
413 | writeCurrentM3u(); | 413 | writeCurrentM3u(); |
414 | 414 | ||
415 | d->setDocumentUsed = TRUE; | 415 | d->setDocumentUsed = TRUE; |
416 | mediaPlayerState->setPlaying( FALSE ); | 416 | mediaPlayerState->setPlaying( FALSE ); |
417 | mediaPlayerState->setPlaying( TRUE ); | 417 | mediaPlayerState->setPlaying( TRUE ); |
418 | } | 418 | } |
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 { |
436 | return &(d->files->selectedDocument()); | 436 | return &(d->files->selectedDocument()); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | 440 | ||
441 | bool PlayListWidget::prev() { | 441 | bool PlayListWidget::prev() { |
442 | if ( mediaPlayerState->isUsingPlaylist() ) { | 442 | if ( mediaPlayerState->isUsingPlaylist() ) { |
443 | if ( mediaPlayerState->isShuffled() ) { | 443 | if ( mediaPlayerState->isShuffled() ) { |
444 | const DocLnk *cur = current(); | 444 | const DocLnk *cur = current(); |
445 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 445 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
446 | for ( int i = 0; i < j; i++ ) { | 446 | for ( int i = 0; i < j; i++ ) { |
447 | if ( !d->selectedFiles->next() ) | 447 | if ( !d->selectedFiles->next() ) |
448 | d->selectedFiles->first(); | 448 | d->selectedFiles->first(); |
449 | } | 449 | } |
450 | if ( cur == current() ) | 450 | if ( cur == current() ) |
451 | if ( !d->selectedFiles->next() ) { | 451 | if ( !d->selectedFiles->next() ) { |
@@ -1120,27 +1120,37 @@ void PlayListWidget::populateSkinsMenu() { | |||
1120 | void PlayListWidget::skinsMenuActivated( int item ) { | 1120 | void PlayListWidget::skinsMenuActivated( int item ) { |
1121 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1121 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1122 | skinsMenu->setItemChecked( i, FALSE ); | 1122 | skinsMenu->setItemChecked( i, FALSE ); |
1123 | } | 1123 | } |
1124 | skinsMenu->setItemChecked( item, TRUE ); | 1124 | skinsMenu->setItemChecked( item, TRUE ); |
1125 | 1125 | ||
1126 | Config cfg( "OpiePlayer" ); | 1126 | Config cfg( "OpiePlayer" ); |
1127 | cfg.setGroup("Options"); | 1127 | cfg.setGroup("Options"); |
1128 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1128 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1129 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1129 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1130 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1130 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1133 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1134 | { | 1134 | { |
1135 | static const TabType indexToTabType[ TabTypeCount ] = | 1135 | static const TabType indexToTabType[ TabTypeCount ] = |
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 | |||
@@ -37,61 +37,74 @@ | |||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qpe/fileselector.h> | 40 | #include <qpe/fileselector.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qpopupmenu.h> | 42 | #include <qpopupmenu.h> |
43 | 43 | ||
44 | #include "playlistwidgetgui.h" | 44 | #include "playlistwidgetgui.h" |
45 | 45 | ||
46 | 46 | ||
47 | //class PlayListWidgetPrivate; | 47 | //class PlayListWidgetPrivate; |
48 | class Config; | 48 | class Config; |
49 | class QListViewItem; | 49 | class QListViewItem; |
50 | class QListView; | 50 | class QListView; |
51 | class QPoint; | 51 | class QPoint; |
52 | class QAction; | 52 | 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: |
82 | void keyReleaseEvent( QKeyEvent *e); | 95 | void keyReleaseEvent( QKeyEvent *e); |
83 | 96 | ||
84 | private: | 97 | private: |
85 | int defaultSkinIndex; | 98 | int defaultSkinIndex; |
86 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 99 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
87 | void readm3u(const QString &); | 100 | void readm3u(const QString &); |
88 | void readPls(const QString &); | 101 | void readPls(const QString &); |
89 | void initializeStates(); | 102 | void initializeStates(); |
90 | void populateAudioView(); | 103 | void populateAudioView(); |
91 | void populateVideoView(); | 104 | void populateVideoView(); |
92 | 105 | ||
93 | QListView *currentFileListView() const; | 106 | QListView *currentFileListView() const; |
94 | 107 | ||
95 | bool inFileListMode() const; | 108 | bool inFileListMode() const; |
96 | 109 | ||
97 | private slots: | 110 | private slots: |