Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void FlowCodeDocument::varNameChanged ( const QString &  newValue,
const QString &  oldValue 
) [slot]

Called when a variable name has changed (from an entry box)

Definition at line 259 of file flowcodedocument.cpp.

References MicroSettings::deleteVariable(), microSettings(), MicroSettings::setVariable(), and MicroSettings::variableInfo().

{
      if (m_bDeleted) return;
      
      // Decrease the old variable count
      // If none are left after, remove it from microsettings
      StringIntMap::iterator it = m_varNames.find(oldValue);
      if ( it != m_varNames.end() ) {
            --(it.data());
            if ( it.data() <= 0 ) {
                  VariableInfo *info = microSettings()->variableInfo(it.key());
                  if ( info && !info->permanent ) microSettings()->deleteVariable(oldValue);
                  m_varNames.erase(it);
            }
      }
      
      // Add the new variable to a count, tell microsettings about it if it is new
      if ( !newValue.isEmpty() ) {
            it = m_varNames.find(newValue);
            if ( it != m_varNames.end() ) {
                  ++it.data();
            } else {
                  m_varNames[newValue] = 1;
                  microSettings()->setVariable( newValue, QVariant(), false );
            }
      }
      
      // Tell all FlowParts to update their variable lists
      const ItemMap::iterator end = m_itemList.end();
      for ( ItemMap::iterator it = m_itemList.begin(); it != end; ++it )
      {
            if ( FlowPart *flowPart = dynamic_cast<FlowPart*>(*it) ) 
                  flowPart->updateVarNames();
      }
}


Generated by  Doxygen 1.6.0   Back to index