72 lines
1.9 KiB
C++
Executable File
72 lines
1.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* VdSetScript
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Astrid Müller, SGAS, 2018-06-18
|
|
*/
|
|
|
|
#include "vd_set_script.h"
|
|
#include "ivd_comm.h"
|
|
#include "ivd_command_done_observer.h"
|
|
#include "logger.h"
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
namespace AvaCommands
|
|
{
|
|
|
|
VdSetScript::VdSetScript(IVdComm *comm, IVdCommandDoneObserver *doneObserver, const QString &scriptName, AvaStreamType typ, int fileSplitting,
|
|
const QVector<AvaScriptEntry> &streams, const QString &exportedDirBaseName, const QString &absolutePath)
|
|
: m_scriptName(scriptName)
|
|
, m_type(typ)
|
|
, m_state(AvaStreamState::NotPossible)
|
|
, m_fileSplitting(fileSplitting)
|
|
, m_streams(streams)
|
|
, m_exportedDirBaseName(exportedDirBaseName)
|
|
, m_absolutePath(absolutePath)
|
|
, m_comm(comm)
|
|
, m_observer(doneObserver)
|
|
{
|
|
Q_ASSERT(comm);
|
|
Q_ASSERT(doneObserver);
|
|
}
|
|
|
|
void VdSetScript::send()
|
|
{
|
|
connect(m_comm, &IVdComm::scriptExportProgress, this, &VdSetScript::onScriptExportProgress);
|
|
connect(m_comm, &IVdComm::scriptStateReceived, this, &VdSetScript::onScriptStateReceived);
|
|
|
|
m_comm->vdSetScript(m_scriptName, m_type, m_fileSplitting, m_streams, m_exportedDirBaseName, m_absolutePath);
|
|
}
|
|
|
|
void VdSetScript::onScriptExportProgress(int progress)
|
|
{
|
|
Q_UNUSED(progress);
|
|
m_observer->alive(this);
|
|
}
|
|
|
|
void VdSetScript::onScriptStateReceived(const QString &scriptName, AvaStreamState state)
|
|
{
|
|
if (m_scriptName != scriptName)
|
|
return;
|
|
DEBUG_LOG(getLogger("ExportScript")) << "onScriptStateReceived: " << m_scriptName << ", " << int(m_state) << " -> " << int(state);
|
|
if (m_state == AvaStreamState::Start && state == AvaStreamState::Stop)
|
|
done();
|
|
if (state == AvaStreamState::NotPossible)
|
|
done();
|
|
m_state = state;
|
|
}
|
|
|
|
void VdSetScript::done()
|
|
{
|
|
m_comm->disconnect(this);
|
|
m_observer->done(this);
|
|
}
|
|
|
|
}
|
|
} // namespace AudioVideoManagement::AvaCommands
|
|
|