Esempio n. 1
0
void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, const QString& name )
{
	bool automatedOrControlled = false;

	if( isAutomated() )
	{
		// automation needs tuple of data (name, id, value)
		// => it must be appended as a node
		QDomElement me = doc.createElement( name );
		me.setAttribute( "id", id() );
		me.setAttribute( "value", m_value );
		element.appendChild( me );

		automatedOrControlled = true;
	}
	else
	{
		// non automation => can be saved as attribute
		element.setAttribute( name, m_value );
	}

	if( m_controllerConnection )
	{
		QDomElement controllerElement;

		// get "connection" element (and create it if needed)
		QDomNode node = element.namedItem( "connection" );
		if( node.isElement() )
		{
			controllerElement = node.toElement();
		}
		else
		{
			controllerElement = doc.createElement( "connection" );
			element.appendChild( controllerElement );
		}

		QDomElement element = doc.createElement( name );
		m_controllerConnection->saveSettings( doc, element );

		controllerElement.appendChild( element );

		automatedOrControlled = true;
	}

	if( automatedOrControlled && ( m_scaleType != Linear ) )
	{	// note: if we have more scale types than two, make
		// a mapper function enums <-> string
		if(m_scaleType == Logarithmic) {
			element.setAttribute( "scale_type", "log" );
		}
	}
}
Esempio n. 2
0
void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, const QString& name )
{
	if( isAutomated() || m_scaleType != Linear )
	{
		// automation needs tuple of data (name, id, value)
		// scale type also needs an extra value
		// => it must be appended as a node
		QDomElement me = doc.createElement( name );
		me.setAttribute( "id", ProjectJournal::idToSave( id() ) );
		me.setAttribute( "value", m_value );
		me.setAttribute( "scale_type", m_scaleType == Logarithmic ? "log" : "linear" );
		element.appendChild( me );
	}
	else
	{
		// non automation, linear scale (default), can be saved as attribute
		element.setAttribute( name, m_value );
	}

	if( m_controllerConnection && m_controllerConnection->getController()->type()
				!= Controller::DummyController )
	{
		QDomElement controllerElement;

		// get "connection" element (and create it if needed)
		QDomNode node = element.namedItem( "connection" );
		if( node.isElement() )
		{
			controllerElement = node.toElement();
		}
		else
		{
			controllerElement = doc.createElement( "connection" );
			element.appendChild( controllerElement );
		}

		QDomElement element = doc.createElement( name );
		m_controllerConnection->saveSettings( doc, element );

		controllerElement.appendChild( element );
	}
}
bool CvSelectionGroupAI::AI_isControlled()
{
	return (!isHuman() || isAutomated());
}