#ifndef PQSOUND_H
#define PQSOUND_H

#include <pqobject.h>
#include <QSound>

class PQSound : public QSound
{
    Q_OBJECT
    PQ_OBJECT_EX(QSound)

    Q_PROPERTY(int loops READ loops WRITE setLoops)

public:
    Q_INVOKABLE explicit PQSound(const QString &filename = "", QObject *parent = Q_NULLPTR);
    ~PQSound();

    Q_INVOKABLE QString fileName() const;
    Q_INVOKABLE bool isFinished() const;
    Q_INVOKABLE int loops() const;
    Q_INVOKABLE int loopsRemaining() const;
    Q_INVOKABLE void setLoops(int number);

    Q_INVOKABLE void play(const QString &filename);

public slots:
    Q_INVOKABLE void play();
    Q_INVOKABLE void stop();

    PQ_ON_SIGNAL_DECL_START {
        PQOBJECT_ON_SIGNALS();
    } PQ_ON_SIGNAL_DECL_END
};

#endif // PQSOUND_H
