void MusicSongsListItemInfoWidget::setMusicSongInformation(MusicSong &info) { QString musicArt = info.getMusicArtistFront(); QFontMetrics str(font()); ui->songNameValue->setText( info.getMusicName().isEmpty() ? "-" : str.elidedText( info.getMusicName(), Qt::ElideRight, ui->songNameValue->width()) ); ui->artlistValue->setText( musicArt.isEmpty() ? "-" : str.elidedText( musicArt, Qt::ElideRight, ui->artlistValue->width()) ); ui->sizeValue->setText( str.elidedText( QString::number(MusicTime::fileSizeByte2MByte( info.getMusicSize())).left(4) + "M", Qt::ElideRight, ui->sizeValue->width()) ); ui->typeValue->setText( info.getMusicType().isEmpty() ? "-" : str.elidedText( info.getMusicType(), Qt::ElideRight, ui->typeValue->width()) ); ui->timeValue->setText( str.elidedText( QString::number(info.getMusicPlayCount()), Qt::ElideRight, ui->timeValue->width()) ); if(!showArtPicture(musicArt) && !showArtPicture(info.getMusicArtistBack())) { ui->artPicture->setPixmap(QPixmap(":/share/defaultArt").scaled(60, 60)); } }
foreach(MusicSong song, musics[2]) { writeDomElementMutilText(netFilePath, "value", QStringList() << "name" << "playCount" << "time", QList<QVariant>() << song.getMusicName() << song.getMusicPlayCount() << song.getMusicTime(), song.getMusicPath()); }