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/multimedia/opieplayer2 | |
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 :)
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
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 @@ -2,6 +2,8 @@ #include "playlistfileview.h" -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 ) { addColumn( tr( "Title" ), 140); @@ -21,4 +23,14 @@ 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 @@ -4,10 +4,21 @@ #include "playlistview.h" +#include <qpe/applnk.h> + class PlayListFileView : public PlayListView { Q_OBJECT 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 @@ -50,4 +50,5 @@ #include "inputDialog.h" #include "om3u.h" +#include "playlistfileview.h" //only needed for the random play @@ -62,7 +63,4 @@ extern MediaPlayerState *mediaPlayerState; // extern VideoWidget *videoUI; -QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; -// no m3u's here please - PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : PlayListWidgetGui( mediaPlayerState, parent, name ) { @@ -640,12 +638,5 @@ 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; populateAudioView(); @@ -653,11 +644,5 @@ 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; populateVideoView(); @@ -672,5 +657,5 @@ void PlayListWidget::populateAudioView() { } - QListIterator<DocLnk> dit( files.children() ); + QListIterator<DocLnk> dit( audioView->files().children() ); // QListIterator<FileSystem> it ( fs ); audioView->clear(); @@ -715,5 +700,5 @@ void PlayListWidget::populateVideoView() { } - QListIterator<DocLnk> Vdit( vFiles.children() ); + QListIterator<DocLnk> Vdit( videoView->files().children() ); // QListIterator<FileSystem> it ( fs ); videoView->clear(); 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 @@ -135,6 +135,4 @@ private slots: private: - DocLnkSet files; - DocLnkSet vFiles; bool fromSetDocument; bool insanityBool; 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 @@ -151,5 +151,6 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg Alayout->setSpacing( 2 ); 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 ); tabWidget->insertTab( aTab, tr( "Audio" ) ); @@ -163,5 +164,5 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg Vlayout->setSpacing( 2 ); 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 @@ -51,4 +51,5 @@ class PlayListWidgetPrivate; class PlayListSelection; class MediaPlayerState; +class PlayListFileView; class Config; @@ -102,5 +103,6 @@ public: protected: QTabWidget * tabWidget; - QListView *audioView, *videoView, *playlistView; + PlayListFileView *audioView, *videoView; + QListView *playlistView; QLabel *libString; QPopupMenu *pmView ; |