diff --git a/src/Config.h b/src/Config.h index c9fe6123..3a8bc220 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 291 +#define VER_LAMEXP_BUILD 293 #define VER_LAMEXP_SUFFIX Beta-3 /* diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 7559956a..5870cc7d 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -596,18 +596,16 @@ AudioFileModel ProcessingDialog::updateMetaInfo(const AudioFileModel &audioFile) { if(!m_settings->writeMetaTags()) { - AudioFileModel result(audioFile, false); - return result; + return AudioFileModel(audioFile, false); } AudioFileModel result = audioFile; - - if(!m_metaInfo->fileArtist().isEmpty()) result.setFileArtist(m_metaInfo->fileArtist()); - if(!m_metaInfo->fileAlbum().isEmpty()) result.setFileAlbum(m_metaInfo->fileAlbum()); - if(!m_metaInfo->fileGenre().isEmpty()) result.setFileGenre(m_metaInfo->fileGenre()); - if(m_metaInfo->fileYear()) result.setFileYear(m_metaInfo->fileYear()); - if(m_metaInfo->filePosition() == UINT_MAX) result.setFilePosition(m_currentFile); - if(!m_metaInfo->fileComment().isEmpty()) result.setFileComment(m_metaInfo->fileComment()); + result.updateMetaInfo(*m_metaInfo); + + if(m_metaInfo->filePosition() == UINT_MAX) + { + result.setFilePosition(m_currentFile); + } return result; } diff --git a/src/Model_AudioFile.cpp b/src/Model_AudioFile.cpp index 54d0579b..43db4079 100644 --- a/src/Model_AudioFile.cpp +++ b/src/Model_AudioFile.cpp @@ -30,24 +30,15 @@ AudioFileModel::AudioFileModel(const QString &path, const QString &name) { + resetAll(); + m_filePath = path; m_fileName = name; - m_fileYear = 0; - m_filePosition = 0; - m_fileDuration = 0; - m_formatAudioSamplerate = 0; - m_formatAudioChannels = 0; - m_formatAudioBitdepth = 0; } AudioFileModel::AudioFileModel(const AudioFileModel &model, bool copyMetaInfo) { - m_fileYear = 0; - m_filePosition = 0; - m_fileDuration = 0; - m_formatAudioSamplerate = 0; - m_formatAudioChannels = 0; - m_formatAudioBitdepth = 0; + resetAll(); setFilePath(model.m_filePath); setFormatContainerType(model.m_formatContainerType); @@ -100,6 +91,34 @@ AudioFileModel::~AudioFileModel(void) { } +//////////////////////////////////////////////////////////// +// Private Functions +//////////////////////////////////////////////////////////// + +void AudioFileModel::resetAll(void) +{ + m_filePath.clear(); + m_fileName.clear(); + m_fileArtist.clear(); + m_fileAlbum.clear(); + m_fileGenre.clear(); + m_fileComment.clear(); + + m_fileYear = 0; + m_filePosition = 0; + m_fileDuration = 0; + + m_formatContainerType.clear(); + m_formatContainerProfile.clear(); + m_formatAudioType.clear(); + m_formatAudioProfile.clear(); + m_formatAudioVersion.clear(); + + m_formatAudioSamplerate = 0; + m_formatAudioChannels = 0; + m_formatAudioBitdepth = 0; +} + //////////////////////////////////////////////////////////// // Public Functions //////////////////////////////////////////////////////////// @@ -362,3 +381,12 @@ void AudioFileModel::setFormatAudioBitdepth(unsigned int bitdepth) { m_formatAudioBitdepth = bitdepth; } + +void AudioFileModel::updateMetaInfo(const AudioFileModel &model) +{ + if(!model.fileArtist().isEmpty()) setFileArtist(model.fileArtist()); + if(!model.fileAlbum().isEmpty()) setFileAlbum(model.fileAlbum()); + if(!model.fileGenre().isEmpty()) setFileGenre(model.fileGenre()); + if(!model.fileComment().isEmpty()) setFileComment(model.fileComment()); + if(model.fileYear()) setFileYear(model.fileYear()); +} diff --git a/src/Model_AudioFile.h b/src/Model_AudioFile.h index 13dc9327..bf27d7e5 100644 --- a/src/Model_AudioFile.h +++ b/src/Model_AudioFile.h @@ -85,6 +85,8 @@ public: void setFormatAudioChannels(unsigned int channels); void setFormatAudioBitdepth(unsigned int bitdepth); + void updateMetaInfo(const AudioFileModel &model); + private: QString m_filePath; QString m_fileName; @@ -104,4 +106,6 @@ private: unsigned int m_formatAudioSamplerate; unsigned int m_formatAudioChannels; unsigned int m_formatAudioBitdepth; + + void resetAll(void); };