author | harlekin <harlekin> | 2002-12-11 23:35:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-12-11 23:35:31 (UTC) |
commit | a1ff0243520fca8406d90b0875ef141b7555d748 (patch) (side-by-side diff) | |
tree | 739fb7fbd60e1e19eb017e28afea3b8c6efd918b | |
parent | d4a0626f01fae21ed19d0eea88d8eca1935c6bc8 (diff) | |
download | opie-a1ff0243520fca8406d90b0875ef141b7555d748.zip opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.gz opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.bz2 |
buttons centered again
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c35e03d..a65495e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -51,17 +51,17 @@ #include "om3u.h" #include "playlistfileview.h" //only needed for the random play #include <stdlib.h> #include <assert.h> PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) - : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) + : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) { d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", this , SLOT(addSelected() ) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", this , SLOT(removeSelected() ) ); @@ -96,23 +96,23 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), &mediaPlayerState, SLOT( toggleFullscreen() ) ); Config cfg( "OpiePlayer" ); bool b= cfg.readBoolEntry("FullScreen", 0); mediaPlayerState.setFullscreen( b ); pmView->setItemChecked( -16, b ); - (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", + (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); - (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", + (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); - // QVBox *stretch2 = new QVBox( vbox1 ); + QVBox *stretch2 = new QVBox( vbox1 ); connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), @@ -183,28 +183,28 @@ void PlayListWidget::writeDefaultPlaylist() { // qDebug(d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); m3uList->write(); m3uList->close(); delete m3uList; - + } } } void PlayListWidget::addToSelection( const DocLnk& lnk ) { d->setDocumentUsed = FALSE; if( QFileInfo( lnk.file() ).exists() || lnk.file().left(4) == "http" ) { d->selectedFiles->addToSelection( lnk ); } -// writeCurrentM3u(); +// writeCurrentM3u(); } void PlayListWidget::clearList() { while ( first() ) { d->selectedFiles->removeSelected(); } Config cfg( "OpiePlayer" ); @@ -256,52 +256,52 @@ void PlayListWidget::addAllToList() { DocLnk lnk; QString filename; // iterate through all items of the listview for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); - } + } videoView->populateView(); QListViewItemIterator videoIt( videoView ); for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); - } + } // d->selectedFiles->addToSelection( ); // if ( it.current()->isSelected() ) // lst->append( audioIt.current() ); // } - + // if(!audioScan) // scanForAudio(); -// if(!videoScan) +// if(!videoScan) // scanForVideo(); // DocLnkSet filesAll; // Global::findDocuments(&filesAll, "video/*;"+audioMimes); // QListIterator<DocLnk> Adit( filesAll.children() ); // for ( ; Adit.current(); ++Adit ) { // if( QFileInfo( Adit.current()->file() ).exists() ) { // d->selectedFiles->addToSelection( **Adit ); // } // } // qDebug("elapsed time %d", t.elapsed() ); tabWidget->setCurrentPage(0); - + writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllMusicToList() { audioView->populateView(); @@ -310,17 +310,17 @@ void PlayListWidget::addAllMusicToList() { DocLnk lnk; QString filename; // iterate through all items of the listview for ( ; audioIt.current(); ++audioIt ) { filename = audioIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); - } + } /* if(!audioScan) scanForAudio(); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( QFileInfo(dit.current()->file() ).exists() ) { d->selectedFiles->addToSelection( **dit ); } @@ -339,30 +339,30 @@ void PlayListWidget::addAllVideoToList() { QListViewItemIterator videoIt( videoView ); DocLnk lnk; QString filename; for ( ; videoIt.current(); ++videoIt ) { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); - } + } /* if(!videoScan) scanForVideo(); QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { if( QFileInfo( dit.current()->file() ).exists() ) { d->selectedFiles->addToSelection( **dit ); } } -*/ +*/ tabWidget->setCurrentPage(0); - writeCurrentM3u(); + writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::setDocument( const QString& fileref ) { // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); fromSetDocument = TRUE; if ( fileref.isNull() ) { @@ -378,18 +378,18 @@ void PlayListWidget::setDocument( const QString& fileref ) { readm3u( DocLnk( fileref).file() ); } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls readPls( fileref ); } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { readPls( DocLnk( fileref).file() ); } else { clearList(); addToSelection( DocLnk( fileref ) ); - writeCurrentM3u(); - + writeCurrentM3u(); + d->setDocumentUsed = TRUE; mediaPlayerState.setPlaying( FALSE ); mediaPlayerState.setPlaying( TRUE ); } } void PlayListWidget::useSelectedDocument() { @@ -500,17 +500,17 @@ void PlayListWidget::addSelected() { // tabWidget->setCurrentPage( 0 ); writeCurrentM3u(); } void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); - writeCurrentM3u(); + writeCurrentM3u(); } void PlayListWidget::playIt( QListViewItem *it) { if(!it) return; mediaPlayerState.setPlaying(FALSE); mediaPlayerState.setPlaying(TRUE); d->selectedFiles->unSelect(); @@ -526,20 +526,20 @@ void PlayListWidget::addToSelection( QListViewItem *it) { // case 1: { DocLnk lnk; QString filename; filename=it->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); - - writeCurrentM3u(); + + writeCurrentM3u(); // tabWidget->setCurrentPage(0); - + } } void PlayListWidget::tabChanged(QWidget *) { d->tbPlay->setEnabled( true ); @@ -688,43 +688,43 @@ void PlayListWidget::openFile() { } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); d->selectedFiles->setSelectedItem( lnk.name()); } } - + delete fileDlg; } /* reads m3u and shows files/urls to playlist widget */ -void PlayListWidget::readm3u( const QString &filename ) { +void PlayListWidget::readm3u( const QString &filename ) { qDebug( "read m3u filename " + filename ); Om3u *m3uList; QString s, name; m3uList = new Om3u( filename, IO_ReadOnly ); m3uList->readM3u(); DocLnk lnk; for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { s = *it; // qDebug("reading "+ s); if(s.left(4)=="http") { lnk.setName( s ); //sets file name lnk.setIcon("opieplayer2/musicfile"); lnk.setFile( s ); //sets file name - + } else { // if( QFileInfo( s ).exists() ) { lnk.setName( QFileInfo(s).baseName()); // if(s.right(4) == '.') {//if regular file - if(s.left(1) != "/") { + if(s.left(1) != "/") { // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); // lnk.setIcon(MimeType(s).pixmap() ); // lnk.setIcon("SoundPlayer"); } else { // qDebug("set link2 "+s); lnk.setFile( s); // lnk.setIcon(MimeType(s).pixmap() ); @@ -741,17 +741,17 @@ void PlayListWidget::readm3u( const QString &filename ) { currentPlayList=filename; // m3uList->write(); m3uList->close(); delete m3uList; d->selectedFiles->setSelectedItem( s); setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); - + } /* reads pls and adds files/urls to playlist */ void PlayListWidget::readPls( const QString &filename ) { qDebug( "pls filename is " + filename ); Om3u *m3uList; @@ -810,17 +810,17 @@ void PlayListWidget::writeCurrentM3u() { m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); m3uList->write(); m3uList->close(); } delete m3uList; - + } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { InputDialog *fileDlg; fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); fileDlg->exec(); @@ -845,28 +845,28 @@ void PlayListWidget::writem3u() { do { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); // qDebug( list ); m3uList->write(); m3uList->close(); delete m3uList; - + delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name // qDebug(filename); Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); - + config.writeEntry("CurrentPlaylist",filename); currentPlayList=filename; if(!lnk.writeLink()) { qDebug("Writing doclink did not work"); } setCaption(tr("OpiePlayer: ") + name); |