-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index de36551..1a0c7ca 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,514 +1,514 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | 21 | ||
22 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
23 | #include <qpe/qpetoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
24 | #include <qpe/fileselector.h> | 24 | #include <qpe/fileselector.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | 26 | ||
27 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qaction.h> | 31 | #include <qaction.h> |
32 | #include <qimage.h> | 32 | #include <qimage.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
42 | #include <qlistview.h> | 42 | #include <qlistview.h> |
43 | #include <qpoint.h> | 43 | #include <qpoint.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | 46 | ||
47 | //#include <qtimer.h> | 47 | //#include <qtimer.h> |
48 | 48 | ||
49 | #include "playlistselection.h" | 49 | #include "playlistselection.h" |
50 | #include "playlistwidget.h" | 50 | #include "playlistwidget.h" |
51 | #include "mediaplayerstate.h" | 51 | #include "mediaplayerstate.h" |
52 | 52 | ||
53 | #include "inputDialog.h" | 53 | #include "inputDialog.h" |
54 | 54 | ||
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | 56 | ||
57 | #define BUTTONS_ON_TOOLBAR | 57 | #define BUTTONS_ON_TOOLBAR |
58 | #define SIDE_BUTTONS | 58 | #define SIDE_BUTTONS |
59 | #define CAN_SAVE_LOAD_PLAYLISTS | 59 | #define CAN_SAVE_LOAD_PLAYLISTS |
60 | 60 | ||
61 | extern MediaPlayerState *mediaPlayerState; | 61 | extern MediaPlayerState *mediaPlayerState; |
62 | 62 | ||
63 | // class myFileSelector { | 63 | // class myFileSelector { |
64 | 64 | ||
65 | // }; | 65 | // }; |
66 | class PlayListWidgetPrivate { | 66 | class PlayListWidgetPrivate { |
67 | public: | 67 | public: |
68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
69 | QFrame *playListFrame; | 69 | QFrame *playListFrame; |
70 | FileSelector *files; | 70 | FileSelector *files; |
71 | PlayListSelection *selectedFiles; | 71 | PlayListSelection *selectedFiles; |
72 | bool setDocumentUsed; | 72 | bool setDocumentUsed; |
73 | DocLnk *current; | 73 | DocLnk *current; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | class ToolButton : public QToolButton { | 77 | class ToolButton : public QToolButton { |
78 | public: | 78 | public: |
79 | 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 ) |
80 | : QToolButton( parent, name ) { | 80 | : QToolButton( parent, name ) { |
81 | setTextLabel( name ); | 81 | setTextLabel( name ); |
82 | setPixmap( Resource::loadPixmap( icon ) ); | 82 | setPixmap( Resource::loadPixmap( icon ) ); |
83 | setAutoRaise( TRUE ); | 83 | setAutoRaise( TRUE ); |
84 | setFocusPolicy( QWidget::NoFocus ); | 84 | setFocusPolicy( QWidget::NoFocus ); |
85 | setToggleButton( t ); | 85 | setToggleButton( t ); |
86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
87 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 87 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
88 | } | 88 | } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
92 | class MenuItem : public QAction { | 92 | class MenuItem : public QAction { |
93 | public: | 93 | public: |
94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
95 | : QAction( text, QString::null, 0, 0 ) { | 95 | : QAction( text, QString::null, 0, 0 ) { |
96 | connect( this, SIGNAL( activated() ), handler, slot ); | 96 | connect( this, SIGNAL( activated() ), handler, slot ); |
97 | addTo( parent ); | 97 | addTo( parent ); |
98 | } | 98 | } |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
103 | : QMainWindow( parent, name, fl ) { | 103 | : QMainWindow( parent, name, fl ) { |
104 | 104 | ||
105 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 107 | d->current = NULL; |
108 | // menuTimer = new QTimer( this ,"menu timer"), | 108 | // menuTimer = new QTimer( this ,"menu timer"), |
109 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 109 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
110 | 110 | ||
111 | setBackgroundMode( PaletteButton ); | 111 | setBackgroundMode( PaletteButton ); |
112 | 112 | ||
113 | setCaption( tr("OpiePlayer") ); | 113 | setCaption( tr("OpiePlayer") ); |
114 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 114 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
115 | 115 | ||
116 | setToolBarsMovable( FALSE ); | 116 | setToolBarsMovable( FALSE ); |
117 | 117 | ||
118 | // Create Toolbar | 118 | // Create Toolbar |
119 | QPEToolBar *toolbar = new QPEToolBar( this ); | 119 | QPEToolBar *toolbar = new QPEToolBar( this ); |
120 | toolbar->setHorizontalStretchable( TRUE ); | 120 | toolbar->setHorizontalStretchable( TRUE ); |
121 | 121 | ||
122 | // Create Menubar | 122 | // Create Menubar |
123 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 123 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
124 | menu->setMargin( 0 ); | 124 | menu->setMargin( 0 ); |
125 | 125 | ||
126 | QPEToolBar *bar = new QPEToolBar( this ); | 126 | QPEToolBar *bar = new QPEToolBar( this ); |
127 | bar->setLabel( tr( "Play Operations" ) ); | 127 | bar->setLabel( tr( "Play Operations" ) ); |
128 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", | 128 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", |
129 | // this , SLOT( addSelected()) ); | 129 | // this , SLOT( addSelected()) ); |
130 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("close"),"",bar,"close"); | 130 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
131 | tbDeletePlaylist->setFlat(TRUE); | 131 | tbDeletePlaylist->setFlat(TRUE); |
132 | tbDeletePlaylist->setFixedSize(20,20); | 132 | tbDeletePlaylist->setFixedSize(20,20); |
133 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 133 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
134 | 134 | ||
135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | 135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", |
136 | this , SLOT(addSelected()) ); | 136 | this , SLOT(addSelected()) ); |
137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | 137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", |
138 | this , SLOT(removeSelected()) ); | 138 | this , SLOT(removeSelected()) ); |
139 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 139 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
140 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | 140 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", |
141 | this , SLOT( btnPlay(bool) ), TRUE ); | 141 | this , SLOT( btnPlay(bool) ), TRUE ); |
142 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", | 142 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", |
143 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 143 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
144 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", | 144 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", |
145 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 145 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
146 | tbDeletePlaylist->hide(); | 146 | tbDeletePlaylist->hide(); |
147 | 147 | ||
148 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 148 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
149 | menu->insertItem( tr( "File" ), pmPlayList ); | 149 | menu->insertItem( tr( "File" ), pmPlayList ); |
150 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 150 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
151 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
152 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
153 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 153 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
155 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 155 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
156 | 156 | ||
157 | QPopupMenu *pmView = new QPopupMenu( this ); | 157 | QPopupMenu *pmView = new QPopupMenu( this ); |
158 | menu->insertItem( tr( "View" ), pmView ); | 158 | menu->insertItem( tr( "View" ), pmView ); |
159 | 159 | ||
160 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 160 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
161 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 161 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
162 | fullScreenButton->addTo(pmView); | 162 | fullScreenButton->addTo(pmView); |
163 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | 163 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); |
164 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 164 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
165 | scaleButton->addTo(pmView); | 165 | scaleButton->addTo(pmView); |
166 | 166 | ||
167 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 167 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
168 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 168 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
169 | 169 | ||
170 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 170 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
171 | 171 | ||
172 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 172 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
173 | tabWidget->setTabShape(QTabWidget::Triangular); | 173 | tabWidget->setTabShape(QTabWidget::Triangular); |
174 | 174 | ||
175 | QWidget *pTab; | 175 | QWidget *pTab; |
176 | pTab = new QWidget( tabWidget, "pTab" ); | 176 | pTab = new QWidget( tabWidget, "pTab" ); |
177 | playlistView = new QListView( pTab, "Videoview" ); | 177 | playlistView = new QListView( pTab, "Videoview" ); |
178 | playlistView->setMinimumSize(236,260); | 178 | playlistView->setMinimumSize(236,260); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 179 | tabWidget->insertTab( pTab,"Playlist"); |
180 | 180 | ||
181 | // Add the playlist area | 181 | // Add the playlist area |
182 | 182 | ||
183 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 183 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
184 | d->playListFrame = vbox3; | 184 | d->playListFrame = vbox3; |
185 | d->playListFrame ->setMinimumSize(235,260); | 185 | d->playListFrame ->setMinimumSize(235,260); |
186 | 186 | ||
187 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 187 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
188 | 188 | ||
189 | d->selectedFiles = new PlayListSelection( hbox2); | 189 | d->selectedFiles = new PlayListSelection( hbox2); |
190 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 190 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
191 | 191 | ||
192 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 192 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
193 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 193 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
194 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 194 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
195 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 195 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
196 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 196 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
197 | 197 | ||
198 | QWidget *aTab; | 198 | QWidget *aTab; |
199 | aTab = new QWidget( tabWidget, "aTab" ); | 199 | aTab = new QWidget( tabWidget, "aTab" ); |
200 | audioView = new QListView( aTab, "Audioview" ); | 200 | audioView = new QListView( aTab, "Audioview" ); |
201 | audioView->setMinimumSize(233,260); | 201 | audioView->setMinimumSize(233,260); |
202 | audioView->addColumn( "Title",150); | 202 | audioView->addColumn( "Title",150); |
203 | audioView->addColumn("Size", 45); | 203 | audioView->addColumn("Size", 45); |
204 | audioView->addColumn("Media",35); | 204 | audioView->addColumn("Media",35); |
205 | audioView->setColumnAlignment(1, Qt::AlignRight); | 205 | audioView->setColumnAlignment(1, Qt::AlignRight); |
206 | audioView->setColumnAlignment(2, Qt::AlignRight); | 206 | audioView->setColumnAlignment(2, Qt::AlignRight); |
207 | tabWidget->insertTab(aTab,"Audio"); | 207 | tabWidget->insertTab(aTab,"Audio"); |
208 | // audioView | 208 | // audioView |
209 | Global::findDocuments(&files, "audio/*"); | 209 | Global::findDocuments(&files, "audio/*"); |
210 | QListIterator<DocLnk> dit( files.children() ); | 210 | QListIterator<DocLnk> dit( files.children() ); |
211 | QString storage; | 211 | QString storage; |
212 | for ( ; dit.current(); ++dit ) { | 212 | for ( ; dit.current(); ++dit ) { |
213 | QListViewItem * newItem; | 213 | QListViewItem * newItem; |
214 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 214 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
215 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 215 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
216 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 216 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
217 | else storage="RAM"; | 217 | else storage="RAM"; |
218 | if ( QFile( dit.current()->file()).exists() ) { | 218 | if ( QFile( dit.current()->file()).exists() ) { |
219 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 219 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
220 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 220 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | // videowidget | 223 | // videowidget |
224 | 224 | ||
225 | QWidget *vTab; | 225 | QWidget *vTab; |
226 | vTab = new QWidget( tabWidget, "vTab" ); | 226 | vTab = new QWidget( tabWidget, "vTab" ); |
227 | videoView = new QListView( vTab, "Videoview" ); | 227 | videoView = new QListView( vTab, "Videoview" ); |
228 | videoView->setMinimumSize(233,260); | 228 | videoView->setMinimumSize(233,260); |
229 | 229 | ||
230 | videoView->addColumn("Title",150); | 230 | videoView->addColumn("Title",150); |
231 | videoView->addColumn("Size",45); | 231 | videoView->addColumn("Size",45); |
232 | videoView->addColumn("Media",35); | 232 | videoView->addColumn("Media",35); |
233 | videoView->setColumnAlignment(1, Qt::AlignRight); | 233 | videoView->setColumnAlignment(1, Qt::AlignRight); |
234 | videoView->setColumnAlignment(2, Qt::AlignRight); | 234 | videoView->setColumnAlignment(2, Qt::AlignRight); |
235 | 235 | ||
236 | tabWidget->insertTab( vTab,"Video"); | 236 | tabWidget->insertTab( vTab,"Video"); |
237 | 237 | ||
238 | Global::findDocuments(&vFiles, "video/*"); | 238 | Global::findDocuments(&vFiles, "video/*"); |
239 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 239 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
240 | for ( ; Vdit.current(); ++Vdit ) { | 240 | for ( ; Vdit.current(); ++Vdit ) { |
241 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 241 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
242 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | 242 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; |
243 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 243 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
244 | else storage="RAM"; | 244 | else storage="RAM"; |
245 | QListViewItem * newItem; | 245 | QListViewItem * newItem; |
246 | if ( QFile( Vdit.current()->file()).exists() ) { | 246 | if ( QFile( Vdit.current()->file()).exists() ) { |
247 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 247 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
248 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 248 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | //playlists list | 252 | //playlists list |
253 | QWidget *LTab; | 253 | QWidget *LTab; |
254 | LTab = new QWidget( tabWidget, "LTab" ); | 254 | LTab = new QWidget( tabWidget, "LTab" ); |
255 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 255 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
256 | playLists->setMinimumSize(233,260);; | 256 | playLists->setMinimumSize(233,260);; |
257 | tabWidget->insertTab(LTab,"Lists"); | 257 | tabWidget->insertTab(LTab,"Lists"); |
258 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 258 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
259 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 259 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
260 | 260 | ||
261 | 261 | ||
262 | // add the library area | 262 | // add the library area |
263 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 263 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
264 | 264 | ||
265 | 265 | ||
266 | connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 266 | connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
267 | this, SLOT( fauxPlay( QListViewItem *) ) ); | 267 | this, SLOT( fauxPlay( QListViewItem *) ) ); |
268 | connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 268 | connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
269 | this, SLOT( fauxPlay( QListViewItem *)) ); | 269 | this, SLOT( fauxPlay( QListViewItem *)) ); |
270 | 270 | ||
271 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 271 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
272 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 272 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
273 | 273 | ||
274 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 274 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
275 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 275 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
276 | 276 | ||
277 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 277 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
278 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 278 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
279 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 279 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
280 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 280 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
281 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 281 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
282 | 282 | ||
283 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 283 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
284 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 284 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
285 | 285 | ||
286 | setCentralWidget( vbox5 ); | 286 | setCentralWidget( vbox5 ); |
287 | 287 | ||
288 | Config cfg( "MediaPlayer" ); | 288 | Config cfg( "MediaPlayer" ); |
289 | readConfig( cfg ); | 289 | readConfig( cfg ); |
290 | 290 | ||
291 | initializeStates(); | 291 | initializeStates(); |
292 | } | 292 | } |
293 | 293 | ||
294 | 294 | ||
295 | PlayListWidget::~PlayListWidget() { | 295 | PlayListWidget::~PlayListWidget() { |
296 | Config cfg( "MediaPlayer" ); | 296 | Config cfg( "MediaPlayer" ); |
297 | writeConfig( cfg ); | 297 | writeConfig( cfg ); |
298 | 298 | ||
299 | if ( d->current ) | 299 | if ( d->current ) |
300 | delete d->current; | 300 | delete d->current; |
301 | delete d; | 301 | delete d; |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | void PlayListWidget::initializeStates() { | 305 | void PlayListWidget::initializeStates() { |
306 | 306 | ||
307 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 307 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
308 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 308 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
309 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 309 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
310 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 310 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
311 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 311 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
312 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 312 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
313 | // setPlaylist( mediaPlayerState->playlist() ); | 313 | // setPlaylist( mediaPlayerState->playlist() ); |
314 | setPlaylist( true); | 314 | setPlaylist( true); |
315 | d->selectedFiles->first(); | 315 | d->selectedFiles->first(); |
316 | 316 | ||
317 | } | 317 | } |
318 | 318 | ||
319 | 319 | ||
320 | void PlayListWidget::readConfig( Config& cfg ) { | 320 | void PlayListWidget::readConfig( Config& cfg ) { |
321 | cfg.setGroup("PlayList"); | 321 | cfg.setGroup("PlayList"); |
322 | 322 | ||
323 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 323 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
324 | 324 | ||
325 | for ( int i = 0; i < noOfFiles; i++ ) { | 325 | for ( int i = 0; i < noOfFiles; i++ ) { |
326 | QString entryName; | 326 | QString entryName; |
327 | entryName.sprintf( "File%i", i + 1 ); | 327 | entryName.sprintf( "File%i", i + 1 ); |
328 | QString linkFile = cfg.readEntry( entryName ); | 328 | QString linkFile = cfg.readEntry( entryName ); |
329 | DocLnk lnk( linkFile ); | 329 | DocLnk lnk( linkFile ); |
330 | if ( lnk.isValid() ) | 330 | if ( lnk.isValid() ) |
331 | d->selectedFiles->addToSelection( lnk ); | 331 | d->selectedFiles->addToSelection( lnk ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void PlayListWidget::writeConfig( Config& cfg ) const { | 336 | void PlayListWidget::writeConfig( Config& cfg ) const { |
337 | cfg.setGroup("PlayList"); | 337 | cfg.setGroup("PlayList"); |
338 | 338 | ||
339 | int noOfFiles = 0; | 339 | int noOfFiles = 0; |
340 | 340 | ||
341 | d->selectedFiles->first(); | 341 | d->selectedFiles->first(); |
342 | do { | 342 | do { |
343 | const DocLnk *lnk = d->selectedFiles->current(); | 343 | const DocLnk *lnk = d->selectedFiles->current(); |
344 | if ( lnk ) { | 344 | if ( lnk ) { |
345 | QString entryName; | 345 | QString entryName; |
346 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 346 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
347 | cfg.writeEntry( entryName, lnk->linkFile() ); | 347 | cfg.writeEntry( entryName, lnk->linkFile() ); |
348 | // if this link does exist, add it so we have the file | 348 | // if this link does exist, add it so we have the file |
349 | // next time... | 349 | // next time... |
350 | if ( !QFile::exists( lnk->linkFile() ) ) { | 350 | if ( !QFile::exists( lnk->linkFile() ) ) { |
351 | // the way writing lnks doesn't really check for out | 351 | // the way writing lnks doesn't really check for out |
352 | // of disk space, but check it anyway. | 352 | // of disk space, but check it anyway. |
353 | if ( !lnk->writeLink() ) { | 353 | if ( !lnk->writeLink() ) { |
354 | QMessageBox::critical( 0, tr("Out of space"), | 354 | QMessageBox::critical( 0, tr("Out of space"), |
355 | tr( "There was a problem saving " | 355 | tr( "There was a problem saving " |
356 | "the playlist.\n" | 356 | "the playlist.\n" |
357 | "Your playlist " | 357 | "Your playlist " |
358 | "may be missing some entries\n" | 358 | "may be missing some entries\n" |
359 | "the next time you start it." ) | 359 | "the next time you start it." ) |
360 | ); | 360 | ); |
361 | } | 361 | } |
362 | } | 362 | } |
363 | noOfFiles++; | 363 | noOfFiles++; |
364 | } | 364 | } |
365 | } while ( d->selectedFiles->next() ); | 365 | } while ( d->selectedFiles->next() ); |
366 | 366 | ||
367 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 367 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
368 | 368 | ||
369 | 369 | ||
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 373 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
374 | qDebug("add"); | 374 | qDebug("add"); |
375 | d->setDocumentUsed = FALSE; | 375 | d->setDocumentUsed = FALSE; |
376 | if ( mediaPlayerState->playlist() ) | 376 | if ( mediaPlayerState->playlist() ) |
377 | d->selectedFiles->addToSelection( lnk ); | 377 | d->selectedFiles->addToSelection( lnk ); |
378 | else | 378 | else |
379 | mediaPlayerState->setPlaying( TRUE ); | 379 | mediaPlayerState->setPlaying( TRUE ); |
380 | } | 380 | } |
381 | 381 | ||
382 | 382 | ||
383 | void PlayListWidget::clearList() { | 383 | void PlayListWidget::clearList() { |
384 | while ( first() ) | 384 | while ( first() ) |
385 | d->selectedFiles->removeSelected(); | 385 | d->selectedFiles->removeSelected(); |
386 | } | 386 | } |
387 | 387 | ||
388 | 388 | ||
389 | void PlayListWidget::addAllToList() { | 389 | void PlayListWidget::addAllToList() { |
390 | DocLnkSet files; | 390 | DocLnkSet files; |
391 | Global::findDocuments(&files, "video/*;audio/*"); | 391 | Global::findDocuments(&files, "video/*;audio/*"); |
392 | QListIterator<DocLnk> dit( files.children() ); | 392 | QListIterator<DocLnk> dit( files.children() ); |
393 | for ( ; dit.current(); ++dit ) | 393 | for ( ; dit.current(); ++dit ) |
394 | d->selectedFiles->addToSelection( **dit ); | 394 | d->selectedFiles->addToSelection( **dit ); |
395 | } | 395 | } |
396 | 396 | ||
397 | 397 | ||
398 | void PlayListWidget::addAllMusicToList() { | 398 | void PlayListWidget::addAllMusicToList() { |
399 | DocLnkSet files; | 399 | DocLnkSet files; |
400 | Global::findDocuments(&files, "audio/*"); | 400 | Global::findDocuments(&files, "audio/*"); |
401 | QListIterator<DocLnk> dit( files.children() ); | 401 | QListIterator<DocLnk> dit( files.children() ); |
402 | for ( ; dit.current(); ++dit ) | 402 | for ( ; dit.current(); ++dit ) |
403 | d->selectedFiles->addToSelection( **dit ); | 403 | d->selectedFiles->addToSelection( **dit ); |
404 | } | 404 | } |
405 | 405 | ||
406 | 406 | ||
407 | void PlayListWidget::addAllVideoToList() { | 407 | void PlayListWidget::addAllVideoToList() { |
408 | DocLnkSet files; | 408 | DocLnkSet files; |
409 | Global::findDocuments(&files, "video/*"); | 409 | Global::findDocuments(&files, "video/*"); |
410 | QListIterator<DocLnk> dit( files.children() ); | 410 | QListIterator<DocLnk> dit( files.children() ); |
411 | for ( ; dit.current(); ++dit ) | 411 | for ( ; dit.current(); ++dit ) |
412 | d->selectedFiles->addToSelection( **dit ); | 412 | d->selectedFiles->addToSelection( **dit ); |
413 | } | 413 | } |
414 | 414 | ||
415 | 415 | ||
416 | void PlayListWidget::setDocument(const QString& fileref) { | 416 | void PlayListWidget::setDocument(const QString& fileref) { |
417 | if ( fileref.isNull() ) { | 417 | if ( fileref.isNull() ) { |
418 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 418 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
419 | return; | 419 | return; |
420 | } | 420 | } |
421 | if ( mediaPlayerState->playlist() ) | 421 | if ( mediaPlayerState->playlist() ) |
422 | addToSelection( DocLnk( fileref ) ); | 422 | addToSelection( DocLnk( fileref ) ); |
423 | else { | 423 | else { |
424 | d->setDocumentUsed = TRUE; | 424 | d->setDocumentUsed = TRUE; |
425 | if ( d->current ) | 425 | if ( d->current ) |
426 | delete d->current; | 426 | delete d->current; |
427 | d->current = new DocLnk( fileref ); | 427 | d->current = new DocLnk( fileref ); |
428 | } | 428 | } |
429 | mediaPlayerState->setPlaying( FALSE ); | 429 | mediaPlayerState->setPlaying( FALSE ); |
430 | mediaPlayerState->setPlaying( TRUE ); | 430 | mediaPlayerState->setPlaying( TRUE ); |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | void PlayListWidget::setActiveWindow() { | 434 | void PlayListWidget::setActiveWindow() { |
435 | // When we get raised we need to ensure that it switches views | 435 | // When we get raised we need to ensure that it switches views |
436 | char origView = mediaPlayerState->view(); | 436 | char origView = mediaPlayerState->view(); |
437 | mediaPlayerState->setView( 'l' ); // invalidate | 437 | mediaPlayerState->setView( 'l' ); // invalidate |
438 | mediaPlayerState->setView( origView ); // now switch back | 438 | mediaPlayerState->setView( origView ); // now switch back |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | void PlayListWidget::useSelectedDocument() { | 442 | void PlayListWidget::useSelectedDocument() { |
443 | d->setDocumentUsed = FALSE; | 443 | d->setDocumentUsed = FALSE; |
444 | } | 444 | } |
445 | 445 | ||
446 | 446 | ||
447 | const DocLnk *PlayListWidget::current() { | 447 | const DocLnk *PlayListWidget::current() { |
448 | 448 | ||
449 | // qDebug("in Playlist widget ::current"); | 449 | // qDebug("in Playlist widget ::current"); |
450 | if ( mediaPlayerState->playlist() ) { | 450 | if ( mediaPlayerState->playlist() ) { |
451 | return d->selectedFiles->current(); | 451 | return d->selectedFiles->current(); |
452 | } | 452 | } |
453 | else if ( d->setDocumentUsed && d->current ) { | 453 | else if ( d->setDocumentUsed && d->current ) { |
454 | return d->current; | 454 | return d->current; |
455 | } else { | 455 | } else { |
456 | return d->files->selected(); | 456 | return d->files->selected(); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | bool PlayListWidget::prev() { | 461 | bool PlayListWidget::prev() { |
462 | if ( mediaPlayerState->playlist() ) { | 462 | if ( mediaPlayerState->playlist() ) { |
463 | if ( mediaPlayerState->shuffled() ) { | 463 | if ( mediaPlayerState->shuffled() ) { |
464 | const DocLnk *cur = current(); | 464 | const DocLnk *cur = current(); |
465 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 465 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
466 | for ( int i = 0; i < j; i++ ) { | 466 | for ( int i = 0; i < j; i++ ) { |
467 | if ( !d->selectedFiles->next() ) | 467 | if ( !d->selectedFiles->next() ) |
468 | d->selectedFiles->first(); | 468 | d->selectedFiles->first(); |
469 | } | 469 | } |
470 | if ( cur == current() ) | 470 | if ( cur == current() ) |
471 | if ( !d->selectedFiles->next() ) | 471 | if ( !d->selectedFiles->next() ) |
472 | d->selectedFiles->first(); | 472 | d->selectedFiles->first(); |
473 | return TRUE; | 473 | return TRUE; |
474 | } else { | 474 | } else { |
475 | if ( !d->selectedFiles->prev() ) { | 475 | if ( !d->selectedFiles->prev() ) { |
476 | if ( mediaPlayerState->looping() ) { | 476 | if ( mediaPlayerState->looping() ) { |
477 | return d->selectedFiles->last(); | 477 | return d->selectedFiles->last(); |
478 | } else { | 478 | } else { |
479 | return FALSE; | 479 | return FALSE; |
480 | } | 480 | } |
481 | } | 481 | } |
482 | return TRUE; | 482 | return TRUE; |
483 | } | 483 | } |
484 | } else { | 484 | } else { |
485 | return mediaPlayerState->looping(); | 485 | return mediaPlayerState->looping(); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | bool PlayListWidget::next() { | 490 | bool PlayListWidget::next() { |
491 | if ( mediaPlayerState->playlist() ) { | 491 | if ( mediaPlayerState->playlist() ) { |
492 | if ( mediaPlayerState->shuffled() ) { | 492 | if ( mediaPlayerState->shuffled() ) { |
493 | return prev(); | 493 | return prev(); |
494 | } else { | 494 | } else { |
495 | if ( !d->selectedFiles->next() ) { | 495 | if ( !d->selectedFiles->next() ) { |
496 | if ( mediaPlayerState->looping() ) { | 496 | if ( mediaPlayerState->looping() ) { |
497 | return d->selectedFiles->first(); | 497 | return d->selectedFiles->first(); |
498 | } else { | 498 | } else { |
499 | return FALSE; | 499 | return FALSE; |
500 | } | 500 | } |
501 | } | 501 | } |
502 | return TRUE; | 502 | return TRUE; |
503 | } | 503 | } |
504 | } else { | 504 | } else { |
505 | return mediaPlayerState->looping(); | 505 | return mediaPlayerState->looping(); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | bool PlayListWidget::first() { | 510 | bool PlayListWidget::first() { |
511 | if ( mediaPlayerState->playlist() ) | 511 | if ( mediaPlayerState->playlist() ) |
512 | return d->selectedFiles->first(); | 512 | return d->selectedFiles->first(); |
513 | else | 513 | else |
514 | return mediaPlayerState->looping(); | 514 | return mediaPlayerState->looping(); |