Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetVolume
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-02-28
|
||||
*/
|
||||
|
||||
#include "set_volume.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetVolume::SetVolume(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, AvaVolume db)
|
||||
: m_db(db)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void SetVolume::send()
|
||||
{
|
||||
QObject::connect(m_comm, &IAvaComm::ok, this, &SetVolume::onOk);
|
||||
QObject::connect(m_comm, &IAvaComm::volumeReceived, this, &SetVolume::onVolumeReceived);
|
||||
|
||||
m_comm->setVolume(m_db);
|
||||
}
|
||||
|
||||
bool SetVolume::nullifies(ICommand *other) const
|
||||
{
|
||||
Q_ASSERT(other);
|
||||
SetVolume *other_ = dynamic_cast<SetVolume*>(other);
|
||||
if (!other_)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetVolume::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void SetVolume::onVolumeReceived(AvaVolume db)
|
||||
{
|
||||
Q_UNUSED(db);
|
||||
|
||||
if (!m_ok)
|
||||
return;
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
void SetVolume::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
Reference in new issue
Block a user