author | simon <simon> | 2002-12-04 10:52:00 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 10:52:00 (UTC) |
commit | 63541c46776721ef5ae63903e5b40838c1c49a43 (patch) (side-by-side diff) | |
tree | e9beaf0d1340b32a7fffdce8e6dad7b0cbc54866 /noncore | |
parent | d000538b68b3411a409e829c4e68f42f9646b940 (diff) | |
download | opie-63541c46776721ef5ae63903e5b40838c1c49a43.zip opie-63541c46776721ef5ae63903e5b40838c1c49a43.tar.gz opie-63541c46776721ef5ae63903e5b40838c1c49a43.tar.bz2 |
- merged scanForVideo and scanForAudio into a common scanFiles method in
the PlayListFileView. less duplicated code :)
6 files changed, 37 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp index c4f93e7..2726296 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.cpp +++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp @@ -3,4 +3,6 @@ -PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) - : PlayListView( parent, name ) +#include <qpe/global.h> + +PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) + : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ) { @@ -22,2 +24,12 @@ PlayListFileView::~PlayListFileView() +void PlayListFileView::scanFiles() +{ + m_files.detachChildren(); + QListIterator<DocLnk> sdit( m_files.children() ); + for ( ; sdit.current(); ++sdit ) + delete sdit.current(); + + Global::findDocuments( &m_files, m_mimeTypePattern ); +} + /* vim: et sw=4 ts=4 diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h index eef4bd1..08db929 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.h +++ b/noncore/multimedia/opieplayer2/playlistfileview.h @@ -5,2 +5,4 @@ +#include <qpe/applnk.h> + class PlayListFileView : public PlayListView @@ -9,4 +11,13 @@ class PlayListFileView : public PlayListView public: - PlayListFileView( QWidget *parent, const char *name = 0 ); + PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 ); virtual ~PlayListFileView(); + + DocLnkSet &files() { return m_files; } + +public slots: + void scanFiles(); + +private: + QString m_mimeTypePattern; + DocLnkSet m_files; }; diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6bda71e..93e7919 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -51,2 +51,3 @@ #include "om3u.h" +#include "playlistfileview.h" @@ -63,5 +64,2 @@ extern MediaPlayerState *mediaPlayerState; -QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; -// no m3u's here please - PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) @@ -641,10 +639,3 @@ void PlayListWidget::playSelected() { void PlayListWidget::scanForAudio() { -// qDebug("scan for audio"); - files.detachChildren(); - QListIterator<DocLnk> sdit( files.children() ); - for ( ; sdit.current(); ++sdit ) { - delete sdit.current(); - } -// Global::findDocuments( &files, "audio/*"); - Global::findDocuments( &files, audioMimes); + audioView->scanFiles(); audioScan = true; @@ -654,9 +645,3 @@ void PlayListWidget::scanForAudio() { void PlayListWidget::scanForVideo() { -// qDebug("scan for video"); - vFiles.detachChildren(); - QListIterator<DocLnk> sdit( vFiles.children() ); - for ( ; sdit.current(); ++sdit ) { - delete sdit.current(); - } - Global::findDocuments(&vFiles, "video/*"); + videoView->scanFiles(); videoScan = true; @@ -673,3 +658,3 @@ void PlayListWidget::populateAudioView() { - QListIterator<DocLnk> dit( files.children() ); + QListIterator<DocLnk> dit( audioView->files().children() ); // QListIterator<FileSystem> it ( fs ); @@ -716,3 +701,3 @@ void PlayListWidget::populateVideoView() { - QListIterator<DocLnk> Vdit( vFiles.children() ); + QListIterator<DocLnk> Vdit( videoView->files().children() ); // QListIterator<FileSystem> it ( fs ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 62d78a2..e81ef3c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -136,4 +136,2 @@ private slots: private: - DocLnkSet files; - DocLnkSet vFiles; bool fromSetDocument; diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index cfca5e3..a219cfd 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -152,3 +152,4 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg Alayout->setMargin( 2 ); - audioView = new PlayListFileView( aTab, "Audioview" ); + // no m3u's here please + audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" ); Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); @@ -164,3 +165,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg Vlayout->setMargin( 2 ); - videoView = new PlayListFileView( vTab, "Videoview" ); + videoView = new PlayListFileView( "video/*", vTab, "Videoview" ); Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h index 9b5252a..0d8af43 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h @@ -52,2 +52,3 @@ class PlayListSelection; class MediaPlayerState; +class PlayListFileView; @@ -103,3 +104,4 @@ protected: QTabWidget * tabWidget; - QListView *audioView, *videoView, *playlistView; + PlayListFileView *audioView, *videoView; + QListView *playlistView; QLabel *libString; |