author | llornkcor <llornkcor> | 2002-05-31 00:24:18 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-31 00:24:18 (UTC) |
commit | 294fecd1c15c4940bdab8566e5afaee9f305abb6 (patch) (unidiff) | |
tree | 47860d13c0aeffb0b9afad96d669d8935769fe7a | |
parent | 706841997a5d466f3b873ed79102e4abe0d745ae (diff) | |
download | opie-294fecd1c15c4940bdab8566e5afaee9f305abb6.zip opie-294fecd1c15c4940bdab8566e5afaee9f305abb6.tar.gz opie-294fecd1c15c4940bdab8566e5afaee9f305abb6.tar.bz2 |
sped up startup time, and fixed segfault on exit
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 70 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 3 |
3 files changed, 53 insertions, 22 deletions
diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h index cf9daea..8f9a0ee 100644 --- a/core/multimedia/opieplayer/mediaplayer.h +++ b/core/multimedia/opieplayer/mediaplayer.h | |||
@@ -46,2 +46,3 @@ private slots: | |||
46 | void stopChangingVolume(); | 46 | void stopChangingVolume(); |
47 | void cleanUp(); | ||
47 | 48 | ||
@@ -52,3 +53,2 @@ protected: | |||
52 | void doUnblank(); | 53 | void doUnblank(); |
53 | void cleanUp(); | ||
54 | private: | 54 | private: |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 7a79be1..78c2822 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -34,3 +34,2 @@ | |||
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | |||
36 | #include <qaction.h> | 35 | #include <qaction.h> |
@@ -133,2 +132,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
133 | insanityBool=FALSE; | 132 | insanityBool=FALSE; |
133 | audioScan = FALSE; | ||
134 | videoScan = FALSE; | ||
134 | // menuTimer = new QTimer( this ,"menu timer"), | 135 | // menuTimer = new QTimer( this ,"menu timer"), |
@@ -183,2 +184,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
183 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 184 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
185 | pmPlayList->insertSeparator(-1); | ||
186 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | ||
187 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | ||
184 | 188 | ||
@@ -256,3 +260,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
256 | // audioView | 260 | // audioView |
257 | populateAudioView(); | 261 | // populateAudioView(); |
258 | // videowidget | 262 | // videowidget |
@@ -281,3 +285,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
281 | tabWidget->insertTab( vTab,tr("Video")); | 285 | tabWidget->insertTab( vTab,tr("Video")); |
282 | populateVideoView(); | 286 | // populateVideoView(); |
283 | 287 | ||
@@ -287,3 +291,3 @@ populateVideoView(); | |||
287 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 291 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
288 | playLists->setMinimumSize(233,260);; | 292 | playLists->setMinimumSize(233,260); |
289 | tabWidget->insertTab(LTab,tr("Lists")); | 293 | tabWidget->insertTab(LTab,tr("Lists")); |
@@ -293,3 +297,2 @@ populateVideoView(); | |||
293 | 297 | ||
294 | |||
295 | // add the library area | 298 | // add the library area |
@@ -435,4 +438,2 @@ void PlayListWidget::addAllToList() { | |||
435 | void PlayListWidget::addAllMusicToList() { | 438 | void PlayListWidget::addAllMusicToList() { |
436 | // DocLnkSet files; | ||
437 | // Global::findDocuments(&files, "audio/*"); | ||
438 | QListIterator<DocLnk> dit( files.children() ); | 439 | QListIterator<DocLnk> dit( files.children() ); |
@@ -529,3 +530,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
529 | qDebug("audioView"); | 530 | qDebug("audioView"); |
530 | // Global::findDocuments(&files, "audio/*"); | ||
531 | QListIterator<DocLnk> dit( files.children() ); | 531 | QListIterator<DocLnk> dit( files.children() ); |
@@ -543,3 +543,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
543 | qDebug("videoView"); | 543 | qDebug("videoView"); |
544 | // Global::findDocuments(&vFiles, "video/*"); | ||
545 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 544 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
@@ -805,2 +804,5 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
805 | { | 804 | { |
805 | audioView->clear(); | ||
806 | populateAudioView(); | ||
807 | |||
806 | if( !tbDeletePlaylist->isHidden()) | 808 | if( !tbDeletePlaylist->isHidden()) |
@@ -813,2 +815,4 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
813 | { | 815 | { |
816 | videoView->clear(); | ||
817 | populateVideoView(); | ||
814 | if( !tbDeletePlaylist->isHidden()) | 818 | if( !tbDeletePlaylist->isHidden()) |
@@ -829,4 +833,2 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
829 | 833 | ||
830 | |||
831 | |||
832 | void PlayListWidget::btnPlay(bool b) { | 834 | void PlayListWidget::btnPlay(bool b) { |
@@ -882,3 +884,2 @@ void PlayListWidget::deletePlaylist() { | |||
882 | }; | 884 | }; |
883 | |||
884 | } | 885 | } |
@@ -976,12 +977,33 @@ void PlayListWidget::listDelete() { | |||
976 | 977 | ||
978 | void PlayListWidget::scanForAudio() { | ||
979 | qDebug("scan for audio"); | ||
980 | files.detachChildren(); | ||
981 | QListIterator<DocLnk> sdit( files.children() ); | ||
982 | for ( ; sdit.current(); ++sdit ) { | ||
983 | delete sdit.current(); | ||
984 | } | ||
985 | Global::findDocuments(&files, "audio/*"); | ||
986 | audioScan = TRUE; | ||
987 | } | ||
988 | void PlayListWidget::scanForVideo() { | ||
989 | qDebug("scan for video"); | ||
990 | vFiles.detachChildren(); | ||
991 | QListIterator<DocLnk> sdit( vFiles.children() ); | ||
992 | for ( ; sdit.current(); ++sdit ) { | ||
993 | delete sdit.current(); | ||
994 | } | ||
995 | Global::findDocuments(&vFiles, "video/*"); | ||
996 | videoScan = TRUE; | ||
997 | } | ||
998 | |||
977 | void PlayListWidget::populateAudioView() { | 999 | void PlayListWidget::populateAudioView() { |
978 | // if(files) | 1000 | |
979 | // files.~DocLnkSet(); | 1001 | audioView->clear(); |
980 | StorageInfo storageInfo; | 1002 | StorageInfo storageInfo; |
981 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1003 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1004 | if(!audioScan) scanForAudio(); | ||
982 | 1005 | ||
983 | Global::findDocuments(&files, "audio/*"); | ||
984 | QListIterator<DocLnk> dit( files.children() ); | 1006 | QListIterator<DocLnk> dit( files.children() ); |
985 | QListIterator<FileSystem> it ( fs ); | 1007 | QListIterator<FileSystem> it ( fs ); |
986 | audioView->clear(); | 1008 | |
987 | QString storage; | 1009 | QString storage; |
@@ -995,4 +1017,6 @@ void PlayListWidget::populateAudioView() { | |||
995 | QListViewItem * newItem; | 1017 | QListViewItem * newItem; |
996 | if ( QFile( dit.current()->file()).exists() ) { | 1018 | if ( QFile( dit.current()->file()).exists() ) { |
997 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 1019 | // qDebug(dit.current()->name()); |
1020 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | ||
1021 | QString::number( QFile( dit.current()->file()).size() ), storage); | ||
998 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1022 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
@@ -1004,2 +1028,3 @@ void PlayListWidget::populateAudioView() { | |||
1004 | void PlayListWidget::populateVideoView() { | 1028 | void PlayListWidget::populateVideoView() { |
1029 | videoView->clear(); | ||
1005 | StorageInfo storageInfo; | 1030 | StorageInfo storageInfo; |
@@ -1007,3 +1032,4 @@ void PlayListWidget::populateVideoView() { | |||
1007 | 1032 | ||
1008 | Global::findDocuments(&vFiles, "video/*"); | 1033 | if(!videoScan ) scanForVideo(); |
1034 | |||
1009 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1035 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
@@ -1021,3 +1047,4 @@ void PlayListWidget::populateVideoView() { | |||
1021 | if ( QFile( Vdit.current()->file()).exists() ) { | 1047 | if ( QFile( Vdit.current()->file()).exists() ) { |
1022 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 1048 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1049 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | ||
1023 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1050 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
@@ -1097,3 +1124,3 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1097 | qDebug("Play"); | 1124 | qDebug("Play"); |
1098 | playSelected(); | 1125 | // playSelected(); puh |
1099 | break; | 1126 | break; |
@@ -1235 +1262,2 @@ void PlayListWidget::readPls(const QString &filename) { | |||
1235 | } | 1262 | } |
1263 | |||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 778e3ee..6569f35 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -73,2 +73,3 @@ void keyPressEvent( QKeyEvent *e); | |||
73 | private: | 73 | private: |
74 | bool audioScan, videoScan; | ||
74 | void doBlank(); | 75 | void doBlank(); |
@@ -87,2 +88,4 @@ private: | |||
87 | private slots: | 88 | private slots: |
89 | void scanForAudio(); | ||
90 | void scanForVideo(); | ||
88 | void openFile(); | 91 | void openFile(); |