author | llornkcor <llornkcor> | 2002-06-13 04:46:12 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-13 04:46:12 (UTC) |
commit | 7ab4c2b4684287ac5f629445abcedb34ebfce9f3 (patch) (unidiff) | |
tree | 28a17efdd2ac4a3b2193b27e14dbd96740fffc66 | |
parent | 7239ae505999b64c74479c460daba256baf82798 (diff) | |
download | opie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.zip opie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.tar.gz opie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.tar.bz2 |
bugfix: menu select play works again
-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 25 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 2 |
3 files changed, 14 insertions, 17 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index e0989d0..3262e38 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -6,32 +6,33 @@ | |||
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 | 20 | // L.J.Potter added better error code Fri 02-15-2002 14:37:47 |
21 | 21 | ||
22 | |||
22 | #include <stdlib.h> | 23 | #include <stdlib.h> |
23 | #include <stdio.h> | 24 | #include <stdio.h> |
24 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | #include "audiodevice.h" | 27 | #include "audiodevice.h" |
27 | 28 | ||
28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 29 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
29 | #include "qpe/qcopenvelope_qws.h" | 30 | #include "qpe/qcopenvelope_qws.h" |
30 | #endif | 31 | #endif |
31 | 32 | ||
32 | #ifdef Q_WS_WIN | 33 | #ifdef Q_WS_WIN |
33 | #include <windows.h> | 34 | #include <windows.h> |
34 | #include <mmsystem.h> | 35 | #include <mmsystem.h> |
35 | #include <mmreg.h> | 36 | #include <mmreg.h> |
36 | #endif | 37 | #endif |
37 | 38 | ||
@@ -175,48 +176,48 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
175 | cfg.writeEntry("Volume",(int)rV); | 176 | cfg.writeEntry("Volume",(int)rV); |
176 | # endif | 177 | # endif |
177 | 178 | ||
178 | #endif | 179 | #endif |
179 | // qDebug( "setting volume to: 0x%x", volume ); | 180 | // qDebug( "setting volume to: 0x%x", volume ); |
180 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 181 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
181 | // Send notification that the volume has changed | 182 | // Send notification that the volume has changed |
182 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 183 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
183 | #endif | 184 | #endif |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | 188 | ||
188 | 189 | ||
189 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | 190 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { |
190 | qDebug("creating new audio device"); | 191 | qDebug("creating new audio device"); |
192 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | ||
191 | d = new AudioDevicePrivate; | 193 | d = new AudioDevicePrivate; |
192 | d->frequency = f; | 194 | d->frequency = f; |
193 | d->channels = chs; | 195 | d->channels = chs; |
194 | d->bytesPerSample = bps; | 196 | d->bytesPerSample = bps; |
195 | qDebug("%d",bps); | 197 | qDebug("%d",bps); |
196 | int format=0; | 198 | int format=0; |
197 | if( bps == 8) format = AFMT_U8; | 199 | if( bps == 8) format = AFMT_U8; |
198 | else if( bps <= 0) format = AFMT_S16_LE; | 200 | else if( bps <= 0) format = AFMT_S16_LE; |
199 | else format = AFMT_S16_LE; | 201 | else format = AFMT_S16_LE; |
200 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | 202 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); |
201 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 203 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
202 | 204 | ||
203 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 205 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
204 | int capabilities = 0; | 206 | int capabilities = 0; |
205 | 207 | ||
206 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | ||
207 | 208 | ||
208 | #ifdef KEEP_DEVICE_OPEN | 209 | #ifdef KEEP_DEVICE_OPEN |
209 | if ( AudioDevicePrivate::dspFd == 0 ) { | 210 | if ( AudioDevicePrivate::dspFd == 0 ) { |
210 | #endif | 211 | #endif |
211 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { | 212 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { |
212 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); | 213 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); |
213 | d->handle = ::open( "/dev/null", O_WRONLY ); | 214 | d->handle = ::open( "/dev/null", O_WRONLY ); |
214 | } | 215 | } |
215 | #ifdef KEEP_DEVICE_OPEN | 216 | #ifdef KEEP_DEVICE_OPEN |
216 | AudioDevicePrivate::dspFd = d->handle; | 217 | AudioDevicePrivate::dspFd = d->handle; |
217 | } else { | 218 | } else { |
218 | d->handle = AudioDevicePrivate::dspFd; | 219 | d->handle = AudioDevicePrivate::dspFd; |
219 | } | 220 | } |
220 | #endif | 221 | #endif |
221 | 222 | ||
222 | if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) | 223 | if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) |
@@ -251,33 +252,32 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
251 | } | 252 | } |
252 | 253 | ||
253 | 254 | ||
254 | AudioDevice::~AudioDevice() { | 255 | AudioDevice::~AudioDevice() { |
255 | qDebug("destryo audiodevice"); | 256 | qDebug("destryo audiodevice"); |
256 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | 257 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; |
257 | 258 | ||
258 | #ifdef Q_OS_WIN32 | 259 | #ifdef Q_OS_WIN32 |
259 | waveOutClose( (HWAVEOUT)d->handle ); | 260 | waveOutClose( (HWAVEOUT)d->handle ); |
260 | #else | 261 | #else |
261 | # ifndef KEEP_DEVICE_OPEN | 262 | # ifndef KEEP_DEVICE_OPEN |
262 | close( d->handle ); // Now it should be safe to shut the handle | 263 | close( d->handle ); // Now it should be safe to shut the handle |
263 | # endif | 264 | # endif |
264 | delete d->unwrittenBuffer; | 265 | delete d->unwrittenBuffer; |
265 | delete d; | 266 | delete d; |
266 | #endif | 267 | #endif |
267 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; | ||
268 | 268 | ||
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
272 | void AudioDevice::volumeChanged( bool muted ) | 272 | void AudioDevice::volumeChanged( bool muted ) |
273 | { | 273 | { |
274 | AudioDevicePrivate::muted = muted; | 274 | AudioDevicePrivate::muted = muted; |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | void AudioDevice::write( char *buffer, unsigned int length ) | 278 | void AudioDevice::write( char *buffer, unsigned int length ) |
279 | { | 279 | { |
280 | #ifdef Q_OS_WIN32 | 280 | #ifdef Q_OS_WIN32 |
281 | // returns immediately and (to be implemented) emits completedIO() when finished writing | 281 | // returns immediately and (to be implemented) emits completedIO() when finished writing |
282 | WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) ); | 282 | WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) ); |
283 | // maybe the buffer should be copied so that this fool proof, but its a performance hit | 283 | // maybe the buffer should be copied so that this fool proof, but its a performance hit |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 930560e..d7447b7 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -827,90 +827,87 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
827 | } | 827 | } |
828 | break; | 828 | break; |
829 | }; | 829 | }; |
830 | } | 830 | } |
831 | 831 | ||
832 | void PlayListWidget::btnPlay(bool b) { | 832 | void PlayListWidget::btnPlay(bool b) { |
833 | 833 | ||
834 | // mediaPlayerState->setPlaying(b); | 834 | // mediaPlayerState->setPlaying(b); |
835 | switch ( tabWidget->currentPageIndex()) { | 835 | switch ( tabWidget->currentPageIndex()) { |
836 | case 0: | 836 | case 0: |
837 | { | 837 | { |
838 | mediaPlayerState->setPlaying(b); | 838 | mediaPlayerState->setPlaying(b); |
839 | } | 839 | } |
840 | break; | 840 | break; |
841 | case 1: | 841 | case 1: |
842 | { | 842 | { |
843 | // if(audioView->selectedItem()) { | 843 | addToSelection( audioView->currentItem() ); |
844 | addToSelection( audioView->selectedItem() ); | ||
845 | mediaPlayerState->setPlaying(b); | 844 | mediaPlayerState->setPlaying(b); |
846 | d->selectedFiles->removeSelected( ); | 845 | d->selectedFiles->removeSelected( ); |
847 | tabWidget->setCurrentPage(1); | 846 | tabWidget->setCurrentPage(1); |
848 | d->selectedFiles->unSelect(); | 847 | d->selectedFiles->unSelect(); |
849 | insanityBool=FALSE; | 848 | insanityBool=FALSE; |
850 | // audioView->clearSelection(); | 849 | // audioView->clearSelection(); |
851 | // } | ||
852 | } | 850 | } |
853 | break; | 851 | break; |
854 | case 2: | 852 | case 2: |
855 | { | 853 | { |
856 | // if(videoView->selectedItem() ) { | 854 | addToSelection( videoView->currentItem() ); |
857 | addToSelection( videoView->selectedItem() ); | ||
858 | mediaPlayerState->setPlaying(b); | 855 | mediaPlayerState->setPlaying(b); |
859 | qApp->processEvents(); | 856 | qApp->processEvents(); |
860 | d->selectedFiles->removeSelected( ); | 857 | d->selectedFiles->removeSelected( ); |
861 | tabWidget->setCurrentPage(2); | 858 | tabWidget->setCurrentPage(2); |
862 | d->selectedFiles->unSelect(); | 859 | d->selectedFiles->unSelect(); |
863 | insanityBool=FALSE; | 860 | insanityBool=FALSE; |
864 | // videoView->clearSelection(); | 861 | // videoView->clearSelection(); |
865 | // } | ||
866 | } | 862 | } |
867 | break; | 863 | break; |
868 | }; | 864 | }; |
869 | } | 865 | } |
870 | 866 | ||
871 | void PlayListWidget::deletePlaylist() { | 867 | void PlayListWidget::deletePlaylist() { |
872 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 868 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
873 | (tr("You really want to delete\nthis playlist?")), | 869 | (tr("You really want to delete\nthis playlist?")), |
874 | (tr("Yes")), (tr("No")), 0 )){ | 870 | (tr("Yes")), (tr("No")), 0 )){ |
875 | case 0: // Yes clicked, | 871 | case 0: // Yes clicked, |
876 | QFile().remove(playLists->selected()->file()); | 872 | QFile().remove(playLists->selected()->file()); |
877 | QFile().remove(playLists->selected()->linkFile()); | 873 | QFile().remove(playLists->selected()->linkFile()); |
878 | playLists->reread(); | 874 | playLists->reread(); |
879 | break; | 875 | break; |
880 | case 1: // Cancel | 876 | case 1: // Cancel |
881 | break; | 877 | break; |
882 | }; | 878 | }; |
883 | } | 879 | } |
884 | 880 | ||
885 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 881 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
886 | { | 882 | { |
887 | switch (mouse) { | 883 | switch (mouse) { |
888 | case 1: | 884 | case 1: |
889 | break; | 885 | break; |
890 | case 2:{ | 886 | case 2:{ |
891 | QPopupMenu m; | 887 | |
892 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 888 | QPopupMenu m; |
893 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 889 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
894 | m.insertSeparator(); | 890 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
895 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) | 891 | m.insertSeparator(); |
896 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 892 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) |
893 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | ||
897 | 894 | ||
898 | m.exec( QCursor::pos() ); | 895 | m.exec( QCursor::pos() ); |
899 | } | 896 | } |
900 | break; | 897 | break; |
901 | }; | 898 | }; |
902 | } | 899 | } |
903 | 900 | ||
904 | void PlayListWidget::playSelected() | 901 | void PlayListWidget::playSelected() |
905 | { | 902 | { |
906 | btnPlay( TRUE); | 903 | btnPlay( TRUE); |
907 | // d->selectedFiles->unSelect(); | 904 | // d->selectedFiles->unSelect(); |
908 | } | 905 | } |
909 | 906 | ||
910 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 907 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
911 | { | 908 | { |
912 | switch (mouse) { | 909 | switch (mouse) { |
913 | case 1: | 910 | case 1: |
914 | 911 | ||
915 | break; | 912 | break; |
916 | case 2:{ | 913 | case 2:{ |
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 6569f35..5837ed3 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -44,33 +44,33 @@ public: | |||
44 | ~PlayListWidget(); | 44 | ~PlayListWidget(); |
45 | QTabWidget * tabWidget; | 45 | QTabWidget * tabWidget; |
46 | QAction *fullScreenButton, *scaleButton; | 46 | QAction *fullScreenButton, *scaleButton; |
47 | DocLnkSet files; | 47 | DocLnkSet files; |
48 | DocLnkSet vFiles; | 48 | DocLnkSet vFiles; |
49 | QListView *audioView, *videoView, *playlistView; | 49 | QListView *audioView, *videoView, *playlistView; |
50 | QLabel *libString; | 50 | QLabel *libString; |
51 | bool fromSetDocument; | 51 | bool fromSetDocument; |
52 | bool insanityBool; | 52 | bool insanityBool; |
53 | QString setDocFileRef; | 53 | QString setDocFileRef; |
54 | // retrieve the current playlist entry (media file link) | 54 | // retrieve the current playlist entry (media file link) |
55 | const DocLnk *current(); | 55 | const DocLnk *current(); |
56 | void useSelectedDocument(); | 56 | void useSelectedDocument(); |
57 | /* QTimer * menuTimer; */ | 57 | /* QTimer * menuTimer; */ |
58 | FileSelector* playLists; | 58 | FileSelector* playLists; |
59 | QPushButton *tbDeletePlaylist; | 59 | QPushButton *tbDeletePlaylist; |
60 | int fd; | 60 | int fd, selected; |
61 | public slots: | 61 | public slots: |
62 | bool first(); | 62 | bool first(); |
63 | bool last(); | 63 | bool last(); |
64 | bool next(); | 64 | bool next(); |
65 | bool prev(); | 65 | bool prev(); |
66 | /* void setFullScreen(); */ | 66 | /* void setFullScreen(); */ |
67 | /* void setScaled(); */ | 67 | /* void setScaled(); */ |
68 | protected: | 68 | protected: |
69 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 69 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
70 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 70 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
71 | void keyReleaseEvent( QKeyEvent *e); | 71 | void keyReleaseEvent( QKeyEvent *e); |
72 | void keyPressEvent( QKeyEvent *e); | 72 | void keyPressEvent( QKeyEvent *e); |
73 | private: | 73 | private: |
74 | bool audioScan, videoScan; | 74 | bool audioScan, videoScan; |
75 | void doBlank(); | 75 | void doBlank(); |
76 | void doUnblank(); | 76 | void doUnblank(); |