diff options
| author | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-02-07 13:36:34 +0000 |
|---|---|---|
| committer | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-02-07 13:36:34 +0000 |
| commit | 06d1877811fa6aa97dddc0e03bcde4e766928c87 (patch) | |
| tree | c25462d0e58c3d58c728664440412bf4f16a49ec /src/plugins/Input/mpc/decodermpcfactory.cpp | |
| parent | 3f6b60f23c44a8ba8dd97ca6f41a16e2af7ef2f7 (diff) | |
| download | qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.gz qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.bz2 qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.zip | |
new directory structure
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@232 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mpc/decodermpcfactory.cpp')
| -rw-r--r-- | src/plugins/Input/mpc/decodermpcfactory.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/plugins/Input/mpc/decodermpcfactory.cpp b/src/plugins/Input/mpc/decodermpcfactory.cpp new file mode 100644 index 000000000..f2874a08d --- /dev/null +++ b/src/plugins/Input/mpc/decodermpcfactory.cpp @@ -0,0 +1,95 @@ +#include <QtGui> +#include <taglib/tag.h> +#include <taglib/fileref.h> + +#include "detailsdialog.h" +#include "decoder_mpc.h" +#include "decodermpcfactory.h" + + +// DecoderMPCFactory + +bool DecoderMPCFactory::supports(const QString &source) const +{ + + return (source.right(4).toLower() == ".mpc"); +} + +bool DecoderMPCFactory::canDecode(QIODevice *) const +{ + return FALSE; +} + +const DecoderProperties DecoderMPCFactory::properties() const +{ + DecoderProperties properties; + properties.name = tr("Musepack Plugin"); + properties.filter = "*.mpc"; + properties.description = tr("Musepack Files"); + //properties.contentType = ; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; +} + +Decoder *DecoderMPCFactory::create(QObject *parent, QIODevice *input, + Output *output) +{ + return new DecoderMPC(parent, this, input, output); +} + +FileTag *DecoderMPCFactory::createTag(const QString &source) +{ + FileTag *ftag = new FileTag(); + + TagLib::FileRef fileRef(source.toLocal8Bit ()); + TagLib::Tag *tag = fileRef.tag(); + + if (tag && !tag->isEmpty()) + { + ftag->setValue(FileTag::ALBUM, + QString::fromUtf8(tag->album().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::ARTIST, + QString::fromUtf8(tag->artist().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::COMMENT, + QString::fromUtf8(tag->comment().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::GENRE, + QString::fromUtf8(tag->genre().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::TITLE, + QString::fromUtf8(tag->title().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::YEAR, tag->year()); + ftag->setValue(FileTag::TRACK, tag->track()); + } + + if (fileRef.audioProperties()) + ftag->setValue(FileTag::LENGTH, fileRef.audioProperties()->length()); + + return ftag; +} + +QObject* DecoderMPCFactory::showDetails(QWidget *parent, const QString &path) +{ + DetailsDialog *d = new DetailsDialog(parent, path); + d -> show(); + return d; +} + +void DecoderMPCFactory::showSettings(QWidget *) +{} + +void DecoderMPCFactory::showAbout(QWidget *parent) +{ + QMessageBox::about (parent, tr("About Musepack Audio Plugin"), + tr("Qmmp Musepack Audio Plugin")+"\n"+ + tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")); +} + +QTranslator *DecoderMPCFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = QLocale::system().name(); + translator->load(QString(":/mpc_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN(DecoderMPCFactory) |
