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 | |
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') (more/less context) (show whitespace changes)
4 files changed, 14 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp index 2726296..1e2ef89 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.cpp +++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp | |||
@@ -1,19 +1,19 @@ | |||
1 | 1 | ||
2 | #include "playlistfileview.h" | 2 | #include "playlistfileview.h" |
3 | 3 | ||
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | 5 | ||
6 | PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) | 6 | PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) |
7 | : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ) | 7 | : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false ) |
8 | { | 8 | { |
9 | addColumn( tr( "Title" ), 140); | 9 | addColumn( tr( "Title" ), 140); |
10 | addColumn( tr( "Size" ), -1 ); | 10 | addColumn( tr( "Size" ), -1 ); |
11 | addColumn(tr( "Media" ), 0 ); | 11 | addColumn(tr( "Media" ), 0 ); |
12 | addColumn(tr( "Path" ), -1 ); | 12 | addColumn(tr( "Path" ), -1 ); |
13 | setColumnAlignment( 1, Qt::AlignRight ); | 13 | setColumnAlignment( 1, Qt::AlignRight ); |
14 | setColumnAlignment( 2, Qt::AlignRight ); | 14 | setColumnAlignment( 2, Qt::AlignRight ); |
15 | setAllColumnsShowFocus( TRUE ); | 15 | setAllColumnsShowFocus( TRUE ); |
16 | setSorting( 3, TRUE ); | 16 | setSorting( 3, TRUE ); |
17 | setMultiSelection( TRUE ); | 17 | setMultiSelection( TRUE ); |
18 | setSelectionMode( QListView::Extended ); | 18 | setSelectionMode( QListView::Extended ); |
19 | } | 19 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h index 08db929..4e17966 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.h +++ b/noncore/multimedia/opieplayer2/playlistfileview.h | |||
@@ -3,25 +3,29 @@ | |||
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, QWidget *parent, const char *name = 0 ); | 12 | PlayListFileView( const QString &mimeTypePattern, 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 | ||
15 | DocLnkSet &files() { return m_files; } | 17 | DocLnkSet &files() { return m_files; } |
18 | bool &scannedFiles() { return m_scannedFiles; } | ||
16 | 19 | ||
17 | public slots: | 20 | public slots: |
18 | void scanFiles(); | 21 | void scanFiles(); |
19 | 22 | ||
20 | private: | 23 | private: |
21 | QString m_mimeTypePattern; | 24 | QString m_mimeTypePattern; |
22 | DocLnkSet m_files; | 25 | DocLnkSet m_files; |
26 | bool m_scannedFiles; | ||
23 | }; | 27 | }; |
24 | 28 | ||
25 | #endif // PLAYLISTFILEVIEW_H | 29 | #endif // PLAYLISTFILEVIEW_H |
26 | /* vim: et sw=4 ts=4 | 30 | /* vim: et sw=4 ts=4 |
27 | */ | 31 | */ |
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 | |||
@@ -142,26 +142,24 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
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() { |
@@ -245,41 +243,41 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi | |||
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 | ||
@@ -305,25 +303,25 @@ void PlayListWidget::addAllToList() { | |||
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 |
@@ -338,25 +336,25 @@ void PlayListWidget::addAllMusicToList() { | |||
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); |
@@ -629,39 +627,39 @@ void PlayListWidget::deletePlaylist() { | |||
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(); |
@@ -686,25 +684,25 @@ void PlayListWidget::populateAudioView() { | |||
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 ) { |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index e81ef3c..58efd47 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -85,25 +85,25 @@ public slots: | |||
85 | bool next(); | 85 | bool next(); |
86 | bool prev(); | 86 | bool prev(); |
87 | void writeDefaultPlaylist( ); | 87 | void writeDefaultPlaylist( ); |
88 | QString currentFileListPathName() const; | 88 | QString currentFileListPathName() const; |
89 | protected: | 89 | protected: |
90 | void keyReleaseEvent( QKeyEvent *e); | 90 | void keyReleaseEvent( QKeyEvent *e); |
91 | 91 | ||
92 | signals: | 92 | signals: |
93 | void skinSelected(); | 93 | void skinSelected(); |
94 | 94 | ||
95 | private: | 95 | private: |
96 | int defaultSkinIndex; | 96 | int defaultSkinIndex; |
97 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 97 | bool audioPopulated, videoPopulated; |
98 | void readm3u(const QString &); | 98 | void readm3u(const QString &); |
99 | void readPls(const QString &); | 99 | void readPls(const QString &); |
100 | void initializeStates(); | 100 | void initializeStates(); |
101 | void populateAudioView(); | 101 | void populateAudioView(); |
102 | void populateVideoView(); | 102 | void populateVideoView(); |
103 | 103 | ||
104 | QListView *currentFileListView() const; | 104 | QListView *currentFileListView() const; |
105 | 105 | ||
106 | bool inFileListMode() const; | 106 | bool inFileListMode() const; |
107 | 107 | ||
108 | private slots: | 108 | private slots: |
109 | void populateSkinsMenu(); | 109 | void populateSkinsMenu(); |