本文整理汇总了C++中Album类的典型用法代码示例。如果您正苦于以下问题:C++ Album类的具体用法?C++ Album怎么用?C++ Album使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Album类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TrackDashboard::onCoverClicked()
{
Album album = m_track.album();
if (!album.isNull())
QDesktopServices::openUrl( album.www() );
}
示例2: qDebug
Album ParserAlbum::getAlbumFromFile(const QString &_name)
{
m_pFile->close();
if(!m_pFile->open(QIODevice::ReadOnly))
{
qDebug() << "Can`t open file : " << m_pFile->fileName();
}
Album newAlbum;
newAlbum.setName(_name);
QDomElement element = m_pDoc->documentElement();
QDomNode node = element.firstChild();
while(!node.isNull())
{
if(node.isElement())
{
QDomElement domElement = node.toElement();
if(domElement.nodeName() == "images")
{
if(domElement.hasChildNodes())
{
getImages(newAlbum,domElement.childNodes());
}
}
if(domElement.nodeName() == "current")
{
newAlbum.setCurrentIndex(domElement.text().toInt());
}
node = node.nextSibling().toElement();
}
}
m_pFile->close();
return newAlbum;
}
示例3: query
Album* Album::forId(int albumId) {
if (cache.contains(albumId)) {
// get from cache
// qDebug() << "Album was cached" << albumId;
return cache.value(albumId);
}
QSqlDatabase db = Database::instance().getConnection();
QSqlQuery query(db);
query.prepare("select title, year, artist from albums where id=?");
query.bindValue(0, albumId);
bool success = query.exec();
if (!success) qDebug() << query.lastQuery() << query.lastError().text();
if (query.next()) {
Album* album = new Album();
album->setId(albumId);
album->setTitle(query.value(0).toString());
album->setYear(query.value(1).toInt());
// relations
int artistId = query.value(2).toInt();
// TODO this could be made lazy
album->setArtist(Artist::forId(artistId));
// put into cache
cache.insert(albumId, album);
return album;
}
cache.insert(albumId, 0);
return 0;
}
示例4: getCover
void AlbumCoversAssetService::getCover(Core::DataItem* item)
{
Controller::InfoController* controller = ICore::infoController();
Album* album = qobject_cast<Album*>(item);
if(!item->getMediaCollection())
return;
QString path = item->getMediaCollection()->getAssetFolderPath("AlbumCoversPreview").toString()+"/"+QString::number(item->getID()) + ".jpg";
if((!QFile::exists(path) ) | overwriteCovers)
{
if(album && album->getName() != "Unbekannt")
{
Core::InfoRequest* request;
QString infoType;
if (saveHiresCovers)
infoType = "org.safri.audio.album.cover.hires";
else
infoType = "org.safri.audio.album.cover";
request = controller->getInfoForItem(infoType, album);
connect(request, SIGNAL(infoDataAvailable()), this, SLOT(infoSlot()));
}
}
else
{
qDebug()<<"Cover already exists... (: ";
}
}
示例5: sp_track_album
Album* Track::GetAlbum()
{
Album* pAlbum = m_pSession->CreateAlbum();
pAlbum->Load( sp_track_album( m_pTrack ) );
return pAlbum;
}
示例6: showCover
void SearchDialog::showCover( int ind ){
int aind = searchResults->currentRow();
if(aind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
QList<QUrl> images = album.images();
int n = images.size();
//qDebug()<<"Trying to set cover "<<ind<<" of "<<n;
if( n==0 ){
currentCoverInd=0;
return;
}
if( ind<0 ){
ind=0;
}
if( ind>=n ){
ind=n-1;
}
setCover( images[ind] );
//qDebug()<<"Set cover "<<ind<<" of "<<n;
currentCoverInd = ind;
coverLabel->setText("Cover "+QString::number(ind+1)+" of "+QString::number(n));
}
示例7:
Album::Album (const Album& alb, QQuickItem *parent):QQuickItem(parent)
{
a_artist = alb.artist();
a_title = alb.title();
a_cover = alb.cover();
a_year = alb.year();
a_ID = alb.albumID();
}
示例8: Q_Q
void AlbumListPrivate::loadAlbums(const QVariantList &albums) {
Q_Q(AlbumList);
foreach (QVariant album, albums) {
Album *a = new Album;
a->d_func()->loadAlbum(album.toMap());
m_albums.append(a);
}
示例9: findAlbum
int album_db::findAlbum(int album_id)
{
for(int i=0;i<albums.size();i++)
{
Album temp = albums.at(i);
if( temp.getAlbumID() == album_id )
return i;
}
}
示例10: AlbumItem
void TestAlbum::album_76101()
{
Album album;
album.setName("test");
album.append(new AlbumItem(root + "/" + DIR + "album_76101-01.mscx"));
album.append(new AlbumItem(root + "/" + DIR + "album_76101-02.mscx"));
album.createScore("album_76101.mscx");
QVERIFY(compareFiles("album_76101.mscx", DIR + "album_76101-ref.mscx"));
}
示例11: main
int main( int argc, char **argv )
{
if ( argc < 2 ) {
Error( "Missing configuration file in options. (testing.conf)" );
exit( -1 );
}
srand( 345645631 );
env.parse( argv[1] );
env.Summary();
std::vector<std::string> imgList = std::move( readlines( strf( "%s/%s", env["dataset"].c_str(),
env["list-file"].c_str())) );
imgList = std::move( path::FFFL( env["dataset"], imgList, ".png" ) );
for ( auto& ele : imgList ) {
printf( "%s\n", ele.c_str() );
}
Info( "Loading Learning Album ..." );
Album<float> album;
for ( auto& ele : imgList ) {
album.push( std::move( cvFeat<HOG>::gen( ele ) ) );
}
Done( "Learning Album Loaded" );
Info( "Loading Forest ..." );
Forest<SimpleKernel<float> > forest( env["forest-name"] );
Info( "Learning ..." );
forest.PrepareWeitghts();
float feat[album(0).GetPatchDim()];
for ( int k=0; k<album.size(); k++ ) {
for ( int i=0; i<album(k).rows; i++ ) {
for ( int j=0; j<album(k).cols; j++ ) {
album(k).FetchPatch( i, j, feat );
forest.learn( feat );
}
}
Info( "%d / %d learned.", k + 1, album.size() );
}
forest.writeWeights( env["forest-name"] );
return 0;
}
示例12: Album
void HackingWidget::on_pushButton_12_clicked()
{
Controller::InfoController* controller = Core::ICore::infoController();
Album* album = new Album(4711, "By the way");
Artist* artist = new Artist(12, "Red Hot Chili Peppers");
album->addArtist(artist);
Core::InfoRequest* request = controller->getInfoForItem("org.safri.audio.album.cover.hires", album);
connect(request, SIGNAL(infoDataAvailable()), this, SLOT(infoSlot()));
}
示例13: showAlbums
string album_db::showAlbums()
{
std::stringstream out;
for(int i=0;i<albums.size();i++)
{
Album temp = albums.at(i);
out<<temp.albumStatus();
}
return out.str();
}
示例14: saveCoverFromReply
void SearchDialog::saveCoverFromReply(QNetworkReply* reply){
//image to be saved must exist in albumLineEdit.images
QByteArray data = reply->readAll();
QImage p;
p.loadFromData(data);
p.convertToFormat(QImage::Format_RGB32);
reply->deleteLater();
int aind = searchResults->currentRow();
if(aind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
QList<QUrl> images = album.images();
QString url = reply->url().toString();
int cInd=-1;
for(int i=0;i<images.size();i++){
if(url==images[i].toString()){
cInd=i;
break;
}
}
if(cInd==-1){
return;
}
QString name = images[cInd].toString();
//qDebug()<<name;
int ind = name.lastIndexOf("/");
if(ind==-1){
ind = name.lastIndexOf("\\");
}
name = name.remove(0,ind+1);
if(coverFormatCheckBox->isChecked()){
int suffInd = name.lastIndexOf(".");
QString ext = name.right(name.size()-suffInd);
name = createCoverName( cInd+1, ext );
}
//qDebug()<<name;
QString path = items_[0]->fileInfo().absoluteDir().absolutePath();
name = path+"/"+name;
int quality = settings->value("SearchDialog/coverQuality",-1).toInt();
bool ok = p.save( name, 0, quality );
if(!ok){
QMessageBox::critical(this, "Could not save cover",
"Could not save cover "+url+" as "+name, QMessageBox::Ok, QMessageBox::Ok);
}else{
qDebug()<<"saved"<<name;
}
}
示例15: saveCoverNow
void SearchDialog::saveCoverNow(){
int ind = searchResults->currentRow();
if(ind==-1){
return;
}
Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
if(album.images().size()==0){
return;
}
QList<QUrl> images = album.images();
saveCover( images[currentCoverInd] );
}