author | llornkcor <llornkcor> | 2002-05-31 00:24:18 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-31 00:24:18 (UTC) |
commit | 294fecd1c15c4940bdab8566e5afaee9f305abb6 (patch) (side-by-side diff) | |
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 | 68 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 3 |
3 files changed, 52 insertions, 21 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 @@ -45,4 +45,5 @@ private slots: void startDecreasingVolume(); void stopChangingVolume(); + void cleanUp(); protected: @@ -51,5 +52,4 @@ protected: void doBlank(); void doUnblank(); - void cleanUp(); private: int volumeDirection; 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 @@ -33,5 +33,4 @@ #include <qpe/global.h> #include <qpe/resource.h> - #include <qaction.h> #include <qcursor.h> @@ -132,4 +131,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) fromSetDocument = FALSE; insanityBool=FALSE; + audioScan = FALSE; + videoScan = FALSE; // menuTimer = new QTimer( this ,"menu timer"), // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); @@ -182,4 +183,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); + pmPlayList->insertSeparator(-1); + new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); + new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); QPopupMenu *pmView = new QPopupMenu( this ); @@ -255,5 +259,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) // audioView - populateAudioView(); +// populateAudioView(); // videowidget @@ -280,5 +284,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) tabWidget->insertTab( vTab,tr("Video")); -populateVideoView(); +// populateVideoView(); //playlists list @@ -286,5 +290,5 @@ populateVideoView(); LTab = new QWidget( tabWidget, "LTab" ); playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy - playLists->setMinimumSize(233,260);; + playLists->setMinimumSize(233,260); tabWidget->insertTab(LTab,tr("Lists")); @@ -292,5 +296,4 @@ populateVideoView(); // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); - // add the library area @@ -434,6 +437,4 @@ void PlayListWidget::addAllToList() { void PlayListWidget::addAllMusicToList() { -// DocLnkSet files; -// Global::findDocuments(&files, "audio/*"); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) @@ -528,5 +529,4 @@ const DocLnk *PlayListWidget::current() { // this is fugly { qDebug("audioView"); -// Global::findDocuments(&files, "audio/*"); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { @@ -542,5 +542,4 @@ const DocLnk *PlayListWidget::current() { // this is fugly { qDebug("videoView"); -// Global::findDocuments(&vFiles, "video/*"); QListIterator<DocLnk> Vdit( vFiles.children() ); for ( ; Vdit.current(); ++Vdit ) { @@ -804,4 +803,7 @@ void PlayListWidget::tabChanged(QWidget *widg) { case 1: { + audioView->clear(); + populateAudioView(); + if( !tbDeletePlaylist->isHidden()) tbDeletePlaylist->hide(); @@ -812,4 +814,6 @@ void PlayListWidget::tabChanged(QWidget *widg) { case 2: { + videoView->clear(); + populateVideoView(); if( !tbDeletePlaylist->isHidden()) tbDeletePlaylist->hide(); @@ -828,6 +832,4 @@ void PlayListWidget::tabChanged(QWidget *widg) { } - - void PlayListWidget::btnPlay(bool b) { @@ -881,5 +883,4 @@ void PlayListWidget::deletePlaylist() { break; }; - } @@ -975,14 +976,35 @@ void PlayListWidget::listDelete() { } +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/*"); + audioScan = TRUE; +} +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/*"); + videoScan = TRUE; +} + void PlayListWidget::populateAudioView() { -// if(files) -// files.~DocLnkSet(); + + audioView->clear(); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); + if(!audioScan) scanForAudio(); - Global::findDocuments(&files, "audio/*"); QListIterator<DocLnk> dit( files.children() ); QListIterator<FileSystem> it ( fs ); - audioView->clear(); + QString storage; for ( ; dit.current(); ++dit ) { @@ -995,5 +1017,7 @@ void PlayListWidget::populateAudioView() { QListViewItem * newItem; if ( QFile( dit.current()->file()).exists() ) { - newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); +// qDebug(dit.current()->name()); + newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), + QString::number( QFile( dit.current()->file()).size() ), storage); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); } @@ -1003,8 +1027,10 @@ void PlayListWidget::populateAudioView() { void PlayListWidget::populateVideoView() { + videoView->clear(); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); - Global::findDocuments(&vFiles, "video/*"); + if(!videoScan ) scanForVideo(); + QListIterator<DocLnk> Vdit( vFiles.children() ); QListIterator<FileSystem> it ( fs ); @@ -1020,5 +1046,6 @@ void PlayListWidget::populateVideoView() { QListViewItem * newItem; if ( QFile( Vdit.current()->file()).exists() ) { - newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); + newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), + QString::number( QFile( Vdit.current()->file()).size() ), storage); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); } @@ -1096,5 +1123,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) case Key_Space: qDebug("Play"); - playSelected(); +// playSelected(); puh break; case Key_1: @@ -1234,2 +1261,3 @@ void PlayListWidget::readPls(const QString &filename) { } } + 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 @@ -72,4 +72,5 @@ void keyReleaseEvent( QKeyEvent *e); void keyPressEvent( QKeyEvent *e); private: + bool audioScan, videoScan; void doBlank(); void doUnblank(); @@ -86,4 +87,6 @@ private: void populateVideoView(); private slots: + void scanForAudio(); + void scanForVideo(); void openFile(); void setDocument( const QString& fileref ); |