summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-08 00:10:23 (UTC)
committer llornkcor <llornkcor>2002-10-08 00:10:23 (UTC)
commit5e450f24ca13923535754b33a1d1645709a8259d (patch) (unidiff)
tree50603e21c40bd0a4dd1661a96a5b4b0fe3b6f364
parent02464ee120e2661d1fb30b0743ce64626c2d3133 (diff)
downloadopie-5e450f24ca13923535754b33a1d1645709a8259d.zip
opie-5e450f24ca13923535754b33a1d1645709a8259d.tar.gz
opie-5e450f24ca13923535754b33a1d1645709a8259d.tar.bz2
small config fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index ab6b593..26c2896 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -156,161 +156,161 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
156// } else { 156// } else {
157// readConfig( cfg ); 157// readConfig( cfg );
158 158
159// } 159// }
160 // see which skins are installed 160 // see which skins are installed
161 videoScan=FALSE; 161 videoScan=FALSE;
162 audioScan=FALSE; 162 audioScan=FALSE;
163 populateSkinsMenu(); 163 populateSkinsMenu();
164 initializeStates(); 164 initializeStates();
165} 165}
166 166
167 167
168PlayListWidget::~PlayListWidget() { 168PlayListWidget::~PlayListWidget() {
169 // WTF?!@?! 169 // WTF?!@?!
170 170
171 if ( d->current ) { 171 if ( d->current ) {
172 delete d->current; 172 delete d->current;
173 } 173 }
174 delete d; 174 delete d;
175} 175}
176 176
177 177
178void PlayListWidget::initializeStates() { 178void PlayListWidget::initializeStates() {
179 d->tbPlay->setOn( mediaPlayerState->playing() ); 179 d->tbPlay->setOn( mediaPlayerState->playing() );
180 d->tbLoop->setOn( mediaPlayerState->looping() ); 180 d->tbLoop->setOn( mediaPlayerState->looping() );
181 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 181 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
182 setPlaylist( true ); 182 setPlaylist( true );
183} 183}
184 184
185 185
186void PlayListWidget::readConfig( Config& cfg ) { 186void PlayListWidget::readConfig( Config& cfg ) {
187 187
188 cfg.setGroup( "PlayList" ); 188 cfg.setGroup( "PlayList" );
189 QString currentString = cfg.readEntry( "current", "" ); 189 QString currentString = cfg.readEntry( "current", "" );
190 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); 190 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
191 191
192 for ( int i = 0; i < noOfFiles; i++ ) { 192 for ( int i = 0; i < noOfFiles; i++ ) {
193 QString entryName; 193 QString entryName;
194 entryName.sprintf( "File%i", i + 1 ); 194 entryName.sprintf( "File%i", i + 1 );
195 195
196 QString linkFile = cfg.readEntry( entryName ); 196 QString linkFile = cfg.readEntry( entryName );
197 197
198 qDebug("reading "+linkFile); 198 qDebug("reading "+linkFile);
199 199
200 if( QFileInfo( linkFile ).exists() ) { 200 if( QFileInfo( linkFile ).exists() ) {
201 201
202 DocLnk lnk( linkFile ); 202 DocLnk lnk( linkFile );
203 203
204 if ( QFileInfo( lnk.file() ).exists() || 204 if ( QFileInfo( lnk.file() ).exists() ||
205 205
206 linkFile.find( "http" , 0, TRUE) != -1) { 206 linkFile.find( "http" , 0, TRUE) != -1) {
207 207
208 d->selectedFiles->addToSelection( lnk ); 208 d->selectedFiles->addToSelection( lnk );
209 209
210 } 210 }
211 } 211 }
212 } 212 }
213 d->selectedFiles->setSelectedItem( currentString ); 213 d->selectedFiles->setSelectedItem( currentString );
214 214
215} 215}
216 216
217 217
218void PlayListWidget::writeConfig( Config& cfg ) const { 218void PlayListWidget::writeConfig( Config& cfg ) const {
219 219
220// Config config( "OpiePlayer" ); 220 Config config( "OpiePlayer" );
221// config.setGroup( "PlayList" ); 221 config.setGroup( "PlayList" );
222 222
223// if(config.readBoolEntry("newPlaylist")) { 223// if(config.readBoolEntry("newPlaylist")) {
224// new for testing 224// new for testing
225 QString name, filename, list; 225 QString name, filename, list;
226 Om3u *m3uList; 226 Om3u *m3uList;
227 name = "default"; 227 name = "default";
228 228
229 filename=QPEApplication::documentDir() + "/" + name+".m3u"; 229 filename=QPEApplication::documentDir() + "/" + name+".m3u";
230 230
231 m3uList = new Om3u(filename); 231 m3uList = new Om3u(filename);
232 232
233 d->selectedFiles->first(); 233 d->selectedFiles->first();
234 do { 234 do {
235 m3uList->add( d->selectedFiles->current()->file()); 235 m3uList->add( d->selectedFiles->current()->file());
236 } 236 }
237 while ( d->selectedFiles->next() ); 237 while ( d->selectedFiles->next() );
238 238
239 qDebug( list ); 239 qDebug( list );
240 240
241 m3uList->write(); 241 m3uList->write();
242 m3uList->close(); 242 m3uList->close();
243 if(m3uList) delete m3uList; 243 if(m3uList) delete m3uList;
244 244
245 DocLnk lnk; 245 DocLnk lnk;
246 lnk.setFile( filename); 246 lnk.setFile( filename);
247 lnk.setIcon("opieplayer2/playlist2"); 247 lnk.setIcon("opieplayer2/playlist2");
248 lnk.setName( name); //sets file name 248 lnk.setName( name); //sets file name
249 249
250 qDebug("writing default playlist "+filename); 250 qDebug("writing default playlist "+filename);
251 251
252 config.writeEntry("CurrentPlaylist", filename); 252 config.writeEntry("CurrentPlaylist", filename);
253// currentPlayList=filename; 253// currentPlayList=filename;
254 254
255 if(!lnk.writeLink()) { 255 if(!lnk.writeLink()) {
256 qDebug("Writing doclink did not work"); 256 qDebug("Writing doclink did not work");
257 } 257 }
258 258
259// } else { 259// } else {
260 260
261// d->selectedFiles->writeCurrent( cfg ); 261// d->selectedFiles->writeCurrent( cfg );
262// int noOfFiles = 0; 262// int noOfFiles = 0;
263// d->selectedFiles->first(); 263// d->selectedFiles->first();
264 264
265// do { 265// do {
266// const DocLnk *lnk = d->selectedFiles->current(); 266// const DocLnk *lnk = d->selectedFiles->current();
267 267
268// if ( lnk ) { 268// if ( lnk ) {
269 269
270// QString entryName; 270// QString entryName;
271// entryName.sprintf( "File%i", noOfFiles + 1 ); 271// entryName.sprintf( "File%i", noOfFiles + 1 );
272 272
273// cfg.writeEntry( entryName, lnk->linkFile() ); 273// cfg.writeEntry( entryName, lnk->linkFile() );
274// // if this link does exist, add it so we have the file 274// // if this link does exist, add it so we have the file
275// // next time... 275// // next time...
276 276
277// if ( !QFile::exists( lnk->linkFile() ) ) { 277// if ( !QFile::exists( lnk->linkFile() ) ) {
278// lnk->writeLink(); 278// lnk->writeLink();
279// } 279// }
280// } 280// }
281// noOfFiles++; 281// noOfFiles++;
282// } 282// }
283// while ( d->selectedFiles->next() ); 283// while ( d->selectedFiles->next() );
284// cfg.writeEntry("NumberOfFiles", noOfFiles ); 284// cfg.writeEntry("NumberOfFiles", noOfFiles );
285// } 285// }
286} 286}
287 287
288 288
289void PlayListWidget::addToSelection( const DocLnk& lnk ) { 289void PlayListWidget::addToSelection( const DocLnk& lnk ) {
290 d->setDocumentUsed = FALSE; 290 d->setDocumentUsed = FALSE;
291 if ( mediaPlayerState->playlist() ) { 291 if ( mediaPlayerState->playlist() ) {
292 if( QFileInfo( lnk.file() ).exists() || 292 if( QFileInfo( lnk.file() ).exists() ||
293 lnk.file().left(4) == "http" ) 293 lnk.file().left(4) == "http" )
294 d->selectedFiles->addToSelection( lnk ); 294 d->selectedFiles->addToSelection( lnk );
295 } 295 }
296 else 296 else
297 mediaPlayerState->setPlaying( TRUE ); 297 mediaPlayerState->setPlaying( TRUE );
298} 298}
299 299
300 300
301void PlayListWidget::clearList() { 301void PlayListWidget::clearList() {
302 while ( first() ) { 302 while ( first() ) {
303 d->selectedFiles->removeSelected(); 303 d->selectedFiles->removeSelected();
304 } 304 }
305} 305}
306 306
307 307
308void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 308void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
309 switch (mouse) { 309 switch (mouse) {
310 case 1: 310 case 1:
311 break; 311 break;
312 case 2: 312 case 2:
313 { 313 {
314 QPopupMenu m; 314 QPopupMenu m;
315 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 315 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
316 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 316 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));