-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 172 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 36 |
2 files changed, 131 insertions, 77 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index db6533a..3b8f6d7 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -20,2 +20,4 @@ // code added by L. J. Potter Sat 03-02-2002 06:17:54 +#define QTOPIA_INTERNAL_FSLP + #include <qpe/qpemenubar.h> @@ -24,2 +26,3 @@ #include <qpe/qpeapplication.h> +#include <qpe/lnkproperties.h> @@ -209,5 +212,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) audioView->setMinimumSize(233,260); - audioView->addColumn( "Title",140); - audioView->addColumn("Size", -1); - audioView->addColumn("Media",-1); + audioView->addColumn( tr("Title"),140); + audioView->addColumn(tr("Size"), -1); + audioView->addColumn(tr("Media"),-1); audioView->setColumnAlignment(1, Qt::AlignRight); @@ -215,3 +218,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) audioView->setAllColumnsShowFocus(TRUE); - tabWidget->insertTab(aTab,"Audio"); + tabWidget->insertTab(aTab,tr("Audio")); @@ -223,16 +226,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) // audioView - Global::findDocuments(&files, "audio/*"); - QListIterator<DocLnk> dit( files.children() ); - QString storage; - for ( ; dit.current(); ++dit ) { - QListViewItem * newItem; - if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; - else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; - else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; - else storage="RAM"; - if ( QFile( dit.current()->file()).exists() ) { - newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); - newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); - } - } + populateAudioView(); // videowidget @@ -244,5 +234,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - videoView->addColumn("Title",140); - videoView->addColumn("Size",-1); - videoView->addColumn("Media",-1); + videoView->addColumn(tr("Title"),140); + videoView->addColumn(tr("Size"),-1); + videoView->addColumn(tr("Media"),-1); videoView->setColumnAlignment(1, Qt::AlignRight); @@ -254,17 +244,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - tabWidget->insertTab( vTab,"Video"); + tabWidget->insertTab( vTab,tr("Video")); - Global::findDocuments(&vFiles, "video/*"); - QListIterator<DocLnk> Vdit( vFiles.children() ); - for ( ; Vdit.current(); ++Vdit ) { - if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; - else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; - else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; - else storage="RAM"; - 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->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); - } - } @@ -275,3 +252,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) playLists->setMinimumSize(233,260);; - tabWidget->insertTab(LTab,"Lists"); + tabWidget->insertTab(LTab,tr("Lists")); @@ -310,3 +287,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) loadList(DocLnk( currentPlaylist)); - setCaption("OpiePlayer: "+ currentPlaylist ); + setCaption(tr("OpiePlayer: ")+ currentPlaylist ); @@ -452,3 +429,3 @@ void PlayListWidget::setDocument(const QString& fileref) { qApp->processEvents(); - setCaption("OpiePlayer"); + setCaption(tr("OpiePlayer")); @@ -495,3 +472,3 @@ const DocLnk *PlayListWidget::current() { // this is fugly if ( mediaPlayerState->playlist() ) { - return d->selectedFiles->current(); + return d->selectedFiles->current(); } @@ -604,3 +581,3 @@ void PlayListWidget::saveList() { InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); + fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); fileDlg->exec(); @@ -631,3 +608,3 @@ void PlayListWidget::saveList() { config.writeEntry("CurrentPlaylist",filename); - setCaption("OpiePlayer: "+filename); + setCaption(tr("OpiePlayer: ")+filename); d->selectedFiles->first(); @@ -683,3 +660,3 @@ void PlayListWidget::addSelected() { if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { - int result= QMessageBox::warning(this,"OpiePlayer", + int result= QMessageBox::warning(this,tr("OpiePlayer"), tr("This is all ready in your playlist.\nContinue?"), @@ -700,3 +677,3 @@ void PlayListWidget::addSelected() { if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { - int result= QMessageBox::warning(this,"OpiePlayer", + int result= QMessageBox::warning(this,tr("OpiePlayer"), tr("This is all ready in your playlist.\nContinue?"), @@ -718,3 +695,2 @@ void PlayListWidget::removeSelected() { - void PlayListWidget::playIt( QListViewItem *it) { @@ -728,9 +704,6 @@ void PlayListWidget::addToSelection( QListViewItem *it) { if(it) { -// qDebug("add to selection"); switch (tabWidget->currentPageIndex()) { case 1: { -// qDebug("case 1"); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { -// qDebug(dit.current()->name()); if( dit.current()->name() == it->text(0)) { @@ -742,6 +715,4 @@ void PlayListWidget::addToSelection( QListViewItem *it) { case 2: { -// qDebug("case 2"); QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { -// qDebug(dit.current()->name()); if( dit.current()->name() == it->text(0)) { @@ -756,3 +727,2 @@ void PlayListWidget::addToSelection( QListViewItem *it) { tabWidget->setCurrentPage(0); -// mediaPlayerState->setPlaying( TRUE ); } @@ -798,5 +768,5 @@ void PlayListWidget::tabChanged(QWidget *widg) { -/* - play button is pressed*/ + void PlayListWidget::btnPlay(bool b) { + // mediaPlayerState->setPlaying(b); @@ -815,3 +785,3 @@ void PlayListWidget::btnPlay(bool b) { tabWidget->setCurrentPage(1); - d->selectedFiles->unSelect(); + d->selectedFiles->unSelect(); // mediaPlayerState->setPlaying(FALSE); @@ -826,3 +796,3 @@ void PlayListWidget::btnPlay(bool b) { tabWidget->setCurrentPage(2); - d->selectedFiles->unSelect(); + d->selectedFiles->unSelect(); // mediaPlayerState->setPlaying(FALSE); @@ -831,6 +801,2 @@ void PlayListWidget::btnPlay(bool b) { }; - - - - } @@ -861,4 +827,4 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); -// m.insertSeparator(); -// m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); + m.insertSeparator(); + m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); m.exec( QCursor::pos() ); @@ -867,3 +833,2 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& }; - } @@ -891 +856,86 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const } + +void PlayListWidget::listDelete() { + Config cfg( "MediaPlayer" ); + cfg.setGroup("PlayList"); + QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); + QString file; + int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); + switch ( tabWidget->currentPageIndex()) { + case 0: + break; + case 1: + { + file = audioView->selectedItem()->text(0); +// Global::findDocuments(&files, "audio/*"); +// AppLnkSet appFiles; + QListIterator<DocLnk> dit( files.children() ); + for ( ; dit.current(); ++dit ) { + if( dit.current()->name() == file) { + qDebug(file); + LnkProperties prop( dit.current() ); +// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); + prop.showMaximized(); + prop.exec(); + } + } + populateAudioView(); + } + break; + case 2: + { +// file = videoView->selectedItem()->text(0); +// for ( int i = 0; i < noOfFiles; i++ ) { +// QString entryName; +// entryName.sprintf( "File%i", i + 1 ); +// QString linkFile = cfg.readEntry( entryName ); +// AppLnk lnk( AppLnk(linkFile)); +// if( lnk.name() == file ) { +// LnkProperties prop( &lnk); +// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); +// prop.showMaximized(); +// prop.exec(); +// } +// } + } + break; + }; +} + +void PlayListWidget::populateAudioView() { +// if(files) +// files.~DocLnkSet(); + Global::findDocuments(&files, "audio/*"); + QListIterator<DocLnk> dit( files.children() ); + audioView->clear(); + QString storage; + for ( ; dit.current(); ++dit ) { + QListViewItem * newItem; + if(dit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF"); + else if(dit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF"); + else if(dit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD"); + else storage=tr("RAM"); + if ( QFile( dit.current()->file()).exists() ) { + newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); + newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); + } + } +} + +void PlayListWidget::populateVideoView() { + Global::findDocuments(&vFiles, "video/*"); + QListIterator<DocLnk> Vdit( vFiles.children() ); + videoView->clear(); + QString storage; + for ( ; Vdit.current(); ++Vdit ) { + if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF"); + else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF"); + else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD"); + else storage=tr("RAM"); + 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->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); + } + } +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 10a42df..186ca1b 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -60,2 +60,20 @@ public: public slots: + bool first(); + bool last(); + bool next(); + bool prev(); +/* void setFullScreen(); */ +/* void setScaled(); */ +protected: +/* void contentsMousePressEvent( QMouseEvent * e ); */ +/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ + +private: + void initializeStates(); + void readConfig( Config& cfg ); + void writeConfig( Config& cfg ) const; + PlayListWidgetPrivate *d; // Private implementation data + void populateAudioView(); + void populateVideoView(); +private slots: void setDocument( const QString& fileref ); @@ -76,6 +94,2 @@ public slots: void deletePlaylist(); - bool first(); - bool last(); - bool next(); - bool prev(); void addSelected(); @@ -86,14 +100,4 @@ public slots: void playSelected(); -/* void setFullScreen(); */ -/* void setScaled(); */ -protected: -/* void contentsMousePressEvent( QMouseEvent * e ); */ -/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ - -private: - void initializeStates(); - void readConfig( Config& cfg ); - void writeConfig( Config& cfg ) const; - PlayListWidgetPrivate *d; // Private implementation data - + void listDelete(); + protected slots: |