author | simon <simon> | 2002-12-04 11:03:26 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 11:03:26 (UTC) |
commit | 9b30090fddf1cc2e8ffbff70b164213118106167 (patch) (unidiff) | |
tree | a328c893928233cd0f17f1842d150ecf87530efe /noncore/multimedia/opieplayer2/playlistwidget.cpp | |
parent | 63541c46776721ef5ae63903e5b40838c1c49a43 (diff) | |
download | opie-9b30090fddf1cc2e8ffbff70b164213118106167.zip opie-9b30090fddf1cc2e8ffbff70b164213118106167.tar.gz opie-9b30090fddf1cc2e8ffbff70b164213118106167.tar.bz2 |
- moving videoScan and audioScan into PlayListFileView
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 93e7919..12b8a71 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -106,98 +106,96 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
106 | bool b= cfg.readBoolEntry("FullScreen", 0); | 106 | bool b= cfg.readBoolEntry("FullScreen", 0); |
107 | mediaPlayerState.setFullscreen( b ); | 107 | mediaPlayerState.setFullscreen( b ); |
108 | pmView->setItemChecked( -16, b ); | 108 | pmView->setItemChecked( -16, b ); |
109 | 109 | ||
110 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 110 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
111 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 111 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
112 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 112 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
113 | d->selectedFiles, SLOT(removeSelected() ) ); | 113 | d->selectedFiles, SLOT(removeSelected() ) ); |
114 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 114 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
115 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 115 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
116 | // QVBox *stretch2 = new QVBox( vbox1 ); | 116 | // QVBox *stretch2 = new QVBox( vbox1 ); |
117 | 117 | ||
118 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 118 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
119 | SLOT( deletePlaylist() ) ); | 119 | SLOT( deletePlaylist() ) ); |
120 | connect( pmView, SIGNAL( activated( int ) ), | 120 | connect( pmView, SIGNAL( activated( int ) ), |
121 | this, SLOT( pmViewActivated( int ) ) ); | 121 | this, SLOT( pmViewActivated( int ) ) ); |
122 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 122 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
123 | this, SLOT( skinsMenuActivated( int ) ) ); | 123 | this, SLOT( skinsMenuActivated( int ) ) ); |
124 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 124 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
125 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 125 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
126 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 126 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
128 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 128 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
129 | this,SLOT( playIt( QListViewItem *) ) ); | 129 | this,SLOT( playIt( QListViewItem *) ) ); |
130 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 130 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
131 | this, SLOT( addToSelection( QListViewItem *) ) ); | 131 | this, SLOT( addToSelection( QListViewItem *) ) ); |
132 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 132 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
133 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 133 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
134 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 134 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
135 | this,SLOT( playIt( QListViewItem *) ) ); | 135 | this,SLOT( playIt( QListViewItem *) ) ); |
136 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 136 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
137 | this, SLOT( addToSelection( QListViewItem *) ) ); | 137 | this, SLOT( addToSelection( QListViewItem *) ) ); |
138 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 138 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
139 | this, SLOT( loadList( const DocLnk & ) ) ); | 139 | this, SLOT( loadList( const DocLnk & ) ) ); |
140 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 140 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
141 | this, SLOT( tabChanged( QWidget* ) ) ); | 141 | this, SLOT( tabChanged( QWidget* ) ) ); |
142 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 142 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
143 | d->tbPlay, SLOT( setOn( bool ) ) ); | 143 | d->tbPlay, SLOT( setOn( bool ) ) ); |
144 | connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 144 | connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
145 | d->tbLoop, SLOT( setOn( bool ) ) ); | 145 | d->tbLoop, SLOT( setOn( bool ) ) ); |
146 | connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 146 | connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
147 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 147 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
148 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 148 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
149 | this, SLOT( playIt( QListViewItem *) ) ); | 149 | this, SLOT( playIt( QListViewItem *) ) ); |
150 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 150 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
151 | &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 151 | &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
152 | 152 | ||
153 | // see which skins are installed | 153 | // see which skins are installed |
154 | videoScan=false; | ||
155 | audioScan=false; | ||
156 | audioPopulated=false; | 154 | audioPopulated=false; |
157 | videoPopulated=false; | 155 | videoPopulated=false; |
158 | populateSkinsMenu(); | 156 | populateSkinsMenu(); |
159 | initializeStates(); | 157 | initializeStates(); |
160 | 158 | ||
161 | cfg.setGroup("PlayList"); | 159 | cfg.setGroup("PlayList"); |
162 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 160 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
163 | loadList(DocLnk( currentPlaylist ) ); | 161 | loadList(DocLnk( currentPlaylist ) ); |
164 | } | 162 | } |
165 | 163 | ||
166 | 164 | ||
167 | PlayListWidget::~PlayListWidget() { | 165 | PlayListWidget::~PlayListWidget() { |
168 | delete d; | 166 | delete d; |
169 | } | 167 | } |
170 | 168 | ||
171 | 169 | ||
172 | void PlayListWidget::initializeStates() { | 170 | void PlayListWidget::initializeStates() { |
173 | d->tbPlay->setOn( mediaPlayerState.isPlaying() ); | 171 | d->tbPlay->setOn( mediaPlayerState.isPlaying() ); |
174 | d->tbLoop->setOn( mediaPlayerState.isLooping() ); | 172 | d->tbLoop->setOn( mediaPlayerState.isLooping() ); |
175 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); | 173 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); |
176 | d->playListFrame->show(); | 174 | d->playListFrame->show(); |
177 | } | 175 | } |
178 | 176 | ||
179 | void PlayListWidget::writeDefaultPlaylist() { | 177 | void PlayListWidget::writeDefaultPlaylist() { |
180 | 178 | ||
181 | Config config( "OpiePlayer" ); | 179 | Config config( "OpiePlayer" ); |
182 | config.setGroup( "PlayList" ); | 180 | config.setGroup( "PlayList" ); |
183 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 181 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
184 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 182 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
185 | if( currentString == filename) { | 183 | if( currentString == filename) { |
186 | Om3u *m3uList; | 184 | Om3u *m3uList; |
187 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 185 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
188 | if( d->selectedFiles->first() ) { | 186 | if( d->selectedFiles->first() ) { |
189 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 187 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
190 | do { | 188 | do { |
191 | // qDebug(d->selectedFiles->current()->file()); | 189 | // qDebug(d->selectedFiles->current()->file()); |
192 | m3uList->add( d->selectedFiles->current()->file() ); | 190 | m3uList->add( d->selectedFiles->current()->file() ); |
193 | } | 191 | } |
194 | while ( d->selectedFiles->next() ); | 192 | while ( d->selectedFiles->next() ); |
195 | 193 | ||
196 | m3uList->write(); | 194 | m3uList->write(); |
197 | m3uList->close(); | 195 | m3uList->close(); |
198 | if(m3uList) delete m3uList; | 196 | if(m3uList) delete m3uList; |
199 | 197 | ||
200 | } | 198 | } |
201 | } | 199 | } |
202 | } | 200 | } |
203 | 201 | ||
@@ -209,190 +207,190 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
209 | } | 207 | } |
210 | // writeCurrentM3u(); | 208 | // writeCurrentM3u(); |
211 | } | 209 | } |
212 | 210 | ||
213 | 211 | ||
214 | void PlayListWidget::clearList() { | 212 | void PlayListWidget::clearList() { |
215 | while ( first() ) { | 213 | while ( first() ) { |
216 | d->selectedFiles->removeSelected(); | 214 | d->selectedFiles->removeSelected(); |
217 | } | 215 | } |
218 | } | 216 | } |
219 | 217 | ||
220 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 218 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
221 | switch (mouse) { | 219 | switch (mouse) { |
222 | case 1: | 220 | case 1: |
223 | break; | 221 | break; |
224 | case 2: | 222 | case 2: |
225 | { | 223 | { |
226 | QPopupMenu m; | 224 | QPopupMenu m; |
227 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 225 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
228 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 226 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
229 | m.exec( QCursor::pos() ); | 227 | m.exec( QCursor::pos() ); |
230 | } | 228 | } |
231 | break; | 229 | break; |
232 | } | 230 | } |
233 | } | 231 | } |
234 | 232 | ||
235 | 233 | ||
236 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 234 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
237 | switch (mouse) { | 235 | switch (mouse) { |
238 | case 1: | 236 | case 1: |
239 | break; | 237 | break; |
240 | case 2: | 238 | case 2: |
241 | { | 239 | { |
242 | QPopupMenu m; | 240 | QPopupMenu m; |
243 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 241 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
244 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 242 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
245 | m.exec( QCursor::pos() ); | 243 | m.exec( QCursor::pos() ); |
246 | } | 244 | } |
247 | break; | 245 | break; |
248 | } | 246 | } |
249 | } | 247 | } |
250 | 248 | ||
251 | 249 | ||
252 | void PlayListWidget::addAllToList() { | 250 | void PlayListWidget::addAllToList() { |
253 | 251 | ||
254 | // QTime t; | 252 | // QTime t; |
255 | // t.start(); | 253 | // t.start(); |
256 | 254 | ||
257 | if(!audioScan) { | 255 | if(!audioView->scannedFiles()) { |
258 | if(audioView->childCount() < 1) | 256 | if(audioView->childCount() < 1) |
259 | populateAudioView(); | 257 | populateAudioView(); |
260 | } | 258 | } |
261 | 259 | ||
262 | QListViewItemIterator audioIt( audioView ); | 260 | QListViewItemIterator audioIt( audioView ); |
263 | DocLnk lnk; | 261 | DocLnk lnk; |
264 | QString filename; | 262 | QString filename; |
265 | // iterate through all items of the listview | 263 | // iterate through all items of the listview |
266 | for ( ; audioIt.current(); ++audioIt ) { | 264 | for ( ; audioIt.current(); ++audioIt ) { |
267 | filename = audioIt.current()->text(3); | 265 | filename = audioIt.current()->text(3); |
268 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 266 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
269 | lnk.setFile( filename ); //sets file name | 267 | lnk.setFile( filename ); //sets file name |
270 | d->selectedFiles->addToSelection( lnk); | 268 | d->selectedFiles->addToSelection( lnk); |
271 | } | 269 | } |
272 | 270 | ||
273 | if(!videoScan) { | 271 | if(!videoView->scannedFiles()) { |
274 | if(videoView->childCount() < 1) | 272 | if(videoView->childCount() < 1) |
275 | populateVideoView(); | 273 | populateVideoView(); |
276 | } | 274 | } |
277 | 275 | ||
278 | QListViewItemIterator videoIt( videoView ); | 276 | QListViewItemIterator videoIt( videoView ); |
279 | for ( ; videoIt.current(); ++videoIt ) { | 277 | for ( ; videoIt.current(); ++videoIt ) { |
280 | filename = videoIt.current()->text(3); | 278 | filename = videoIt.current()->text(3); |
281 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 279 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
282 | lnk.setFile( filename ); //sets file name | 280 | lnk.setFile( filename ); //sets file name |
283 | d->selectedFiles->addToSelection( lnk); | 281 | d->selectedFiles->addToSelection( lnk); |
284 | } | 282 | } |
285 | 283 | ||
286 | // d->selectedFiles->addToSelection( ); | 284 | // d->selectedFiles->addToSelection( ); |
287 | // if ( it.current()->isSelected() ) | 285 | // if ( it.current()->isSelected() ) |
288 | // lst->append( audioIt.current() ); | 286 | // lst->append( audioIt.current() ); |
289 | // } | 287 | // } |
290 | 288 | ||
291 | 289 | ||
292 | // if(!audioScan) | 290 | // if(!audioScan) |
293 | // scanForAudio(); | 291 | // scanForAudio(); |
294 | // if(!videoScan) | 292 | // if(!videoScan) |
295 | // scanForVideo(); | 293 | // scanForVideo(); |
296 | 294 | ||
297 | // DocLnkSet filesAll; | 295 | // DocLnkSet filesAll; |
298 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); | 296 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); |
299 | // QListIterator<DocLnk> Adit( filesAll.children() ); | 297 | // QListIterator<DocLnk> Adit( filesAll.children() ); |
300 | // for ( ; Adit.current(); ++Adit ) { | 298 | // for ( ; Adit.current(); ++Adit ) { |
301 | // if( QFileInfo( Adit.current()->file() ).exists() ) { | 299 | // if( QFileInfo( Adit.current()->file() ).exists() ) { |
302 | // d->selectedFiles->addToSelection( **Adit ); | 300 | // d->selectedFiles->addToSelection( **Adit ); |
303 | // } | 301 | // } |
304 | // } | 302 | // } |
305 | 303 | ||
306 | // qDebug("elapsed time %d", t.elapsed() ); | 304 | // qDebug("elapsed time %d", t.elapsed() ); |
307 | 305 | ||
308 | tabWidget->setCurrentPage(0); | 306 | tabWidget->setCurrentPage(0); |
309 | 307 | ||
310 | writeCurrentM3u(); | 308 | writeCurrentM3u(); |
311 | d->selectedFiles->first(); | 309 | d->selectedFiles->first(); |
312 | } | 310 | } |
313 | 311 | ||
314 | 312 | ||
315 | void PlayListWidget::addAllMusicToList() { | 313 | void PlayListWidget::addAllMusicToList() { |
316 | 314 | ||
317 | if(!audioScan) { | 315 | if(!audioView->scannedFiles()) { |
318 | if(audioView->childCount() < 1) | 316 | if(audioView->childCount() < 1) |
319 | populateAudioView(); | 317 | populateAudioView(); |
320 | } | 318 | } |
321 | 319 | ||
322 | QListViewItemIterator audioIt( audioView ); | 320 | QListViewItemIterator audioIt( audioView ); |
323 | DocLnk lnk; | 321 | DocLnk lnk; |
324 | QString filename; | 322 | QString filename; |
325 | // iterate through all items of the listview | 323 | // iterate through all items of the listview |
326 | for ( ; audioIt.current(); ++audioIt ) { | 324 | for ( ; audioIt.current(); ++audioIt ) { |
327 | filename = audioIt.current()->text(3); | 325 | filename = audioIt.current()->text(3); |
328 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 326 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
329 | lnk.setFile( filename ); //sets file name | 327 | lnk.setFile( filename ); //sets file name |
330 | d->selectedFiles->addToSelection( lnk); | 328 | d->selectedFiles->addToSelection( lnk); |
331 | } | 329 | } |
332 | 330 | ||
333 | /* if(!audioScan) | 331 | /* if(!audioScan) |
334 | scanForAudio(); | 332 | scanForAudio(); |
335 | QListIterator<DocLnk> dit( files.children() ); | 333 | QListIterator<DocLnk> dit( files.children() ); |
336 | for ( ; dit.current(); ++dit ) { | 334 | for ( ; dit.current(); ++dit ) { |
337 | if( QFileInfo(dit.current()->file() ).exists() ) { | 335 | if( QFileInfo(dit.current()->file() ).exists() ) { |
338 | d->selectedFiles->addToSelection( **dit ); | 336 | d->selectedFiles->addToSelection( **dit ); |
339 | } | 337 | } |
340 | } | 338 | } |
341 | */ | 339 | */ |
342 | tabWidget->setCurrentPage(0); | 340 | tabWidget->setCurrentPage(0); |
343 | writeCurrentM3u(); | 341 | writeCurrentM3u(); |
344 | d->selectedFiles->first(); | 342 | d->selectedFiles->first(); |
345 | } | 343 | } |
346 | 344 | ||
347 | 345 | ||
348 | void PlayListWidget::addAllVideoToList() { | 346 | void PlayListWidget::addAllVideoToList() { |
349 | 347 | ||
350 | if(!videoScan) { | 348 | if(!videoView->scannedFiles()) { |
351 | if(videoView->childCount() < 1) | 349 | if(videoView->childCount() < 1) |
352 | populateVideoView(); | 350 | populateVideoView(); |
353 | } | 351 | } |
354 | 352 | ||
355 | QListViewItemIterator videoIt( videoView ); | 353 | QListViewItemIterator videoIt( videoView ); |
356 | DocLnk lnk; | 354 | DocLnk lnk; |
357 | QString filename; | 355 | QString filename; |
358 | for ( ; videoIt.current(); ++videoIt ) { | 356 | for ( ; videoIt.current(); ++videoIt ) { |
359 | filename = videoIt.current()->text(3); | 357 | filename = videoIt.current()->text(3); |
360 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 358 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
361 | lnk.setFile( filename ); //sets file name | 359 | lnk.setFile( filename ); //sets file name |
362 | d->selectedFiles->addToSelection( lnk); | 360 | d->selectedFiles->addToSelection( lnk); |
363 | } | 361 | } |
364 | 362 | ||
365 | 363 | ||
366 | /* if(!videoScan) | 364 | /* if(!videoScan) |
367 | scanForVideo(); | 365 | scanForVideo(); |
368 | QListIterator<DocLnk> dit( vFiles.children() ); | 366 | QListIterator<DocLnk> dit( vFiles.children() ); |
369 | for ( ; dit.current(); ++dit ) { | 367 | for ( ; dit.current(); ++dit ) { |
370 | if( QFileInfo( dit.current()->file() ).exists() ) { | 368 | if( QFileInfo( dit.current()->file() ).exists() ) { |
371 | d->selectedFiles->addToSelection( **dit ); | 369 | d->selectedFiles->addToSelection( **dit ); |
372 | } | 370 | } |
373 | } | 371 | } |
374 | */ | 372 | */ |
375 | tabWidget->setCurrentPage(0); | 373 | tabWidget->setCurrentPage(0); |
376 | writeCurrentM3u(); | 374 | writeCurrentM3u(); |
377 | d->selectedFiles->first(); | 375 | d->selectedFiles->first(); |
378 | } | 376 | } |
379 | 377 | ||
380 | 378 | ||
381 | void PlayListWidget::setDocument( const QString& fileref ) { | 379 | void PlayListWidget::setDocument( const QString& fileref ) { |
382 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 380 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
383 | fromSetDocument = TRUE; | 381 | fromSetDocument = TRUE; |
384 | if ( fileref.isNull() ) { | 382 | if ( fileref.isNull() ) { |
385 | QMessageBox::warning( this, tr( "Invalid File" ), | 383 | QMessageBox::warning( this, tr( "Invalid File" ), |
386 | tr( "There was a problem in getting the file." ) ); | 384 | tr( "There was a problem in getting the file." ) ); |
387 | return; | 385 | return; |
388 | } | 386 | } |
389 | 387 | ||
390 | clearList(); | 388 | clearList(); |
391 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 389 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
392 | readm3u( fileref ); | 390 | readm3u( fileref ); |
393 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 391 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
394 | readm3u( DocLnk( fileref).file() ); | 392 | readm3u( DocLnk( fileref).file() ); |
395 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 393 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
396 | readPls( fileref ); | 394 | readPls( fileref ); |
397 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 395 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
398 | readPls( DocLnk( fileref).file() ); | 396 | readPls( DocLnk( fileref).file() ); |
@@ -593,154 +591,154 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
593 | } | 591 | } |
594 | d->tbRemoveFromList->setEnabled(FALSE); | 592 | d->tbRemoveFromList->setEnabled(FALSE); |
595 | d->tbAddToList->setEnabled(TRUE); | 593 | d->tbAddToList->setEnabled(TRUE); |
596 | } | 594 | } |
597 | break; | 595 | break; |
598 | case PlayLists: | 596 | case PlayLists: |
599 | { | 597 | { |
600 | if( tbDeletePlaylist->isHidden() ) { | 598 | if( tbDeletePlaylist->isHidden() ) { |
601 | tbDeletePlaylist->show(); | 599 | tbDeletePlaylist->show(); |
602 | } | 600 | } |
603 | playLists->reread(); | 601 | playLists->reread(); |
604 | d->tbAddToList->setEnabled(FALSE); | 602 | d->tbAddToList->setEnabled(FALSE); |
605 | 603 | ||
606 | d->tbPlay->setEnabled( false ); | 604 | d->tbPlay->setEnabled( false ); |
607 | } | 605 | } |
608 | break; | 606 | break; |
609 | }; | 607 | }; |
610 | } | 608 | } |
611 | 609 | ||
612 | 610 | ||
613 | void PlayListWidget::btnPlay(bool b) { | 611 | void PlayListWidget::btnPlay(bool b) { |
614 | // mediaPlayerState->setPlaying(false); | 612 | // mediaPlayerState->setPlaying(false); |
615 | mediaPlayerState.setPlaying(b); | 613 | mediaPlayerState.setPlaying(b); |
616 | insanityBool=FALSE; | 614 | insanityBool=FALSE; |
617 | } | 615 | } |
618 | 616 | ||
619 | void PlayListWidget::deletePlaylist() { | 617 | void PlayListWidget::deletePlaylist() { |
620 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 618 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
621 | (tr("You really want to delete\nthis playlist?")), | 619 | (tr("You really want to delete\nthis playlist?")), |
622 | (tr("Yes")), (tr("No")), 0 )){ | 620 | (tr("Yes")), (tr("No")), 0 )){ |
623 | case 0: // Yes clicked, | 621 | case 0: // Yes clicked, |
624 | QFile().remove(playLists->selectedDocument().file()); | 622 | QFile().remove(playLists->selectedDocument().file()); |
625 | QFile().remove(playLists->selectedDocument().linkFile()); | 623 | QFile().remove(playLists->selectedDocument().linkFile()); |
626 | playLists->reread(); | 624 | playLists->reread(); |
627 | break; | 625 | break; |
628 | case 1: // Cancel | 626 | case 1: // Cancel |
629 | break; | 627 | break; |
630 | }; | 628 | }; |
631 | } | 629 | } |
632 | 630 | ||
633 | 631 | ||
634 | void PlayListWidget::playSelected() { | 632 | void PlayListWidget::playSelected() { |
635 | btnPlay( TRUE); | 633 | btnPlay( TRUE); |
636 | } | 634 | } |
637 | 635 | ||
638 | 636 | ||
639 | void PlayListWidget::scanForAudio() { | 637 | void PlayListWidget::scanForAudio() { |
640 | audioView->scanFiles(); | 638 | audioView->scanFiles(); |
641 | audioScan = true; | 639 | audioView->scannedFiles() = true; |
642 | populateAudioView(); | 640 | populateAudioView(); |
643 | } | 641 | } |
644 | 642 | ||
645 | void PlayListWidget::scanForVideo() { | 643 | void PlayListWidget::scanForVideo() { |
646 | videoView->scanFiles(); | 644 | videoView->scanFiles(); |
647 | videoScan = true; | 645 | videoView->scannedFiles() = true; |
648 | populateVideoView(); | 646 | populateVideoView(); |
649 | } | 647 | } |
650 | 648 | ||
651 | void PlayListWidget::populateAudioView() { | 649 | void PlayListWidget::populateAudioView() { |
652 | audioView->clear(); | 650 | audioView->clear(); |
653 | StorageInfo storageInfo; | 651 | StorageInfo storageInfo; |
654 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | 652 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); |
655 | if(!audioScan) { | 653 | if(!audioView->scannedFiles()) { |
656 | scanForAudio(); | 654 | scanForAudio(); |
657 | } | 655 | } |
658 | 656 | ||
659 | QListIterator<DocLnk> dit( audioView->files().children() ); | 657 | QListIterator<DocLnk> dit( audioView->files().children() ); |
660 | // QListIterator<FileSystem> it ( fs ); | 658 | // QListIterator<FileSystem> it ( fs ); |
661 | audioView->clear(); | 659 | audioView->clear(); |
662 | 660 | ||
663 | QString storage; | 661 | QString storage; |
664 | for ( ; dit.current(); ++dit ) { | 662 | for ( ; dit.current(); ++dit ) { |
665 | // // for( ; it.current(); ++it ){ | 663 | // // for( ; it.current(); ++it ){ |
666 | // const QString name = (*dit)->name(); | 664 | // const QString name = (*dit)->name(); |
667 | // const QString path = (*dit)->path(); | 665 | // const QString path = (*dit)->path(); |
668 | // if(dit.current()->file().find(path) != -1 ) { | 666 | // if(dit.current()->file().find(path) != -1 ) { |
669 | // storage = name; | 667 | // storage = name; |
670 | // // } | 668 | // // } |
671 | // } | 669 | // } |
672 | 670 | ||
673 | QListViewItem * newItem; | 671 | QListViewItem * newItem; |
674 | if ( QFile( dit.current()->file()).exists() || | 672 | if ( QFile( dit.current()->file()).exists() || |
675 | dit.current()->file().left(4) == "http" ) { | 673 | dit.current()->file().left(4) == "http" ) { |
676 | long size; | 674 | long size; |
677 | if( dit.current()->file().left(4) == "http" ) | 675 | if( dit.current()->file().left(4) == "http" ) |
678 | size=0; | 676 | size=0; |
679 | else | 677 | else |
680 | size = QFile( dit.current()->file() ).size(); | 678 | size = QFile( dit.current()->file() ).size(); |
681 | 679 | ||
682 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 680 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
683 | QString::number(size ), "" /*storage*/, | 681 | QString::number(size ), "" /*storage*/, |
684 | dit.current()->file() ); | 682 | dit.current()->file() ); |
685 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 683 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
686 | // qDebug("<<<< "+dit.current()->file()); | 684 | // qDebug("<<<< "+dit.current()->file()); |
687 | } | 685 | } |
688 | } | 686 | } |
689 | audioPopulated=true; | 687 | audioPopulated=true; |
690 | } | 688 | } |
691 | 689 | ||
692 | 690 | ||
693 | void PlayListWidget::populateVideoView() { | 691 | void PlayListWidget::populateVideoView() { |
694 | videoView->clear(); | 692 | videoView->clear(); |
695 | StorageInfo storageInfo; | 693 | StorageInfo storageInfo; |
696 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | 694 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); |
697 | 695 | ||
698 | if(!videoScan ) { | 696 | if(!videoView->scannedFiles()) { |
699 | scanForVideo(); | 697 | scanForVideo(); |
700 | } | 698 | } |
701 | 699 | ||
702 | QListIterator<DocLnk> Vdit( videoView->files().children() ); | 700 | QListIterator<DocLnk> Vdit( videoView->files().children() ); |
703 | // QListIterator<FileSystem> it ( fs ); | 701 | // QListIterator<FileSystem> it ( fs ); |
704 | videoView->clear(); | 702 | videoView->clear(); |
705 | QString storage, pathName; | 703 | QString storage, pathName; |
706 | for ( ; Vdit.current(); ++Vdit ) { | 704 | for ( ; Vdit.current(); ++Vdit ) { |
707 | // // for( ; it.current(); ++it ) { | 705 | // // for( ; it.current(); ++it ) { |
708 | // const QString name = (*Vdit)->name(); | 706 | // const QString name = (*Vdit)->name(); |
709 | // const QString path = (*Vdit)->path(); | 707 | // const QString path = (*Vdit)->path(); |
710 | // if( Vdit.current()->file().find(path) != -1 ) { | 708 | // if( Vdit.current()->file().find(path) != -1 ) { |
711 | // storage=name; | 709 | // storage=name; |
712 | // pathName=path; | 710 | // pathName=path; |
713 | // // } | 711 | // // } |
714 | // } | 712 | // } |
715 | 713 | ||
716 | QListViewItem * newItem; | 714 | QListViewItem * newItem; |
717 | if ( QFile( Vdit.current()->file() ).exists() ) { | 715 | if ( QFile( Vdit.current()->file() ).exists() ) { |
718 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 716 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
719 | QString::number( QFile( Vdit.current()->file() ).size() ), | 717 | QString::number( QFile( Vdit.current()->file() ).size() ), |
720 | ""/*storage*/, Vdit.current()->file()); | 718 | ""/*storage*/, Vdit.current()->file()); |
721 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 719 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
722 | } | 720 | } |
723 | } | 721 | } |
724 | videoPopulated=true; | 722 | videoPopulated=true; |
725 | } | 723 | } |
726 | 724 | ||
727 | QListView *PlayListWidget::currentFileListView() const | 725 | QListView *PlayListWidget::currentFileListView() const |
728 | { | 726 | { |
729 | switch ( currentTab() ) { | 727 | switch ( currentTab() ) { |
730 | case AudioFiles: return audioView; | 728 | case AudioFiles: return audioView; |
731 | case VideoFiles: return videoView; | 729 | case VideoFiles: return videoView; |
732 | default: assert( false ); | 730 | default: assert( false ); |
733 | } | 731 | } |
734 | return 0; | 732 | return 0; |
735 | } | 733 | } |
736 | 734 | ||
737 | bool PlayListWidget::inFileListMode() const | 735 | bool PlayListWidget::inFileListMode() const |
738 | { | 736 | { |
739 | TabType tab = currentTab(); | 737 | TabType tab = currentTab(); |
740 | return tab == AudioFiles || tab == VideoFiles; | 738 | return tab == AudioFiles || tab == VideoFiles; |
741 | } | 739 | } |
742 | 740 | ||
743 | void PlayListWidget::openFile() { | 741 | void PlayListWidget::openFile() { |
744 | // http://66.28.164.33:2080 | 742 | // http://66.28.164.33:2080 |
745 | // http://somafm.com/star0242.m3u | 743 | // http://somafm.com/star0242.m3u |
746 | QString filename, name; | 744 | QString filename, name; |