author | llornkcor <llornkcor> | 2002-04-06 22:53:11 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-06 22:53:11 (UTC) |
commit | 014a5c29fc8a1b2e6bc2ec550134163bea86443c (patch) (side-by-side diff) | |
tree | edad7dd5cabe8891b02875c879b31a15c8251053 | |
parent | f79c6b3e3407a4263e7210b52638c4426dea825b (diff) | |
download | opie-014a5c29fc8a1b2e6bc2ec550134163bea86443c.zip opie-014a5c29fc8a1b2e6bc2ec550134163bea86443c.tar.gz opie-014a5c29fc8a1b2e6bc2ec550134163bea86443c.tar.bz2 |
translations stuff
-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 @@ -15,16 +15,19 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // code added by L. J. Potter Sat 03-02-2002 06:17:54 +#define QTOPIA_INTERNAL_FSLP + #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/fileselector.h> #include <qpe/qpeapplication.h> +#include <qpe/lnkproperties.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qaction.h> @@ -204,79 +207,53 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); audioView = new QListView( aTab, "Audioview" ); 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); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); - tabWidget->insertTab(aTab,"Audio"); + tabWidget->insertTab(aTab,tr("Audio")); QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); // 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 QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); videoView = new QListView( vTab, "Videoview" ); videoView->setMinimumSize(233,260); - 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); videoView->setColumnAlignment(2, Qt::AlignRight); videoView->setAllColumnsShowFocus(TRUE); QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); - 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" )); - } - } //playlists list QWidget *LTab; LTab = new QWidget( tabWidget, "LTab" ); playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy playLists->setMinimumSize(233,260);; - tabWidget->insertTab(LTab,"Lists"); + tabWidget->insertTab(LTab,tr("Lists")); connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); // add the library area @@ -305,13 +282,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) Config cfg( "MediaPlayer" ); readConfig( cfg ); QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); // qDebug("currentList is "+currentPlaylist); loadList(DocLnk( currentPlaylist)); - setCaption("OpiePlayer: "+ currentPlaylist ); + setCaption(tr("OpiePlayer: ")+ currentPlaylist ); initializeStates(); } PlayListWidget::~PlayListWidget() { @@ -447,13 +424,13 @@ void PlayListWidget::setDocument(const QString& fileref) { addToSelection( DocLnk( fileref ) ); d->setDocumentUsed = TRUE; mediaPlayerState->setPlaying( FALSE ); qApp->processEvents(); mediaPlayerState->setPlaying( TRUE ); qApp->processEvents(); - setCaption("OpiePlayer"); + setCaption(tr("OpiePlayer")); } else { //is playlist clearList(); loadList(DocLnk(fileref)); d->selectedFiles->first(); } @@ -490,13 +467,13 @@ const DocLnk *PlayListWidget::current() { // this is fugly // qDebug("current"); // switch (tabWidget->currentPageIndex()) { // case 0: //playlist // { qDebug("playlist"); if ( mediaPlayerState->playlist() ) { - return d->selectedFiles->current(); + return d->selectedFiles->current(); } else if ( d->setDocumentUsed && d->current ) { return d->current; } else { return d->files->selected(); } @@ -599,13 +576,13 @@ bool PlayListWidget::last() { void PlayListWidget::saveList() { QString filename; InputDialog *fileDlg; - fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); + fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { if ( d->current ) delete d->current; filename = fileDlg->LineEdit1->text();//+".playlist"; // qDebug("saving playlist "+filename+".playlist"); @@ -626,13 +603,13 @@ void PlayListWidget::saveList() { lnk.setName( filename); //sets file name if(!lnk.writeLink()) qDebug("Writing doclink did not work"); } Config config( "MediaPlayer" ); config.writeEntry("CurrentPlaylist",filename); - setCaption("OpiePlayer: "+filename); + setCaption(tr("OpiePlayer: ")+filename); d->selectedFiles->first(); if(fileDlg) delete fileDlg; } void PlayListWidget::loadList( const DocLnk & lnk) { @@ -678,13 +655,13 @@ void PlayListWidget::addSelected() { case 1: { //audio for ( int i = 0; i < noOfFiles; i++ ) { QString entryName; entryName.sprintf( "File%i", i + 1 ); QString linkFile = cfg.readEntry( entryName ); 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?"), tr("Yes"),tr("No"),0,0,1); if (result !=0) return; } } @@ -695,13 +672,13 @@ void PlayListWidget::addSelected() { case 2: { // video for ( int i = 0; i < noOfFiles; i++ ) { QString entryName; entryName.sprintf( "File%i", i + 1 ); QString linkFile = cfg.readEntry( entryName ); 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?"), tr("Yes"),tr("No"),0,0,1); if (result !=0) return; } } @@ -713,51 +690,44 @@ void PlayListWidget::addSelected() { } void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); } - void PlayListWidget::playIt( QListViewItem *it) { // d->setDocumentUsed = FALSE; mediaPlayerState->setPlaying(TRUE); } void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; 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)) { d->selectedFiles->addToSelection( **dit ); } } } break; 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)) { d->selectedFiles->addToSelection( **dit ); } } } break; case 0: break; }; tabWidget->setCurrentPage(0); -// mediaPlayerState->setPlaying( TRUE ); } } void PlayListWidget::tabChanged(QWidget *widg) { switch ( tabWidget->currentPageIndex()) { @@ -793,15 +763,15 @@ void PlayListWidget::tabChanged(QWidget *widg) { } break; }; } -/* - play button is pressed*/ + void PlayListWidget::btnPlay(bool b) { + // mediaPlayerState->setPlaying(b); switch ( tabWidget->currentPageIndex()) { case 0: { mediaPlayerState->setPlaying(b); } @@ -810,32 +780,28 @@ void PlayListWidget::btnPlay(bool b) { { addToSelection( audioView->selectedItem() ); mediaPlayerState->setPlaying(b); // qApp->processEvents(); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(1); - d->selectedFiles->unSelect(); + d->selectedFiles->unSelect(); // mediaPlayerState->setPlaying(FALSE); } break; case 2: { addToSelection( videoView->selectedItem() ); mediaPlayerState->setPlaying(b); qApp->processEvents(); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(2); - d->selectedFiles->unSelect(); + d->selectedFiles->unSelect(); // mediaPlayerState->setPlaying(FALSE); } break; }; - - - - } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ @@ -856,19 +822,18 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& case 1: break; case 2:{ QPopupMenu m; m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 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() ); } break; }; - } void PlayListWidget::playSelected() { btnPlay( TRUE); } @@ -886,6 +851,91 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const m.exec( QCursor::pos() ); } break; }; } + +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 @@ -55,12 +55,30 @@ public: const DocLnk *current(); void useSelectedDocument(); /* QTimer * menuTimer; */ FileSelector* playLists; QPushButton *tbDeletePlaylist; 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 ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void setActiveWindow(); // need to handle this to show the right view void setPlaylist( bool ); // Show/Hide the playlist void setView( char ); @@ -71,34 +89,20 @@ public slots: void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); void btnPlay(bool); void deletePlaylist(); - bool first(); - bool last(); - bool next(); - bool prev(); void addSelected(); void removeSelected(); void tabChanged(QWidget*); void viewPressed( int, QListViewItem *, const QPoint&, int); void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 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: /* void cancelMenuTimer(); */ /* void showFileMenu(); */ }; |