-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 | |||
@@ -229,145 +229,133 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , in | |||
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(); |