summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-05 19:05:25 (UTC)
committer simon <simon>2002-12-05 19:05:25 (UTC)
commit4b77aaa27305f0ec120aa6ec4d860f62b7fa7a3f (patch) (unidiff)
treee4ecf41fafccccd82534df6a1e46115727a9b49c
parent05757f4914d19f9c392be1e60e5ec972027886bf (diff)
downloadopie-4b77aaa27305f0ec120aa6ec4d860f62b7fa7a3f.zip
opie-4b77aaa27305f0ec120aa6ec4d860f62b7fa7a3f.tar.gz
opie-4b77aaa27305f0ec120aa6ec4d860f62b7fa7a3f.tar.bz2
- turned if ( foo ) delete foo; into straight delete foo; as the if is
redundant.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp16
2 files changed, 8 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp
index 975dec3..2019b3a 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.cpp
+++ b/noncore/multimedia/opieplayer2/playlistselection.cpp
@@ -109,18 +109,17 @@ void PlayListSelection::addToSelection( const DocLnk &lnk ) {
109 item->moveItem( current ); 109 item->moveItem( current );
110 setSelected( item, TRUE ); 110 setSelected( item, TRUE );
111 ensureItemVisible( selectedItem() ); 111 ensureItemVisible( selectedItem() );
112} 112}
113 113
114 114
115void PlayListSelection::removeSelected() { 115void PlayListSelection::removeSelected() {
116 QListViewItem *item = selectedItem(); 116 QListViewItem *item = selectedItem();
117 if ( item ) 117 delete item;
118 delete item;
119 setSelected( currentItem(), TRUE ); 118 setSelected( currentItem(), TRUE );
120 ensureItemVisible( selectedItem() ); 119 ensureItemVisible( selectedItem() );
121} 120}
122 121
123 122
124void PlayListSelection::moveSelectedUp() { 123void PlayListSelection::moveSelectedUp() {
125 QListViewItem *item = selectedItem(); 124 QListViewItem *item = selectedItem();
126 if ( item && item->itemAbove() ) 125 if ( item && item->itemAbove() )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 86b3424..ac52b07 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -186,17 +186,17 @@ void PlayListWidget::writeDefaultPlaylist() {
186 do { 186 do {
187 // qDebug(d->selectedFiles->current()->file()); 187 // qDebug(d->selectedFiles->current()->file());
188 m3uList->add( d->selectedFiles->current()->file() ); 188 m3uList->add( d->selectedFiles->current()->file() );
189 } 189 }
190 while ( d->selectedFiles->next() ); 190 while ( d->selectedFiles->next() );
191 191
192 m3uList->write(); 192 m3uList->write();
193 m3uList->close(); 193 m3uList->close();
194 if(m3uList) delete m3uList; 194 delete m3uList;
195 195
196 } 196 }
197 } 197 }
198} 198}
199 199
200void PlayListWidget::addToSelection( const DocLnk& lnk ) { 200void PlayListWidget::addToSelection( const DocLnk& lnk ) {
201 d->setDocumentUsed = FALSE; 201 d->setDocumentUsed = FALSE;
202 if( QFileInfo( lnk.file() ).exists() || 202 if( QFileInfo( lnk.file() ).exists() ||
@@ -679,19 +679,17 @@ void PlayListWidget::openFile() {
679 lnk.setName( QFileInfo(filename).baseName() ); //sets name 679 lnk.setName( QFileInfo(filename).baseName() ); //sets name
680 lnk.setFile( filename ); //sets file name 680 lnk.setFile( filename ); //sets file name
681 d->selectedFiles->addToSelection( lnk); 681 d->selectedFiles->addToSelection( lnk);
682 writeCurrentM3u(); 682 writeCurrentM3u();
683 d->selectedFiles->setSelectedItem( lnk.name()); 683 d->selectedFiles->setSelectedItem( lnk.name());
684 } 684 }
685 } 685 }
686 686
687 if( fileDlg ) { 687 delete fileDlg;
688 delete fileDlg;
689 }
690} 688}
691 689
692/* 690/*
693reads m3u and shows files/urls to playlist widget */ 691reads m3u and shows files/urls to playlist widget */
694void PlayListWidget::readm3u( const QString &filename ) { 692void PlayListWidget::readm3u( const QString &filename ) {
695 qDebug( "read m3u filename " + filename ); 693 qDebug( "read m3u filename " + filename );
696 694
697 Om3u *m3uList; 695 Om3u *m3uList;
@@ -729,17 +727,17 @@ void PlayListWidget::readm3u( const QString &filename ) {
729 config.setGroup( "PlayList" ); 727 config.setGroup( "PlayList" );
730 728
731 config.writeEntry("CurrentPlaylist",filename); 729 config.writeEntry("CurrentPlaylist",filename);
732 config.write(); 730 config.write();
733 currentPlayList=filename; 731 currentPlayList=filename;
734 732
735// m3uList->write(); 733// m3uList->write();
736 m3uList->close(); 734 m3uList->close();
737 if(m3uList) delete m3uList; 735 delete m3uList;
738 736
739 d->selectedFiles->setSelectedItem( s); 737 d->selectedFiles->setSelectedItem( s);
740 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 738 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
741 739
742} 740}
743 741
744/* 742/*
745reads pls and adds files/urls to playlist */ 743reads pls and adds files/urls to playlist */
@@ -777,17 +775,17 @@ void PlayListWidget::readPls( const QString &filename ) {
777 } 775 }
778 lnk.setType( "audio/x-mpegurl" ); 776 lnk.setType( "audio/x-mpegurl" );
779 777
780 lnk.writeLink(); 778 lnk.writeLink();
781 d->selectedFiles->addToSelection( lnk ); 779 d->selectedFiles->addToSelection( lnk );
782 } 780 }
783 781
784 m3uList->close(); 782 m3uList->close();
785 if(m3uList) delete m3uList; 783 delete m3uList;
786} 784}
787 785
788/* 786/*
789 writes current playlist to current m3u file */ 787 writes current playlist to current m3u file */
790void PlayListWidget::writeCurrentM3u() { 788void PlayListWidget::writeCurrentM3u() {
791 qDebug("writing to current m3u"); 789 qDebug("writing to current m3u");
792 Config cfg( "OpiePlayer" ); 790 Config cfg( "OpiePlayer" );
793 cfg.setGroup("PlayList"); 791 cfg.setGroup("PlayList");
@@ -801,17 +799,17 @@ void PlayListWidget::writeCurrentM3u() {
801 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 799 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
802 m3uList->add( d->selectedFiles->current()->file() ); 800 m3uList->add( d->selectedFiles->current()->file() );
803 } 801 }
804 while ( d->selectedFiles->next() ); 802 while ( d->selectedFiles->next() );
805 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 803 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
806 m3uList->write(); 804 m3uList->write();
807 m3uList->close(); 805 m3uList->close();
808 806
809 if(m3uList) delete m3uList; 807 delete m3uList;
810 } 808 }
811 809
812} 810}
813 811
814 /* 812 /*
815 writes current playlist to m3u file */ 813 writes current playlist to m3u file */
816void PlayListWidget::writem3u() { 814void PlayListWidget::writem3u() {
817 InputDialog *fileDlg; 815 InputDialog *fileDlg;
@@ -837,19 +835,19 @@ void PlayListWidget::writem3u() {
837 835
838 do { 836 do {
839 m3uList->add( d->selectedFiles->current()->file()); 837 m3uList->add( d->selectedFiles->current()->file());
840 } 838 }
841 while ( d->selectedFiles->next() ); 839 while ( d->selectedFiles->next() );
842 // qDebug( list ); 840 // qDebug( list );
843 m3uList->write(); 841 m3uList->write();
844 m3uList->close(); 842 m3uList->close();
845 if(m3uList) delete m3uList; 843 delete m3uList;
846 844
847 if(fileDlg) delete fileDlg; 845 delete fileDlg;
848 846
849 DocLnk lnk; 847 DocLnk lnk;
850 lnk.setFile( filename); 848 lnk.setFile( filename);
851 lnk.setIcon("opieplayer2/playlist2"); 849 lnk.setIcon("opieplayer2/playlist2");
852 lnk.setName( name); //sets file name 850 lnk.setName( name); //sets file name
853 851
854 // qDebug(filename); 852 // qDebug(filename);
855 Config config( "OpiePlayer" ); 853 Config config( "OpiePlayer" );