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 @@ #include "playlistfileview.h" #include <qpe/global.h> PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) - : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ) + : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false ) { addColumn( tr( "Title" ), 140); addColumn( tr( "Size" ), -1 ); addColumn(tr( "Media" ), 0 ); addColumn(tr( "Path" ), -1 ); setColumnAlignment( 1, Qt::AlignRight ); setColumnAlignment( 2, Qt::AlignRight ); setAllColumnsShowFocus( TRUE ); setSorting( 3, TRUE ); setMultiSelection( TRUE ); setSelectionMode( QListView::Extended ); } 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 @@ #include "playlistview.h" #include <qpe/applnk.h> class PlayListFileView : public PlayListView { Q_OBJECT public: PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 ); virtual ~PlayListFileView(); + // both temporarily accessible that way until the caller code has + // been migrated into this class DocLnkSet &files() { return m_files; } + bool &scannedFiles() { return m_scannedFiles; } public slots: void scanFiles(); private: QString m_mimeTypePattern; DocLnkSet m_files; + bool m_scannedFiles; }; #endif // PLAYLISTFILEVIEW_H /* vim: et sw=4 ts=4 */ 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 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); connect ( gammaSlider, SIGNAL( valueChanged( int ) ), &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed - videoScan=false; - audioScan=false; audioPopulated=false; videoPopulated=false; populateSkinsMenu(); initializeStates(); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); loadList(DocLnk( currentPlaylist ) ); } PlayListWidget::~PlayListWidget() { @@ -245,41 +243,41 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi m.exec( QCursor::pos() ); } break; } } void PlayListWidget::addAllToList() { // QTime t; // t.start(); - if(!audioScan) { + if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) populateAudioView(); } QListViewItemIterator audioIt( audioView ); DocLnk lnk; QString filename; // iterate through all items of the listview for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } - if(!videoScan) { + if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) populateVideoView(); } QListViewItemIterator videoIt( videoView ); for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } @@ -305,25 +303,25 @@ void PlayListWidget::addAllToList() { // qDebug("elapsed time %d", t.elapsed() ); tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllMusicToList() { - if(!audioScan) { + if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) populateAudioView(); } QListViewItemIterator audioIt( audioView ); DocLnk lnk; QString filename; // iterate through all items of the listview for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name @@ -338,25 +336,25 @@ void PlayListWidget::addAllMusicToList() { d->selectedFiles->addToSelection( **dit ); } } */ tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllVideoToList() { - if(!videoScan) { + if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) populateVideoView(); } QListViewItemIterator videoIt( videoView ); DocLnk lnk; QString filename; for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); @@ -629,39 +627,39 @@ void PlayListWidget::deletePlaylist() { break; }; } void PlayListWidget::playSelected() { btnPlay( TRUE); } void PlayListWidget::scanForAudio() { audioView->scanFiles(); - audioScan = true; + audioView->scannedFiles() = true; populateAudioView(); } void PlayListWidget::scanForVideo() { videoView->scanFiles(); - videoScan = true; + videoView->scannedFiles() = true; populateVideoView(); } void PlayListWidget::populateAudioView() { audioView->clear(); StorageInfo storageInfo; // const QList<FileSystem> &fs = storageInfo.fileSystems(); - if(!audioScan) { + if(!audioView->scannedFiles()) { scanForAudio(); } QListIterator<DocLnk> dit( audioView->files().children() ); // QListIterator<FileSystem> it ( fs ); audioView->clear(); QString storage; for ( ; dit.current(); ++dit ) { // // for( ; it.current(); ++it ){ // const QString name = (*dit)->name(); // const QString path = (*dit)->path(); @@ -686,25 +684,25 @@ void PlayListWidget::populateAudioView() { // qDebug("<<<< "+dit.current()->file()); } } audioPopulated=true; } void PlayListWidget::populateVideoView() { videoView->clear(); StorageInfo storageInfo; // const QList<FileSystem> &fs = storageInfo.fileSystems(); - if(!videoScan ) { + if(!videoView->scannedFiles()) { scanForVideo(); } QListIterator<DocLnk> Vdit( videoView->files().children() ); // QListIterator<FileSystem> it ( fs ); videoView->clear(); QString storage, pathName; for ( ; Vdit.current(); ++Vdit ) { // // for( ; it.current(); ++it ) { // const QString name = (*Vdit)->name(); // const QString path = (*Vdit)->path(); // 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: bool next(); bool prev(); void writeDefaultPlaylist( ); QString currentFileListPathName() const; protected: void keyReleaseEvent( QKeyEvent *e); signals: void skinSelected(); private: int defaultSkinIndex; - bool audioScan, videoScan, audioPopulated, videoPopulated; + bool audioPopulated, videoPopulated; void readm3u(const QString &); void readPls(const QString &); void initializeStates(); void populateAudioView(); void populateVideoView(); QListView *currentFileListView() const; bool inFileListMode() const; private slots: void populateSkinsMenu(); |