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
@@ -87,207 +87,207 @@ bool AudioDevicePrivate::muted = FALSE;
87unsigned int AudioDevicePrivate::leftVolume = 0; 87unsigned int AudioDevicePrivate::leftVolume = 0;
88unsigned int AudioDevicePrivate::rightVolume = 0; 88unsigned int AudioDevicePrivate::rightVolume = 0;
89 89
90 90
91void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) { 91void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) {
92 muted = AudioDevicePrivate::muted; 92 muted = AudioDevicePrivate::muted;
93 unsigned int volume; 93 unsigned int volume;
94 int mixerHandle = open( "/dev/mixer", O_RDWR ); 94 int mixerHandle = open( "/dev/mixer", O_RDWR );
95 if ( mixerHandle >= 0 ) { 95 if ( mixerHandle >= 0 ) {
96 if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) 96 if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1)
97 perror("ioctl(\"MIXER_READ\")"); 97 perror("ioctl(\"MIXER_READ\")");
98 close( mixerHandle ); 98 close( mixerHandle );
99 } else 99 } else
100 perror("open(\"/dev/mixer\")"); 100 perror("open(\"/dev/mixer\")");
101 leftVolume = ((volume & 0x00FF) << 16) / 101; 101 leftVolume = ((volume & 0x00FF) << 16) / 101;
102 rightVolume = ((volume & 0xFF00) << 8) / 101; 102 rightVolume = ((volume & 0xFF00) << 8) / 101;
103} 103}
104 104
105 105
106void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) { 106void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) {
107 AudioDevicePrivate::muted = muted; 107 AudioDevicePrivate::muted = muted;
108 if ( muted ) { 108 if ( muted ) {
109 AudioDevicePrivate::leftVolume = leftVolume; 109 AudioDevicePrivate::leftVolume = leftVolume;
110 AudioDevicePrivate::rightVolume = rightVolume; 110 AudioDevicePrivate::rightVolume = rightVolume;
111 leftVolume = 0; 111 leftVolume = 0;
112 rightVolume = 0; 112 rightVolume = 0;
113 } else { 113 } else {
114 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume ); 114 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume );
115 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume ); 115 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume );
116 } 116 }
117 // Volume can be from 0 to 100 which is 101 distinct values 117 // Volume can be from 0 to 100 which is 101 distinct values
118 unsigned int rV = (rightVolume * 101) >> 16; 118 unsigned int rV = (rightVolume * 101) >> 16;
119 119
120# if 0 120# if 0
121 unsigned int lV = (leftVolume * 101) >> 16; 121 unsigned int lV = (leftVolume * 101) >> 16;
122 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); 122 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF);
123 int mixerHandle = 0; 123 int mixerHandle = 0;
124 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 124 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
125 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) 125 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1)
126 perror("ioctl(\"MIXER_WRITE\")"); 126 perror("ioctl(\"MIXER_WRITE\")");
127 close( mixerHandle ); 127 close( mixerHandle );
128 } else 128 } else
129 perror("open(\"/dev/mixer\")"); 129 perror("open(\"/dev/mixer\")");
130 130
131# else 131# else
132 // This is the way this has to be done now I guess, doesn't allow for 132 // This is the way this has to be done now I guess, doesn't allow for
133 // independant right and left channel setting, or setting for different outputs 133 // independant right and left channel setting, or setting for different outputs
134 Config cfg("qpe"); // qtopia is "Sound" 134 Config cfg("qpe"); // qtopia is "Sound"
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
168#ifdef KEEP_DEVICE_OPEN 168#ifdef KEEP_DEVICE_OPEN
169 if ( AudioDevicePrivate::dspFd == 0 ) { 169 if ( AudioDevicePrivate::dspFd == 0 ) {
170#endif 170#endif
171 if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { 171 if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) {
172 172
173// perror("open(\"/dev/dsp\") sending to /dev/null instead"); 173// perror("open(\"/dev/dsp\") sending to /dev/null instead");
174 perror("open(\"/dev/dsp\")"); 174 perror("open(\"/dev/dsp\")");
175 QString errorMsg=tr("Somethin's wrong with\nyour sound device.\nopen(\"/dev/dsp\")\n")+(QString)strerror(errno)+tr("\n\nClosing player now."); 175 QString errorMsg=tr("Somethin's wrong with\nyour sound device.\nopen(\"/dev/dsp\")\n")+(QString)strerror(errno)+tr("\n\nClosing player now.");
176 QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort")); 176 QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort"));
177 exit(-1); //harsh? 177 exit(-1); //harsh?
178// d->handle = ::open( "/dev/null", O_WRONLY ); 178// d->handle = ::open( "/dev/null", O_WRONLY );
179 // WTF?!?! 179 // WTF?!?!
180 } 180 }
181#ifdef KEEP_DEVICE_OPEN 181#ifdef KEEP_DEVICE_OPEN
182 AudioDevicePrivate::dspFd = d->handle; 182 AudioDevicePrivate::dspFd = d->handle;
183 } else { 183 } else {
184 d->handle = AudioDevicePrivate::dspFd; 184 d->handle = AudioDevicePrivate::dspFd;
185 } 185 }
186#endif 186#endif
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");
246 memcpy(d->unwrittenBuffer,buffer+t,length-t); 246 memcpy(d->unwrittenBuffer,buffer+t,length-t);
247 d->unwritten = length-t; 247 d->unwritten = length-t;
248 } 248 }
249//#endif 249//#endif
250} 250}
251 251
252 252
253unsigned int AudioDevice::channels() const 253unsigned int AudioDevice::channels() const
254{ 254{
255 return d->channels; 255 return d->channels;
256} 256}
257 257
258 258
259unsigned int AudioDevice::frequency() const 259unsigned int AudioDevice::frequency() const
260{ 260{
261 return d->frequency; 261 return d->frequency;
262} 262}
263 263
264 264
265unsigned int AudioDevice::bytesPerSample() const 265unsigned int AudioDevice::bytesPerSample() const
266{ 266{
267 return d->bytesPerSample; 267 return d->bytesPerSample;
268} 268}
269 269
270 270
271unsigned int AudioDevice::bufferSize() const 271unsigned int AudioDevice::bufferSize() const
272{ 272{
273 return d->bufferSize; 273 return d->bufferSize;
274} 274}
275 275
276unsigned int AudioDevice::canWrite() const 276unsigned int AudioDevice::canWrite() const
277{ 277{
278 audio_buf_info info; 278 audio_buf_info info;
279 if ( d->can_GETOSPACE && ioctl(d->handle,SNDCTL_DSP_GETOSPACE,&info) ) { 279 if ( d->can_GETOSPACE && ioctl(d->handle,SNDCTL_DSP_GETOSPACE,&info) ) {
280 d->can_GETOSPACE = FALSE; 280 d->can_GETOSPACE = FALSE;
281 fcntl( d->handle, F_SETFL, O_NONBLOCK ); 281 fcntl( d->handle, F_SETFL, O_NONBLOCK );
282 } 282 }
283 if ( d->can_GETOSPACE ) { 283 if ( d->can_GETOSPACE ) {
284 int t = info.fragments * sound_fragment_bytes; 284 int t = info.fragments * sound_fragment_bytes;
285 return QMIN(t,(int)bufferSize()); 285 return QMIN(t,(int)bufferSize());
286 } else { 286 } else {
287 if ( d->unwritten ) { 287 if ( d->unwritten ) {
288 int t = ::write( d->handle, d->unwrittenBuffer, d->unwritten ); 288 int t = ::write( d->handle, d->unwrittenBuffer, d->unwritten );
289 if ( t<0 ) t = 0; 289 if ( t<0 ) t = 0;
290 if ( (unsigned)t!=d->unwritten ) { 290 if ( (unsigned)t!=d->unwritten ) {
291 memcpy(d->unwrittenBuffer,d->unwrittenBuffer+t,d->unwritten-t); 291 memcpy(d->unwrittenBuffer,d->unwrittenBuffer+t,d->unwritten-t);
292 d->unwritten -= t; 292 d->unwritten -= t;
293 } else { 293 } else {
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
@@ -153,240 +153,243 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
153 // Create Toolbar 153 // Create Toolbar
154 QPEToolBar *toolbar = new QPEToolBar( this ); 154 QPEToolBar *toolbar = new QPEToolBar( this );
155 toolbar->setHorizontalStretchable( TRUE ); 155 toolbar->setHorizontalStretchable( TRUE );
156 156
157 // Create Menubar 157 // Create Menubar
158 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 158 QPEMenuBar *menu = new QPEMenuBar( toolbar );
159 menu->setMargin( 0 ); 159 menu->setMargin( 0 );
160 160
161 QPEToolBar *bar = new QPEToolBar( this ); 161 QPEToolBar *bar = new QPEToolBar( this );
162 bar->setLabel( tr( "Play Operations" ) ); 162 bar->setLabel( tr( "Play Operations" ) );
163// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 163// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
164// this , SLOT( addSelected()) ); 164// this , SLOT( addSelected()) );
165 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 165 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
166 tbDeletePlaylist->setFlat(TRUE); 166 tbDeletePlaylist->setFlat(TRUE);
167 tbDeletePlaylist->setFixedSize(20,20); 167 tbDeletePlaylist->setFixedSize(20,20);
168 168
169 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 169 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
170 this , SLOT(addSelected()) ); 170 this , SLOT(addSelected()) );
171 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 171 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
172 this , SLOT(removeSelected()) ); 172 this , SLOT(removeSelected()) );
173// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 173// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
174 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 174 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
175 this , SLOT( btnPlay(bool) ), TRUE ); 175 this , SLOT( btnPlay(bool) ), TRUE );
176 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 176 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
177 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 177 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
178 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 178 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
179 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 179 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
180 tbDeletePlaylist->hide(); 180 tbDeletePlaylist->hide();
181 181
182 QPopupMenu *pmPlayList = new QPopupMenu( this ); 182 QPopupMenu *pmPlayList = new QPopupMenu( this );
183 menu->insertItem( tr( "File" ), pmPlayList ); 183 menu->insertItem( tr( "File" ), pmPlayList );
184 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 184 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
185 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 185 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
186 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 186 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
187 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 187 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
188 pmPlayList->insertSeparator(-1); 188 pmPlayList->insertSeparator(-1);
189 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 189 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
190 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 190 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
191 pmPlayList->insertSeparator(-1); 191 pmPlayList->insertSeparator(-1);
192 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 192 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
193 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 193 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
194 194
195 QPopupMenu *pmView = new QPopupMenu( this ); 195 QPopupMenu *pmView = new QPopupMenu( this );
196 menu->insertItem( tr( "View" ), pmView ); 196 menu->insertItem( tr( "View" ), pmView );
197 197
198 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 198 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
199 fullScreenButton->addTo(pmView); 199 fullScreenButton->addTo(pmView);
200 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 200 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
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
234 d->selectedFiles = new PlayListSelection( hbox2); 234 d->selectedFiles = new PlayListSelection( hbox2);
235 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 235 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
236 236
237 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 237 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
238 238
239 239
240 240
241 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 241 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
242 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 242 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
243 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 243 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
244 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 244 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
245 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 245 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
246 246
247 QWidget *aTab; 247 QWidget *aTab;
248 aTab = new QWidget( tabWidget, "aTab" ); 248 aTab = new QWidget( tabWidget, "aTab" );
249 audioView = new QListView( aTab, "Audioview" ); 249 audioView = new QListView( aTab, "Audioview" );
250 audioView->setMinimumSize(233,260); 250 audioView->setMinimumSize(233,260);
251 audioView->addColumn( tr("Title"),140); 251 audioView->addColumn( tr("Title"),140);
252 audioView->addColumn(tr("Size"), -1); 252 audioView->addColumn(tr("Size"), -1);
253 audioView->addColumn(tr("Media"),-1); 253 audioView->addColumn(tr("Media"),-1);
254 audioView->addColumn( tr( "Path" ), 0 ); 254 audioView->addColumn( tr( "Path" ), 0 );
255 255
256 audioView->setColumnAlignment(1, Qt::AlignRight); 256 audioView->setColumnAlignment(1, Qt::AlignRight);
257 audioView->setColumnAlignment(2, Qt::AlignRight); 257 audioView->setColumnAlignment(2, Qt::AlignRight);
258 audioView->setAllColumnsShowFocus(TRUE); 258 audioView->setAllColumnsShowFocus(TRUE);
259 259
260 audioView->setMultiSelection( TRUE ); 260 audioView->setMultiSelection( TRUE );
261 audioView->setSelectionMode( QListView::Extended); 261 audioView->setSelectionMode( QListView::Extended);
262 audioView->setSorting( 3, TRUE ); 262 audioView->setSorting( 3, TRUE );
263 263
264 tabWidget->insertTab(aTab,tr("Audio")); 264 tabWidget->insertTab(aTab,tr("Audio"));
265 265
266 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 266 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
267 267
268// audioView 268// audioView
269// populateAudioView(); 269// populateAudioView();
270// videowidget 270// videowidget
271 271
272 QWidget *vTab; 272 QWidget *vTab;
273 vTab = new QWidget( tabWidget, "vTab" ); 273 vTab = new QWidget( tabWidget, "vTab" );
274 videoView = new QListView( vTab, "Videoview" ); 274 videoView = new QListView( vTab, "Videoview" );
275 videoView->setMinimumSize(233,260); 275 videoView->setMinimumSize(233,260);
276 276
277 videoView->addColumn(tr("Title"),140); 277 videoView->addColumn(tr("Title"),140);
278 videoView->addColumn(tr("Size"),-1); 278 videoView->addColumn(tr("Size"),-1);
279 videoView->addColumn(tr("Media"),-1); 279 videoView->addColumn(tr("Media"),-1);
280 videoView->addColumn(tr( "Path" ), 0 ); 280 videoView->addColumn(tr( "Path" ), 0 );
281 videoView->setColumnAlignment(1, Qt::AlignRight); 281 videoView->setColumnAlignment(1, Qt::AlignRight);
282 videoView->setColumnAlignment(2, Qt::AlignRight); 282 videoView->setColumnAlignment(2, Qt::AlignRight);
283 videoView->setAllColumnsShowFocus(TRUE); 283 videoView->setAllColumnsShowFocus(TRUE);
284 videoView->setMultiSelection( TRUE ); 284 videoView->setMultiSelection( TRUE );
285 videoView->setSelectionMode( QListView::Extended); 285 videoView->setSelectionMode( QListView::Extended);
286 286
287 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 287 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
288 288
289 tabWidget->insertTab( vTab,tr("Video")); 289 tabWidget->insertTab( vTab,tr("Video"));
290 290
291 QWidget *LTab; 291 QWidget *LTab;
292 LTab = new QWidget( tabWidget, "LTab" ); 292 LTab = new QWidget( tabWidget, "LTab" );
293 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 293 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
294 playLists->setMinimumSize(233,260); 294 playLists->setMinimumSize(233,260);
295 tabWidget->insertTab(LTab,tr("Lists")); 295 tabWidget->insertTab(LTab,tr("Lists"));
296 296
297 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 297 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
298 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 298 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
299 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 299 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
300 300
301 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 301 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
302 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 302 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
303 303
304 304
305///audioView 305///audioView
306 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 306 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
307 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 307 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
308 308
309 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 309 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
310 this,SLOT( playIt( QListViewItem *)) ); 310 this,SLOT( playIt( QListViewItem *)) );
311 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 311 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
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}
345 348
346 349
347PlayListWidget::~PlayListWidget() { 350PlayListWidget::~PlayListWidget() {
348 Config cfg( "OpiePlayer" ); 351 Config cfg( "OpiePlayer" );
349 writeConfig( cfg ); 352 writeConfig( cfg );
350 353
351 if ( d->current ) 354 if ( d->current )
352 delete d->current; 355 delete d->current;
353 delete d; 356 delete d;
354} 357}
355 358
356 359
357void PlayListWidget::initializeStates() { 360void PlayListWidget::initializeStates() {
358 361
359 d->tbPlay->setOn( mediaPlayerState->playing() ); 362 d->tbPlay->setOn( mediaPlayerState->playing() );
360 d->tbLoop->setOn( mediaPlayerState->looping() ); 363 d->tbLoop->setOn( mediaPlayerState->looping() );
361 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 364 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
362 setPlaylist( true); 365 setPlaylist( true);
363} 366}
364 367
365 368
366void PlayListWidget::readConfig( Config& cfg ) { 369void PlayListWidget::readConfig( Config& cfg ) {
367 cfg.setGroup("PlayList"); 370 cfg.setGroup("PlayList");
368 QString currentString = cfg.readEntry("current", "" ); 371 QString currentString = cfg.readEntry("current", "" );
369 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 372 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
370 for ( int i = 0; i < noOfFiles; i++ ) { 373 for ( int i = 0; i < noOfFiles; i++ ) {
371 QString entryName; 374 QString entryName;
372 entryName.sprintf( "File%i", i + 1 ); 375 entryName.sprintf( "File%i", i + 1 );
373 QString linkFile = cfg.readEntry( entryName ); 376 QString linkFile = cfg.readEntry( entryName );
374 DocLnk lnk( linkFile ); 377 DocLnk lnk( linkFile );
375 if ( lnk.isValid() ) { 378 if ( lnk.isValid() ) {
376 d->selectedFiles->addToSelection( lnk ); 379 d->selectedFiles->addToSelection( lnk );
377 } 380 }
378 } 381 }
379 d->selectedFiles->setSelectedItem( currentString); 382 d->selectedFiles->setSelectedItem( currentString);
380} 383}
381 384
382 385
383void PlayListWidget::writeConfig( Config& cfg ) const { 386void PlayListWidget::writeConfig( Config& cfg ) const {
384 387
385 d->selectedFiles->writeCurrent( cfg); 388 d->selectedFiles->writeCurrent( cfg);
386 cfg.setGroup("PlayList"); 389 cfg.setGroup("PlayList");
387 int noOfFiles = 0; 390 int noOfFiles = 0;
388 d->selectedFiles->first(); 391 d->selectedFiles->first();
389 do { 392 do {
390 const DocLnk *lnk = d->selectedFiles->current(); 393 const DocLnk *lnk = d->selectedFiles->current();
391 if ( lnk ) { 394 if ( lnk ) {
392 QString entryName; 395 QString entryName;
@@ -663,166 +666,166 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
663// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 666// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
664 667
665 if( name.length()>0) { 668 if( name.length()>0) {
666 setCaption("OpiePlayer: "+name); 669 setCaption("OpiePlayer: "+name);
667// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 670// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
668 clearList(); 671 clearList();
669 readm3u(lnk.file()); 672 readm3u(lnk.file());
670 tabWidget->setCurrentPage(0); 673 tabWidget->setCurrentPage(0);
671 } 674 }
672} 675}
673 676
674void PlayListWidget::setPlaylist( bool shown ) { 677void PlayListWidget::setPlaylist( bool shown ) {
675 if ( shown ) 678 if ( shown )
676 d->playListFrame->show(); 679 d->playListFrame->show();
677 else 680 else
678 d->playListFrame->hide(); 681 d->playListFrame->hide();
679} 682}
680 683
681void PlayListWidget::setView( char view ) { 684void PlayListWidget::setView( char view ) {
682 if ( view == 'l' ) 685 if ( view == 'l' )
683 showMaximized(); 686 showMaximized();
684 else 687 else
685 hide(); 688 hide();
686} 689}
687 690
688void PlayListWidget::addSelected() { 691void PlayListWidget::addSelected() {
689 qDebug("addSelected"); 692 qDebug("addSelected");
690 DocLnk lnk; 693 DocLnk lnk;
691 QString filename; 694 QString filename;
692 switch (tabWidget->currentPageIndex()) { 695 switch (tabWidget->currentPageIndex()) {
693 696
694 case 0: //playlist 697 case 0: //playlist
695 return; 698 return;
696 break; 699 break;
697 case 1: { //audio 700 case 1: { //audio
698 QListViewItemIterator it( audioView ); 701 QListViewItemIterator it( audioView );
699 for ( ; it.current(); ++it ) { 702 for ( ; it.current(); ++it ) {
700 if ( it.current()->isSelected() ) { 703 if ( it.current()->isSelected() ) {
701 filename = it.current()->text(3); 704 filename = it.current()->text(3);
702 lnk.setName( QFileInfo(filename).baseName() ); //sets name 705 lnk.setName( QFileInfo(filename).baseName() ); //sets name
703 lnk.setFile( filename ); //sets file name 706 lnk.setFile( filename ); //sets file name
704 d->selectedFiles->addToSelection( lnk); 707 d->selectedFiles->addToSelection( lnk);
705 } 708 }
706 } 709 }
707 audioView->clearSelection(); 710 audioView->clearSelection();
708 // d->selectedFiles->next(); 711 // d->selectedFiles->next();
709 } 712 }
710 break; 713 break;
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}
744 747
745void PlayListWidget::addToSelection( QListViewItem *it) { 748void PlayListWidget::addToSelection( QListViewItem *it) {
746 d->setDocumentUsed = FALSE; 749 d->setDocumentUsed = FALSE;
747 750
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:
781 { 784 {
782 audioView->clear(); 785 audioView->clear();
783 populateAudioView(); 786 populateAudioView();
784 787
785 if( !tbDeletePlaylist->isHidden()) 788 if( !tbDeletePlaylist->isHidden())
786 tbDeletePlaylist->hide(); 789 tbDeletePlaylist->hide();
787 d->tbRemoveFromList->setEnabled(FALSE); 790 d->tbRemoveFromList->setEnabled(FALSE);
788 d->tbAddToList->setEnabled(TRUE); 791 d->tbAddToList->setEnabled(TRUE);
789 } 792 }
790 break; 793 break;
791 case 2: 794 case 2:
792 { 795 {
793 videoView->clear(); 796 videoView->clear();
794 populateVideoView(); 797 populateVideoView();
795 if( !tbDeletePlaylist->isHidden()) 798 if( !tbDeletePlaylist->isHidden())
796 tbDeletePlaylist->hide(); 799 tbDeletePlaylist->hide();
797 d->tbRemoveFromList->setEnabled(FALSE); 800 d->tbRemoveFromList->setEnabled(FALSE);
798 d->tbAddToList->setEnabled(TRUE); 801 d->tbAddToList->setEnabled(TRUE);
799 } 802 }
800 break; 803 break;
801 case 3: 804 case 3:
802 { 805 {
803 if( tbDeletePlaylist->isHidden()) 806 if( tbDeletePlaylist->isHidden())
804 tbDeletePlaylist->show(); 807 tbDeletePlaylist->show();
805 playLists->reread(); 808 playLists->reread();
806 } 809 }
807 break; 810 break;
808 }; 811 };
809} 812}
810 813
811void PlayListWidget::btnPlay(bool b) { 814void PlayListWidget::btnPlay(bool b) {
812 qDebug("<<<<<<<<<<<<<<<BtnPlay"); 815 qDebug("<<<<<<<<<<<<<<<BtnPlay");
813// mediaPlayerState->setPlaying(b); 816// mediaPlayerState->setPlaying(b);
814 switch ( tabWidget->currentPageIndex()) { 817 switch ( tabWidget->currentPageIndex()) {
815 case 0: 818 case 0:
816 { 819 {
817 qDebug("1"); 820 qDebug("1");
818// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 821// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
819// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 822// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
820// QMessageBox::message("Note","You are trying to play\na malformed url."); 823// QMessageBox::message("Note","You are trying to play\na malformed url.");
821// } else { 824// } else {
822 mediaPlayerState->setPlaying(b); 825 mediaPlayerState->setPlaying(b);
823 insanityBool=FALSE; 826 insanityBool=FALSE;
824 qDebug("insanity"); 827 qDebug("insanity");
825// } 828// }
826 } 829 }
827 break; 830 break;
828 case 1: 831 case 1: