diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-08-04 21:46:14 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-08-04 21:46:14 +0000 |
| commit | 89e33b8d34bfa667e69a3422b9b73806d83e53bf (patch) | |
| tree | 00434d6874843504f6d5a4fcb30d303c8845a757 /src/plugins/Input/mpc/mpcmetadatamodel.cpp | |
| parent | c40c1ba38df9efce07a9f8372e6d357ff3c5d9b6 (diff) | |
| download | qmmp-89e33b8d34bfa667e69a3422b9b73806d83e53bf.tar.gz qmmp-89e33b8d34bfa667e69a3422b9b73806d83e53bf.tar.bz2 qmmp-89e33b8d34bfa667e69a3422b9b73806d83e53bf.zip | |
mpc: fixed recent api support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8224 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mpc/mpcmetadatamodel.cpp')
| -rw-r--r-- | src/plugins/Input/mpc/mpcmetadatamodel.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/plugins/Input/mpc/mpcmetadatamodel.cpp b/src/plugins/Input/mpc/mpcmetadatamodel.cpp index 3b58b16f4..74daf0b86 100644 --- a/src/plugins/Input/mpc/mpcmetadatamodel.cpp +++ b/src/plugins/Input/mpc/mpcmetadatamodel.cpp @@ -24,9 +24,10 @@ #include <taglib/apetag.h> #include "mpcmetadatamodel.h" -MPCMetaDataModel::MPCMetaDataModel(const QString &path, QObject *parent) : MetaDataModel(parent) +MPCMetaDataModel::MPCMetaDataModel(const QString &path, bool readOnly, QObject *parent) : MetaDataModel(readOnly, parent) { - m_file = new TagLib::MPC::File (QStringToFileName(path)); + m_stream = new TagLib::FileStream(QStringToFileName(path), readOnly); + m_file = new TagLib::MPC::File(m_stream); m_tags << new MPCFileTagModel(m_file, TagLib::MPC::File::ID3v1); m_tags << new MPCFileTagModel(m_file, TagLib::MPC::File::APE); } @@ -35,23 +36,11 @@ MPCMetaDataModel::~MPCMetaDataModel() { while(!m_tags.isEmpty()) delete m_tags.takeFirst(); - delete m_file; + delete m_file; + delete m_stream; } -QHash<QString, QString> MPCMetaDataModel::audioProperties() -{ - QHash<QString, QString> ap; - QString text = QString("%1").arg(m_file->audioProperties()->length()/60); - text +=":"+QString("%1").arg(m_file->audioProperties()->length()%60,2,10,QChar('0')); - ap.insert(tr("Length"), text); - ap.insert(tr("Sample rate"), QString("%1 " + tr("Hz")).arg(m_file->audioProperties()->sampleRate())); - ap.insert(tr("Channels"), QString("%1").arg(m_file->audioProperties()->channels())); - ap.insert(tr("Bitrate"), QString("%1 " + tr("kbps")).arg(m_file->audioProperties()->bitrate())); - ap.insert(tr("File size"), QString("%1 "+tr("KB")).arg(m_file->length()/1024)); - return ap; -} - -QList<TagModel* > MPCMetaDataModel::tags() +QList<TagModel* > MPCMetaDataModel::tags() const { return m_tags; } |
