本文整理汇总了C++中Artist类的典型用法代码示例。如果您正苦于以下问题:C++ Artist类的具体用法?C++ Artist怎么用?C++ Artist使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Artist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sp_track_artist
Artist* Track::GetArtist( int index )
{
Artist* pArtist = m_pSession->CreateArtist();
pArtist->Load( sp_track_artist( m_pTrack, index ) );
return pArtist;
}
示例2: onDraw
void SkView::onDraw(SkCanvas* canvas) {
Artist* artist = this->getArtist();
if (artist) {
artist->draw(this, canvas);
}
}
示例3: Artist
void CollectionScanner::processArtist(FileInfo *file) {
Artist *artist = new Artist();
const QString artistTag = file->getTags()->artist;
artist->setName(DataUtils::cleanTag(artistTag));
artist->setProperty("originalHash", artist->getHash());
// qDebug() << "Processing artist:" << artist->getName() << artist->getHash();
if (filesWaitingForArtists.contains(artist->getHash())) {
qDebug() << "ERROR Processing artist multiple times!" << artist->getName();
}
if (loadedArtists.contains(artist->getHash())) {
qDebug() << "ERROR Artist already processed!" << artist->getName();
}
// add this file to filesWaitingForArtists
// this also acts as a lock for other files
// when the info is ready, all waiting files will be processed
QList<FileInfo *> files;
files.append(file);
filesWaitingForArtists.insert(artist->getHash(), files);
connect(artist, SIGNAL(gotInfo()), SLOT(gotArtistInfo()));
artist->fetchInfo();
}
示例4: qDebug
void UniversalMusicScraper::onArtistRelsFinished()
{
QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
Artist *artist = reply->property("storage").value<Storage*>()->artist();
QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
reply->deleteLater();
if (!artist)
return;
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302 ||
reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) {
qDebug() << "Got redirect" << reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
reply = qnam()->get(QNetworkRequest(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl()));
reply->setProperty("storage", Storage::toVariant(reply, artist));
reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
connect(reply, SIGNAL(finished()), this, SLOT(onArtistRelsFinished()));
return;
}
QString discogsUrl;
if (reply->error() == QNetworkReply::NoError) {
QString msg = QString::fromUtf8(reply->readAll());
QDomDocument domDoc;
domDoc.setContent(msg);
for (int i=0, n=domDoc.elementsByTagName("relation").count() ; i<n ; ++i) {
QDomElement elem = domDoc.elementsByTagName("relation").at(i).toElement();
if (elem.attribute("type") == "allmusic" && elem.elementsByTagName("target").count() > 0) {
QString url = elem.elementsByTagName("target").at(0).toElement().text();
QRegExp rx("allmusic\\.com/artist/(.*)$");
if (rx.indexIn(url) != -1)
artist->setAllMusicId(rx.cap(1));
}
if (elem.attribute("type") == "discogs" && elem.elementsByTagName("target").count() > 0)
discogsUrl = elem.elementsByTagName("target").at(0).toElement().text();
}
}
if (!m_artistDownloads.contains(artist))
m_artistDownloads.insert(artist, QList<DownloadElement>());
m_artistDownloads[artist].clear();
appendDownloadElement(artist, "theaudiodb", "tadb_data", QUrl(QString("http://www.theaudiodb.com/api/v1/json/%1/artist-mb.php?i=%2").arg(m_tadbApiKey).arg(artist->mbId())));
appendDownloadElement(artist, "theaudiodb", "tadb_discography", QUrl(QString("http://www.theaudiodb.com/api/v1/json/%1/discography-mb.php?s=%2").arg(m_tadbApiKey).arg(artist->mbId())));
if (!artist->allMusicId().isEmpty()) {
appendDownloadElement(artist, "allmusic", "am_data", QUrl(QString("http://www.allmusic.com/artist/%1").arg(artist->allMusicId())));
appendDownloadElement(artist, "allmusic", "am_biography", QUrl(QString("http://www.allmusic.com/artist/%1/biography").arg(artist->allMusicId())));
}
if (!discogsUrl.isEmpty())
appendDownloadElement(artist, "discogs", "discogs_data", QUrl(discogsUrl + "?type=Releases&subtype=Albums"));
foreach (DownloadElement elem, m_artistDownloads[artist]) {
QNetworkRequest request(elem.url);
request.setRawHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0");
QNetworkReply *reply = qnam()->get(request);
new NetworkReplyWatcher(this, reply);
reply->setProperty("storage", Storage::toVariant(reply, artist));
reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
connect(reply, SIGNAL(finished()), this, SLOT(onArtistLoadFinished()));
}
示例5: Q_Q
void ArtistListPrivate::loadArtists(const QVariantList &artists) {
Q_Q(ArtistList);
foreach (QVariant artist, artists) {
Artist *a = new Artist;
a->d_func()->loadArtist(artist.toMap());
m_artists.append(a);
}
示例6: testReleaseArtist
void testReleaseArtist()
{
Metadata *md = MbXmlParser().parse(get_file_contents("../test-data/valid/release/Under_the_Pink_1.xml"));
Release *release = md->getRelease();
CPPUNIT_ASSERT(release);
Artist *artist = release->getArtist();
CPPUNIT_ASSERT(artist);
CPPUNIT_ASSERT_EQUAL(string("http://musicbrainz.org/artist/c0b2500e-0cef-4130-869d-732b23ed9df5"), artist->getId());
CPPUNIT_ASSERT_EQUAL(string("Tori Amos"), artist->getName());
}
示例7: get
bool FArtistsAdd::get(Artist &value)
{
this->ui->eName->setText(value.Name());
if (this->exec() == QDialog::Accepted) {
value.setName(this->ui->eName->text());
return true;
}
return false;
}
示例8: clear
void AlbumInfo::setAlbum(Album *album) {
if (!album) {
clear();
return;
}
titleLabel->setText(album->getTitle());
QString wiki = album->getWiki();
if (wiki.isEmpty()) {
wikiLabel->clear();
} else {
int split = wiki.indexOf('\n', 512);
if (split == -1) {
split = wiki.indexOf(". ", 512);
}
QString html = "<html><style>a { color: white }</style><body>" + wiki.left(split);
if (split != -1) {
Artist *artist = album->getArtist();
QString url = "http://www.last.fm/music/" + (artist ? artist->getName() : "_") + "/" + album->getTitle() + "/+wiki";
html += QString(" <a href='%1'>%2</a>").arg(url, tr("Read more"));
}
html += "</body></html>";
wikiLabel->setText(html);
}
QImage photo = album->getPhoto();
if (photo.isNull()) {
photoLabel->clear();
photoLabel->hide();
} else {
photoLabel->setPixmap(QPixmap::fromImage(photo));
photoLabel->show();
}
QString query;
if (album->getArtist())
query = album->getArtist()->getName() + " - ";
query += album->getTitle();
buyOnAmazonButton->setProperty("query", query);
buyOnAmazonButton->show();
/*
QString qry("SELECT id FROM tracks where album=%1 order by track, title");
qry = qry.arg(album->getId());
qDebug() << qry;
trackListModel->setQuery(qry, Database::instance().getConnection());
if (trackListModel->lastError().isValid())
qDebug() << trackListModel->lastError();
trackListView->setMinimumHeight(trackListView->maximumViewportSize().height());
*/
}
示例9: LfmItem
void
LfmListModel::addArtist( const Artist& a_artist )
{
Artist* artist = new Artist;
*artist = a_artist;
LfmItem* item = new LfmItem( artist );
item->loadImage( artist->imageUrl( lastfm::Small, true ));
beginInsertRows( QModelIndex(), rowCount(), rowCount());
m_items << item;
connect( item, SIGNAL(updated()), SLOT( itemUpdated()));
endInsertRows();
}
示例10: testReleaseTracksVA
void testReleaseTracksVA()
{
Metadata *md = MbXmlParser().parse(get_file_contents("../test-data/valid/release/Mission_Impossible_2.xml"));
Release *release = md->getRelease();
CPPUNIT_ASSERT(release);
TrackList &tracks = release->getTracks();
CPPUNIT_ASSERT_EQUAL(16, int(tracks.size()));
Artist *artist = tracks[1]->getArtist();
CPPUNIT_ASSERT(artist);
CPPUNIT_ASSERT_EQUAL(string("1981"), artist->getBeginDate());
CPPUNIT_ASSERT_EQUAL(string("Metallica"), artist->getName());
CPPUNIT_ASSERT_EQUAL(string("Metallica"), artist->getSortName());
CPPUNIT_ASSERT_EQUAL(Artist::TYPE_GROUP, artist->getType());
}
示例11: PaintingList
/**************************************************************************
parameters: -
return value: -
Destructor, deletes all dynamically allocated parts of an instance
of the class. As well as, the instance.
**************************************************************************/
Artist::Artist(Artist& a)
{
cout << "Please enter a new first name: ";
getline(cin, firstName);
lastName = a.getLastName();
numberOfPaintings = a.getNumberOfPaintings();
pList = new PaintingList();
next = NULL;
int i;
PaintingList * pl = a.getPaintingList();
Painting * p = pl->getHead();
for(i = 0; i < numberOfPaintings; i++, p = p->getNext())
{
pList->appendToTail(p->copy());
}
}
示例12: qDebug
void CollectionScanner::gotArtistInfo() {
// get the Artist that sent the signal
Artist *artist = static_cast<Artist *>(sender());
if (!artist) {
qDebug() << "Cannot get sender";
return;
}
// qDebug() << "got info for" << artist->getName();
int artistId = Artist::idForName(artist->getName());
if (artistId < 0) {
// qDebug() << "We have a new promising artist:" << artist->getName();
artist->insert();
// TODO last insert id
artistId = Artist::idForName(artist->getName());
} else {
qDebug() << "Updating artist" << artist->getName();
artist->update();
}
artist->setId(artistId);
// now that we have an id, let's enqueue the cover image download
QString imageUrl = artist->property("imageUrl").toString();
if (!imageUrl.isEmpty())
ImageDownloader::enqueue(artistId, ImageDownloader::ArtistType, imageUrl);
const QString hash = artist->property("originalHash").toString();
QList<FileInfo *> files = filesWaitingForArtists.value(hash);
filesWaitingForArtists.remove(hash);
loadedArtists.insert(hash, artist);
// if (hash != artist->getHash())
loadedArtists.insert(artist->getHash(), artist);
// continue the processing of blocked files
// qDebug() << files.size() << "files were waiting for artist" << artist->getName();
foreach (FileInfo *file, files) {
file->setArtist(artist);
// qDebug() << "ready for album" << file->getFileInfo().baseName();
giveThisFileAnAlbum(file);
}
示例13: qWarning
void LastFm::scrobble(Track* track) {
if (!track) return;
if (sessionKey.isEmpty()) {
qWarning() << "Not authenticated to Last.fm";
return;
}
QUrl url(WS);
QMap<QString, QString> params;
params["method"] = "track.scrobble";
params["timestamp"] = QString::number(track->getStartTime());
params["track"] = track->getTitle();
Artist* artist = track->getArtist();
if (!artist) {
qDebug() << __FUNCTION__ << "Missing artist for" << track;
return;
}
params["artist"] = artist->getName();
Album* album = track->getAlbum();
if (album)
params["album"] = album->getTitle();
if (track->getNumber())
params["trackNumber"] = QString::number(track->getNumber());
if (track->getLength())
params["duration"] = QString::number(track->getLength());
params["api_key"] = Constants::LASTFM_API_KEY;
params["sk"] = sessionKey;
sign(params);
The::http()->post(url, params);
}
示例14: f
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;
}
示例15: paintAlbumHeader
void PlaylistItemDelegate::paintAlbumHeader(
QPainter* painter, const QStyleOptionViewItem& option, QRect line, Track* track) const {
QString headerTitle;
Album *album = track->getAlbum();
if (album) headerTitle = album->getTitle();
Artist *artist = track->getArtist();
if (artist) headerTitle += " - " + artist->getName();
painter->save();
// cover background
/*
QImage p = album->getPhoto();
if (!p.isNull()) {
painter->drawTiledPixmap(line, QPixmap::fromImage(p));
QLinearGradient linearGrad(0, 0, 0, line.height());
linearGrad.setColorAt(0, QColor(0,0,0, 96));
linearGrad.setColorAt(1, QColor(0,0,0, 64));
painter->fillRect(line, QBrush(linearGrad));
} else {
QLinearGradient linearGrad(0, 0, 0, line.height());
linearGrad.setColorAt(0, option.palette.color(QPalette::Mid));
linearGrad.setColorAt(1, option.palette.midlight().color());
painter->fillRect(line, QBrush(linearGrad));
}*/
QLinearGradient linearGrad(0, 0, 0, line.height());
#ifdef APP_MAC
linearGrad.setColorAt(0, QColor(0x99, 0x99, 0x99, 0xFF));
linearGrad.setColorAt(1, QColor(0xCC, 0xCC, 0xCC, 0xFF));
#else
linearGrad.setColorAt(0, option.palette.color(QPalette::Mid));
linearGrad.setColorAt(1, option.palette.color(QPalette::Midlight));
#endif
painter->fillRect(line, QBrush(linearGrad));
// borders
// painter->setPen(option.palette.color(QPalette::Light));
// painter->drawLine(0, 0, line.width(), 0);
painter->setPen(option.palette.color(QPalette::Mid));
painter->drawLine(0, line.height()-1, line.width(), line.height()-1);
// font
QFont boldFont = painter->font();
boldFont.setBold(true);
painter->setFont(boldFont);
// text size
QSize trackStringSize(QFontMetrics(painter->font()).size(Qt::TextSingleLine, headerTitle));
QPoint textLoc(PADDING*6, 0);
QRect trackTextBox(textLoc.x(), textLoc.y(), trackStringSize.width(), line.height());
// text shadow
painter->setPen(QColor(0, 0, 0, 64));
painter->drawText(trackTextBox.translated(0, -1), Qt::AlignLeft | Qt::AlignVCenter, headerTitle);
// text
painter->setPen(option.palette.color(QPalette::Light));
painter->drawText(trackTextBox, Qt::AlignLeft | Qt::AlignVCenter, headerTitle);
// album length
if (album) {
// TODO this is the album duration, but not necessarily what we have in the playlist
int totalLength = Track::getTotalLength(album->getTracks());
QString albumLength;
if (totalLength > 3600)
albumLength = QTime().addSecs(totalLength).toString("h:mm:ss");
else
albumLength = QTime().addSecs(totalLength).toString("m:ss");
QFont normalFont = painter->font();
normalFont.setBold(false);
// normalFont.setPointSize(boldFont.pointSize()*.9);
painter->setFont(normalFont);
painter->drawText(line.translated(-PADDING, 0), Qt::AlignRight | Qt::AlignVCenter, albumLength);
}
// TODO album year
painter->restore();
}