author | llornkcor <llornkcor> | 2002-04-10 20:16:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-10 20:16:48 (UTC) |
commit | 5d7caf051fb1b46fc2ed7d2f71b03fdf3b42b3ac (patch) (side-by-side diff) | |
tree | af7abddaeb16b6167d975968f62a521d8e6231dc | |
parent | 5cf7797af9fb965916f5017f84898516157c4620 (diff) | |
download | opie-5d7caf051fb1b46fc2ed7d2f71b03fdf3b42b3ac.zip opie-5d7caf051fb1b46fc2ed7d2f71b03fdf3b42b3ac.tar.gz opie-5d7caf051fb1b46fc2ed7d2f71b03fdf3b42b3ac.tar.bz2 |
added ability to remember position in the playlist you were last at startup and when opening playlists
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 12 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 12 |
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 @@ -195,9 +195,21 @@ void PlayListSelection::writeCurrent( Config& cfg ) { 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 @@ -316,13 +316,14 @@ void PlayListWidget::initializeStates() { 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", "" ); @@ -333,12 +334,13 @@ void PlayListWidget::readConfig( Config& cfg ) { 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 { @@ -348,13 +350,13 @@ void PlayListWidget::writeConfig( Config& cfg ) const { 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. @@ -470,13 +472,13 @@ const DocLnk *PlayListWidget::current() { // this is fugly // } // } 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 { @@ -606,13 +608,13 @@ void PlayListWidget::saveList() { 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); @@ -883,13 +885,13 @@ void PlayListWidget::listDelete() { 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(); } } |