Esempio n. 1
0
MetaBundle
TagDialog::bundleForURL( const KURL &url )
{
    if( storedTags.find( url.path() ) != storedTags.end() )
        return storedTags[ url.path() ];

    return MetaBundle( url, true );
}
Esempio n. 2
0
void TrackToolTip::clear()
{
    m_pos     = 0;
    m_cover   = QString::null;
    m_tooltip = i18n( "Amarok - rediscover your music" );
    m_tags    = MetaBundle();
    m_tags.setUrl( KURL() );

    updateWidgets();
}
Esempio n. 3
0
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();

    m_bundle = MetaBundle();

    MetaBundle first = bundleForURL( *it );
    uint scoreFirst = CollectionDB::instance()->getSongPercentage( first.url().path() );

    bool artist=true, album=true, genre=true, comment=true,
         year=true, score=true, composer=true, discNumber=true;
    for ( ; it != end; ++it ) {
        MetaBundle mb = bundleForURL( *it );

        if( !mb.url().isLocalFile() ) {
            // If we have a non local file, don't even lose more time comparing, just leave
            artist = album = genre = comment = year = score = composer = discNumber = false;
            break;
        }
        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 ( composer && mb.composer()!=first.composer() ) { composer=false; };
        if ( discNumber && mb.discNumber()!=first.discNumber() ) { discNumber=false; };

        uint scoreCurrent = CollectionDB::instance()->getSongPercentage( mb.url().path() );
        if ( score && scoreFirst != scoreCurrent )
            score = false;

        if (!artist && !album && !genre && !comment && !year && !score && !composer && !discNumber)
            break;
    }
    // Set them in the dialog and in m_bundle ( so we don't break hasChanged() )
    if (artist) {
        m_bundle.setArtist( first.artist() );
        kComboBox_artist->setCurrentText( first.artist() );
    }
    if (album) {
        m_bundle.setAlbum( first.album() );
        kComboBox_album->setCurrentText( first.album() );
    }
    if (genre) {
        m_bundle.setGenre( first.genre() );
        kComboBox_genre->setCurrentText( first.genre() );
    }
    if (comment) {
        m_bundle.setComment( first.comment() );
        kTextEdit_comment->setText( first.comment() );
    }
    if (composer) {
        m_bundle.setComposer( first.composer() );
        kComboBox_composer->setCurrentText( first.composer() );
    }
    if (year) {
        m_bundle.setYear( first.year() );
        kIntSpinBox_year->setValue( first.year() );
    }
    if (discNumber) {
        m_bundle.setDiscNumber( first.discNumber() );
        kIntSpinBox_discNumber->setValue( first.discNumber() );
    }
    if (score) {
        m_score = scoreFirst;
        kIntSpinBox_score->setValue( scoreFirst );
    }

    m_currentURL = m_urlList.begin();
}
Esempio n. 4
0
		MetaBundle MetaBundle::mockUp(const dtn::data::BundleID &id)
		{
			return MetaBundle(id);
		}