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