Ejemplo n.º 1
0
void Collection::start(MasterTimer* timer)
{
	Q_ASSERT(timer != NULL);

	Doc* doc = qobject_cast <Doc*> (parent());
	Q_ASSERT(doc != NULL);

	m_childCount = 0;

	QListIterator <t_function_id> it(m_steps);
	while (it.hasNext() == true)
	{
		Function* function;
		function = doc->function(it.next());
		Q_ASSERT(function != NULL);

		m_childCountMutex.lock();
		m_childCount++;
		m_childCountMutex.unlock();

		connect(function, SIGNAL(stopped(t_function_id)),
			this, SLOT(slotChildStopped(t_function_id)));

		function->start(timer);
	}

	Function::start(timer);
}
Ejemplo n.º 2
0
void Collection::slotChildStopped(quint32 fid)
{
    Doc* doc = qobject_cast <Doc*> (parent());
    Q_ASSERT(doc != NULL);

    Function* function = doc->function(fid);
    disconnect(function, SIGNAL(stopped(quint32)),
               this, SLOT(slotChildStopped(quint32)));

    QMutexLocker locker(&m_functionListMutex);
    m_runningChildren.remove(fid);
}
Ejemplo n.º 3
0
void Collection::slotChildStopped(t_function_id fid)
{
	Doc* doc = qobject_cast <Doc*> (parent());
	Q_ASSERT(doc != NULL);

	Function* function;
	function = doc->function(fid);
	Q_ASSERT(function != NULL);

	disconnect(function, SIGNAL(stopped(t_function_id)),
		   this, SLOT(slotChildStopped(t_function_id)));

	m_childCountMutex.lock();
	m_childCount--;
	m_childCountMutex.unlock();
}
Ejemplo n.º 4
0
void Collection::write(MasterTimer* timer, QList<Universe *> universes)
{
    Q_UNUSED(universes);

    if (elapsed() == 0)
    {
        Doc* doc = qobject_cast <Doc*> (parent());
        Q_ASSERT(doc != NULL);

        QMutexLocker locker(&m_functionListMutex);
        QListIterator <quint32> it(m_functions);
        while (it.hasNext() == true)
        {
            Function* function = doc->function(it.next());
            Q_ASSERT(function != NULL);

            // Append the IDs of all functions started by this collection
            // to a set so that we can track which of them are still controlled
            // by this collection which are not.
            m_runningChildren << function->id();

            // Listen to the children's stopped signals so that this collection
            // can give up its rights to stop the function later.
            connect(function, SIGNAL(stopped(quint32)),
                    this, SLOT(slotChildStopped(quint32)));

            function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity);
            function->start(timer, true, 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration());
        }
    }

    incrementElapsed();

    {
        QMutexLocker locker(&m_functionListMutex);
        if (m_runningChildren.size() > 0)
          return;
    }

    stop();
}