summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp8
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp11
2 files changed, 11 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 136e06c..73e41dc 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -135,33 +135,33 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
135 cfg.setGroup("Volume"); // qtopia is "Settings" 135 cfg.setGroup("Volume"); // qtopia is "Settings"
136 cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume 136 cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume
137# endif 137# endif
138 138
139//#endif 139//#endif
140// qDebug( "setting volume to: 0x%x", volume ); 140// qDebug( "setting volume to: 0x%x", volume );
141#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 141#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
142 // Send notification that the volume has changed 142 // Send notification that the volume has changed
143 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; 143 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
144#endif 144#endif
145} 145}
146 146
147 147
148 148
149AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { 149AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
150 qDebug("creating new audio device"); 150 qDebug("creating new audio device");
151 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; 151// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
152 d = new AudioDevicePrivate; 152 d = new AudioDevicePrivate;
153 d->frequency = f; 153 d->frequency = f;
154 d->channels = chs; 154 d->channels = chs;
155 d->bytesPerSample = bps; 155 d->bytesPerSample = bps;
156 qDebug("%d",bps); 156 qDebug("%d",bps);
157 int format=0; 157 int format=0;
158 if( bps == 8) format = AFMT_U8; 158 if( bps == 8) format = AFMT_U8;
159 else if( bps <= 0) format = AFMT_S16_LE; 159 else if( bps <= 0) format = AFMT_S16_LE;
160 else format = AFMT_S16_LE; 160 else format = AFMT_S16_LE;
161 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); 161 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
162 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); 162 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
163 163
164 int fragments = 0x10000 * 8 + sound_fragment_shift; 164 int fragments = 0x10000 * 8 + sound_fragment_shift;
165 int capabilities = 0; 165 int capabilities = 0;
166 166
167 167
@@ -187,59 +187,59 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
187 187
188 if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) 188 if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1)
189 perror("ioctl(\"SNDCTL_DSP_GETCAPS\")"); 189 perror("ioctl(\"SNDCTL_DSP_GETCAPS\")");
190 if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1) 190 if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1)
191 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); 191 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
192 if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) 192 if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1)
193 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 193 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
194 qDebug("freq %d", d->frequency); 194 qDebug("freq %d", d->frequency);
195 if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) 195 if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1)
196 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 196 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
197 qDebug("channels %d",d->channels); 197 qDebug("channels %d",d->channels);
198 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { 198 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) {
199 d->channels = ( d->channels == 1 ) ? 2 : d->channels; 199 d->channels = ( d->channels == 1 ) ? 2 : d->channels;
200 if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) 200 if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1)
201 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 201 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
202 } 202 }
203 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; 203// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
204 204
205 d->bufferSize = sound_fragment_bytes; 205 d->bufferSize = sound_fragment_bytes;
206 d->unwrittenBuffer = new char[d->bufferSize]; 206 d->unwrittenBuffer = new char[d->bufferSize];
207 d->unwritten = 0; 207 d->unwritten = 0;
208 d->can_GETOSPACE = TRUE; // until we find otherwise 208 d->can_GETOSPACE = TRUE; // until we find otherwise
209 209
210 //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); 210 //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels );
211 //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); 211 //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency );
212 //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); 212 //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" );
213 //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); 213 //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" );
214 //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); 214 //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" );
215 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); 215 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" );
216 216
217} 217}
218 218
219 219
220AudioDevice::~AudioDevice() { 220AudioDevice::~AudioDevice() {
221 qDebug("destryo audiodevice"); 221 qDebug("destryo audiodevice");
222 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; 222// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
223 223
224# ifndef KEEP_DEVICE_OPEN 224# ifndef KEEP_DEVICE_OPEN
225 close( d->handle ); // Now it should be safe to shut the handle 225 close( d->handle ); // Now it should be safe to shut the handle
226# endif 226# endif
227 delete d->unwrittenBuffer; 227 delete d->unwrittenBuffer;
228 delete d; 228 delete d;
229 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; 229// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
230 230
231} 231}
232 232
233 233
234void AudioDevice::volumeChanged( bool muted ) 234void AudioDevice::volumeChanged( bool muted )
235{ 235{
236 AudioDevicePrivate::muted = muted; 236 AudioDevicePrivate::muted = muted;
237} 237}
238 238
239 239
240void AudioDevice::write( char *buffer, unsigned int length ) 240void AudioDevice::write( char *buffer, unsigned int length )
241{ 241{
242 int t = ::write( d->handle, buffer, length ); 242 int t = ::write( d->handle, buffer, length );
243 if ( t<0 ) t = 0; 243 if ( t<0 ) t = 0;
244 if ( t != (int)length) { 244 if ( t != (int)length) {
245 qDebug("Ahhh!! memcpys 1"); 245 qDebug("Ahhh!! memcpys 1");
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 3c5734e..a0bf4db 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -201,33 +201,33 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
201 scaleButton->addTo(pmView); 201 scaleButton->addTo(pmView);
202 202
203 203
204 skinsMenu = new QPopupMenu( this ); 204 skinsMenu = new QPopupMenu( this );
205 menu->insertItem( tr( "Skins" ), skinsMenu ); 205 menu->insertItem( tr( "Skins" ), skinsMenu );
206 skinsMenu->isCheckable(); 206 skinsMenu->isCheckable();
207 connect( skinsMenu, SIGNAL( activated( int ) ) , 207 connect( skinsMenu, SIGNAL( activated( int ) ) ,
208 this, SLOT( skinsMenuActivated( int ) ) ); 208 this, SLOT( skinsMenuActivated( int ) ) );
209 populateSkinsMenu(); 209 populateSkinsMenu();
210 210
211 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 211 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
212 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 212 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
213 213
214 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 214 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
215 215
216 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 216 tabWidget = new QTabWidget( hbox6, "tabWidget" );
217 tabWidget->setTabShape(QTabWidget::Triangular); 217// tabWidget->setTabShape(QTabWidget::Triangular);
218 218
219 QWidget *pTab; 219 QWidget *pTab;
220 pTab = new QWidget( tabWidget, "pTab" ); 220 pTab = new QWidget( tabWidget, "pTab" );
221// playlistView = new QListView( pTab, "playlistview" ); 221// playlistView = new QListView( pTab, "playlistview" );
222// playlistView->setMinimumSize(236,260); 222// playlistView->setMinimumSize(236,260);
223 tabWidget->insertTab( pTab,"Playlist"); 223 tabWidget->insertTab( pTab,"Playlist");
224 224
225 225
226 // Add the playlist area 226 // Add the playlist area
227 227
228 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 228 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
229 d->playListFrame = vbox3; 229 d->playListFrame = vbox3;
230 d->playListFrame ->setMinimumSize(235,260); 230 d->playListFrame ->setMinimumSize(235,260);
231 231
232 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 232 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
233 233
@@ -312,33 +312,36 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
312 312
313 313
314//videoView 314//videoView
315 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 315 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
316 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 316 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
317 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 317 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
318 this,SLOT( playIt( QListViewItem *)) ); 318 this,SLOT( playIt( QListViewItem *)) );
319 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 319 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
320 320
321 321
322//playlists 322//playlists
323 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 323 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
324 324
325 325
326 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 326 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
327 327
328// connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 328 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
329
330
331
329 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 332 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
330 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 333 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
331 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 334 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
332 335
333 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 336 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
334 337
335 setCentralWidget( vbox5 ); 338 setCentralWidget( vbox5 );
336 339
337 Config cfg( "OpiePlayer" ); 340 Config cfg( "OpiePlayer" );
338 readConfig( cfg ); 341 readConfig( cfg );
339 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 342 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
340 loadList(DocLnk( currentPlaylist)); 343 loadList(DocLnk( currentPlaylist));
341 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); 344 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
342 345
343 initializeStates(); 346 initializeStates();
344} 347}
@@ -711,33 +714,33 @@ void PlayListWidget::addSelected() {
711 714
712 case 2: { // video 715 case 2: { // video
713 QListViewItemIterator it( videoView ); 716 QListViewItemIterator it( videoView );
714 for ( ; it.current(); ++it ) { 717 for ( ; it.current(); ++it ) {
715 if ( it.current()->isSelected() ) { 718 if ( it.current()->isSelected() ) {
716 719
717 filename = it.current()->text(3); 720 filename = it.current()->text(3);
718 lnk.setName( QFileInfo(filename).baseName() ); //sets name 721 lnk.setName( QFileInfo(filename).baseName() ); //sets name
719 lnk.setFile( filename ); //sets file name 722 lnk.setFile( filename ); //sets file name
720 d->selectedFiles->addToSelection( lnk); 723 d->selectedFiles->addToSelection( lnk);
721 } 724 }
722 } 725 }
723 videoView->clearSelection(); 726 videoView->clearSelection();
724 } 727 }
725 break; 728 break;
726 }; 729 };
727 tabWidget->setCurrentPage(0); 730// tabWidget->setCurrentPage(0);
728 writeCurrentM3u(); 731 writeCurrentM3u();
729 732
730} 733}
731 734
732void PlayListWidget::removeSelected() { 735void PlayListWidget::removeSelected() {
733 d->selectedFiles->removeSelected( ); 736 d->selectedFiles->removeSelected( );
734} 737}
735 738
736void PlayListWidget::playIt( QListViewItem *) { 739void PlayListWidget::playIt( QListViewItem *) {
737// d->setDocumentUsed = FALSE; 740// d->setDocumentUsed = FALSE;
738// mediaPlayerState->curPosition =0; 741// mediaPlayerState->curPosition =0;
739 qDebug("playIt"); 742 qDebug("playIt");
740 mediaPlayerState->setPlaying(FALSE); 743 mediaPlayerState->setPlaying(FALSE);
741 mediaPlayerState->setPlaying(TRUE); 744 mediaPlayerState->setPlaying(TRUE);
742 d->selectedFiles->unSelect(); 745 d->selectedFiles->unSelect();
743} 746}
@@ -748,33 +751,33 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
748 if(it) { 751 if(it) {
749 switch ( tabWidget->currentPageIndex()) { 752 switch ( tabWidget->currentPageIndex()) {
750 case 0: //playlist 753 case 0: //playlist
751 return; 754 return;
752 break; 755 break;
753 }; 756 };
754 // case 1: { 757 // case 1: {
755 DocLnk lnk; 758 DocLnk lnk;
756 QString filename; 759 QString filename;
757 760
758 filename=it->text(3); 761 filename=it->text(3);
759 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name 762 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
760 lnk.setFile( filename ); //sets file name 763 lnk.setFile( filename ); //sets file name
761 d->selectedFiles->addToSelection( lnk); 764 d->selectedFiles->addToSelection( lnk);
762 765
763 writeCurrentM3u(); 766 writeCurrentM3u();
764 tabWidget->setCurrentPage(0); 767// tabWidget->setCurrentPage(0);
765 768
766 } 769 }
767} 770}
768 771
769void PlayListWidget::tabChanged(QWidget *) { 772void PlayListWidget::tabChanged(QWidget *) {
770 773
771 switch ( tabWidget->currentPageIndex()) { 774 switch ( tabWidget->currentPageIndex()) {
772 case 0: 775 case 0:
773 { 776 {
774 if( !tbDeletePlaylist->isHidden()) 777 if( !tbDeletePlaylist->isHidden())
775 tbDeletePlaylist->hide(); 778 tbDeletePlaylist->hide();
776 d->tbRemoveFromList->setEnabled(TRUE); 779 d->tbRemoveFromList->setEnabled(TRUE);
777 d->tbAddToList->setEnabled(FALSE); 780 d->tbAddToList->setEnabled(FALSE);
778 } 781 }
779 break; 782 break;
780 case 1: 783 case 1: