summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
2 files changed, 8 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 603d426..bf2acc8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -154,64 +154,65 @@ void MediaPlayer::startIncreasingVolume() {
154bool drawnOnScreenDisplay = FALSE; 154bool drawnOnScreenDisplay = FALSE;
155unsigned int onScreenDisplayVolume = 0; 155unsigned int onScreenDisplayVolume = 0;
156const int yoff = 110; 156const int yoff = 110;
157 157
158void MediaPlayer::stopChangingVolume() { 158void MediaPlayer::stopChangingVolume() {
159 killTimers(); 159 killTimers();
160 // Get rid of the on-screen display stuff 160 // Get rid of the on-screen display stuff
161 drawnOnScreenDisplay = FALSE; 161 drawnOnScreenDisplay = FALSE;
162 onScreenDisplayVolume = 0; 162 onScreenDisplayVolume = 0;
163 int w=0; 163 int w=0;
164 int h=0; 164 int h=0;
165 if( !xineControl->hasVideo()) { 165 if( !xineControl->hasVideo()) {
166 w = audioUI->width(); 166 w = audioUI->width();
167 h = audioUI->height(); 167 h = audioUI->height();
168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
169 } else { 169 } else {
170 w = videoUI->width(); 170 w = videoUI->width();
171 h = videoUI->height(); 171 h = videoUI->height();
172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
173 } 173 }
174} 174}
175 175
176 176
177void MediaPlayer::timerEvent( QTimerEvent * ) { 177void MediaPlayer::timerEvent( QTimerEvent * ) {
178 if ( volumeDirection == +1 ) { 178 if ( volumeDirection == +1 ) {
179 volControl->incVol(2); 179 volControl->incVol(2);
180 } else if ( volumeDirection == -1 ) { 180 } else if ( volumeDirection == -1 ) {
181 volControl->decVol(2); 181 volControl->decVol(2);
182 } 182 }
183 183
184 184
185 // TODO FIXME 185 // TODO FIXME
186 // huh??
186 unsigned int v= 0; 187 unsigned int v= 0;
187 v = volControl->volume(); 188 v = volControl->volume();
188 v = v / 10; 189 v = v / 10;
189 190
190 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 191 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
191 return; 192 return;
192 } 193 }
193 194
194 int w=0; int h=0; 195 int w=0; int h=0;
195 if( !xineControl->hasVideo()) { 196 if( !xineControl->hasVideo()) {
196 w = audioUI->width(); 197 w = audioUI->width();
197 h = audioUI->height(); 198 h = audioUI->height();
198 199
199 if ( drawnOnScreenDisplay ) { 200 if ( drawnOnScreenDisplay ) {
200 if ( onScreenDisplayVolume > v ) { 201 if ( onScreenDisplayVolume > v ) {
201 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 202 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
202 } 203 }
203 } 204 }
204 drawnOnScreenDisplay = TRUE; 205 drawnOnScreenDisplay = TRUE;
205 onScreenDisplayVolume = v; 206 onScreenDisplayVolume = v;
206 QPainter p( audioUI ); 207 QPainter p( audioUI );
207 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 208 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
208 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 209 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
209 210
210 QFont f; 211 QFont f;
211 f.setPixelSize( 20 ); 212 f.setPixelSize( 20 );
212 f.setBold( TRUE ); 213 f.setBold( TRUE );
213 p.setFont( f ); 214 p.setFont( f );
214 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 215 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
215 216
216 for ( unsigned int i = 0; i < 10; i++ ) { 217 for ( unsigned int i = 0; i < 10; i++ ) {
217 if ( v > i ) { 218 if ( v > i ) {
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6c7f6ba..603a7a3 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -96,73 +96,74 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); 96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) );
97 QVBox *stretch2 = new QVBox( vbox1 ); 97 QVBox *stretch2 = new QVBox( vbox1 );
98 98
99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); 99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) );
100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); 100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) );
101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); 101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) );
102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
107 this,SLOT( playIt( QListViewItem *) ) ); 107 this,SLOT( playIt( QListViewItem *) ) );
108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
112 this,SLOT( playIt( QListViewItem *) ) ); 112 this,SLOT( playIt( QListViewItem *) ) );
113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); 115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) );
116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
121 121
122 readConfig( cfg ); 122 readConfig( cfg );
123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); 123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
124 loadList(DocLnk( currentPlaylist ) ); 124 loadList(DocLnk( currentPlaylist ) );
125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); 125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
126 126
127 // see which skins are installed 127 // see which skins are installed
128 videoScan=FALSE;
129 audioScan=FALSE;
128 populateSkinsMenu(); 130 populateSkinsMenu();
129 initializeStates(); 131 initializeStates();
130} 132}
131 133
132 134
133PlayListWidget::~PlayListWidget() { 135PlayListWidget::~PlayListWidget() {
134/* fixing symptoms and not sources is entirely stupid - zecke */ 136 // WTF?!@?!
135// Config cfg( "OpiePlayer" ); 137
136// writeConfig( cfg );
137 if ( d->current ) { 138 if ( d->current ) {
138 delete d->current; 139 delete d->current;
139 } 140 }
140 delete d; 141 delete d;
141} 142}
142 143
143 144
144void PlayListWidget::initializeStates() { 145void PlayListWidget::initializeStates() {
145 d->tbPlay->setOn( mediaPlayerState->playing() ); 146 d->tbPlay->setOn( mediaPlayerState->playing() );
146 d->tbLoop->setOn( mediaPlayerState->looping() ); 147 d->tbLoop->setOn( mediaPlayerState->looping() );
147 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 148 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
148 setPlaylist( true ); 149 setPlaylist( true );
149} 150}
150 151
151 152
152void PlayListWidget::readConfig( Config& cfg ) { 153void PlayListWidget::readConfig( Config& cfg ) {
153 cfg.setGroup( "PlayList" ); 154 cfg.setGroup( "PlayList" );
154 QString currentString = cfg.readEntry( "current", "" ); 155 QString currentString = cfg.readEntry( "current", "" );
155 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); 156 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
156 for ( int i = 0; i < noOfFiles; i++ ) { 157 for ( int i = 0; i < noOfFiles; i++ ) {
157 QString entryName; 158 QString entryName;
158 entryName.sprintf( "File%i", i + 1 ); 159 entryName.sprintf( "File%i", i + 1 );
159 QString linkFile = cfg.readEntry( entryName ); 160 QString linkFile = cfg.readEntry( entryName );
160 if( QFileInfo( linkFile ).exists() ) { 161 if( QFileInfo( linkFile ).exists() ) {
161 DocLnk lnk( linkFile ); 162 DocLnk lnk( linkFile );
162 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) { 163 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) {
163 d->selectedFiles->addToSelection( lnk ); 164 d->selectedFiles->addToSelection( lnk );
164 } 165 }
165 } 166 }
166 } 167 }
167 d->selectedFiles->setSelectedItem( currentString ); 168 d->selectedFiles->setSelectedItem( currentString );
168} 169}
@@ -755,65 +756,65 @@ void PlayListWidget::populateVideoView() {
755 for( ; it.current(); ++it ) { 756 for( ; it.current(); ++it ) {
756 const QString name = (*it)->name(); 757 const QString name = (*it)->name();
757 const QString path = (*it)->path(); 758 const QString path = (*it)->path();
758 if( Vdit.current()->file().find(path) != -1 ) { 759 if( Vdit.current()->file().find(path) != -1 ) {
759 storage=name; 760 storage=name;
760 } 761 }
761 } 762 }
762 763
763 QListViewItem * newItem; 764 QListViewItem * newItem;
764 if ( QFile( Vdit.current()->file() ).exists() ) { 765 if ( QFile( Vdit.current()->file() ).exists() ) {
765 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 766 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
766 QString::number( QFile( Vdit.current()->file() ).size() ), storage ); 767 QString::number( QFile( Vdit.current()->file() ).size() ), storage );
767 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 768 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
768 } 769 }
769 } 770 }
770} 771}
771 772
772 773
773void PlayListWidget::openFile() { 774void PlayListWidget::openFile() {
774 QString filename, name; 775 QString filename, name;
775 InputDialog *fileDlg; 776 InputDialog *fileDlg;
776 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 777 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
777 fileDlg->exec(); 778 fileDlg->exec();
778 if( fileDlg->result() == 1 ) { 779 if( fileDlg->result() == 1 ) {
779 filename = fileDlg->text(); 780 filename = fileDlg->text();
780 781
781 qDebug( "Selected filename is " + filename ); 782 qDebug( "Selected filename is " + filename );
782 if( filename.right( 3 ) == "m3u" ) { 783 if( filename.right( 3 ) == "m3u" ) {
783 readm3u( filename ); 784 readm3u( filename );
784 } else if( filename.right(3) == "pls" ) { 785 } else if( filename.right(3) == "pls" ) {
785 readPls( filename ); 786 readPls( filename );
786 } else { 787 } else {
787 /* FIXME ....... AUDIO/X-MPEGURL is bad*/ 788 // this doesnt need fixing
788 DocLnk lnk; 789 DocLnk lnk;
789 lnk.setName( filename ); //sets file name 790 lnk.setName( filename ); //sets file name
790 lnk.setFile( filename ); //sets File property 791 lnk.setFile( filename ); //sets File property
791 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); 792 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
792 lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); 793 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
793 lnk.setExec( "opieplayer" ); 794 lnk.setExec( "opieplayer" );
794 lnk.setIcon( "opieplayer2/MPEGPlayer" ); 795 lnk.setIcon( "opieplayer2/MPEGPlayer" );
795 796
796 if( !lnk.writeLink() ) { 797 if( !lnk.writeLink() ) {
797 qDebug( "Writing doclink did not work" ); 798 qDebug( "Writing doclink did not work" );
798 } 799 }
799 d->selectedFiles->addToSelection( lnk ); 800 d->selectedFiles->addToSelection( lnk );
800 } 801 }
801 } 802 }
802 if( fileDlg ) { 803 if( fileDlg ) {
803 delete fileDlg; 804 delete fileDlg;
804 } 805 }
805} 806}
806 807
807void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 808void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
808 switch ( e->key() ) { 809 switch ( e->key() ) {
809 ////////////////////////////// Zaurus keys 810 ////////////////////////////// Zaurus keys
810 case Key_F9: //activity 811 case Key_F9: //activity
811 // if(audioUI->isHidden()) 812 // if(audioUI->isHidden())
812 // audioUI->showMaximized(); 813 // audioUI->showMaximized();
813 break; 814 break;
814 case Key_F10: //contacts 815 case Key_F10: //contacts
815 // if( videoUI->isHidden()) 816 // if( videoUI->isHidden())
816 // videoUI->showMaximized(); 817 // videoUI->showMaximized();
817 break; 818 break;
818 case Key_F11: //menu 819 case Key_F11: //menu
819 break; 820 break;
@@ -900,64 +901,66 @@ void PlayListWidget::readm3u( const QString &filename ) {
900 if( s.at( s.length() - 4) == '.' ) { 901 if( s.at( s.length() - 4) == '.' ) {
901 lnk.setFile( s ); 902 lnk.setFile( s );
902 } else { 903 } else {
903 lnk.setFile( s + "/" ); 904 lnk.setFile( s + "/" );
904 } 905 }
905 lnk.setType( "audio/x-mpegurl" ); 906 lnk.setType( "audio/x-mpegurl" );
906 lnk.writeLink(); 907 lnk.writeLink();
907 d->selectedFiles->addToSelection( lnk ); 908 d->selectedFiles->addToSelection( lnk );
908 } 909 }
909 i++; 910 i++;
910 } 911 }
911 } 912 }
912 } 913 }
913 } 914 }
914 f.close(); 915 f.close();
915} 916}
916 917
917void PlayListWidget::writem3u() { 918void PlayListWidget::writem3u() {
918 InputDialog *fileDlg; 919 InputDialog *fileDlg;
919 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 920 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
920 fileDlg->exec(); 921 fileDlg->exec();
921 QString filename, list; 922 QString filename, list;
922 if( fileDlg->result() == 1 ) { 923 if( fileDlg->result() == 1 ) {
923 filename = fileDlg->text(); 924 filename = fileDlg->text();
924 qDebug( filename ); 925 qDebug( filename );
925 int noOfFiles = 0; 926 int noOfFiles = 0;
926 d->selectedFiles->first(); 927 d->selectedFiles->first();
927 do { 928 do {
928 // we dont check for existance because of url's 929 // we dont check for existance because of url's
929 // qDebug(d->selectedFiles->current()->file()); 930 // qDebug(d->selectedFiles->current()->file());
930 931
931 // so maybe we should do some net checking to ,-) 932 // so maybe we should do some net checking to ,-)
933 // no, cause it takes to long...
934
932 list += d->selectedFiles->current()->file() + "\n"; 935 list += d->selectedFiles->current()->file() + "\n";
933 noOfFiles++; 936 noOfFiles++;
934 } 937 }
935 while ( d->selectedFiles->next() ); 938 while ( d->selectedFiles->next() );
936 qDebug( list ); 939 qDebug( list );
937 if( filename.left( 1) != "/" ) { 940 if( filename.left( 1) != "/" ) {
938 filename=QPEApplication::documentDir() + "/" + filename; 941 filename=QPEApplication::documentDir() + "/" + filename;
939 } 942 }
940 if( filename.right( 3 ) != "m3u" ) { 943 if( filename.right( 3 ) != "m3u" ) {
941 filename=filename+".m3u"; 944 filename=filename+".m3u";
942 } 945 }
943 QFile f( filename ); 946 QFile f( filename );
944 f.open( IO_WriteOnly ); 947 f.open( IO_WriteOnly );
945 f.writeBlock( list, list.length() ); 948 f.writeBlock( list, list.length() );
946 f.close(); 949 f.close();
947 } 950 }
948 if( fileDlg ) { 951 if( fileDlg ) {
949 delete fileDlg; 952 delete fileDlg;
950 } 953 }
951} 954}
952 955
953void PlayListWidget::readPls( const QString &filename ) { 956void PlayListWidget::readPls( const QString &filename ) {
954 957
955 qDebug( "pls filename is " + filename ); 958 qDebug( "pls filename is " + filename );
956 QFile f( filename ); 959 QFile f( filename );
957 960
958 if( f.open( IO_ReadOnly ) ) { 961 if( f.open( IO_ReadOnly ) ) {
959 QTextStream t( &f ); 962 QTextStream t( &f );
960 QString s;//, first, second; 963 QString s;//, first, second;
961 int i = 0; 964 int i = 0;
962 while ( !t.atEnd() ) { 965 while ( !t.atEnd() ) {
963 s = t.readLine(); 966 s = t.readLine();