Summary: | "View/Edit Meta Information" should show ID3 when selecting a group of songs | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Iñaki Baz Castillo <ibc> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | jens-bugs.kde.org |
Priority: | NOR | ||
Version: | 1.2 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Iñaki Baz Castillo
2005-02-28 09:59:34 UTC
CVS commit by aoliveira: When selecting multiple files, the "View/Edit Meta Information" dialog will show the tags that are common to all of them. BUG: 100423 CCMAIL: amarok-devel@lists.sf.net M +56 -3 tagdialog.cpp 1.53 M +1 -0 tagdialog.h 1.29 --- kdeextragear-1/amarok/src/tagdialog.cpp #1.52:1.53 @@ -279,6 +279,8 @@ void TagDialog::init() #endif - if( m_urlList.count() ) //editing multiple tracks + if( m_urlList.count() ) { //editing multiple tracks setMultipleTracksMode(); + readMultipleTracks(); + } else readTags(); @@ -368,4 +370,53 @@ TagDialog::setMultipleTracksMode() +void +TagDialog::readMultipleTracks() +{ + //Check which fields are the same for all selected tracks + const KURL::List::ConstIterator end = m_urlList.end(); + KURL::List::ConstIterator it = m_urlList.begin(); + MetaBundle first( *it ); + bool artist=true, album=true, genre=true, comment=true, year=true; + + for ( ; it != end; ++it ) { + if( !(*it).isLocalFile() ) { + // If we have a non local file, don't even lose more time comparing, just leave + artist=false; album=false; genre=false; comment=false, year=false; + break; + } + MetaBundle mb( *it ); + if ( artist && mb.artist()!=first.artist() ) { artist=false; }; + if ( album && mb.album()!=first.album() ) { album=false; }; + if ( genre && mb.genre()!=first.genre() ) { genre=false; }; + if ( comment && mb.comment()!=first.comment() ) { comment=false; }; + if ( year && mb.year()!=first.year() ) { year=false; }; + + if (!artist && !album && !genre && !comment && !year) + break; + } + // Set them in the dialog and in m_bundle ( so we don't break hasChanged() ) + if (artist) { + kComboBox_artist->setCurrentText( first.artist() ); + m_bundle.setArtist( first.artist() ); + } + if (album) { + kComboBox_album->setCurrentText( first.album() ); + m_bundle.setAlbum( first.album() ); + } + if (genre) { + kComboBox_genre->setCurrentText( first.genre() ); + m_bundle.setGenre( first.genre() ); + } + if (comment) { + kLineEdit_comment->setText( first.comment() ); + m_bundle.setComment( first.comment() ); + } + if (year) { + kIntSpinBox_year->setValue( first.year().toInt() ); + m_bundle.setYear( first.year() ); + } + checkModified(); +} + inline bool equalString( const QString &a, const QString &b ) @@ -378,11 +429,13 @@ TagDialog::hasChanged() { bool modified = false; - modified |= !equalString( kLineEdit_title->text(), m_bundle.title() ); modified |= !equalString( kComboBox_artist->lineEdit()->text(), m_bundle.artist() ); modified |= !equalString( kComboBox_album->lineEdit()->text(), m_bundle.album() ); modified |= !equalString( kComboBox_genre->lineEdit()->text(), m_bundle.genre() ); - modified |= kIntSpinBox_track->value() != m_bundle.track().toInt(); modified |= kIntSpinBox_year->value() != m_bundle.year().toInt(); modified |= !equalString( kLineEdit_comment->text(), m_bundle.comment() ); + if (!m_urlList.count()) { //ignore these on MultipleTracksMode + modified |= !equalString( kLineEdit_title->text(), m_bundle.title() ); + modified |= kIntSpinBox_track->value() != m_bundle.track().toInt(); + } return modified; --- kdeextragear-1/amarok/src/tagdialog.h #1.28:1.29 @@ -43,4 +43,5 @@ class TagDialog : public TagDialogBase void init(); void readTags(); + void readMultipleTracks(); void setMultipleTracksMode(); bool hasChanged(); |