Detect and show audio bitrate + added an option to copy a file's meta info to the 'meta info' tab + do not jump to first tab on minimize/restore.

This commit is contained in:
LoRd_MuldeR 2011-05-31 19:04:45 +02:00
parent a955f791e9
commit d452e92bd4
20 changed files with 386 additions and 34 deletions

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1603,6 +1615,18 @@
</context>
<context>
<name>MetaInfoDialog</name>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Load Artwork From File</source>
<translation type="unfinished"></translation>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<source>Bitrate</source>
<translation>Bitrate</translation>
</message>
<message>
<source>Constant</source>
<translation>konstant</translation>
</message>
<message>
<source>Variable</source>
<translation>variabel</translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1632,6 +1644,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation>Artwork konnte nicht aus der Ausgewählten Datei geladen werden!</translation>
</message>
<message>
<source>Edit this Information</source>
<translation>Diese Information bearbeiten</translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation>Alles in den Metadaten-Tab kopieren</translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation>Metainformationen löschen</translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation>Versión</translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1631,6 +1643,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation>¡Lo sentimos, ha habido un error al cargar la carátula desde el archivo seleccionado!</translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -242,6 +242,18 @@
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1641,6 +1653,18 @@ Ouvrir le dossier récursivement...</translation>
<source>Sorry, failed to load artwork from selected file!</source>
<translation>Impossible de charger l&apos;oeuvre depuis le fichier sélectionné !</translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1632,6 +1644,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1631,6 +1643,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation type="unfinished">, !</translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation>Версия</translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1634,6 +1646,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation type="unfinished">Извините, немогу загрузит картинку из выделенного файла!</translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -238,6 +238,18 @@
<source>Version</source>
<translation>Версія</translation>
</message>
<message>
<source>Bitrate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Constant</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Variable</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CueImportDialog</name>
@ -1631,6 +1643,18 @@
<source>Sorry, failed to load artwork from selected file!</source>
<translation>Вибачте, але неможливо завантажити обкладинку з вибраного файла!</translation>
</message>
<message>
<source>Edit this Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy everything to Meta Info tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear all Meta Info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfoModel</name>

View File

@ -172,6 +172,9 @@
</property>
<item>
<widget class="QTableView" name="tableView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
@ -498,6 +501,7 @@
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -64,6 +64,7 @@
<file>icons/page_white_cplusplus.png</file>
<file>icons/page_white_add.png</file>
<file>icons/page_white_cd.png</file>
<file>icons/page_white_copy.png</file>
<file>icons/paste_plain.png</file>
<file>icons/photo.png</file>
<file>icons/play.png</file>

Binary file not shown.

View File

@ -29,8 +29,8 @@
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 5
#define VER_LAMEXP_BUILD 554
#define VER_LAMEXP_PATCH 6
#define VER_LAMEXP_BUILD 558
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -648,7 +648,11 @@ void MainWindow::showEvent(QShowEvent *event)
m_accepted = false;
m_dropNoteLabel->setGeometry(0, 0, sourceFileView->width(), sourceFileView->height());
sourceModelChanged();
tabWidget->setCurrentIndex(0);
if(!event->spontaneous())
{
tabWidget->setCurrentIndex(0);
}
if(m_firstTimeShown)
{
@ -1761,6 +1765,13 @@ void MainWindow::showDetailsButtonClicked(void)
iResult = metaInfoDialog->exec(file, index.row() > 0, index.row() < m_fileListModel->rowCount() - 1);
)
if(iResult == INT_MAX)
{
m_metaInfoModel->assignInfoFrom(file);
tabWidget->setCurrentIndex(tabWidget->indexOf(tabMetaData));
break;
}
if(!iResult) break;
}

View File

