summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp34
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp70
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp4
4 files changed, 39 insertions, 73 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index 1e2ef89..0ed1061 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -3,6 +3,8 @@
+#include <qfile.h>
#include <qpe/global.h>
+#include <qpe/resource.h>
-PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name )
- : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false )
+PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name )
+ : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false )
{
@@ -34,2 +36,30 @@ void PlayListFileView::scanFiles()
+void PlayListFileView::populateView()
+{
+ clear();
+
+ if( !m_scannedFiles ) {
+ scanFiles();
+ m_scannedFiles = true;
+ }
+
+ QString storage;
+ QListIterator<DocLnk> dit( m_files.children() );
+ for ( ; dit.current(); ++dit ) {
+
+ QListViewItem *newItem;
+
+ if ( QFile::exists( dit.current()->file() ) ||
+ dit.current()->file().left( 4 ) == "http" ) {
+
+ unsigned long size = QFile( dit.current()->file() ).size();
+
+ newItem = new QListViewItem( this, dit.current()->name(),
+ QString::number( size ), "" /*storage*/,
+ dit.current()->file() );
+ newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) );
+ }
+ }
+}
+
/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 4e17966..a00349e 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -11,3 +11,3 @@ class PlayListFileView : public PlayListView
public:
- PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 );
+ PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
virtual ~PlayListFileView();
@@ -21,2 +21,3 @@ public slots:
void scanFiles();
+ void populateView();
@@ -24,2 +25,3 @@ private:
QString m_mimeTypePattern;
+ QString m_itemPixmapName;
DocLnkSet m_files;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 12b8a71..460a0bf 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -649,39 +649,3 @@ void PlayListWidget::scanForVideo() {
void PlayListWidget::populateAudioView() {
- audioView->clear();
- StorageInfo storageInfo;
- // const QList<FileSystem> &fs = storageInfo.fileSystems();
- 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();
-// if(dit.current()->file().find(path) != -1 ) {
-// storage = name;
-// // }
-// }
-
- QListViewItem * newItem;
- if ( QFile( dit.current()->file()).exists() ||
- dit.current()->file().left(4) == "http" ) {
- long size;
- if( dit.current()->file().left(4) == "http" )
- size=0;
- else
- size = QFile( dit.current()->file() ).size();
-
- newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
- QString::number(size ), "" /*storage*/,
- dit.current()->file() );
- newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
-// qDebug("<<<< "+dit.current()->file());
- }
- }
+ audioView->populateView();
audioPopulated=true;
@@ -689,34 +653,4 @@ void PlayListWidget::populateAudioView() {
-
void PlayListWidget::populateVideoView() {
- videoView->clear();
- StorageInfo storageInfo;
- // const QList<FileSystem> &fs = storageInfo.fileSystems();
-
- 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 ) {
-// storage=name;
-// pathName=path;
-// // }
-// }
-
- QListViewItem * newItem;
- if ( QFile( Vdit.current()->file() ).exists() ) {
- newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
- QString::number( QFile( Vdit.current()->file() ).size() ),
- ""/*storage*/, Vdit.current()->file());
- newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
- }
- }
+ videoView->populateView();
videoPopulated=true;
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index a219cfd..7f851bd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -153,3 +153,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
// no m3u's here please
- audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" );
+ audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" );
Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
@@ -165,3 +165,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
Vlayout->setMargin( 2 );
- videoView = new PlayListFileView( "video/*", vTab, "Videoview" );
+ videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );