#ifndef EAUDIO_H
#define EAUDIO_H

#include "ebase.h"
#include "pagelistitem.h"

class EAudio : public EBase {
    Q_OBJECT
public:
    static QString filters() { return tr("Audio")+"(*.mp3 *.wav *.wma *.flac *.ape *.amr *.aac *.ac3 *.mka *.m4a *.ogg)"; }
    static EAudio *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
    static EAudio *create(const QJsonObject &, PageListItem *pageItem, EBase *multiWin = nullptr);
    static QJsonObject genProg(const QJsonObject &, const QString &);

    explicit EAudio(const QString &dir, const QString &name, int dur, PageListItem *pageItem, EBase *multiWin = nullptr);
    virtual int type() const override { return EBase::Gif; }
    void paint(QPainter*, const QStyleOptionGraphicsItem *, QWidget *) override;
    QWidget* attrWgt() override;
    bool save(const QString &pRoot) override;
    QJsonObject attrJson() const override;

    QString mDir;
    QString mName;
protected:
    int mDuration = 10;
    PageListItem *mPageItem;
};

#endif // EAUDIO_H
