You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
882 B
C++

#include "pushbuttonsound.h"
#include "features/gamefeatures.h"
PushButtonSound::PushButtonSound(const QPixmap &pixmap_off, QGraphicsItem *parent) :
b_on(false),
pix_on(pixmap_off),
pix_off(pixmap_off)
{
setParentItem(parent);
Q_ASSERT(!pixmap_off.isNull());
}
void PushButtonSound::onClick()
{
b_on = !b_on;
emit signalChangeSound(b_on);
}
void PushButtonSound::onConnect(std::unique_ptr<GameFeatures> &game_features)
{
QObject::connect(this, //sender
SIGNAL(signalChangeSound(bool)),
game_features->ptr_sound_player, //receiver
SLOT(setMuteness(bool)));
}
////////////////////////
void PushButtonSound::setPixmapOn(const QPixmap &pixmap_on) noexcept
{
pix_on = pixmap_on;
}
void PushButtonSound::setPixmapOff(const QPixmap &pixmap_off) noexcept
{
pix_off = pixmap_off;
}