@ -62,12 +62,21 @@ MetaInfoDialog::MetaInfoDialog(QWidget *parent)
connect(editButton, SIGNAL(clicked()), this, SLOT(editButtonClicked()));
//Create context menu
m_contextMenu = new QMenu();
QAction *loadArtworkAction = m_contextMenu->addAction(QIcon(":/icons/folder_image.png"), tr("Load Artwork From File"));
QAction *clearArtworkAction = m_contextMenu->addAction(QIcon(":/icons/bin.png"), tr("Clear Artwork"));
m_contextMenuInfo = new QMenu();
m_contextMenuArtwork = new QMenu();
QAction *editMetaInfoAction = m_contextMenuInfo->addAction(QIcon(":/icons/table_edit.png"), tr("Edit this Information"));
QAction *copyMetaInfoAction = m_contextMenuInfo->addAction(QIcon(":/icons/page_white_copy.png"), tr("Copy everything to Meta Info tab"));
QAction *clearMetaInfoAction = m_contextMenuInfo->addAction(QIcon(":/icons/bin.png"), tr("Clear all Meta Info"));
QAction *loadArtworkAction = m_contextMenuArtwork->addAction(QIcon(":/icons/folder_image.png"), tr("Load Artwork From File"));
QAction *clearArtworkAction = m_contextMenuArtwork->addAction(QIcon(":/icons/bin.png"), tr("Clear Artwork"));
SET_FONT_BOLD(editMetaInfoAction, true);
SET_FONT_BOLD(loadArtworkAction, true);
connect(labelArtwork, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(frameArtwork, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(infoContextMenuRequested(QPoint)));
connect(labelArtwork, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(artworkContextMenuRequested(QPoint)));
connect(frameArtwork, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(artworkContextMenuRequested(QPoint)));
connect(editMetaInfoAction, SIGNAL(triggered(bool)), this, SLOT(editButtonClicked()));
connect(copyMetaInfoAction, SIGNAL(triggered(bool)), this, SLOT(copyMetaInfoActionTriggered()));
connect(clearMetaInfoAction, SIGNAL(triggered(bool)), this, SLOT(clearMetaInfoActionTriggered()));
connect(loadArtworkAction, SIGNAL(triggered(bool)), this, SLOT(editButtonClicked()));
connect(clearArtworkAction, SIGNAL(triggered(bool)), this, SLOT(clearArtworkActionTriggered()));
@ -77,7 +86,8 @@ MetaInfoDialog::MetaInfoDialog(QWidget *parent)
MetaInfoDialog::~MetaInfoDialog(void)
{
LAMEXP_DELETE(m_contextMenu);
LAMEXP_DELETE(m_contextMenuInfo);
LAMEXP_DELETE(m_contextMenuArtwork);
}
////////////////////////////////////////////////////////////
@ -165,8 +175,7 @@ void MetaInfoDialog::editButtonClicked(void)
}
}
void MetaInfoDialog::contextMenuRequested(const QPoint &pos)
void MetaInfoDialog::infoContextMenuRequested(const QPoint &pos)
{
QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(QObject::sender());
QWidget *sender = scrollArea ? scrollArea->viewport() : dynamic_cast<QWidget*>(QObject::sender());
@ -175,11 +184,38 @@ void MetaInfoDialog::contextMenuRequested(const QPoint &pos)
{
if(pos.x() <= sender->width() && pos.y() <= sender->height() && pos.x() >= 0 && pos.y() >= 0)
{
m_contextMenu->popup(sender->mapToGlobal(pos));
m_contextMenuInfo->popup(sender->mapToGlobal(pos));
}
}
}
void MetaInfoDialog::artworkContextMenuRequested(const QPoint &pos)
{
QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(QObject::sender());
QWidget *sender = scrollArea ? scrollArea->viewport() : dynamic_cast<QWidget*>(QObject::sender());
if(sender)
{
if(pos.x() <= sender->width() && pos.y() <= sender->height() && pos.x() >= 0 && pos.y() >= 0)
{
m_contextMenuArtwork->popup(sender->mapToGlobal(pos));
}
}
}
void MetaInfoDialog::copyMetaInfoActionTriggered(void)
{
done(INT_MAX);
}
void MetaInfoDialog::clearMetaInfoActionTriggered(void)
{
if(MetaInfoModel *model = dynamic_cast<MetaInfoModel*>(tableView->model()))
{
model->clearData(true);
}
}
void MetaInfoDialog::clearArtworkActionTriggered(void)
{
labelArtwork->setPixmap(QPixmap::fromImage(QImage(":/images/CD.png")));

View File

@ -40,9 +40,13 @@ private slots:
void upButtonClicked(void);
void downButtonClicked(void);
void editButtonClicked(void);
void contextMenuRequested(const QPoint &pos);
void infoContextMenuRequested(const QPoint &pos);
void artworkContextMenuRequested(const QPoint &pos);
void copyMetaInfoActionTriggered(void);
void clearMetaInfoActionTriggered(void);
void clearArtworkActionTriggered(void);
private:
QMenu *m_contextMenu;
QMenu *m_contextMenuInfo;
QMenu *m_contextMenuArtwork;
};

