summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-31 00:24:18 (UTC)
committer llornkcor <llornkcor>2002-05-31 00:24:18 (UTC)
commit294fecd1c15c4940bdab8566e5afaee9f305abb6 (patch) (side-by-side diff)
tree47860d13c0aeffb0b9afad96d669d8935769fe7a
parent706841997a5d466f3b873ed79102e4abe0d745ae (diff)
downloadopie-294fecd1c15c4940bdab8566e5afaee9f305abb6.zip
opie-294fecd1c15c4940bdab8566e5afaee9f305abb6.tar.gz
opie-294fecd1c15c4940bdab8566e5afaee9f305abb6.tar.bz2
sped up startup time, and fixed segfault on exit
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayer.h2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp68
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h3
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
@@ -46,2 +46,3 @@ private slots:
void stopChangingVolume();
+ void cleanUp();
@@ -52,3 +53,2 @@ protected:
void doUnblank();
- void cleanUp();
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 @@
#include <qpe/resource.h>
-
#include <qaction.h>
@@ -133,2 +132,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
insanityBool=FALSE;
+ audioScan = FALSE;
+ videoScan = FALSE;
// menuTimer = new QTimer( this ,"menu timer"),
@@ -183,2 +184,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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() ) );
@@ -256,3 +260,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
// audioView
- populateAudioView();
+// populateAudioView();
// videowidget
@@ -281,3 +285,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
tabWidget->insertTab( vTab,tr("Video"));
-populateVideoView();
+// populateVideoView();
@@ -287,3 +291,3 @@ populateVideoView();
playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
- playLists->setMinimumSize(233,260);;
+ playLists->setMinimumSize(233,260);
tabWidget->insertTab(LTab,tr("Lists"));
@@ -293,3 +297,2 @@ populateVideoView();
-
// add the library area
@@ -435,4 +438,2 @@ void PlayListWidget::addAllToList() {
void PlayListWidget::addAllMusicToList() {
-// DocLnkSet files;
-// Global::findDocuments(&files, "audio/*");
QListIterator<DocLnk> dit( files.children() );
@@ -529,3 +530,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly
qDebug("audioView");
-// Global::findDocuments(&files, "audio/*");
QListIterator<DocLnk> dit( files.children() );
@@ -543,3 +543,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly
qDebug("videoView");
-// Global::findDocuments(&vFiles, "video/*");
QListIterator<DocLnk> Vdit( vFiles.children() );
@@ -805,2 +804,5 @@ void PlayListWidget::tabChanged(QWidget *widg) {
{
+ audioView->clear();
+ populateAudioView();
+
if( !tbDeletePlaylist->isHidden())
@@ -813,2 +815,4 @@ void PlayListWidget::tabChanged(QWidget *widg) {
{
+ videoView->clear();
+ populateVideoView();
if( !tbDeletePlaylist->isHidden())
@@ -829,4 +833,2 @@ void PlayListWidget::tabChanged(QWidget *widg) {
-
-
void PlayListWidget::btnPlay(bool b) {
@@ -882,3 +884,2 @@ void PlayListWidget::deletePlaylist() {
};
-
}
@@ -976,12 +977,33 @@ 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;
@@ -996,3 +1018,5 @@ void PlayListWidget::populateAudioView() {
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" ));
@@ -1004,2 +1028,3 @@ void PlayListWidget::populateAudioView() {
void PlayListWidget::populateVideoView() {
+ videoView->clear();
StorageInfo storageInfo;
@@ -1007,3 +1032,4 @@ void PlayListWidget::populateVideoView() {
- Global::findDocuments(&vFiles, "video/*");
+ if(!videoScan ) scanForVideo();
+
QListIterator<DocLnk> Vdit( vFiles.children() );
@@ -1021,3 +1047,4 @@ void PlayListWidget::populateVideoView() {
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" ));
@@ -1097,3 +1124,3 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
qDebug("Play");
- playSelected();
+// playSelected(); puh
break;
@@ -1235 +1262,2 @@ 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
@@ -73,2 +73,3 @@ void keyPressEvent( QKeyEvent *e);
private:
+ bool audioScan, videoScan;
void doBlank();
@@ -87,2 +88,4 @@ private:
private slots:
+ void scanForAudio();
+ void scanForVideo();
void openFile();