summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-08 00:10:23 (UTC)
committer llornkcor <llornkcor>2002-10-08 00:10:23 (UTC)
commit5e450f24ca13923535754b33a1d1645709a8259d (patch) (side-by-side diff)
tree50603e21c40bd0a4dd1661a96a5b4b0fe3b6f364
parent02464ee120e2661d1fb30b0743ce64626c2d3133 (diff)
downloadopie-5e450f24ca13923535754b33a1d1645709a8259d.zip
opie-5e450f24ca13923535754b33a1d1645709a8259d.tar.gz
opie-5e450f24ca13923535754b33a1d1645709a8259d.tar.bz2
small config fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
1 files changed, 2 insertions, 2 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
@@ -124,194 +124,194 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
this,SLOT( playIt( QListViewItem *) ) );
connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
this, SLOT( addToSelection( QListViewItem *) ) );
connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
this,SLOT( playIt( QListViewItem *) ) );
connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
this, SLOT( addToSelection( QListViewItem *) ) );
connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
this, SLOT( loadList( const DocLnk & ) ) );
connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
this, SLOT( tabChanged( QWidget* ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
d->tbPlay, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
d->tbLoop, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
d->tbShuffle, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ),
this, SLOT( setPlaylist( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
this, SLOT( playIt( QListViewItem *) ) );
connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
mediaPlayerState, SLOT( setVideoGamma( int ) ) );
// cfg.setGroup( "PlayList" );
// if( cfg.readBoolEntry("newPlaylist") ){
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
loadList(DocLnk( currentPlaylist ) );
setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
// } else {
// readConfig( cfg );
// }
// see which skins are installed
videoScan=FALSE;
audioScan=FALSE;
populateSkinsMenu();
initializeStates();
}
PlayListWidget::~PlayListWidget() {
// WTF?!@?!
if ( d->current ) {
delete d->current;
}
delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
setPlaylist( true );
}
void PlayListWidget::readConfig( Config& cfg ) {
cfg.setGroup( "PlayList" );
QString currentString = cfg.readEntry( "current", "" );
int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
for ( int i = 0; i < noOfFiles; i++ ) {
QString entryName;
entryName.sprintf( "File%i", i + 1 );
QString linkFile = cfg.readEntry( entryName );
qDebug("reading "+linkFile);
if( QFileInfo( linkFile ).exists() ) {
DocLnk lnk( linkFile );
if ( QFileInfo( lnk.file() ).exists() ||
linkFile.find( "http" , 0, TRUE) != -1) {
d->selectedFiles->addToSelection( lnk );
}
}
}
d->selectedFiles->setSelectedItem( currentString );
}
void PlayListWidget::writeConfig( Config& cfg ) const {
-// Config config( "OpiePlayer" );
-// config.setGroup( "PlayList" );
+ Config config( "OpiePlayer" );
+ config.setGroup( "PlayList" );
// if(config.readBoolEntry("newPlaylist")) {
// new for testing
QString name, filename, list;
Om3u *m3uList;
name = "default";
filename=QPEApplication::documentDir() + "/" + name+".m3u";
m3uList = new Om3u(filename);
d->selectedFiles->first();
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
qDebug( list );
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
DocLnk lnk;
lnk.setFile( filename);
lnk.setIcon("opieplayer2/playlist2");
lnk.setName( name); //sets file name
qDebug("writing default playlist "+filename);
config.writeEntry("CurrentPlaylist", filename);
// currentPlayList=filename;
if(!lnk.writeLink()) {
qDebug("Writing doclink did not work");
}
// } else {
// d->selectedFiles->writeCurrent( cfg );
// int noOfFiles = 0;
// d->selectedFiles->first();
// do {
// const DocLnk *lnk = d->selectedFiles->current();
// if ( lnk ) {
// QString entryName;
// entryName.sprintf( "File%i", noOfFiles + 1 );
// cfg.writeEntry( entryName, lnk->linkFile() );
// // if this link does exist, add it so we have the file
// // next time...
// if ( !QFile::exists( lnk->linkFile() ) ) {
// lnk->writeLink();
// }
// }
// noOfFiles++;
// }
// while ( d->selectedFiles->next() );
// cfg.writeEntry("NumberOfFiles", noOfFiles );
// }
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = FALSE;
if ( mediaPlayerState->playlist() ) {
if( QFileInfo( lnk.file() ).exists() ||
lnk.file().left(4) == "http" )
d->selectedFiles->addToSelection( lnk );
}
else
mediaPlayerState->setPlaying( TRUE );
}
void PlayListWidget::clearList() {
while ( first() ) {
d->selectedFiles->removeSelected();
}
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
switch (mouse) {
case 1:
break;
case 2:
{
QPopupMenu m;
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.exec( QCursor::pos() );