-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index d1506db..9918eeb 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -23,64 +23,65 @@ | |||
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpetoolbar.h> | 34 | #include <qpe/qpetoolbar.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | #include <qpe/mimetype.h> | 37 | #include <qpe/mimetype.h> |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | 40 | ||
41 | #include <qdatetime.h> | 41 | #include <qdatetime.h> |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #include <qregexp.h> | 44 | #include <qregexp.h> |
45 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
46 | 46 | ||
47 | #include "playlistselection.h" | 47 | #include "playlistselection.h" |
48 | #include "playlistwidget.h" | 48 | #include "playlistwidget.h" |
49 | #include "mediaplayerstate.h" | 49 | #include "mediaplayerstate.h" |
50 | #include "inputDialog.h" | 50 | #include "inputDialog.h" |
51 | #include "om3u.h" | 51 | #include "om3u.h" |
52 | 52 | ||
53 | //only needed for the random play | 53 | //only needed for the random play |
54 | #include <stdlib.h> | 54 | #include <stdlib.h> |
55 | #include <assert.h> | ||
55 | 56 | ||
56 | #include "audiowidget.h" | 57 | #include "audiowidget.h" |
57 | #include "videowidget.h" | 58 | #include "videowidget.h" |
58 | 59 | ||
59 | extern MediaPlayerState *mediaPlayerState; | 60 | extern MediaPlayerState *mediaPlayerState; |
60 | // extern AudioWidget *audioUI; | 61 | // extern AudioWidget *audioUI; |
61 | // extern VideoWidget *videoUI; | 62 | // extern VideoWidget *videoUI; |
62 | 63 | ||
63 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | 64 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; |
64 | // no m3u's here please | 65 | // no m3u's here please |
65 | 66 | ||
66 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 67 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
67 | : PlayListWidgetGui( parent, name, fl ) { | 68 | : PlayListWidgetGui( parent, name, fl ) { |
68 | 69 | ||
69 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 70 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
70 | "opieplayer2/add_to_playlist", | 71 | "opieplayer2/add_to_playlist", |
71 | this , SLOT(addSelected() ) ); | 72 | this , SLOT(addSelected() ) ); |
72 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 73 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
73 | "opieplayer2/remove_from_playlist", | 74 | "opieplayer2/remove_from_playlist", |
74 | this , SLOT(removeSelected() ) ); | 75 | this , SLOT(removeSelected() ) ); |
75 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 76 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
76 | this , SLOT( btnPlay( bool) ), TRUE ); | 77 | this , SLOT( btnPlay( bool) ), TRUE ); |
77 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 78 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
78 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 79 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
79 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 80 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
80 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 81 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
81 | 82 | ||
82 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 83 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
83 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 84 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
84 | this, SLOT( addAllMusicToList() ) ); | 85 | this, SLOT( addAllMusicToList() ) ); |
85 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 86 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
86 | this, SLOT( addAllVideoToList() ) ); | 87 | this, SLOT( addAllVideoToList() ) ); |
@@ -1116,43 +1117,54 @@ void PlayListWidget::populateSkinsMenu() { | |||
1116 | skinName = fi->fileName(); | 1117 | skinName = fi->fileName(); |
1117 | // qDebug( fi->fileName() ); | 1118 | // qDebug( fi->fileName() ); |
1118 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1119 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1119 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1120 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1120 | } | 1121 | } |
1121 | if( skinName == "default" ) { | 1122 | if( skinName == "default" ) { |
1122 | defaultSkinIndex = item; | 1123 | defaultSkinIndex = item; |
1123 | } | 1124 | } |
1124 | if( skinName == skin ) { | 1125 | if( skinName == skin ) { |
1125 | skinsMenu->setItemChecked( item, TRUE ); | 1126 | skinsMenu->setItemChecked( item, TRUE ); |
1126 | } | 1127 | } |
1127 | ++it; | 1128 | ++it; |
1128 | } | 1129 | } |
1129 | } | 1130 | } |
1130 | 1131 | ||
1131 | void PlayListWidget::skinsMenuActivated( int item ) { | 1132 | void PlayListWidget::skinsMenuActivated( int item ) { |
1132 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1133 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1133 | skinsMenu->setItemChecked( i, FALSE ); | 1134 | skinsMenu->setItemChecked( i, FALSE ); |
1134 | } | 1135 | } |
1135 | skinsMenu->setItemChecked( item, TRUE ); | 1136 | skinsMenu->setItemChecked( item, TRUE ); |
1136 | 1137 | ||
1137 | Config cfg( "OpiePlayer" ); | 1138 | Config cfg( "OpiePlayer" ); |
1138 | cfg.setGroup("Options"); | 1139 | cfg.setGroup("Options"); |
1139 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1140 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1140 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1141 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1141 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1142 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1142 | } | 1143 | } |
1143 | 1144 | ||
1144 | int PlayListWidget::whichList() { | 1145 | int PlayListWidget::whichList() { |
1145 | return tabWidget->currentPageIndex(); | 1146 | return tabWidget->currentPageIndex(); |
1146 | } | 1147 | } |
1147 | 1148 | ||
1149 | PlayListWidget::TabType PlayListWidget::currentTab() const | ||
1150 | { | ||
1151 | static const TabType indexToTabType[ NumTabTypes ] = | ||
1152 | { CurrentPlaylist, AudioFiles, VideoFiles, PlayLists }; | ||
1153 | |||
1154 | int index = tabWidget->currentPageIndex(); | ||
1155 | assert( index < NumTabTypes && index >= 0 ); | ||
1156 | |||
1157 | return indexToTabType[ index ]; | ||
1158 | } | ||
1159 | |||
1148 | QString PlayListWidget::currentFileListPathName() { | 1160 | QString PlayListWidget::currentFileListPathName() { |
1149 | switch (whichList()) { | 1161 | switch (whichList()) { |
1150 | case 1: | 1162 | case 1: |
1151 | return audioView->currentItem()->text(3); | 1163 | return audioView->currentItem()->text(3); |
1152 | break; | 1164 | break; |
1153 | case 2: | 1165 | case 2: |
1154 | return videoView->currentItem()->text(3); | 1166 | return videoView->currentItem()->text(3); |
1155 | break; | 1167 | break; |
1156 | }; | 1168 | }; |
1157 | return ""; | 1169 | return ""; |
1158 | } | 1170 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index b2c389e..05d53a4 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -26,76 +26,79 @@ | |||
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef PLAY_LIST_WIDGET_H | 34 | #ifndef PLAY_LIST_WIDGET_H |
35 | #define PLAY_LIST_WIDGET_H | 35 | #define PLAY_LIST_WIDGET_H |
36 | 36 | ||
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, NumTabTypes = 4 }; | ||
59 | |||
58 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 60 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
59 | ~PlayListWidget(); | 61 | ~PlayListWidget(); |
60 | DocLnkSet files; | 62 | DocLnkSet files; |
61 | DocLnkSet vFiles; | 63 | DocLnkSet vFiles; |
62 | bool fromSetDocument; | 64 | bool fromSetDocument; |
63 | bool insanityBool; | 65 | bool insanityBool; |
64 | QString setDocFileRef, currentPlayList; | 66 | QString setDocFileRef, currentPlayList; |
65 | // retrieve the current playlist entry (media file link) | 67 | // retrieve the current playlist entry (media file link) |
66 | const DocLnk *current(); | 68 | const DocLnk *current(); |
67 | void useSelectedDocument(); | 69 | void useSelectedDocument(); |
68 | int selected; | 70 | int selected; |
69 | int whichList(); | 71 | int whichList(); |
72 | TabType currentTab() const; | ||
70 | 73 | ||
71 | public slots: | 74 | public slots: |
72 | bool first(); | 75 | bool first(); |
73 | bool last(); | 76 | bool last(); |
74 | bool next(); | 77 | bool next(); |
75 | bool prev(); | 78 | bool prev(); |
76 | void writeDefaultPlaylist( ); | 79 | void writeDefaultPlaylist( ); |
77 | QString currentFileListPathName(); | 80 | QString currentFileListPathName(); |
78 | protected: | 81 | protected: |
79 | void keyReleaseEvent( QKeyEvent *e); | 82 | void keyReleaseEvent( QKeyEvent *e); |
80 | 83 | ||
81 | private: | 84 | private: |
82 | int defaultSkinIndex; | 85 | int defaultSkinIndex; |
83 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 86 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
84 | void readm3u(const QString &); | 87 | void readm3u(const QString &); |
85 | void readPls(const QString &); | 88 | void readPls(const QString &); |
86 | void initializeStates(); | 89 | void initializeStates(); |
87 | void populateAudioView(); | 90 | void populateAudioView(); |
88 | void populateVideoView(); | 91 | void populateVideoView(); |
89 | 92 | ||
90 | private slots: | 93 | private slots: |
91 | void populateSkinsMenu(); | 94 | void populateSkinsMenu(); |
92 | void skinsMenuActivated(int); | 95 | void skinsMenuActivated(int); |
93 | void pmViewActivated(int); | 96 | void pmViewActivated(int); |
94 | void writem3u(); | 97 | void writem3u(); |
95 | void writeCurrentM3u(); | 98 | void writeCurrentM3u(); |
96 | void scanForAudio(); | 99 | void scanForAudio(); |
97 | void scanForVideo(); | 100 | void scanForVideo(); |
98 | void openFile(); | 101 | void openFile(); |
99 | void setDocument( const QString& fileref ); | 102 | void setDocument( const QString& fileref ); |
100 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 103 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
101 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 104 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |