本文整理汇总了C++中MetaData::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::fileName方法的具体用法?C++ MetaData::fileName怎么用?C++ MetaData::fileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::fileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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;
}
}