author | llornkcor <llornkcor> | 2002-02-25 00:26:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 00:26:33 (UTC) |
commit | c0446b55fc32b7fdea9f58db06e40da703f5e8ff (patch) (unidiff) | |
tree | b84cbcdf9d2687bb3e8672981a6e62577c98becb | |
parent | 146ed85c70bf6a288294e91baceb9af9ec5b8611 (diff) | |
download | opie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.zip opie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.tar.gz opie-c0446b55fc32b7fdea9f58db06e40da703f5e8ff.tar.bz2 |
*** empty log message ***
-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 16 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 47 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 12 |
4 files changed, 44 insertions, 39 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 59136af..11fd9e8 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -96,33 +96,33 @@ unsigned int AudioDevicePrivate::rightVolume = 0; | |||
96 | 96 | ||
97 | void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) { | 97 | void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) { |
98 | muted = AudioDevicePrivate::muted; | 98 | muted = AudioDevicePrivate::muted; |
99 | unsigned int volume; | 99 | unsigned int volume; |
100 | #ifdef Q_OS_WIN32 | 100 | #ifdef Q_OS_WIN32 |
101 | HWAVEOUT handle; | 101 | HWAVEOUT handle; |
102 | WAVEFORMATEX formatData; | 102 | WAVEFORMATEX formatData; |
103 | formatData.cbSize = sizeof(WAVEFORMATEX); | 103 | formatData.cbSize = sizeof(WAVEFORMATEX); |
104 | formatData.wFormatTag = WAVE_FORMAT_PCM; | 104 | formatData.wFormatTag = WAVE_FORMAT_PCM; |
105 | formatData.nAvgBytesPerSec = 4 * 44000; | 105 | formatData.nAvgBytesPerSec = 4 * 44000; |
106 | formatData.nBlockAlign = 4; | 106 | formatData.nBlockAlign = 4; |
107 | formatData.nChannels = 2; | 107 | formatData.nChannels = 2; |
108 | formatData.nSamplesPerSec = 44000; | 108 | formatData.nSamplesPerSec = 44000; |
109 | formatData.wBitsPerSample = 16; | 109 | formatData.wBitsPerSample = 16; |
110 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); | 110 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); |
111 | if ( waveOutGetVolume( handle, (LPDWORD)&volume ) ) | 111 | if ( waveOutGetVolume( handle, (LPDWORD)&volume ) ) |
112 | qDebug( "get volume of audio device failed" ); | 112 | // qDebug( "get volume of audio device failed" ); |
113 | waveOutClose( handle ); | 113 | waveOutClose( handle ); |
114 | leftVolume = volume & 0xFFFF; | 114 | leftVolume = volume & 0xFFFF; |
115 | rightVolume = volume >> 16; | 115 | rightVolume = volume >> 16; |
116 | #else | 116 | #else |
117 | int mixerHandle = open( "/dev/mixer", O_RDWR ); | 117 | int mixerHandle = open( "/dev/mixer", O_RDWR ); |
118 | if ( mixerHandle >= 0 ) { | 118 | if ( mixerHandle >= 0 ) { |
119 | if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) | 119 | if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) |
120 | perror("ioctl(\"MIXER_READ\")"); | 120 | perror("ioctl(\"MIXER_READ\")"); |
121 | close( mixerHandle ); | 121 | close( mixerHandle ); |
122 | } else | 122 | } else |
123 | perror("open(\"/dev/mixer\")"); | 123 | perror("open(\"/dev/mixer\")"); |
124 | leftVolume = ((volume & 0x00FF) << 16) / 101; | 124 | leftVolume = ((volume & 0x00FF) << 16) / 101; |
125 | rightVolume = ((volume & 0xFF00) << 8) / 101; | 125 | rightVolume = ((volume & 0xFF00) << 8) / 101; |
126 | #endif | 126 | #endif |
127 | } | 127 | } |
128 | 128 | ||
@@ -138,33 +138,33 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
138 | leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume ); | 138 | leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume ); |
139 | rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume ); | 139 | rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume ); |
140 | } | 140 | } |
141 | #ifdef Q_OS_WIN32 | 141 | #ifdef Q_OS_WIN32 |
142 | HWAVEOUT handle; | 142 | HWAVEOUT handle; |
143 | WAVEFORMATEX formatData; | 143 | WAVEFORMATEX formatData; |
144 | formatData.cbSize = sizeof(WAVEFORMATEX); | 144 | formatData.cbSize = sizeof(WAVEFORMATEX); |
145 | formatData.wFormatTag = WAVE_FORMAT_PCM; | 145 | formatData.wFormatTag = WAVE_FORMAT_PCM; |
146 | formatData.nAvgBytesPerSec = 4 * 44000; | 146 | formatData.nAvgBytesPerSec = 4 * 44000; |
147 | formatData.nBlockAlign = 4; | 147 | formatData.nBlockAlign = 4; |
148 | formatData.nChannels = 2; | 148 | formatData.nChannels = 2; |
149 | formatData.nSamplesPerSec = 44000; | 149 | formatData.nSamplesPerSec = 44000; |
150 | formatData.wBitsPerSample = 16; | 150 | formatData.wBitsPerSample = 16; |
151 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); | 151 | waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); |
152 | unsigned int volume = (rightVolume << 16) | leftVolume; | 152 | unsigned int volume = (rightVolume << 16) | leftVolume; |
153 | if ( waveOutSetVolume( handle, volume ) ) | 153 | if ( waveOutSetVolume( handle, volume ) ) |
154 | qDebug( "set volume of audio device failed" ); | 154 | // qDebug( "set volume of audio device failed" ); |
155 | waveOutClose( handle ); | 155 | waveOutClose( handle ); |
156 | #else | 156 | #else |
157 | // Volume can be from 0 to 100 which is 101 distinct values | 157 | // Volume can be from 0 to 100 which is 101 distinct values |
158 | unsigned int rV = (rightVolume * 101) >> 16; | 158 | unsigned int rV = (rightVolume * 101) >> 16; |
159 | 159 | ||
160 | # if 0 | 160 | # if 0 |
161 | unsigned int lV = (leftVolume * 101) >> 16; | 161 | unsigned int lV = (leftVolume * 101) >> 16; |
162 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); | 162 | unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); |
163 | int mixerHandle = 0; | 163 | int mixerHandle = 0; |
164 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 164 | if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
165 | if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) | 165 | if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) |
166 | perror("ioctl(\"MIXER_WRITE\")"); | 166 | perror("ioctl(\"MIXER_WRITE\")"); |
167 | close( mixerHandle ); | 167 | close( mixerHandle ); |
168 | } else | 168 | } else |
169 | perror("open(\"/dev/mixer\")"); | 169 | perror("open(\"/dev/mixer\")"); |
170 | 170 | ||
@@ -179,39 +179,39 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
179 | #endif | 179 | #endif |
180 | // qDebug( "setting volume to: 0x%x", volume ); | 180 | // qDebug( "setting volume to: 0x%x", volume ); |
181 | #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) |
182 | // Send notification that the volume has changed | 182 | // Send notification that the volume has changed |
183 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 183 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
184 | #endif | 184 | #endif |
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | 188 | ||
189 | 189 | ||
190 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | 190 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { |
191 | d = new AudioDevicePrivate; | 191 | d = new AudioDevicePrivate; |
192 | d->frequency = f; | 192 | d->frequency = f; |
193 | d->channels = chs; | 193 | d->channels = chs; |
194 | d->bytesPerSample = bps; | 194 | d->bytesPerSample = bps; |
195 | qDebug("%d",bps); | 195 | // qDebug("%d",bps); |
196 | int format=0; | 196 | int format=0; |
197 | if( bps == 8) format = AFMT_U8; | 197 | if( bps == 8) format = AFMT_U8; |
198 | else if( bps <= 0) format = AFMT_S16_LE; | 198 | else if( bps <= 0) format = AFMT_S16_LE; |
199 | else format = AFMT_S16_LE; | 199 | else format = AFMT_S16_LE; |
200 | 200 | ||
201 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | 201 | // qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); |
202 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 202 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
203 | 203 | ||
204 | 204 | ||
205 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 205 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
206 | int capabilities = 0; | 206 | int capabilities = 0; |
207 | 207 | ||
208 | #ifdef KEEP_DEVICE_OPEN | 208 | #ifdef KEEP_DEVICE_OPEN |
209 | if ( AudioDevicePrivate::dspFd == 0 ) { | 209 | if ( AudioDevicePrivate::dspFd == 0 ) { |
210 | #endif | 210 | #endif |
211 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { | 211 | if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { |
212 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); | 212 | perror("open(\"/dev/dsp\") sending to /dev/null instead"); |
213 | d->handle = ::open( "/dev/null", O_WRONLY ); | 213 | d->handle = ::open( "/dev/null", O_WRONLY ); |
214 | } | 214 | } |
215 | #ifdef KEEP_DEVICE_OPEN | 215 | #ifdef KEEP_DEVICE_OPEN |
216 | AudioDevicePrivate::dspFd = d->handle; | 216 | AudioDevicePrivate::dspFd = d->handle; |
217 | } else { | 217 | } else { |
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 859a67a..1ae0059 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -222,40 +222,40 @@ void LoopControl::startAudio() { | |||
222 | audioMutex->lock(); | 222 | audioMutex->lock(); |
223 | 223 | ||
224 | if ( moreAudio ) { | 224 | if ( moreAudio ) { |
225 | 225 | ||
226 | if ( !isMuted && mediaPlayerState->curDecoder() ) { | 226 | if ( !isMuted && mediaPlayerState->curDecoder() ) { |
227 | 227 | ||
228 | currentSample = audioSampleCounter + 1; | 228 | currentSample = audioSampleCounter + 1; |
229 | 229 | ||
230 | if ( currentSample != audioSampleCounter + 1 ) | 230 | if ( currentSample != audioSampleCounter + 1 ) |
231 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 231 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); |
232 | 232 | ||
233 | long samplesRead = 0; | 233 | long samplesRead = 0; |
234 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); | 234 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); |
235 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 235 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
236 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 236 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
237 | 237 | ||
238 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 5000 ) ) { | 238 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
239 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 239 | usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
240 | // } | 240 | } |
241 | // else if ( sampleWaitTime <= -5000 ) { | 241 | else if ( sampleWaitTime <= -5000 ) { |
242 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 242 | qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); |
243 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 243 | //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
244 | // currentSample = sampleWeShouldBeAt; | 244 | currentSample = sampleWeShouldBeAt; |
245 | // } | 245 | } |
246 | 246 | ||
247 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 247 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
248 | audioSampleCounter = currentSample + samplesRead - 1; | 248 | audioSampleCounter = currentSample + samplesRead - 1; |
249 | 249 | ||
250 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); | 250 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); |
251 | 251 | ||
252 | } else { | 252 | } else { |
253 | 253 | ||
254 | moreAudio = FALSE; | 254 | moreAudio = FALSE; |
255 | 255 | ||
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | audioMutex->unlock(); | 260 | audioMutex->unlock(); |
261 | } | 261 | } |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 4e1543e..269aed8 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -26,33 +26,33 @@ | |||
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qaction.h> | 29 | #include <qaction.h> |
30 | #include <qimage.h> | 30 | #include <qimage.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlist.h> | 34 | #include <qlist.h> |
35 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
36 | #include <qmainwindow.h> | 36 | #include <qmainwindow.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qlistview.h> | 40 | #include <qlistview.h> |
41 | #include <qpoint.h> | 41 | #include <qpoint.h> |
42 | #include <qtimer.h> | 42 | //#include <qtimer.h> |
43 | 43 | ||
44 | #include "playlistselection.h" | 44 | #include "playlistselection.h" |
45 | #include "playlistwidget.h" | 45 | #include "playlistwidget.h" |
46 | #include "mediaplayerstate.h" | 46 | #include "mediaplayerstate.h" |
47 | 47 | ||
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | 49 | ||
50 | #define BUTTONS_ON_TOOLBAR | 50 | #define BUTTONS_ON_TOOLBAR |
51 | #define SIDE_BUTTONS | 51 | #define SIDE_BUTTONS |
52 | #define CAN_SAVE_LOAD_PLAYLISTS | 52 | #define CAN_SAVE_LOAD_PLAYLISTS |
53 | 53 | ||
54 | extern MediaPlayerState *mediaPlayerState; | 54 | extern MediaPlayerState *mediaPlayerState; |
55 | 55 | ||
56 | // class myFileSelector { | 56 | // class myFileSelector { |
57 | 57 | ||
58 | // }; | 58 | // }; |
@@ -85,34 +85,34 @@ public: | |||
85 | class MenuItem : public QAction { | 85 | class MenuItem : public QAction { |
86 | public: | 86 | public: |
87 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 87 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
88 | : QAction( text, QString::null, 0, 0 ) { | 88 | : QAction( text, QString::null, 0, 0 ) { |
89 | connect( this, SIGNAL( activated() ), handler, slot ); | 89 | connect( this, SIGNAL( activated() ), handler, slot ); |
90 | addTo( parent ); | 90 | addTo( parent ); |
91 | } | 91 | } |
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 95 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
96 | : QMainWindow( parent, name, fl ) { | 96 | : QMainWindow( parent, name, fl ) { |
97 | 97 | ||
98 | d = new PlayListWidgetPrivate; | 98 | d = new PlayListWidgetPrivate; |
99 | d->setDocumentUsed = FALSE; | 99 | d->setDocumentUsed = FALSE; |
100 | d->current = NULL; | 100 | d->current = NULL; |
101 | menuTimer = new QTimer( this ,"menu timer"), | 101 | // menuTimer = new QTimer( this ,"menu timer"), |
102 | connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 102 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
103 | 103 | ||
104 | setBackgroundMode( PaletteButton ); | 104 | setBackgroundMode( PaletteButton ); |
105 | 105 | ||
106 | setCaption( tr("OpiePlayer") ); | 106 | setCaption( tr("OpiePlayer") ); |
107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
108 | 108 | ||
109 | setToolBarsMovable( FALSE ); | 109 | setToolBarsMovable( FALSE ); |
110 | 110 | ||
111 | // Create Toolbar | 111 | // Create Toolbar |
112 | QPEToolBar *toolbar = new QPEToolBar( this ); | 112 | QPEToolBar *toolbar = new QPEToolBar( this ); |
113 | toolbar->setHorizontalStretchable( TRUE ); | 113 | toolbar->setHorizontalStretchable( TRUE ); |
114 | 114 | ||
115 | // Create Menubar | 115 | // Create Menubar |
116 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 116 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
117 | menu->setMargin( 0 ); | 117 | menu->setMargin( 0 ); |
118 | 118 | ||
@@ -191,62 +191,67 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
191 | aTab = new QWidget( tabWidget, "aTab" ); | 191 | aTab = new QWidget( tabWidget, "aTab" ); |
192 | audioView = new QListView( aTab, "Audioview" ); | 192 | audioView = new QListView( aTab, "Audioview" ); |
193 | audioView->setMinimumSize(233,260); | 193 | audioView->setMinimumSize(233,260); |
194 | audioView->addColumn( "Title",150); | 194 | audioView->addColumn( "Title",150); |
195 | audioView->addColumn("Size", 45); | 195 | audioView->addColumn("Size", 45); |
196 | audioView->addColumn("Media",35); | 196 | audioView->addColumn("Media",35); |
197 | audioView->setColumnAlignment(1, Qt::AlignRight); | 197 | audioView->setColumnAlignment(1, Qt::AlignRight); |
198 | audioView->setColumnAlignment(2, Qt::AlignRight); | 198 | audioView->setColumnAlignment(2, Qt::AlignRight); |
199 | tabWidget->insertTab(aTab,"Audio"); | 199 | tabWidget->insertTab(aTab,"Audio"); |
200 | // audioView | 200 | // audioView |
201 | Global::findDocuments(&files, "audio/*"); | 201 | Global::findDocuments(&files, "audio/*"); |
202 | QListIterator<DocLnk> dit( files.children() ); | 202 | QListIterator<DocLnk> dit( files.children() ); |
203 | QString storage; | 203 | QString storage; |
204 | for ( ; dit.current(); ++dit ) { | 204 | for ( ; dit.current(); ++dit ) { |
205 | QListViewItem * newItem; | 205 | QListViewItem * newItem; |
206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
207 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
207 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 208 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
208 | else storage="RAM"; | 209 | else storage="RAM"; |
209 | 210 | if ( QFile( dit.current()->file()).exists() ) { | |
210 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 211 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
211 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 212 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
213 | } | ||
212 | } | 214 | } |
213 | // videowidget | 215 | // videowidget |
214 | 216 | ||
215 | QWidget *vTab; | 217 | QWidget *vTab; |
216 | vTab = new QWidget( tabWidget, "vTab" ); | 218 | vTab = new QWidget( tabWidget, "vTab" ); |
217 | videoView = new QListView( vTab, "Videoview" ); | 219 | videoView = new QListView( vTab, "Videoview" ); |
218 | videoView->setMinimumSize(233,260); | 220 | videoView->setMinimumSize(233,260); |
219 | 221 | ||
220 | videoView->addColumn("Title",150); | 222 | videoView->addColumn("Title",150); |
221 | videoView->addColumn("Size",45); | 223 | videoView->addColumn("Size",45); |
222 | videoView->addColumn("Media",35); | 224 | videoView->addColumn("Media",35); |
223 | videoView->setColumnAlignment(1, Qt::AlignRight); | 225 | videoView->setColumnAlignment(1, Qt::AlignRight); |
224 | videoView->setColumnAlignment(2, Qt::AlignRight); | 226 | videoView->setColumnAlignment(2, Qt::AlignRight); |
225 | 227 | ||
226 | tabWidget->insertTab( vTab,"Video"); | 228 | tabWidget->insertTab( vTab,"Video"); |
227 | 229 | ||
228 | Global::findDocuments(&vFiles, "video/*"); | 230 | Global::findDocuments(&vFiles, "video/*"); |
229 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 231 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
230 | for ( ; Vdit.current(); ++Vdit ) { | 232 | for ( ; Vdit.current(); ++Vdit ) { |
231 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 233 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
234 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
232 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 235 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
233 | else storage="RAM"; | 236 | else storage="RAM"; |
234 | QListViewItem * newItem; | 237 | QListViewItem * newItem; |
238 | if ( QFile( Vdit.current()->file()).exists() ) { | ||
235 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 239 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
236 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 240 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
241 | } | ||
237 | } | 242 | } |
238 | 243 | ||
239 | 244 | ||
240 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 245 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
241 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 246 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
242 | 247 | ||
243 | // add the library area | 248 | // add the library area |
244 | 249 | ||
245 | // d->files->setBackgroundMode( PaletteButton ); | 250 | // d->files->setBackgroundMode( PaletteButton ); |
246 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 251 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); |
247 | 252 | ||
248 | // #ifdef SIDE_BUTTONS | 253 | // #ifdef SIDE_BUTTONS |
249 | // QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch | 254 | // QVBox *stretch3 = new QVBox( vbox1 ); stretch3->setBackgroundMode( PaletteButton ); // add stretch |
250 | // #endif | 255 | // #endif |
251 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 256 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
252 | 257 | ||
@@ -650,44 +655,44 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
650 | break; | 655 | break; |
651 | case 1: | 656 | case 1: |
652 | { | 657 | { |
653 | d->tbRemoveFromList->setEnabled(FALSE); | 658 | d->tbRemoveFromList->setEnabled(FALSE); |
654 | d->tbAddToList->setEnabled(TRUE); | 659 | d->tbAddToList->setEnabled(TRUE); |
655 | } | 660 | } |
656 | break; | 661 | break; |
657 | case 2: | 662 | case 2: |
658 | { | 663 | { |
659 | d->tbRemoveFromList->setEnabled(FALSE); | 664 | d->tbRemoveFromList->setEnabled(FALSE); |
660 | d->tbAddToList->setEnabled(TRUE); | 665 | d->tbAddToList->setEnabled(TRUE); |
661 | } | 666 | } |
662 | break; | 667 | break; |
663 | }; | 668 | }; |
664 | } | 669 | } |
665 | 670 | ||
666 | void PlayListWidget::cancelMenuTimer() { | 671 | // void PlayListWidget::cancelMenuTimer() { |
667 | if( menuTimer->isActive() ) | 672 | // if( menuTimer->isActive() ) |
668 | menuTimer->stop(); | 673 | // menuTimer->stop(); |
669 | } | 674 | // } |
670 | 675 | ||
671 | void PlayListWidget::showFileMenu() { | 676 | // void PlayListWidget::showFileMenu() { |
672 | 677 | ||
673 | } | 678 | // } |
674 | 679 | ||
675 | void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | 680 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) |
676 | { | 681 | // { |
677 | // QListView::contentsMousePressEvent( e ); | 682 | // // QListView::contentsMousePressEvent( e ); |
678 | menuTimer->start( 750, TRUE ); | 683 | // menuTimer->start( 750, TRUE ); |
679 | } | 684 | // } |
680 | 685 | ||
681 | 686 | ||
682 | void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | 687 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) |
683 | { | 688 | // { |
684 | // QListView::contentsMouseReleaseEvent( e ); | 689 | // // QListView::contentsMouseReleaseEvent( e ); |
685 | menuTimer->stop(); | 690 | // menuTimer->stop(); |
686 | } | 691 | // } |
687 | // void PlayListWidget::setFullScreen() { | 692 | // // void PlayListWidget::setFullScreen() { |
688 | // mediaPlayerState->toggleFullscreen( ); | 693 | // mediaPlayerState->toggleFullscreen( ); |
689 | // } | 694 | // } |
690 | 695 | ||
691 | // void PlayListWidget::setScaled() { | 696 | // void PlayListWidget::setScaled() { |
692 | // mediaPlayerState->toggleScaled(); | 697 | // mediaPlayerState->toggleScaled(); |
693 | // } | 698 | // } |
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 3a52dd5..6fe2211 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -11,87 +11,87 @@ | |||
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 | #ifndef PLAY_LIST_WIDGET_H | 20 | #ifndef PLAY_LIST_WIDGET_H |
21 | #define PLAY_LIST_WIDGET_H | 21 | #define PLAY_LIST_WIDGET_H |
22 | 22 | ||
23 | 23 | ||
24 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qtimer.h> | 27 | /* #include <qtimer.h> */ |
28 | 28 | ||
29 | 29 | ||
30 | class PlayListWidgetPrivate; | 30 | class PlayListWidgetPrivate; |
31 | class Config; | 31 | class Config; |
32 | class QListViewItem; | 32 | class QListViewItem; |
33 | class QListView; | 33 | class QListView; |
34 | class QPoint; | 34 | class QPoint; |
35 | class QAction; | 35 | class QAction; |
36 | class QLabel; | 36 | class QLabel; |
37 | 37 | ||
38 | class PlayListWidget : public QMainWindow { | 38 | class PlayListWidget : public QMainWindow { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 41 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
42 | ~PlayListWidget(); | 42 | ~PlayListWidget(); |
43 | QTabWidget * tabWidget; | 43 | QTabWidget * tabWidget; |
44 | QAction *fullScreenButton, *scaleButton; | 44 | QAction *fullScreenButton, *scaleButton; |
45 | DocLnkSet files; | 45 | DocLnkSet files; |
46 | DocLnkSet vFiles; | 46 | DocLnkSet vFiles; |
47 | QListView *audioView, *videoView, *playlistView; | 47 | QListView *audioView, *videoView, *playlistView; |
48 | QLabel *libString; | 48 | QLabel *libString; |
49 | // retrieve the current playlist entry (media file link) | 49 | // retrieve the current playlist entry (media file link) |
50 | const DocLnk *current(); | 50 | const DocLnk *current(); |
51 | void useSelectedDocument(); | 51 | void useSelectedDocument(); |
52 | QTimer * menuTimer; | 52 | /* QTimer * menuTimer; */ |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void setDocument( const QString& fileref ); | 55 | void setDocument( const QString& fileref ); |
56 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 56 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
57 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 57 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
58 | void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist | 58 | void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist |
59 | void setActiveWindow(); // need to handle this to show the right view | 59 | void setActiveWindow(); // need to handle this to show the right view |
60 | void setPlaylist( bool ); // Show/Hide the playlist | 60 | void setPlaylist( bool ); // Show/Hide the playlist |
61 | void setView( char ); | 61 | void setView( char ); |
62 | void clearList(); | 62 | void clearList(); |
63 | void addAllToList(); | 63 | void addAllToList(); |
64 | void addAllMusicToList(); | 64 | void addAllMusicToList(); |
65 | void addAllVideoToList(); | 65 | void addAllVideoToList(); |
66 | void saveList(); // Save the playlist | 66 | void saveList(); // Save the playlist |
67 | void loadList(); // Load a playlist | 67 | void loadList(); // Load a playlist |
68 | void playIt( QListViewItem *); | 68 | void playIt( QListViewItem *); |
69 | bool first(); | 69 | bool first(); |
70 | bool last(); | 70 | bool last(); |
71 | bool next(); | 71 | bool next(); |
72 | bool prev(); | 72 | bool prev(); |
73 | void addSelected(); | 73 | void addSelected(); |
74 | void removeSelected(); | 74 | void removeSelected(); |
75 | void tabChanged(QWidget*); | 75 | void tabChanged(QWidget*); |
76 | /* void setFullScreen(); */ | 76 | /* void setFullScreen(); */ |
77 | /* void setScaled(); */ | 77 | /* void setScaled(); */ |
78 | protected: | 78 | protected: |
79 | void contentsMousePressEvent( QMouseEvent * e ); | 79 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
80 | void contentsMouseReleaseEvent( QMouseEvent * e ); | 80 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
81 | 81 | ||
82 | private: | 82 | private: |
83 | void initializeStates(); | 83 | void initializeStates(); |
84 | void readConfig( Config& cfg ); | 84 | void readConfig( Config& cfg ); |
85 | void writeConfig( Config& cfg ) const; | 85 | void writeConfig( Config& cfg ) const; |
86 | PlayListWidgetPrivate *d; // Private implementation data | 86 | PlayListWidgetPrivate *d; // Private implementation data |
87 | 87 | ||
88 | protected slots: | 88 | protected slots: |
89 | void cancelMenuTimer(); | 89 | /* void cancelMenuTimer(); */ |
90 | void showFileMenu(); | 90 | /* void showFileMenu(); */ |
91 | 91 | ||
92 | 92 | ||
93 | }; | 93 | }; |
94 | 94 | ||
95 | 95 | ||
96 | #endif // PLAY_LIST_WIDGET_H | 96 | #endif // PLAY_LIST_WIDGET_H |
97 | 97 | ||