From d452e92bd4b38189b1ae6b177a90c21e64f7a922 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Tue, 31 May 2011 19:04:45 +0200 Subject: [PATCH] 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. --- etc/Translation/Blank.ts | 24 +++++++++++++++ etc/Translation/LameXP_DE.ts | 24 +++++++++++++++ etc/Translation/LameXP_ES.ts | 24 +++++++++++++++ etc/Translation/LameXP_FR.ts | 24 +++++++++++++++ etc/Translation/LameXP_IT.ts | 24 +++++++++++++++ etc/Translation/LameXP_KR.ts | 24 +++++++++++++++ etc/Translation/LameXP_RU.ts | 24 +++++++++++++++ etc/Translation/LameXP_UK.ts | 24 +++++++++++++++ gui/MetaInfo.ui | 4 +++ res/Icons.qrc | 1 + res/localization/LameXP_DE.qm | Bin 68705 -> 69280 bytes src/Config.h | 4 +-- src/Dialog_MainWindow.cpp | 13 +++++++- src/Dialog_MetaInfo.cpp | 54 ++++++++++++++++++++++++++++------ src/Dialog_MetaInfo.h | 8 +++-- src/Model_AudioFile.cpp | 45 +++++++++++++++++++++++++++- src/Model_AudioFile.h | 15 +++++++++- src/Model_MetaInfo.cpp | 45 +++++++++++++++++++--------- src/Model_MetaInfo.h | 3 +- src/Thread_FileAnalyzer.cpp | 36 +++++++++++++++++++++-- 20 files changed, 386 insertions(+), 34 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index eab0e326..47fd1e58 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -238,6 +238,18 @@ Version + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1603,6 +1615,18 @@ MetaInfoDialog + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + Load Artwork From File diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 78b6a376..a2ed7c5d 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -238,6 +238,18 @@ Version Version + + Bitrate + Bitrate + + + Constant + konstant + + + Variable + variabel + CueImportDialog @@ -1632,6 +1644,18 @@ Sorry, failed to load artwork from selected file! Artwork konnte nicht aus der Ausgewählten Datei geladen werden! + + Edit this Information + Diese Information bearbeiten + + + Copy everything to Meta Info tab + Alles in den Metadaten-Tab kopieren + + + Clear all Meta Info + Metainformationen löschen + MetaInfoModel diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index d877c86d..7903f1bb 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -238,6 +238,18 @@ Version Versión + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1631,6 +1643,18 @@ Sorry, failed to load artwork from selected file! ¡Lo sentimos, ha habido un error al cargar la carátula desde el archivo seleccionado! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 12fa1cc9..9dceef4f 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -242,6 +242,18 @@ Version Version + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1641,6 +1653,18 @@ Ouvrir le dossier récursivement... Sorry, failed to load artwork from selected file! Impossible de charger l'oeuvre depuis le fichier sélectionné ! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index f4673257..7327dbdf 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -238,6 +238,18 @@ Version + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1632,6 +1644,18 @@ Sorry, failed to load artwork from selected file! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index d4813993..017b4c7d 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -238,6 +238,18 @@ Version 버전 + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1631,6 +1643,18 @@ Sorry, failed to load artwork from selected file! 죄송하지만, 선택한 파일로부터 아트워크 불러기가 실패되었습니다! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 8bf9c453..0d0fc723 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -238,6 +238,18 @@ Version Версия + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1634,6 +1646,18 @@ Sorry, failed to load artwork from selected file! Извините, немогу загрузит картинку из выделенного файла! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 482608d5..98d54dd1 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -238,6 +238,18 @@ Version Версія + + Bitrate + + + + Constant + + + + Variable + + CueImportDialog @@ -1631,6 +1643,18 @@ Sorry, failed to load artwork from selected file! Вибачте, але неможливо завантажити обкладинку з вибраного файла! + + Edit this Information + + + + Copy everything to Meta Info tab + + + + Clear all Meta Info + + MetaInfoModel diff --git a/gui/MetaInfo.ui b/gui/MetaInfo.ui index 017373f9..97bdb029 100644 --- a/gui/MetaInfo.ui +++ b/gui/MetaInfo.ui @@ -172,6 +172,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::SingleSelection @@ -498,6 +501,7 @@ + diff --git a/res/Icons.qrc b/res/Icons.qrc index 703a9a4c..51cf126b 100644 --- a/res/Icons.qrc +++ b/res/Icons.qrc @@ -64,6 +64,7 @@ icons/page_white_cplusplus.png icons/page_white_add.png icons/page_white_cd.png + icons/page_white_copy.png icons/paste_plain.png icons/photo.png icons/play.png diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index ece2cac94261b3f44732c07f20e347b8d547e1c0..15c1a1c845de2306ae2e11d5e69162fd299e8cd6 100644 GIT binary patch delta 4531 zcmYLM2Ut{Bw_P)H@7yVOW@s9f1V=;>gNoQO7DQ1{5gQ-|bSN4Oq9SP2#KD3s2ol7A z4eU`tQIi-OC`b%y5EUEt8cW2MUjrz4i}2q2KR(#pJLl}P%UWxnxtk^AZV*;ESOWp{ z0|HJ0VsD`AFWM2niq^o$QNZJUz*r}sw+Kuq0rouvW{d<{B{tf^kq`<-12d;XI3fVk zOpUhi9E6HCz^sE1ed%v$HN+HtzIrFb?-NW5^u!O-){q7Z^P-= z+^CI1)rc0rnHYsA@p;>Ag6(1$t1zrRyx_UXl(}ctyHXfN{2U{73nAU0P6LM?5z$!ijN}q{T5(d zo+9sB6frPGae5nj*#3T_?Pb?!=U!Eu(Z2%zu2GafW2SBL6_r`{iH}E$%OA6XZSxgZ zZ?PqF)+nlOvX$PIiktdkpvgtWO($0~FzA-zZO_9%^_Pmbu?!$bP?}cr`EXQ5zVajM zV`ZDMvkAYaO7{mbz;IF7%RUuYkd8##~U4dpA{M?UR^j zvMQMGtr)&b6;E0zhuVgS#*;$o;p)>I6Pt`AVw!nV9s;uHX zFz8_oEMBQ z{YcgUg3YV7z*U{#?9S2;J1lhW(ut*hA$ZSY1v(@NgWB~1=6VQ&yu28IMF{%lYaq5+ zqpiLt#5!67n89@+J~18m&|Fw#ssSwd!qV^PU`&~?ynv-WIZpV#4-f8mK*;ht%92(! z+LP(Ry0Ajv=}*G8yrsa!VqyElO+ZzaushrZ7~w7CNzC|av5;Sq4CK2BNAJF7=ADFM z^GV=WwNPq(R!){T6Hblffj@K;&QGE)F25&S2;9t`RtlAB_RLi+T+Ubw{MJ{vyWL0) zJs|v1s0Bitgx4vZftRvSAH)OZ=7=_LQpv4U(SFn_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$~&DdgjAP`n%!1KDnCgu2%tVZkRgMl0wZtrm>CZ z5s6_YpZ2%d4Y4NQ@hq&QzbPcG&Qj&~Q`9VQOKa(NwB3(!aCm;R&z$fHBJSVtzb1Oq>CHX_*&V@4n3j Wv$M;FD(9VfMO{{J&C4%--24CD^9{WK diff --git a/src/Config.h b/src/Config.h index 56b45da1..8a09bbd2 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 9979cbe1..2b480661 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -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) { @@ -1760,6 +1764,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; } diff --git a/src/Dialog_MetaInfo.cpp b/src/Dialog_MetaInfo.cpp index 45af622a..ed05a38a 100644 --- a/src/Dialog_MetaInfo.cpp +++ b/src/Dialog_MetaInfo.cpp @@ -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(QObject::sender()); QWidget *sender = scrollArea ? scrollArea->viewport() : dynamic_cast(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(QObject::sender()); + QWidget *sender = scrollArea ? scrollArea->viewport() : dynamic_cast(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(tableView->model())) + { + model->clearData(true); + } +} + void MetaInfoDialog::clearArtworkActionTriggered(void) { labelArtwork->setPixmap(QPixmap::fromImage(QImage(":/images/CD.png"))); diff --git a/src/Dialog_MetaInfo.h b/src/Dialog_MetaInfo.h index fcca527e..ff700ac4 100644 --- a/src/Dialog_MetaInfo.h +++ b/src/Dialog_MetaInfo.h @@ -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; }; diff --git a/src/Model_AudioFile.cpp b/src/Model_AudioFile.cpp index a6a2f2d9..4a57dfa3 100644 --- a/src/Model_AudioFile.cpp +++ b/src/Model_AudioFile.cpp @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // LameXP - Audio Encoder Front-End // Copyright (C) 2004-2011 LoRd_MuldeR // @@ -26,6 +26,8 @@ #include #include +#define U16Str(X) QString::fromUtf16(reinterpret_cast(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()); diff --git a/src/Model_AudioFile.h b/src/Model_AudioFile.h index 25031b4b..ef6347b8 100644 --- a/src/Model_AudioFile.h +++ b/src/Model_AudioFile.h @@ -38,6 +38,13 @@ public: AudioFileModel &operator=(const AudioFileModel &model); ~AudioFileModel(void); + enum BitrateMode + { + BitrateModeUndefined = 0, + BitrateModeConstant = 1, + BitrateModeVariable = 2, + }; + //----------------------- //Getters //----------------------- @@ -61,7 +68,9 @@ 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; const QString formatAudioBaseInfo(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); }; diff --git a/src/Model_MetaInfo.cpp b/src/Model_MetaInfo.cpp index df0ca9d5..a1d7bc40 100644 --- a/src/Model_MetaInfo.cpp +++ b/src/Model_MetaInfo.cpp @@ -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(); } @@ -467,4 +477,11 @@ void MetaInfoModel::clearData(void) Qt::ItemFlags MetaInfoModel::flags(const QModelIndex &index) const { return QAbstractTableModel::flags(index); -} \ No newline at end of file +} + +void MetaInfoModel::assignInfoFrom(AudioFileModel &file) +{ + beginResetModel(); + m_audioFile->updateMetaInfo(file); + endResetModel(); +} diff --git a/src/Model_MetaInfo.h b/src/Model_MetaInfo.h index 855fa463..0c821744 100644 --- a/src/Model_MetaInfo.h +++ b/src/Model_MetaInfo.h @@ -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; diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index 58f56828..0bd0fcf8 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -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(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(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; } }