summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp12
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp12
2 files changed, 19 insertions, 5 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 8f3711a..3c47256 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -193,11 +193,23 @@ void PlayListSelection::writeCurrent( Config& cfg ) {
QListViewItem *item = selectedItem();
if ( item )
cfg.writeEntry("current", item->text(0) );
qDebug(item->text(0));
}
void PlayListSelection::setSelectedItem(const QString &strk ) {
+
+ unSelect();
+ QListViewItemIterator it( this );
+ for ( ; it.current(); ++it ) {
+// qDebug( it.current()->text(0));
+ if( strk == it.current()->text(0)) {
+// qDebug( "We have a match "+strk);
+ setSelected( it.current(), TRUE);
+ ensureItemVisible( it.current() );
+ return;
+ }
+ }
// setSelected( item, TRUE );
// ensureItemVisible( selectedItem() );
}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 63df715..0764c01 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -314,49 +314,51 @@ void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
// d->tbFull->setOn( mediaPlayerState->fullscreen() );
// d->tbScale->setOn( mediaPlayerState->scaled() );
// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
// setPlaylist( mediaPlayerState->playlist() );
setPlaylist( true);
- d->selectedFiles->first();
+// d->selectedFiles->first();
+
}
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 );
DocLnk lnk( linkFile );
if ( lnk.isValid() ) {
d->selectedFiles->addToSelection( lnk );
}
}
+ d->selectedFiles->setSelectedItem( currentString);
// d->selectedFiles->setSelectedItem( (const QString &)currentString);
}
void PlayListWidget::writeConfig( Config& cfg ) const {
d->selectedFiles->writeCurrent( cfg);
cfg.setGroup("PlayList");
int noOfFiles = 0;
d->selectedFiles->first();
do {
const DocLnk *lnk = d->selectedFiles->current();
if ( lnk ) {
QString entryName;
entryName.sprintf( "File%i", noOfFiles + 1 );
- qDebug(entryName);
+// qDebug(entryName);
cfg.writeEntry( entryName, lnk->linkFile() );
// if this link does exist, add it so we have the file
// next time...
if ( !QFile::exists( lnk->linkFile() ) ) {
// the way writing lnks doesn't really check for out
// of disk space, but check it anyway.
if ( !lnk->writeLink() ) {
QMessageBox::critical( 0, tr("Out of space"),
@@ -468,17 +470,17 @@ const DocLnk *PlayListWidget::current() { // this is fugly
// return dit;
// }
// }
// } else
// qDebug("current");
// switch (tabWidget->currentPageIndex()) {
// case 0: //playlist
// {
- qDebug("playlist");
+// qDebug("playlist");
if ( mediaPlayerState->playlist() ) {
return d->selectedFiles->current();
}
else if ( d->setDocumentUsed && d->current ) {
return d->current;
} else {
return d->files->selected();
}
@@ -604,17 +606,17 @@ void PlayListWidget::saveList() {
// }
// qDebug("new doclnk");
DocLnk lnk;
// lnk.setComment( "");
lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
lnk.setIcon("mpegplayer/playlist2");
lnk.setName( filename); //sets file name
- qDebug(filename);
+// qDebug(filename);
if(!lnk.writeLink())
qDebug("Writing doclink did not work");
}
Config config( "MediaPlayer" );
config.writeEntry("CurrentPlaylist",filename);
setCaption(tr("OpiePlayer: ")+filename);
d->selectedFiles->first();
if(fileDlg)
@@ -881,17 +883,17 @@ void PlayListWidget::listDelete() {
case 1:
{
file = audioView->selectedItem()->text(0);
// Global::findDocuments(&files, "audio/*");
// AppLnkSet appFiles;
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == file) {
- qDebug(file);
+// qDebug(file);
LnkProperties prop( dit.current() );
// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
prop.showMaximized();
prop.exec();
}
}
populateAudioView();
}