author | simon <simon> | 2002-12-04 11:20:48 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 11:20:48 (UTC) |
commit | 84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95 (patch) (unidiff) | |
tree | bb84499e28cfb1d518e3cebf504eb9279257ced9 /noncore/multimedia/opieplayer2 | |
parent | 9b30090fddf1cc2e8ffbff70b164213118106167 (diff) | |
download | opie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.zip opie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.tar.gz opie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.tar.bz2 |
- merged popuplateAudioView and popuplateVideoView into one
PlayListFileView::popuplateView method
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (show whitespace changes)
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 @@ | |||
3 | 3 | ||
4 | #include <qfile.h> | ||
4 | #include <qpe/global.h> | 5 | #include <qpe/global.h> |
6 | #include <qpe/resource.h> | ||
5 | 7 | ||
6 | PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) | 8 | PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name ) |
7 | : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false ) | 9 | : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ) |
8 | { | 10 | { |
@@ -34,2 +36,30 @@ void PlayListFileView::scanFiles() | |||
34 | 36 | ||
37 | void PlayListFileView::populateView() | ||
38 | { | ||
39 | clear(); | ||
40 | |||
41 | if( !m_scannedFiles ) { | ||
42 | scanFiles(); | ||
43 | m_scannedFiles = true; | ||
44 | } | ||
45 | |||
46 | QString storage; | ||
47 | QListIterator<DocLnk> dit( m_files.children() ); | ||
48 | for ( ; dit.current(); ++dit ) { | ||
49 | |||
50 | QListViewItem *newItem; | ||
51 | |||
52 | if ( QFile::exists( dit.current()->file() ) || | ||
53 | dit.current()->file().left( 4 ) == "http" ) { | ||
54 | |||
55 | unsigned long size = QFile( dit.current()->file() ).size(); | ||
56 | |||
57 | newItem = new QListViewItem( this, dit.current()->name(), | ||
58 | QString::number( size ), "" /*storage*/, | ||
59 | dit.current()->file() ); | ||
60 | newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) ); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
35 | /* vim: et sw=4 ts=4 | 65 | /* 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 | |||
11 | public: | 11 | public: |
12 | PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 ); | 12 | PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); |
13 | virtual ~PlayListFileView(); | 13 | virtual ~PlayListFileView(); |
@@ -21,2 +21,3 @@ public slots: | |||
21 | void scanFiles(); | 21 | void scanFiles(); |
22 | void populateView(); | ||
22 | 23 | ||
@@ -24,2 +25,3 @@ private: | |||
24 | QString m_mimeTypePattern; | 25 | QString m_mimeTypePattern; |
26 | QString m_itemPixmapName; | ||
25 | DocLnkSet m_files; | 27 | 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() { | |||
649 | void PlayListWidget::populateAudioView() { | 649 | void PlayListWidget::populateAudioView() { |
650 | audioView->clear(); | 650 | audioView->populateView(); |
651 | StorageInfo storageInfo; | ||
652 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
653 | if(!audioView->scannedFiles()) { | ||
654 | scanForAudio(); | ||
655 | } | ||
656 | |||
657 | QListIterator<DocLnk> dit( audioView->files().children() ); | ||
658 | // QListIterator<FileSystem> it ( fs ); | ||
659 | audioView->clear(); | ||
660 | |||
661 | QString storage; | ||
662 | for ( ; dit.current(); ++dit ) { | ||
663 | // // for( ; it.current(); ++it ){ | ||
664 | // const QString name = (*dit)->name(); | ||
665 | // const QString path = (*dit)->path(); | ||
666 | // if(dit.current()->file().find(path) != -1 ) { | ||
667 | // storage = name; | ||
668 | // // } | ||
669 | // } | ||
670 | |||
671 | QListViewItem * newItem; | ||
672 | if ( QFile( dit.current()->file()).exists() || | ||
673 | dit.current()->file().left(4) == "http" ) { | ||
674 | long size; | ||
675 | if( dit.current()->file().left(4) == "http" ) | ||
676 | size=0; | ||
677 | else | ||
678 | size = QFile( dit.current()->file() ).size(); | ||
679 | |||
680 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | ||
681 | QString::number(size ), "" /*storage*/, | ||
682 | dit.current()->file() ); | ||
683 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | ||
684 | // qDebug("<<<< "+dit.current()->file()); | ||
685 | } | ||
686 | } | ||
687 | audioPopulated=true; | 651 | audioPopulated=true; |
@@ -689,34 +653,4 @@ void PlayListWidget::populateAudioView() { | |||
689 | 653 | ||
690 | |||
691 | void PlayListWidget::populateVideoView() { | 654 | void PlayListWidget::populateVideoView() { |
692 | videoView->clear(); | 655 | videoView->populateView(); |
693 | StorageInfo storageInfo; | ||
694 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
695 | |||
696 | if(!videoView->scannedFiles()) { | ||
697 | scanForVideo(); | ||
698 | } | ||
699 | |||
700 | QListIterator<DocLnk> Vdit( videoView->files().children() ); | ||
701 | // QListIterator<FileSystem> it ( fs ); | ||
702 | videoView->clear(); | ||
703 | QString storage, pathName; | ||
704 | for ( ; Vdit.current(); ++Vdit ) { | ||
705 | // // for( ; it.current(); ++it ) { | ||
706 | // const QString name = (*Vdit)->name(); | ||
707 | // const QString path = (*Vdit)->path(); | ||
708 | // if( Vdit.current()->file().find(path) != -1 ) { | ||
709 | // storage=name; | ||
710 | // pathName=path; | ||
711 | // // } | ||
712 | // } | ||
713 | |||
714 | QListViewItem * newItem; | ||
715 | if ( QFile( Vdit.current()->file() ).exists() ) { | ||
716 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | ||
717 | QString::number( QFile( Vdit.current()->file() ).size() ), | ||
718 | ""/*storage*/, Vdit.current()->file()); | ||
719 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | ||
720 | } | ||
721 | } | ||
722 | videoPopulated=true; | 656 | 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 | |||
153 | // no m3u's here please | 153 | // no m3u's here please |
154 | audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" ); | 154 | audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" ); |
155 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 155 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
@@ -165,3 +165,3 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
165 | Vlayout->setMargin( 2 ); | 165 | Vlayout->setMargin( 2 ); |
166 | videoView = new PlayListFileView( "video/*", vTab, "Videoview" ); | 166 | videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); |
167 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 167 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |