author | simon <simon> | 2002-12-04 11:51:16 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 11:51:16 (UTC) |
commit | d75c4d9a27fcfc38ac3f9fd58f6b398809ec6a94 (patch) (unidiff) | |
tree | 48ef914d460feaaec1a29860067a5b84fb862ae6 | |
parent | df599e48ffde0e5272e511bba57363ac28a67b2d (diff) | |
download | opie-d75c4d9a27fcfc38ac3f9fd58f6b398809ec6a94.zip opie-d75c4d9a27fcfc38ac3f9fd58f6b398809ec6a94.tar.gz opie-d75c4d9a27fcfc38ac3f9fd58f6b398809ec6a94.tar.bz2 |
- scannedFiles is no more public
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 20 |
2 files changed, 4 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h index abe1bb8..6eea2fc 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.h +++ b/noncore/multimedia/opieplayer2/playlistfileview.h | |||
@@ -1,33 +1,29 @@ | |||
1 | #ifndef PLAYLISTFILEVIEW_H | 1 | #ifndef PLAYLISTFILEVIEW_H |
2 | #define PLAYLISTFILEVIEW_H | 2 | #define PLAYLISTFILEVIEW_H |
3 | 3 | ||
4 | #include "playlistview.h" | 4 | #include "playlistview.h" |
5 | 5 | ||
6 | #include <qpe/applnk.h> | 6 | #include <qpe/applnk.h> |
7 | 7 | ||
8 | class PlayListFileView : public PlayListView | 8 | class PlayListFileView : public PlayListView |
9 | { | 9 | { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | public: | 11 | public: |
12 | PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); | 12 | PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); |
13 | virtual ~PlayListFileView(); | 13 | virtual ~PlayListFileView(); |
14 | 14 | ||
15 | // both temporarily accessible that way until the caller code has | ||
16 | // been migrated into this class | ||
17 | bool &scannedFiles() { return m_scannedFiles; } | ||
18 | |||
19 | public slots: | 15 | public slots: |
20 | void scanFiles(); | 16 | void scanFiles(); |
21 | void populateView(); | 17 | void populateView(); |
22 | 18 | ||
23 | private: | 19 | private: |
24 | QString m_mimeTypePattern; | 20 | QString m_mimeTypePattern; |
25 | QString m_itemPixmapName; | 21 | QString m_itemPixmapName; |
26 | DocLnkSet m_files; | 22 | DocLnkSet m_files; |
27 | bool m_scannedFiles; | 23 | bool m_scannedFiles; |
28 | bool m_viewPopulated; | 24 | bool m_viewPopulated; |
29 | }; | 25 | }; |
30 | 26 | ||
31 | #endif // PLAYLISTFILEVIEW_H | 27 | #endif // PLAYLISTFILEVIEW_H |
32 | /* vim: et sw=4 ts=4 | 28 | /* vim: et sw=4 ts=4 |
33 | */ | 29 | */ |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index eb0606d..e754067 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -189,225 +189,213 @@ void PlayListWidget::writeDefaultPlaylist() { | |||
189 | } | 189 | } |
190 | while ( d->selectedFiles->next() ); | 190 | while ( d->selectedFiles->next() ); |
191 | 191 | ||
192 | m3uList->write(); | 192 | m3uList->write(); |
193 | m3uList->close(); | 193 | m3uList->close(); |
194 | if(m3uList) delete m3uList; | 194 | if(m3uList) delete m3uList; |
195 | 195 | ||
196 | } | 196 | } |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 200 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
201 | d->setDocumentUsed = FALSE; | 201 | d->setDocumentUsed = FALSE; |
202 | if( QFileInfo( lnk.file() ).exists() || | 202 | if( QFileInfo( lnk.file() ).exists() || |
203 | lnk.file().left(4) == "http" ) { | 203 | lnk.file().left(4) == "http" ) { |
204 | d->selectedFiles->addToSelection( lnk ); | 204 | d->selectedFiles->addToSelection( lnk ); |
205 | } | 205 | } |
206 | // writeCurrentM3u(); | 206 | // writeCurrentM3u(); |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | void PlayListWidget::clearList() { | 210 | void PlayListWidget::clearList() { |
211 | while ( first() ) { | 211 | while ( first() ) { |
212 | d->selectedFiles->removeSelected(); | 212 | d->selectedFiles->removeSelected(); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 216 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
217 | switch (mouse) { | 217 | switch (mouse) { |
218 | case 1: | 218 | case 1: |
219 | break; | 219 | break; |
220 | case 2: | 220 | case 2: |
221 | { | 221 | { |
222 | QPopupMenu m; | 222 | QPopupMenu m; |
223 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 223 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
224 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 224 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
225 | m.exec( QCursor::pos() ); | 225 | m.exec( QCursor::pos() ); |
226 | } | 226 | } |
227 | break; | 227 | break; |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 232 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
233 | switch (mouse) { | 233 | switch (mouse) { |
234 | case 1: | 234 | case 1: |
235 | break; | 235 | break; |
236 | case 2: | 236 | case 2: |
237 | { | 237 | { |
238 | QPopupMenu m; | 238 | QPopupMenu m; |
239 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 239 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
240 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 240 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
241 | m.exec( QCursor::pos() ); | 241 | m.exec( QCursor::pos() ); |
242 | } | 242 | } |
243 | break; | 243 | break; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | void PlayListWidget::addAllToList() { | 248 | void PlayListWidget::addAllToList() { |
249 | 249 | ||
250 | // QTime t; | 250 | // QTime t; |
251 | // t.start(); | 251 | // t.start(); |
252 | 252 | ||
253 | if(!audioView->scannedFiles()) { | 253 | audioView->populateView(); |
254 | if(audioView->childCount() < 1) | ||
255 | audioView->populateView(); | ||
256 | } | ||
257 | 254 | ||
258 | QListViewItemIterator audioIt( audioView ); | 255 | QListViewItemIterator audioIt( audioView ); |
259 | DocLnk lnk; | 256 | DocLnk lnk; |
260 | QString filename; | 257 | QString filename; |
261 | // iterate through all items of the listview | 258 | // iterate through all items of the listview |
262 | for ( ; audioIt.current(); ++audioIt ) { | 259 | for ( ; audioIt.current(); ++audioIt ) { |
263 | filename = audioIt.current()->text(3); | 260 | filename = audioIt.current()->text(3); |
264 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 261 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
265 | lnk.setFile( filename ); //sets file name | 262 | lnk.setFile( filename ); //sets file name |
266 | d->selectedFiles->addToSelection( lnk); | 263 | d->selectedFiles->addToSelection( lnk); |
267 | } | 264 | } |
268 | 265 | ||
269 | if(!videoView->scannedFiles()) { | 266 | videoView->populateView(); |
270 | if(videoView->childCount() < 1) | ||
271 | videoView->populateView(); | ||
272 | } | ||
273 | 267 | ||
274 | QListViewItemIterator videoIt( videoView ); | 268 | QListViewItemIterator videoIt( videoView ); |
275 | for ( ; videoIt.current(); ++videoIt ) { | 269 | for ( ; videoIt.current(); ++videoIt ) { |
276 | filename = videoIt.current()->text(3); | 270 | filename = videoIt.current()->text(3); |
277 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 271 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
278 | lnk.setFile( filename ); //sets file name | 272 | lnk.setFile( filename ); //sets file name |
279 | d->selectedFiles->addToSelection( lnk); | 273 | d->selectedFiles->addToSelection( lnk); |
280 | } | 274 | } |
281 | 275 | ||
282 | // d->selectedFiles->addToSelection( ); | 276 | // d->selectedFiles->addToSelection( ); |
283 | // if ( it.current()->isSelected() ) | 277 | // if ( it.current()->isSelected() ) |
284 | // lst->append( audioIt.current() ); | 278 | // lst->append( audioIt.current() ); |
285 | // } | 279 | // } |
286 | 280 | ||
287 | 281 | ||
288 | // if(!audioScan) | 282 | // if(!audioScan) |
289 | // scanForAudio(); | 283 | // scanForAudio(); |
290 | // if(!videoScan) | 284 | // if(!videoScan) |
291 | // scanForVideo(); | 285 | // scanForVideo(); |
292 | 286 | ||
293 | // DocLnkSet filesAll; | 287 | // DocLnkSet filesAll; |
294 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); | 288 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); |
295 | // QListIterator<DocLnk> Adit( filesAll.children() ); | 289 | // QListIterator<DocLnk> Adit( filesAll.children() ); |
296 | // for ( ; Adit.current(); ++Adit ) { | 290 | // for ( ; Adit.current(); ++Adit ) { |
297 | // if( QFileInfo( Adit.current()->file() ).exists() ) { | 291 | // if( QFileInfo( Adit.current()->file() ).exists() ) { |
298 | // d->selectedFiles->addToSelection( **Adit ); | 292 | // d->selectedFiles->addToSelection( **Adit ); |
299 | // } | 293 | // } |
300 | // } | 294 | // } |
301 | 295 | ||
302 | // qDebug("elapsed time %d", t.elapsed() ); | 296 | // qDebug("elapsed time %d", t.elapsed() ); |
303 | 297 | ||
304 | tabWidget->setCurrentPage(0); | 298 | tabWidget->setCurrentPage(0); |
305 | 299 | ||
306 | writeCurrentM3u(); | 300 | writeCurrentM3u(); |
307 | d->selectedFiles->first(); | 301 | d->selectedFiles->first(); |
308 | } | 302 | } |
309 | 303 | ||
310 | 304 | ||
311 | void PlayListWidget::addAllMusicToList() { | 305 | void PlayListWidget::addAllMusicToList() { |
312 | 306 | ||
313 | if(!audioView->scannedFiles()) { | 307 | audioView->populateView(); |
314 | if(audioView->childCount() < 1) | ||
315 | audioView->populateView(); | ||
316 | } | ||
317 | 308 | ||
318 | QListViewItemIterator audioIt( audioView ); | 309 | QListViewItemIterator audioIt( audioView ); |
319 | DocLnk lnk; | 310 | DocLnk lnk; |
320 | QString filename; | 311 | QString filename; |
321 | // iterate through all items of the listview | 312 | // iterate through all items of the listview |
322 | for ( ; audioIt.current(); ++audioIt ) { | 313 | for ( ; audioIt.current(); ++audioIt ) { |
323 | filename = audioIt.current()->text(3); | 314 | filename = audioIt.current()->text(3); |
324 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 315 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
325 | lnk.setFile( filename ); //sets file name | 316 | lnk.setFile( filename ); //sets file name |
326 | d->selectedFiles->addToSelection( lnk); | 317 | d->selectedFiles->addToSelection( lnk); |
327 | } | 318 | } |
328 | 319 | ||
329 | /* if(!audioScan) | 320 | /* if(!audioScan) |
330 | scanForAudio(); | 321 | scanForAudio(); |
331 | QListIterator<DocLnk> dit( files.children() ); | 322 | QListIterator<DocLnk> dit( files.children() ); |
332 | for ( ; dit.current(); ++dit ) { | 323 | for ( ; dit.current(); ++dit ) { |
333 | if( QFileInfo(dit.current()->file() ).exists() ) { | 324 | if( QFileInfo(dit.current()->file() ).exists() ) { |
334 | d->selectedFiles->addToSelection( **dit ); | 325 | d->selectedFiles->addToSelection( **dit ); |
335 | } | 326 | } |
336 | } | 327 | } |
337 | */ | 328 | */ |
338 | tabWidget->setCurrentPage(0); | 329 | tabWidget->setCurrentPage(0); |
339 | writeCurrentM3u(); | 330 | writeCurrentM3u(); |
340 | d->selectedFiles->first(); | 331 | d->selectedFiles->first(); |
341 | } | 332 | } |
342 | 333 | ||
343 | 334 | ||
344 | void PlayListWidget::addAllVideoToList() { | 335 | void PlayListWidget::addAllVideoToList() { |
345 | 336 | ||
346 | if(!videoView->scannedFiles()) { | 337 | videoView->populateView(); |
347 | if(videoView->childCount() < 1) | ||
348 | videoView->populateView(); | ||
349 | } | ||
350 | 338 | ||
351 | QListViewItemIterator videoIt( videoView ); | 339 | QListViewItemIterator videoIt( videoView ); |
352 | DocLnk lnk; | 340 | DocLnk lnk; |
353 | QString filename; | 341 | QString filename; |
354 | for ( ; videoIt.current(); ++videoIt ) { | 342 | for ( ; videoIt.current(); ++videoIt ) { |
355 | filename = videoIt.current()->text(3); | 343 | filename = videoIt.current()->text(3); |
356 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 344 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
357 | lnk.setFile( filename ); //sets file name | 345 | lnk.setFile( filename ); //sets file name |
358 | d->selectedFiles->addToSelection( lnk); | 346 | d->selectedFiles->addToSelection( lnk); |
359 | } | 347 | } |
360 | 348 | ||
361 | 349 | ||
362 | /* if(!videoScan) | 350 | /* if(!videoScan) |
363 | scanForVideo(); | 351 | scanForVideo(); |
364 | QListIterator<DocLnk> dit( vFiles.children() ); | 352 | QListIterator<DocLnk> dit( vFiles.children() ); |
365 | for ( ; dit.current(); ++dit ) { | 353 | for ( ; dit.current(); ++dit ) { |
366 | if( QFileInfo( dit.current()->file() ).exists() ) { | 354 | if( QFileInfo( dit.current()->file() ).exists() ) { |
367 | d->selectedFiles->addToSelection( **dit ); | 355 | d->selectedFiles->addToSelection( **dit ); |
368 | } | 356 | } |
369 | } | 357 | } |
370 | */ | 358 | */ |
371 | tabWidget->setCurrentPage(0); | 359 | tabWidget->setCurrentPage(0); |
372 | writeCurrentM3u(); | 360 | writeCurrentM3u(); |
373 | d->selectedFiles->first(); | 361 | d->selectedFiles->first(); |
374 | } | 362 | } |
375 | 363 | ||
376 | 364 | ||
377 | void PlayListWidget::setDocument( const QString& fileref ) { | 365 | void PlayListWidget::setDocument( const QString& fileref ) { |
378 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 366 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
379 | fromSetDocument = TRUE; | 367 | fromSetDocument = TRUE; |
380 | if ( fileref.isNull() ) { | 368 | if ( fileref.isNull() ) { |
381 | QMessageBox::warning( this, tr( "Invalid File" ), | 369 | QMessageBox::warning( this, tr( "Invalid File" ), |
382 | tr( "There was a problem in getting the file." ) ); | 370 | tr( "There was a problem in getting the file." ) ); |
383 | return; | 371 | return; |
384 | } | 372 | } |
385 | 373 | ||
386 | clearList(); | 374 | clearList(); |
387 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 375 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
388 | readm3u( fileref ); | 376 | readm3u( fileref ); |
389 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 377 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
390 | readm3u( DocLnk( fileref).file() ); | 378 | readm3u( DocLnk( fileref).file() ); |
391 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 379 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
392 | readPls( fileref ); | 380 | readPls( fileref ); |
393 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 381 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
394 | readPls( DocLnk( fileref).file() ); | 382 | readPls( DocLnk( fileref).file() ); |
395 | } else { | 383 | } else { |
396 | clearList(); | 384 | clearList(); |
397 | addToSelection( DocLnk( fileref ) ); | 385 | addToSelection( DocLnk( fileref ) ); |
398 | writeCurrentM3u(); | 386 | writeCurrentM3u(); |
399 | 387 | ||
400 | d->setDocumentUsed = TRUE; | 388 | d->setDocumentUsed = TRUE; |
401 | mediaPlayerState.setPlaying( FALSE ); | 389 | mediaPlayerState.setPlaying( FALSE ); |
402 | mediaPlayerState.setPlaying( TRUE ); | 390 | mediaPlayerState.setPlaying( TRUE ); |
403 | } | 391 | } |
404 | } | 392 | } |
405 | 393 | ||
406 | 394 | ||
407 | void PlayListWidget::useSelectedDocument() { | 395 | void PlayListWidget::useSelectedDocument() { |
408 | d->setDocumentUsed = FALSE; | 396 | d->setDocumentUsed = FALSE; |
409 | } | 397 | } |
410 | 398 | ||
411 | 399 | ||
412 | const DocLnk *PlayListWidget::current() const { // this is fugly | 400 | const DocLnk *PlayListWidget::current() const { // this is fugly |
413 | assert( currentTab() == CurrentPlayList ); | 401 | assert( currentTab() == CurrentPlayList ); |