diff options
Diffstat (limited to 'src/plugins/Input/archive')
| -rw-r--r-- | src/plugins/Input/archive/archive.pro | 6 | ||||
| -rw-r--r-- | src/plugins/Input/archive/archivemetadatamodel.cpp | 61 | ||||
| -rw-r--r-- | src/plugins/Input/archive/archivemetadatamodel.h | 46 | ||||
| -rw-r--r-- | src/plugins/Input/archive/decoderarchivefactory.cpp | 9 | ||||
| -rw-r--r-- | src/plugins/Input/archive/decoderarchivefactory.h | 2 |
5 files changed, 9 insertions, 115 deletions
diff --git a/src/plugins/Input/archive/archive.pro b/src/plugins/Input/archive/archive.pro index a96f0e6b7..fc07b36ed 100644 --- a/src/plugins/Input/archive/archive.pro +++ b/src/plugins/Input/archive/archive.pro @@ -6,15 +6,13 @@ HEADERS += \ archiveinputdevice.h \ decoderarchivefactory.h \ decoder_archive.h \ - archivetagreader.h \ - archivemetadatamodel.h + archivetagreader.h SOURCES += \ archiveinputdevice.cpp \ decoderarchivefactory.cpp \ decoder_archive.cpp \ - archivetagreader.cpp \ - archivemetadatamodel.cpp + archivetagreader.cpp RESOURCES = translations/translations.qrc diff --git a/src/plugins/Input/archive/archivemetadatamodel.cpp b/src/plugins/Input/archive/archivemetadatamodel.cpp deleted file mode 100644 index 6509d3ca9..000000000 --- a/src/plugins/Input/archive/archivemetadatamodel.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * - * forkotov02@ya.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include "archiveinputdevice.h" -#include "archivetagreader.h" -#include "archivemetadatamodel.h" - -ArchiveMetaDataModel::ArchiveMetaDataModel(const QString &url, QObject *parent) : - MetaDataModel(parent) -{ - m_reader = 0; - m_input = 0; - m_url = url; -} - -ArchiveMetaDataModel::~ArchiveMetaDataModel() -{ - if(m_reader) - delete m_reader; - if(m_input) - delete m_input; -} - -QHash<QString, QString> ArchiveMetaDataModel::audioProperties() -{ - if(!m_input) - { - m_input = new ArchiveInputDevice(m_url); - if(m_input->isOpen()) - m_reader = new ArchiveTagReader(m_input, m_url); - } - - QHash <QString, QString> ap; - if(m_reader && m_reader->audioProperties()) - { - TagLib::AudioProperties *p = m_reader->audioProperties(); - ap.insert(tr("Length"), QString("%1:%2").arg(p->length()/60).arg(p->length()%60, 2, 10, QChar('0'))); - ap.insert(tr("Sample rate"), QString("%1 " + tr("Hz")).arg(p->sampleRate())); - ap.insert(tr("Channels"), QString("%1").arg(p->channels())); - ap.insert(tr("Bitrate"), QString("%1 " + tr("kbps")).arg(p->bitrate())); - ap.insert(tr("File size"), QString("%1 "+tr("KB")).arg(m_input->size()/1024)); - } - return ap; -} diff --git a/src/plugins/Input/archive/archivemetadatamodel.h b/src/plugins/Input/archive/archivemetadatamodel.h deleted file mode 100644 index b034ae7da..000000000 --- a/src/plugins/Input/archive/archivemetadatamodel.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * - * forkotov02@ya.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef ARCHIVEMETADATAMODEL_H -#define ARCHIVEMETADATAMODEL_H - -#include <QObject> -#include <qmmp/metadatamodel.h> - -class ArchiveInputDevice; -class ArchiveTagReader; - -class ArchiveMetaDataModel : public MetaDataModel -{ - Q_OBJECT -public: - explicit ArchiveMetaDataModel(const QString &url, QObject *parent = 0); - virtual ~ArchiveMetaDataModel(); - - QHash<QString, QString> audioProperties(); - -private: - ArchiveInputDevice *m_input; - ArchiveTagReader *m_reader; - QString m_url; - -}; - -#endif // ARCHIVEMETADATAMODEL_H diff --git a/src/plugins/Input/archive/decoderarchivefactory.cpp b/src/plugins/Input/archive/decoderarchivefactory.cpp index 8ebaefc00..3f64fff6d 100644 --- a/src/plugins/Input/archive/decoderarchivefactory.cpp +++ b/src/plugins/Input/archive/decoderarchivefactory.cpp @@ -25,7 +25,6 @@ #include "decoder_archive.h" #include "archivetagreader.h" #include "archiveinputdevice.h" -#include "archivemetadatamodel.h" #include "decoderarchivefactory.h" // DecoderArchiveFactory @@ -123,6 +122,7 @@ QList<TrackInfo *> DecoderArchiveFactory::createPlayList(const QString &path, Tr list.last()->setValue(Qmmp::BITRATE, ap->bitrate()); list.last()->setValue(Qmmp::SAMPLERATE, ap->sampleRate()); list.last()->setValue(Qmmp::CHANNELS, ap->channels()); + list.last()->setValue(Qmmp::FILE_SIZE, dev.size()); } if(ap) @@ -136,9 +136,12 @@ QList<TrackInfo *> DecoderArchiveFactory::createPlayList(const QString &path, Tr return list; } -MetaDataModel* DecoderArchiveFactory::createMetaDataModel(const QString &path, QObject *parent) +MetaDataModel* DecoderArchiveFactory::createMetaDataModel(const QString &path, bool readOnly, QObject *parent) { - return new ArchiveMetaDataModel(path, parent); + Q_UNUSED(path); + Q_UNUSED(readOnly); + Q_UNUSED(parent); + return 0; } void DecoderArchiveFactory::showSettings(QWidget *) diff --git a/src/plugins/Input/archive/decoderarchivefactory.h b/src/plugins/Input/archive/decoderarchivefactory.h index e56b8837f..554186fc6 100644 --- a/src/plugins/Input/archive/decoderarchivefactory.h +++ b/src/plugins/Input/archive/decoderarchivefactory.h @@ -34,7 +34,7 @@ public: DecoderProperties properties() const; Decoder *create(const QString &url, QIODevice *); QList<TrackInfo *> createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *); - MetaDataModel* createMetaDataModel(const QString &path, QObject *parent = 0); + MetaDataModel* createMetaDataModel(const QString &path, bool readOnly = true, QObject *parent = 0); void showSettings(QWidget *parent); void showAbout(QWidget *parent); QString translation() const; |
