本文整理汇总了C++中Album::addSong方法的典型用法代码示例。如果您正苦于以下问题:C++ Album::addSong方法的具体用法?C++ Album::addSong怎么用?C++ Album::addSong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::addSong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openCollection
bool DAOCollection::openCollection(QString path)
{
QDomDocument doc;
//********************************
// Read the DOM tree form file
//********************************
QFile f(path);
// We open the xml document
if (!f.open(QIODevice::ReadOnly) || !doc.setContent(&f))
return false;
//********************************
// Parse the DOM tree
//********************************
// The root node is supposed to be a "stone" tag, we retrieve its name
QDomElement root=doc.documentElement();
// We traverse its children
QDomElement child=root.firstChild().toElement();
while(!child.isNull())
{
// We know how to treat appearance and geometry
if (child.tagName() == "artist")
{
Artist * a = new Artist(child.attribute("id"),mCollection.getCollectionId(),child.attribute("name"),child.attribute("infos"),QUrl(child.attribute("image")));
// We traverse children
QDomElement albums=child.firstChild().toElement();
while(!albums.isNull())
{
if (albums.tagName() == "album")
{
Album * ab = new Album(child.attribute("id"),mCollection.getCollectionId(),albums.attribute("title"),a,QUrl(albums.attribute("image")));
QDomElement songs=albums.firstChild().toElement();
while(!songs.isNull())
{
if (songs.tagName() == "song")
{
Song * s = new Song(child.attribute("id"),mCollection.getCollectionId(),songs.attribute("title"),1000,ab,QUrl());
ab->addSong(s);
}
songs = songs.nextSiblingElement();
}
a->addAlbum(ab);
}
albums = albums.nextSiblingElement();
}
mCollection.addArtist(a);
}
child = child.nextSiblingElement();
}
return true;
}