void StyleSheetTable::addMap(const std::string &tag, const std::string &aClass, const AttributeMap &map) { if ((!tag.empty() || !aClass.empty()) && !map.empty()) { Key key(tag, aClass); myControlMap[key] = createControl(map); const std::vector<std::string> &pbb = values(map, "page-break-before"); if (!pbb.empty()) { if ((pbb[0] == "always") || (pbb[0] == "left") || (pbb[0] == "right")) { myPageBreakBeforeMap[key] = true; } else if (pbb[0] == "avoid") { myPageBreakBeforeMap[key] = false; } } const std::vector<std::string> &pba = values(map, "page-break-after"); if (!pba.empty()) { if ((pba[0] == "always") || (pba[0] == "left") || (pba[0] == "right")) { myPageBreakAfterMap[key] = true; } else if (pba[0] == "avoid") { myPageBreakAfterMap[key] = false; } } } }
void CollectionScanner::scanFiles( const QStringList& entries ) { DEBUG_BLOCK typedef QPair<QString, QString> CoverBundle; QStringList validImages; validImages << "jpg" << "png" << "gif" << "jpeg"; QStringList validPlaylists; validPlaylists << "m3u" << "pls"; QValueList<CoverBundle> covers; QStringList images; foreachType( QStringList, entries ) { const QString path = *it; const QString ext = extension( path ); const QString dir = directory( path ); // Write path to logfile if( !m_logfile.isEmpty() ) { QFile log( m_logfile ); if( log.open( IO_WriteOnly ) ) log.writeBlock( path.local8Bit(), path.length() ); } if( validImages.contains( ext ) ) images += path; else if( m_importPlaylists && validPlaylists.contains( ext ) ) { AttributeMap attributes; attributes["path"] = path; writeElement( "playlist", attributes ); } else { MetaBundle::EmbeddedImageList images; MetaBundle mb( KURL::fromPathOrURL( path ), true, TagLib::AudioProperties::Fast, &images ); const AttributeMap attributes = readTags( mb ); if( !attributes.empty() ) { writeElement( "tags", attributes ); CoverBundle cover( attributes["artist"], attributes["album"] ); if( !covers.contains( cover ) ) covers += cover; foreachType( MetaBundle::EmbeddedImageList, images ) { AttributeMap attributes; attributes["path"] = path; attributes["hash"] = (*it).hash(); attributes["description"] = (*it).description(); writeElement( "embed", attributes ); } } }
void StyleSheetTable::addMap(shared_ptr<CSSSelector> selectorPtr, const AttributeMap &map) { if (!selectorPtr.isNull() && !map.empty()) { const CSSSelector &selector = *selectorPtr; myControlMap[selector] = createOrUpdateControl(map, myControlMap[selector]); const std::string &pbb = value(map, "page-break-before"); if (pbb == "always" || pbb == "left" || pbb == "right") { myPageBreakBeforeMap[selector] = true; } else if (pbb == "avoid") { myPageBreakBeforeMap[selector] = false; } const std::string &pba = value(map, "page-break-after"); if (pba == "always" || pba == "left" || pba == "right") { myPageBreakAfterMap[selector] = true; } else if (pba == "avoid") { myPageBreakAfterMap[selector] = false; } } }