author | simon <simon> | 2002-12-04 10:52:00 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 10:52:00 (UTC) |
commit | 63541c46776721ef5ae63903e5b40838c1c49a43 (patch) (unidiff) | |
tree | e9beaf0d1340b32a7fffdce8e6dad7b0cbc54866 | |
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 :)
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 @@ | |||
1 | 1 | ||
2 | #include "playlistfileview.h" | 2 | #include "playlistfileview.h" |
3 | 3 | ||
4 | PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) | 4 | #include <qpe/global.h> |
5 | : PlayListView( parent, name ) | 5 | |
6 | PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) | ||
7 | : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ) | ||
6 | { | 8 | { |
7 | addColumn( tr( "Title" ), 140); | 9 | addColumn( tr( "Title" ), 140); |
8 | addColumn( tr( "Size" ), -1 ); | 10 | addColumn( tr( "Size" ), -1 ); |
9 | addColumn(tr( "Media" ), 0 ); | 11 | addColumn(tr( "Media" ), 0 ); |
@@ -19,6 +21,16 @@ PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) | |||
19 | PlayListFileView::~PlayListFileView() | 21 | PlayListFileView::~PlayListFileView() |
20 | { | 22 | { |
21 | } | 23 | } |
22 | 24 | ||
25 | void PlayListFileView::scanFiles() | ||
26 | { | ||
27 | m_files.detachChildren(); | ||
28 | QListIterator<DocLnk> sdit( m_files.children() ); | ||
29 | for ( ; sdit.current(); ++sdit ) | ||
30 | delete sdit.current(); | ||
31 | |||
32 | Global::findDocuments( &m_files, m_mimeTypePattern ); | ||
33 | } | ||
34 | |||
23 | /* vim: et sw=4 ts=4 | 35 | /* vim: et sw=4 ts=4 |
24 | */ | 36 | */ |
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 @@ | |||
2 | #define PLAYLISTFILEVIEW_H | 2 | #define PLAYLISTFILEVIEW_H |
3 | 3 | ||
4 | #include "playlistview.h" | 4 | #include "playlistview.h" |
5 | 5 | ||
6 | #include <qpe/applnk.h> | ||
7 | |||
6 | class PlayListFileView : public PlayListView | 8 | class PlayListFileView : public PlayListView |
7 | { | 9 | { |
8 | Q_OBJECT | 10 | Q_OBJECT |
9 | public: | 11 | public: |
10 | PlayListFileView( QWidget *parent, const char *name = 0 ); | 12 | PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 ); |
11 | virtual ~PlayListFileView(); | 13 | virtual ~PlayListFileView(); |
14 | |||
15 | DocLnkSet &files() { return m_files; } | ||
16 | |||
17 | public slots: | ||
18 | void scanFiles(); | ||
19 | |||
20 | private: | ||
21 | QString m_mimeTypePattern; | ||
22 | DocLnkSet m_files; | ||
12 | }; | 23 | }; |
13 | 24 | ||
14 | #endif // PLAYLISTFILEVIEW_H | 25 | #endif // PLAYLISTFILEVIEW_H |
15 | /* vim: et sw=4 ts=4 | 26 | /* 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 @@ | |||
48 | #include "playlistwidget.h" | 48 | #include "playlistwidget.h" |
49 | #include "mediaplayerstate.h" | 49 | #include "mediaplayerstate.h" |
50 | #include "inputDialog.h" | 50 | #include "inputDialog.h" |
51 | #include "om3u.h" | 51 | #include "om3u.h" |
52 | #include "playlistfileview.h" | ||
52 | 53 | ||
53 | //only needed for the random play | 54 | //only needed for the random play |
54 | #include <stdlib.h> | 55 | #include <stdlib.h> |
55 | #include <assert.h> | 56 | #include <assert.h> |
@@ -60,11 +61,8 @@ | |||
60 | extern MediaPlayerState *mediaPlayerState; | 61 | extern MediaPlayerState *mediaPlayerState; |
61 | // extern AudioWidget *audioUI; | 62 | // extern AudioWidget *audioUI; |
62 | // extern VideoWidget *videoUI; | 63 | // extern VideoWidget *videoUI; |
63 | 64 | ||
64 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | ||
65 | // no m3u's here please | ||
66 | |||
67 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 65 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
68 | : PlayListWidgetGui( mediaPlayerState, parent, name ) { | 66 | : PlayListWidgetGui( mediaPlayerState, parent, name ) { |
69 | 67 | ||
70 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 68 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
@@ -638,28 +636,15 @@ void PlayListWidget::playSelected() { | |||
638 | } | 636 | } |
639 | 637 | ||
640 | 638 | ||
641 | void PlayListWidget::scanForAudio() { | 639 | void PlayListWidget::scanForAudio() { |
642 | // qDebug("scan for audio"); | 640 | audioView->scanFiles(); |
643 | files.detachChildren(); | ||
644 | QListIterator<DocLnk> sdit( files.children() ); | ||
645 | for ( ; sdit.current(); ++sdit ) { | ||
646 | delete sdit.current(); | ||
647 | } | ||
648 | // Global::findDocuments( &files, "audio/*"); | ||
649 | Global::findDocuments( &files, audioMimes); | ||
650 | audioScan = true; | 641 | audioScan = true; |
651 | populateAudioView(); | 642 | populateAudioView(); |
652 | } | 643 | } |
653 | 644 | ||
654 | void PlayListWidget::scanForVideo() { | 645 | void PlayListWidget::scanForVideo() { |
655 | // qDebug("scan for video"); | 646 | videoView->scanFiles(); |
656 | vFiles.detachChildren(); | ||
657 | QListIterator<DocLnk> sdit( vFiles.children() ); | ||
658 | for ( ; sdit.current(); ++sdit ) { | ||
659 | delete sdit.current(); | ||
660 | } | ||
661 | Global::findDocuments(&vFiles, "video/*"); | ||
662 | videoScan = true; | 647 | videoScan = true; |
663 | populateVideoView(); | 648 | populateVideoView(); |
664 | } | 649 | } |
665 | 650 | ||
@@ -670,9 +655,9 @@ void PlayListWidget::populateAudioView() { | |||
670 | if(!audioScan) { | 655 | if(!audioScan) { |
671 | scanForAudio(); | 656 | scanForAudio(); |
672 | } | 657 | } |
673 | 658 | ||
674 | QListIterator<DocLnk> dit( files.children() ); | 659 | QListIterator<DocLnk> dit( audioView->files().children() ); |
675 | // QListIterator<FileSystem> it ( fs ); | 660 | // QListIterator<FileSystem> it ( fs ); |
676 | audioView->clear(); | 661 | audioView->clear(); |
677 | 662 | ||
678 | QString storage; | 663 | QString storage; |
@@ -713,9 +698,9 @@ void PlayListWidget::populateVideoView() { | |||
713 | if(!videoScan ) { | 698 | if(!videoScan ) { |
714 | scanForVideo(); | 699 | scanForVideo(); |
715 | } | 700 | } |
716 | 701 | ||
717 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 702 | QListIterator<DocLnk> Vdit( videoView->files().children() ); |
718 | // QListIterator<FileSystem> it ( fs ); | 703 | // QListIterator<FileSystem> it ( fs ); |
719 | videoView->clear(); | 704 | videoView->clear(); |
720 | QString storage, pathName; | 705 | QString storage, pathName; |
721 | for ( ; Vdit.current(); ++Vdit ) { | 706 | 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: | |||
133 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 133 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
134 | void playSelected(); | 134 | void playSelected(); |
135 | 135 | ||
136 | private: | 136 | private: |
137 | DocLnkSet files; | ||
138 | DocLnkSet vFiles; | ||
139 | bool fromSetDocument; | 137 | bool fromSetDocument; |
140 | bool insanityBool; | 138 | bool insanityBool; |
141 | QString setDocFileRef, currentPlayList; | 139 | QString setDocFileRef, currentPlayList; |
142 | int selected; | 140 | 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 | |||
149 | 149 | ||
150 | QGridLayout *Alayout = new QGridLayout( aTab ); | 150 | QGridLayout *Alayout = new QGridLayout( aTab ); |
151 | Alayout->setSpacing( 2 ); | 151 | Alayout->setSpacing( 2 ); |
152 | Alayout->setMargin( 2 ); | 152 | Alayout->setMargin( 2 ); |
153 | audioView = new PlayListFileView( aTab, "Audioview" ); | 153 | // no m3u's here please |
154 | audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" ); | ||
154 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 155 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
155 | tabWidget->insertTab( aTab, tr( "Audio" ) ); | 156 | tabWidget->insertTab( aTab, tr( "Audio" ) ); |
156 | 157 | ||
157 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); | 158 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); |
@@ -161,9 +162,9 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
161 | 162 | ||
162 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 163 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
163 | Vlayout->setSpacing( 2 ); | 164 | Vlayout->setSpacing( 2 ); |
164 | Vlayout->setMargin( 2 ); | 165 | Vlayout->setMargin( 2 ); |
165 | videoView = new PlayListFileView( vTab, "Videoview" ); | 166 | videoView = new PlayListFileView( "video/*", vTab, "Videoview" ); |
166 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 167 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
167 | 168 | ||
168 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); | 169 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); |
169 | 170 | ||
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 @@ | |||
49 | 49 | ||
50 | class PlayListWidgetPrivate; | 50 | class PlayListWidgetPrivate; |
51 | class PlayListSelection; | 51 | class PlayListSelection; |
52 | class MediaPlayerState; | 52 | class MediaPlayerState; |
53 | class PlayListFileView; | ||
53 | 54 | ||
54 | class Config; | 55 | class Config; |
55 | class QPEToolBar; | 56 | class QPEToolBar; |
56 | class QListViewItem; | 57 | class QListViewItem; |
@@ -100,9 +101,10 @@ public: | |||
100 | ~PlayListWidgetGui(); | 101 | ~PlayListWidgetGui(); |
101 | 102 | ||
102 | protected: | 103 | protected: |
103 | QTabWidget * tabWidget; | 104 | QTabWidget * tabWidget; |
104 | QListView *audioView, *videoView, *playlistView; | 105 | PlayListFileView *audioView, *videoView; |
106 | QListView *playlistView; | ||
105 | QLabel *libString; | 107 | QLabel *libString; |
106 | QPopupMenu *pmView ; | 108 | QPopupMenu *pmView ; |
107 | QPopupMenu *gammaMenu; | 109 | QPopupMenu *gammaMenu; |
108 | QSlider *gammaSlider; | 110 | QSlider *gammaSlider; |