本文整理汇总了C++中MetaData::artist方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::artist方法的具体用法?C++ MetaData::artist怎么用?C++ MetaData::artist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::artist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
void
ShareDialog::setSong( const MetaData& metaData )
{
m_metaData = metaData;
ui.recommendTypeBox->setItemText( 0, tr( "Artist: %1" ).arg( metaData.artist() ) );
ui.recommendTypeBox->setItemText( 1, tr( "Track: %1 - %2" ).arg( metaData.artist() ).arg( metaData.track() ) );
if ( ui.recommendTypeBox->count() == 2 )
ui.recommendTypeBox->addItem( tr( "Album: %1 - %2" ).arg( metaData.artist() ).arg( metaData.album() ) );
else
ui.recommendTypeBox->setItemText( 2, tr( "Album: %1 - %2" ).arg( metaData.artist() ).arg( metaData.album() ) );
}
示例2: onPlayerStateChanged
void MainWindow::onPlayerStateChanged(Phonon::State newState, Phonon::State oldState)
{
Q_UNUSED(oldState);
const MetaData metadata = m_currentMetaData;
QString playing;
if (metadata.title().isEmpty()) {
playing = QFileInfo(metadata.fileName()).fileName();
} else {
playing = metadata.title();
}
if (!metadata.artist().isEmpty()) {
playing = metadata.artist() + QLatin1String(" - ") + playing;
}
switch (newState) {
case Phonon::PlayingState:
m_ui->playPauseButton->setIcon(QIcon(QLatin1String(":/icons/pause")));
ActionManager::instance()->action(QStringLiteral("PlayerPlayPause"))->setIcon(QIcon(QLatin1String(":/icons/pause")));
m_ui->stopButton->setEnabled(true);
ActionManager::instance()->action(QStringLiteral("PlayerStop"))->setEnabled(true);
m_ui->trackTitleLabel->setText(playing);
m_ui->playbackTimeLabel->setText(QLatin1String("00:00:00"));
break;
case Phonon::PausedState:
m_ui->playPauseButton->setIcon(QIcon(QLatin1String(":/icons/start")));
ActionManager::instance()->action(QStringLiteral("PlayerPlayPause"))->setIcon(QIcon(QLatin1String(":/icons/start")));
m_ui->stopButton->setEnabled(true);
ActionManager::instance()->action(QStringLiteral("PlayerStop"))->setEnabled(true);
m_ui->trackTitleLabel->setText(tr("%1 [paused]").arg(m_ui->trackTitleLabel->text()));
break;
case Phonon::StoppedState:
m_ui->playPauseButton->setIcon(QIcon(QLatin1String(":/icons/start")));
ActionManager::instance()->action(QStringLiteral("PlayerPlayPause"))->setIcon(QIcon(QLatin1String(":/icons/start")));
m_ui->stopButton->setEnabled(false);
ActionManager::instance()->action(QStringLiteral("PlayerStop"))->setEnabled(false);
m_ui->trackTitleLabel->setText(tr("Player is stopped"));
m_ui->playbackTimeLabel->setText(tr("Stopped"));
break;
case Phonon::ErrorState:
m_ui->statusBar->showMessage(Player::instance()->errorString(), 5000);
break;
case Phonon::LoadingState:
//todo
break;
case Phonon::BufferingState:
//todo
break;
}
}
示例3: toDBus
QVariantMap toDBus(const MetaData &md) const {
QVariantMap map;
map["mpris:trackid"] = QVariant::fromValue(QDBusObjectPath(dbusTrackId(md.mrl())));
map["mpris:length"] = 1000LL*(qint64)md.duration();
map["xesam:url"] = md.mrl().toString();
map["xesam:title"] = md.title().isEmpty() ? engine->mediaInfo()->name() : md.title();
if (!md.album().isEmpty())
map["xesam:album"] = md.album();
if (!md.artist().isEmpty())
map["xesam:artist"] = QStringList(md.artist());
if (!md.genre().isEmpty())
map["xesam:genre"] = QStringList(md.genre());
return map;
}
示例4: showMetadataEditor
void MainWindow::showMetadataEditor()
{
QPointer<MetadataEditor> editor(new MetadataEditor());
const QModelIndex currentIndex = m_ui->playlistView->currentIndex();
const MetaData metaData = Player::instance()->playlist()->track(currentIndex.row());
editor->setMetaData(metaData);
int result = editor->exec();
if (result == QDialog::Rejected) {
if (editor) {
editor->deleteLater();
}
return;
}
if (!editor) {
return;
}
const MetaData newMetaData = editor->metaData();
TagLib::FileRef f(newMetaData.fileName().toLocal8Bit().constData());
// // FileRef::isNull() is not enough sometimes. Let's check the tag() too...
if (f.isNull() || !f.tag()) {
return;
}
f.tag()->setTrack(newMetaData.trackNumber());
f.tag()->setArtist(newMetaData.artist().toLocal8Bit().constData());
f.tag()->setAlbum(newMetaData.album().toLocal8Bit().constData());
f.tag()->setTitle(newMetaData.title().toLocal8Bit().constData());
f.tag()->setYear(newMetaData.year());
f.tag()->setGenre(newMetaData.genre().toLocal8Bit().constData());
f.save();
Player::instance()->playlist()->setTrack(currentIndex.row(), newMetaData);
TaskManager::instance()->rebuildCollections(newMetaData.fileName());
delete editor;
}