예제 #1
0
const string SimulationConfiguration::Implementation::getSimulationType() const {
	string retval = "(none)";
	if (findChoice("Simulation") != 0) {
		const ConfigurationChoice *type = findChoice("Simulation");
		if (type != 0) {
			retval = stringToUpper(type->getStringValue());
		}
	}
	return retval;
}
예제 #2
0
void DrListOption::setValueText(const QString &s)
{
    m_current = findChoice(s);
    if(!m_current)
    {
        bool ok;
        int index = s.toInt(&ok);
        if(ok)
            setChoice(index);
    }
}
예제 #3
0
double
ConfigurationScope::getDoubleValue( const string &choiceName ) const {
  const ConfigurationChoice *choice = findChoice( choiceName );
  if( choice != 0 ){
    const ConfigurationValue *value = choice->getConfigurationValue();
    if( value->getType() == ConfigurationValue::DOUBLE ){
      return dynamic_cast<const DoubleConfigurationValue *>(value)->getDoubleValue();
    }
  }
  return -1;
}
예제 #4
0
//-----------------------------------------------------------------------------
// Function: ParameterDelegate::setEditorData()
//-----------------------------------------------------------------------------
void ParameterDelegate::setEditorData(QWidget* editor, QModelIndex const& index) const 
{
    if (index.column() == valueColumn() && valueIsArray(index))
    {
        ArrayView* view = dynamic_cast<ArrayView*>(dynamic_cast<QScrollArea*>(editor)->widget());

        QModelIndex arrayLeftIndex = index.sibling(index.row(), arrayLeftColumn());
        int arrayLeftValue = arrayLeftIndex.data(Qt::ToolTipRole).toInt();

        QModelIndex arrayRightIndex = index.sibling(index.row(), arrayRightColumn());
        int arrayRightValue = arrayRightIndex.data(Qt::ToolTipRole).toInt();

        int arraySize = getArraySize(arrayLeftValue, arrayRightValue);

        int arrayStartIndex = arrayLeftValue;
        if (arrayRightValue < arrayLeftValue)
        {
            arrayStartIndex = arrayRightValue;
        }

        QSharedPointer<IPXactSystemVerilogParser> expressionParser(new IPXactSystemVerilogParser(
            getParameterFinder()));

        QSharedPointer<Choice> selectedChoice = findChoice(index);

        ParameterArrayModel* model = new ParameterArrayModel(arraySize, expressionParser, getParameterFinder(),
            expressionFormatter_, selectedChoice, QColor("LemonChiffon"), arrayStartIndex, view);

        QModelIndex valueIndex = index.sibling(index.row(), valueColumn());
        QString parameterValue = valueIndex.data(Qt::EditRole).toString();
        model->setArrayData(parameterValue);

        QModelIndex typeIndex = index.sibling(index.row(), formatColumn());
        QString parameterType = typeIndex.data(Qt::EditRole).toString();
        model->setParameterType(parameterType);

        view->setItemDelegate(new ArrayDelegate(getNameCompleter(), getParameterFinder(), selectedChoice,
            this->parent()));

        view->setModel(model);
        view->setSortingEnabled(false);
        view->resizeColumnsToContents();

        connect(model, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
        connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
            this, SIGNAL(contentChanged()), Qt::UniqueConnection);

        connect(view->itemDelegate(), SIGNAL(increaseReferences(QString)),
            this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
        connect(view->itemDelegate(), SIGNAL(decreaseReferences(QString)),
            this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
    }
예제 #5
0
const string
ConfigurationScope::getStringValue( const string &choiceName ) const {
  string retval("");

  const ConfigurationChoice *choice = findChoice( choiceName );
  if( choice != 0 ){
    const ConfigurationValue *value = choice->getConfigurationValue();
    if( value->getType() == ConfigurationValue::STRING ){
      const StringConfigurationValue *asString = 
	static_cast<const StringConfigurationValue *>(value);
      retval = asString->getStringValue();
    }
  }
  return retval;
}
예제 #6
0
//-----------------------------------------------------------------------------
// Function: AbstractParameterModel::evaluateValueFor()
//-----------------------------------------------------------------------------
QString AbstractParameterModel::evaluateValueFor(QSharedPointer<Parameter> parameter) const
{
    if (!parameter->getChoiceRef().isEmpty())
    {
        QSharedPointer<Choice> choice = findChoice(parameter->getChoiceRef());

        if(parameter->getValue().contains('{') && parameter->getValue().contains('}'))
        {
            return matchArrayValuesToSelectedChoice(choice, parameter->getValue());
        }

        else
        {
            return findDisplayValueForEnumeration(choice, parameter->getValue());
        }
    }
    else
    {
        return parameter->getValue();
    }
}