summaryrefslogtreecommitdiff
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
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 (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,9 +1,11 @@
#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 );
addColumn(tr( "Media" ), 0 );
@@ -19,6 +21,16 @@ PlayListFileView::PlayListFileView( QWidget *parent, const char *name )
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
@@ -2,14 +2,25 @@
#define PLAYLISTFILEVIEW_H
#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
/* vim: et sw=4 ts=4
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
@@ -48,8 +48,9 @@
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "om3u.h"
+#include "playlistfileview.h"
//only needed for the random play
#include <stdlib.h>
#include <assert.h>
@@ -60,11 +61,8 @@
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 ) {
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
@@ -638,28 +636,15 @@ 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();
}
@@ -670,9 +655,9 @@ void PlayListWidget::populateAudioView() {
if(!audioScan) {
scanForAudio();
}
- QListIterator<DocLnk> dit( files.children() );
+ QListIterator<DocLnk> dit( audioView->files().children() );
// QListIterator<FileSystem> it ( fs );
audioView->clear();
QString storage;
@@ -713,9 +698,9 @@ void PlayListWidget::populateVideoView() {
if(!videoScan ) {
scanForVideo();
}
- QListIterator<DocLnk> Vdit( vFiles.children() );
+ QListIterator<DocLnk> Vdit( videoView->files().children() );
// QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage, pathName;
for ( ; Vdit.current(); ++Vdit ) {
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
@@ -133,10 +133,8 @@ private slots:
void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
void playSelected();
private:
- DocLnkSet files;
- DocLnkSet vFiles;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef, currentPlayList;
int selected;
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
@@ -149,9 +149,10 @@ 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" ) );
QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
@@ -161,9 +162,9 @@ 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
@@ -49,8 +49,9 @@
class PlayListWidgetPrivate;
class PlayListSelection;
class MediaPlayerState;
+class PlayListFileView;
class Config;
class QPEToolBar;
class QListViewItem;
@@ -100,9 +101,10 @@ public:
~PlayListWidgetGui();
protected:
QTabWidget * tabWidget;
- QListView *audioView, *videoView, *playlistView;
+ PlayListFileView *audioView, *videoView;
+ QListView *playlistView;
QLabel *libString;
QPopupMenu *pmView ;
QPopupMenu *gammaMenu;
QSlider *gammaSlider;