| 139 | |
| 140 | |
| 141 | void AutomatableModel::loadSettings( const QDomElement& element, const QString& name ) |
| 142 | { |
| 143 | // compat code |
| 144 | QDomNode node = element.namedItem( AutomationPattern::classNodeName() ); |
| 145 | if( node.isElement() ) |
| 146 | { |
| 147 | node = node.namedItem( name ); |
| 148 | if( node.isElement() ) |
| 149 | { |
| 150 | AutomationPattern * p = AutomationPattern::globalAutomationPattern( this ); |
| 151 | p->loadSettings( node.toElement() ); |
| 152 | setValue( p->valueAt( 0 ) ); |
| 153 | // in older projects we sometimes have odd automations |
| 154 | // with just one value in - eliminate if necessary |
| 155 | if( !p->hasAutomation() ) |
| 156 | { |
| 157 | delete p; |
| 158 | } |
| 159 | return; |
| 160 | } |
| 161 | // logscales were not existing at this point of time |
| 162 | // so they can be ignored |
| 163 | } |
| 164 | |
| 165 | QDomNode connectionNode = element.namedItem( "connection" ); |
| 166 | // reads controller connection |
| 167 | if( connectionNode.isElement() ) |
| 168 | { |
| 169 | QDomNode thisConnection = connectionNode.toElement().namedItem( name ); |
| 170 | if( thisConnection.isElement() ) |
| 171 | { |
| 172 | setControllerConnection( new ControllerConnection( (Controller*)NULL ) ); |
| 173 | m_controllerConnection->loadSettings( thisConnection.toElement() ); |
| 174 | //m_controllerConnection->setTargetName( displayName() ); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // models can be stored as elements (port00) or attributes (port10): |
| 179 | // <ladspacontrols port10="4.41"> |
| 180 | // <port00 value="4.41" id="4249278"/> |
| 181 | // </ladspacontrols> |
| 182 | // element => there is automation data, or scaletype information |
| 183 | node = element.namedItem( name ); |
| 184 | if( node.isElement() ) |
| 185 | { |
| 186 | changeID( node.toElement().attribute( "id" ).toInt() ); |
| 187 | setValue( LocaleHelper::toFloat( node.toElement().attribute( "value" ) ) ); |
| 188 | if( node.toElement().hasAttribute( "scale_type" ) ) |
| 189 | { |
| 190 | if( node.toElement().attribute( "scale_type" ) == "linear" ) |
| 191 | { |
| 192 | setScaleType( Linear ); |
| 193 | } |
| 194 | else if( node.toElement().attribute( "scale_type" ) == "log" ) |
| 195 | { |
| 196 | setScaleType( Logarithmic ); |
| 197 | } |
| 198 | } |
nothing calls this directly
no test coverage detected