25 lines
682 B
C++
25 lines
682 B
C++
|
#include "qw_playsoundevent.h"
|
||
|
|
||
|
QWPlaySoundEvent::QWPlaySoundEvent(const QString &path) :
|
||
|
media_sound(new QMediaContent(QUrl("qrc:/res/" + path + ".wav")))
|
||
|
{
|
||
|
Q_ASSERT(!media_sound->isNull());
|
||
|
}
|
||
|
|
||
|
void QWPlaySoundEvent::execute()
|
||
|
{
|
||
|
ptr_soundplayer->playSound(media_sound);
|
||
|
}
|
||
|
|
||
|
////////////////////////
|
||
|
|
||
|
void QWPlaySoundEvent::writeToJson(QJsonObject &event_data)
|
||
|
{
|
||
|
event_data.insert("id", tag());
|
||
|
event_data.insert("type", EVENT_TYPE::PLAY_SOUND);
|
||
|
//event_data.insert("sound", media_sound->canonicalUrl().toString());
|
||
|
|
||
|
//qDebug() << " The play_sound event:\n" << " id " << tag()
|
||
|
//<< "\n sound " << media_sound->canonicalUrl().toString();
|
||
|
}
|