ActionComboBoxWidget::ActionComboBoxWidget(QWidget *parent) : ComboBoxWidget(parent),
	m_filterLineEditWidget(nullptr),
	m_model(new QStandardItemModel(this)),
	m_wasPopupVisible(false)
{
	setEditable(true);

	lineEdit()->hide();

	getView()->viewport()->parentWidget()->installEventFilter(this);

	const QVector<ActionsManager::ActionDefinition> definitions(ActionsManager::getActionDefinitions());

	for (int i = 0; i < definitions.count(); ++i)
	{
		if (!definitions.at(i).flags.testFlag(ActionsManager::ActionDefinition::IsDeprecatedFlag) && !definitions.at(i).flags.testFlag(ActionsManager::ActionDefinition::RequiresParameters))
		{
			addDefinition(definitions.at(i));
		}
	}

	m_model->setSortRole(IdentifierRole);

	setModel(m_model);
	setCurrentIndex(-1);
}
Пример #2
0
FogShaderProgram::FogShaderProgram(bool useAlphaBlend) :
    EffectShaderProgram(AUTO_LOGGER)
{
    addShader("Data/Shaders/PostProcess/fog.vert");
    addShader("Data/Shaders/PostProcess/fog.frag");
    addShader("Data/Shaders/depth.frag");
    if (useAlphaBlend) {
        addDefinition("#define USE_ALPHA_BLEND");
    }
    constructProgram();
}
Пример #3
0
void LLRNGWriter::writeRNG(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace)
{
	mGrammarNode = node;
	mGrammarNode->setName("grammar");
	mGrammarNode->createChild("xmlns", true)->setStringValue("http://relaxng.org/ns/structure/1.0");
	mGrammarNode->createChild("datatypeLibrary", true)->setStringValue("http://www.w3.org/2001/XMLSchema-datatypes");
	mGrammarNode->createChild("ns", true)->setStringValue(xml_namespace);

	node = mGrammarNode->createChild("start", false);
	node = node->createChild("ref", false);
	node->createChild("name", true)->setStringValue(type_name);

	addDefinition(type_name, block);
}
void ActionComboBoxWidget::setActionIdentifier(int action)
{
	const int index(findData(action));

	if (index >= 0)
	{
		setCurrentIndex(index);
	}
	else
	{
		const ActionsManager::ActionDefinition definition(ActionsManager::getActionDefinition(action));

		if (definition.isValid())
		{
			addDefinition(definition);
			setCurrentIndex(count() - 1);

			m_model->sort(0);
		}
	}
}
Пример #5
0
 foreach (QVariant v, definitionMaps) {
     addDefinition(v.toMap());
 }
Пример #6
0
    void JsonSchema::readJson()
    {
        if (! m_cjson)
            return;

        cJSON *jsonId = cJSON_GetObjectItem(m_cjson, "id");
        if (jsonId)
        {
            m_id = jsonId->valuestring;
        }
        cJSON *jsonSchema = cJSON_GetObjectItem(m_cjson, "$schema");
        if (jsonSchema)
        {
            m_schema = jsonSchema->valuestring;
        }
        cJSON *jsonTitle = cJSON_GetObjectItem(m_cjson, "title");
        if (jsonTitle)
        {
            m_title = jsonTitle->valuestring;
        }
        cJSON *jsonType = cJSON_GetObjectItem(m_cjson, "type");
        if (jsonType)
        {
            m_type = jsonType->valuestring;
        }
        cJSON *jsonDescription = cJSON_GetObjectItem(m_cjson, "description");
        if (jsonDescription)
        {
            m_description = jsonDescription->valuestring;
        }
        cJSON *jsonDefinitions = cJSON_GetObjectItem(m_cjson, "definitions");
        if (jsonDefinitions)
        {
            cJSON *childDefinitions = jsonDefinitions->child;
            while (childDefinitions)
            {
                std::string defName = childDefinitions->string;
                addDefinition(defName, readDef(childDefinitions, defName));
                childDefinitions = childDefinitions->next;
            }
        }
        cJSON *jsonProperties = cJSON_GetObjectItem(m_cjson, "properties");
        if (jsonProperties)
        {
            cJSON *childProperties = jsonProperties->child;
            while (childProperties)
            {
                std::string attName = childProperties->string;
                addProperty(attName, readProp(childProperties, attName));
                childProperties = childProperties->next;
            }
        }
        if (m_type == "array")
        {
            cJSON *jsonItems = cJSON_GetObjectItem(m_cjson, "items");
            if (jsonItems)
            {
                if (jsonItems->type == 5)
                {
                    int item_size = cJSON_GetArraySize(jsonItems);
                    int item_index = 0;
                    do
                    {
                        cJSON *item = cJSON_GetArrayItem(jsonItems, item_index);
                        setItem(readItems(item));
                    }
                    while ( ++item_index < item_size);
                }
                else
                {
                    setItem(readItems(jsonItems));
                }
            }
        }
        cJSON *jsonAdditionalProperties = cJSON_GetObjectItem(m_cjson, "additionalProperties");
        if (jsonAdditionalProperties)
            m_additionalProperties = jsonAdditionalProperties->type;
        else
            m_additionalProperties = cJSON_True;

        cJSON *jsonReference = cJSON_GetObjectItem(m_cjson, "$ref");
        if (jsonReference)
        {
            readJsonRef(jsonReference);
        }
        cJSON *jsonAllOf = cJSON_GetObjectItem(m_cjson, "allOf");
        if (jsonAllOf)
        {
            readAllOf(jsonAllOf);
        }
        cJSON *jsonRequiredValues = cJSON_GetObjectItem(m_cjson, "required");
        if (jsonRequiredValues)
        {
            int size = cJSON_GetArraySize(jsonRequiredValues);
            int index = 0;
            do
            {
                setRequiredValue(cJSON_GetArrayItem(jsonRequiredValues, index)->valuestring);
            }
            while ( ++index < size);
        }
    }