#ifndef EAUDIO_H
#define EAUDIO_H

#include <QListWidget>
#include "eobject.h"

class eAudio : public eObject
{
    Q_OBJECT
public:
    struct Data {
        QStringList eList;
        QString          strCur;
        int              index;
        eAudio          *self;
    };

public:
    explicit eAudio(QRectF rectInit,InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
    explicit eAudio(const QJsonObject &json, const QString pRoot, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
    virtual ~eAudio() override;

//public:
//    static void setElement(const QJsonObject &json, Data &attr);

public:
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;

public:
    virtual int type() const override { return eObject::Window; }
    virtual QWidget* wAttr() override;
    virtual QWidget* wAttrElement() override;
    virtual QJsonObject save(const QString &pRoot) override;
    virtual QStringList filesList() const override;
    virtual QJsonObject elementJson() const override;

protected:
    void restoreElement(const QJsonObject &json, const QString &pRoot);

signals:

public slots:
    virtual void playElectment() override;
    virtual void stopElectment() override;

private:
    Data m_attr;
    QString m_strCurMp3Name="Add mp3 on the right";
};

#endif // EAUDIO_H