View File

@ -1,4 +1,4 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
@ -26,6 +26,8 @@
#include <QMutexLocker>
#include <QFile>
#define U16Str(X) QString::fromUtf16(reinterpret_cast<const unsigned short*>(L##X))
////////////////////////////////////////////////////////////
// Constructor & Destructor
////////////////////////////////////////////////////////////
@ -51,6 +53,8 @@ AudioFileModel::AudioFileModel(const AudioFileModel &model, bool copyMetaInfo)
setFormatAudioSamplerate(model.m_formatAudioSamplerate);
setFormatAudioChannels(model.m_formatAudioChannels);
setFormatAudioBitdepth(model.m_formatAudioBitdepth);
setFormatAudioBitrate(model.m_formatAudioBitrate);
setFormatAudioBitrateMode(model.m_formatAudioBitrateMode);
setFileDuration(model.m_fileDuration);
if(copyMetaInfo)
@ -87,6 +91,8 @@ AudioFileModel &AudioFileModel::operator=(const AudioFileModel &model)
setFormatAudioSamplerate(model.m_formatAudioSamplerate);
setFormatAudioChannels(model.m_formatAudioChannels);
setFormatAudioBitdepth(model.m_formatAudioBitdepth);
setFormatAudioBitrate(model.m_formatAudioBitrate);
setFormatAudioBitrateMode(model.m_formatAudioBitrateMode);
return (*this);
}
@ -122,6 +128,8 @@ void AudioFileModel::resetAll(void)
m_formatAudioSamplerate = 0;
m_formatAudioChannels = 0;
m_formatAudioBitdepth = 0;
m_formatAudioBitrate = 0;
m_formatAudioBitrateMode = BitrateModeUndefined;
}
////////////////////////////////////////////////////////////
@ -222,6 +230,16 @@ unsigned int AudioFileModel::formatAudioBitdepth(void) const
return m_formatAudioBitdepth;
}
unsigned int AudioFileModel::formatAudioBitrate(void) const
{
return m_formatAudioBitrate;
}
unsigned int AudioFileModel::formatAudioBitrateMode(void) const
{
return m_formatAudioBitrateMode;
}
const QString AudioFileModel::fileDurationInfo(void) const
{
if(m_fileDuration)
@ -295,6 +313,21 @@ const QString AudioFileModel::formatAudioCompressInfo(void) const
{
info.append(QString(", %1: %2").arg(tr("Version"), m_formatAudioVersion));
}
if(m_formatAudioBitrate > 0)
{
switch(m_formatAudioBitrateMode)
{
case BitrateModeConstant:
info.append(U16Str(", %1: %2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_formatAudioBitrate), tr("Constant")));
break;
case BitrateModeVariable:
info.append(U16Str(", %1: \u2248%2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_formatAudioBitrate), tr("Variable")));
break;
default:
info.append(U16Str(", %1: %2 kbps").arg(tr("Bitrate"), QString::number(m_formatAudioBitrate)));
break;
}
}
return info;
}
else
@ -402,6 +435,16 @@ void AudioFileModel::setFormatAudioBitdepth(unsigned int bitdepth)
m_formatAudioBitdepth = bitdepth;
}
void AudioFileModel::setFormatAudioBitrate(unsigned int bitrate)
{
m_formatAudioBitrate = bitrate;
}
void AudioFileModel::setFormatAudioBitrateMode(unsigned int bitrateMode)
{
m_formatAudioBitrateMode = bitrateMode;
}
void AudioFileModel::updateMetaInfo(const AudioFileModel &model)
{
if(!model.fileArtist().isEmpty()) setFileArtist(model.fileArtist());

View File

@ -38,6 +38,13 @@ public:
AudioFileModel &operator=(const AudioFileModel &model);
~AudioFileModel(void);
enum BitrateMode
{
BitrateModeUndefined = 0,
BitrateModeConstant = 1,
BitrateModeVariable = 2,
};
//-----------------------
//Getters
//-----------------------
@ -61,6 +68,8 @@ public:
unsigned int formatAudioSamplerate(void) const;
unsigned int formatAudioChannels(void) const;
unsigned int formatAudioBitdepth(void) const;
unsigned int formatAudioBitrate(void) const;
unsigned int formatAudioBitrateMode(void) const;
const QString fileDurationInfo(void) const;
const QString formatContainerInfo(void) const;
@ -91,6 +100,8 @@ public:
void setFormatAudioSamplerate(unsigned int samplerate);
void setFormatAudioChannels(unsigned int channels);
void setFormatAudioBitdepth(unsigned int bitdepth);
void setFormatAudioBitrate(unsigned int bitrate);
void setFormatAudioBitrateMode(unsigned int bitrateMode);
void updateMetaInfo(const AudioFileModel &model);
@ -114,6 +125,8 @@ private:
unsigned int m_formatAudioSamplerate;
unsigned int m_formatAudioChannels;
unsigned int m_formatAudioBitdepth;
unsigned int m_formatAudioBitrate;
unsigned int m_formatAudioBitrateMode;
void resetAll(void);
};

View File

@ -435,31 +435,41 @@ void MetaInfoModel::editArtwork(const QString &imagePath)
m_audioFile->setFileCover(imagePath, false);
}
void MetaInfoModel::clearData(void)
void MetaInfoModel::clearData(bool clearMetaOnly)
{
beginResetModel();
m_textUnknown = QString("(%1)").arg(tr("Unknown"));
m_textNotSpecified = QString("(%1)").arg(tr("Not Specified"));
m_audioFile->setFilePath(QString());
m_audioFile->setFileName(QString());
m_audioFile->setFileArtist(QString());
m_audioFile->setFileAlbum(QString());
m_audioFile->setFileGenre(QString());
m_audioFile->setFileComment(tr("Encoded with LameXP"));
m_audioFile->setFileCover(QString(), false);
m_audioFile->setFileYear(0);
m_audioFile->setFilePosition(UINT_MAX);
m_audioFile->setFileDuration(0);
m_audioFile->setFormatContainerType(QString());
m_audioFile->setFormatContainerProfile(QString());
m_audioFile->setFormatAudioType(QString());
m_audioFile->setFormatAudioProfile(QString());
m_audioFile->setFormatAudioVersion(QString());
m_audioFile->setFormatAudioSamplerate(0);
m_audioFile->setFormatAudioChannels(0);
m_audioFile->setFormatAudioBitdepth(0);
m_audioFile->setFilePosition(m_offset ? UINT_MAX : 0);
if(!clearMetaOnly)
{
m_audioFile->setFilePath(QString());
m_audioFile->setFileName(QString());
m_audioFile->setFileDuration(0);
m_audioFile->setFormatContainerType(QString());
m_audioFile->setFormatContainerProfile(QString());
m_audioFile->setFormatAudioType(QString());
m_audioFile->setFormatAudioProfile(QString());
m_audioFile->setFormatAudioVersion(QString());
m_audioFile->setFormatAudioSamplerate(0);
m_audioFile->setFormatAudioChannels(0);
m_audioFile->setFormatAudioBitdepth(0);
}
else
{
QString temp = QFileInfo(m_audioFile->filePath()).baseName();
temp = temp.split("-", QString::SkipEmptyParts).last().trimmed();
m_audioFile->setFileName(temp);
}
endResetModel();
}
@ -468,3 +478,10 @@ Qt::ItemFlags MetaInfoModel::flags(const QModelIndex &index) const
{
return QAbstractTableModel::flags(index);
}
void MetaInfoModel::assignInfoFrom(AudioFileModel &file)
{
beginResetModel();
m_audioFile->updateMetaInfo(file);
endResetModel();
}

View File

@ -43,7 +43,8 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
void editItem(const QModelIndex &index, QWidget *parent);
void editArtwork(const QString &imagePath);
void clearData(void);
void assignInfoFrom(AudioFileModel &file);
void clearData(bool clearMetaOnly = false);
private:
AudioFileModel* m_audioFile;

View File

@ -380,20 +380,50 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, const QString &key, con
}
else if(!key.compare("Channel(s)", Qt::CaseInsensitive))
{
if(!audioFile.formatAudioChannels()) audioFile.setFormatAudioChannels(value.split(" ", QString::SkipEmptyParts).first().toInt());
if(!audioFile.formatAudioChannels()) audioFile.setFormatAudioChannels(value.split(" ", QString::SkipEmptyParts).first().toUInt());
}
else if(!key.compare("Sampling rate", Qt::CaseInsensitive))
{
if(!audioFile.formatAudioSamplerate()) audioFile.setFormatAudioSamplerate(ceil(value.split(" ", QString::SkipEmptyParts).first().toFloat() * 1000.0f));
if(!audioFile.formatAudioSamplerate())
{
bool ok = false;
float fTemp = abs(value.split(" ", QString::SkipEmptyParts).first().toFloat(&ok));
if(ok) audioFile.setFormatAudioSamplerate(static_cast<unsigned int>(floor(fTemp * 1000.0f + 0.5f)));
}
}
else if(!key.compare("Bit depth", Qt::CaseInsensitive))
{
if(!audioFile.formatAudioBitdepth()) audioFile.setFormatAudioBitdepth(value.split(" ", QString::SkipEmptyParts).first().toInt());
if(!audioFile.formatAudioBitdepth()) audioFile.setFormatAudioBitdepth(value.split(" ", QString::SkipEmptyParts).first().toUInt());
}
else if(!key.compare("Duration", Qt::CaseInsensitive))
{
if(!audioFile.fileDuration()) audioFile.setFileDuration(parseDuration(value));
}
else if(!key.compare("Bit rate", Qt::CaseInsensitive))
{
if(!audioFile.formatAudioBitrate())
{
bool ok = false;
unsigned int uiTemp = value.split(" ", QString::SkipEmptyParts).first().toUInt(&ok);
if(ok)
{
audioFile.setFormatAudioBitrate(uiTemp);
}
else
{
float fTemp = abs(value.split(" ", QString::SkipEmptyParts).first().toFloat(&ok));
if(ok) audioFile.setFormatAudioBitrate(static_cast<unsigned int>(floor(fTemp + 0.5f)));
}
}
}
else if(!key.compare("Bit rate mode", Qt::CaseInsensitive))
{
if(audioFile.formatAudioBitrateMode() == AudioFileModel::BitrateModeUndefined)
{
if(!value.compare("Constant", Qt::CaseInsensitive)) audioFile.setFormatAudioBitrateMode(AudioFileModel::BitrateModeConstant);
if(!value.compare("Variable", Qt::CaseInsensitive)) audioFile.setFormatAudioBitrateMode(AudioFileModel::BitrateModeVariable);
}
}
break;
}
}