void MusicSongsListPlayWidget::updateCurrentArtist() { QString name = m_songNameLabel->toolTip(); if(!showArtPicture(name.split('-').front().trimmed()) && !showArtPicture(name.split('-').back().trimmed()) ) { m_artPictureLabel->setPixmap(QPixmap(":/share/defaultArt").scaled(60, 60)); } }
void MusicSongsListPlayWidget::setParameter(const QString &name, const QString &path) { MusicSongTag tag; if(tag.readFile(path)) { m_totalTime = "/" + tag.getLengthString(); } m_songNameLabel->setText(QFontMetrics(font()).elidedText(name, Qt::ElideRight, 180)); m_songNameLabel->setToolTip(name); m_timeLabel->setText("00:00" + m_totalTime); if(!showArtPicture(name.split('-').front().trimmed()) && !showArtPicture(name.split('-').back().trimmed()) ) { m_artPictureLabel->setPixmap(QPixmap(":/share/defaultArt").scaled(60, 60)); } }
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)); } }