summaryrefslogtreecommitdiff
path: root/noncore
authorsimon <simon>2002-12-04 10:52:00 (UTC)
committer simon <simon>2002-12-04 10:52:00 (UTC)
commit63541c46776721ef5ae63903e5b40838c1c49a43 (patch) (side-by-side diff)
treee9beaf0d1340b32a7fffdce8e6dad7b0cbc54866 /noncore
parentd000538b68b3411a409e829c4e68f42f9646b940 (diff)
downloadopie-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') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h13
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h4
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
@@ -1,8 +1,10 @@
#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);
addColumn( tr( "Size" ), -1 );
@@ -20,5 +22,15 @@ 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
@@ -3,12 +3,23 @@
#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;
};
#endif // PLAYLISTFILEVIEW_H
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
@@ -49,6 +49,7 @@
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "om3u.h"
+#include "playlistfileview.h"
//only needed for the random play
#include <stdlib.h>
@@ -61,9 +62,6 @@ extern MediaPlayerState *mediaPlayerState;
// extern AudioWidget *audioUI;
// 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 ) {
@@ -639,26 +637,13 @@ 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();
}
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();
}
@@ -671,7 +656,7 @@ void PlayListWidget::populateAudioView() {
scanForAudio();
}
- QListIterator<DocLnk> dit( files.children() );
+ QListIterator<DocLnk> dit( audioView->files().children() );
// QListIterator<FileSystem> it ( fs );
audioView->clear();
@@ -714,7 +699,7 @@ void PlayListWidget::populateVideoView() {
scanForVideo();
}
- QListIterator<DocLnk> Vdit( vFiles.children() );
+ QListIterator<DocLnk> Vdit( videoView->files().children() );
// QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage, pathName;
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
@@ -134,8 +134,6 @@ private slots:
void playSelected();
private:
- DocLnkSet files;
- DocLnkSet vFiles;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef, currentPlayList;
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
@@ -150,7 +150,8 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
QGridLayout *Alayout = new QGridLayout( aTab );
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" ) );
@@ -162,7 +163,7 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
QGridLayout *Vlayout = new QGridLayout( vTab );
Vlayout->setSpacing( 2 );
Vlayout->setMargin( 2 );
- videoView = new PlayListFileView( vTab, "Videoview" );
+ videoView = new PlayListFileView( "video/*", vTab, "Videoview" );
Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
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
@@ -50,6 +50,7 @@
class PlayListWidgetPrivate;
class PlayListSelection;
class MediaPlayerState;
+class PlayListFileView;
class Config;
class QPEToolBar;
@@ -101,7 +102,8 @@ public:
protected:
QTabWidget * tabWidget;
- QListView *audioView, *videoView, *playlistView;
+ PlayListFileView *audioView, *videoView;
+ QListView *playlistView;
QLabel *libString;
QPopupMenu *pmView ;
QPopupMenu *gammaMenu;