コード例 #1
0
void SettingsManager::Save()
{
	DAVA::KeyedArchive* toSave = new DAVA::KeyedArchive();

    DAVA::FastNameMap<SettingsNode>::iterator i;
    DAVA::FastNameMap<SettingsNode>::iterator end = settingsMap.end();
    for(i = settingsMap.begin(); i != end; ++i)
    {
        SettingsNode *node = &i->second;
        DAVA::String name = i->first.c_str();

        toSave->SetVariant(name, node->value);
    }

	toSave->Save(SETTINGS_CONFIG_FILE);
    toSave->Release();
}
コード例 #2
0
void QtPropertyDataDavaVariant::MeSetFromChilds(const QString &lastChangedChildKey, QtPropertyData *lastChangedChildData)
{
	switch(curVariantValue.type)
	{
	case DAVA::VariantType::TYPE_KEYED_ARCHIVE:
		{
			QtPropertyDataDavaVariant *childVariantData = (QtPropertyDataDavaVariant *) lastChangedChildData;
			DAVA::KeyedArchive *archive = curVariantValue.AsKeyedArchive();

			if(NULL != archive && NULL != childVariantData)
			{
				archive->SetVariant(lastChangedChildKey.toStdString(), childVariantData->curVariantValue);
			}
		}
		break;
	case DAVA::VariantType::TYPE_MATRIX2:
		break;
	case DAVA::VariantType::TYPE_MATRIX3:
		break;
	case DAVA::VariantType::TYPE_MATRIX4:
		break;
	case DAVA::VariantType::TYPE_VECTOR2:
		{
			DAVA::Vector2 vec;
			vec.x = ChildGet("X")->GetValue().toFloat();
			vec.y = ChildGet("Y")->GetValue().toFloat();
			curVariantValue.SetVector2(vec);
		}
		break;
	case DAVA::VariantType::TYPE_VECTOR3:
		{
			DAVA::Vector3 vec;
			vec.x = ChildGet("X")->GetValue().toFloat();
			vec.y = ChildGet("Y")->GetValue().toFloat();
			vec.z = ChildGet("Z")->GetValue().toFloat();
			curVariantValue.SetVector3(vec);
		}
		break;
	case DAVA::VariantType::TYPE_VECTOR4:
		{
			DAVA::Vector4 vec;
			vec.x = ChildGet("X")->GetValue().toFloat();
			vec.y = ChildGet("Y")->GetValue().toFloat();
			vec.z = ChildGet("Z")->GetValue().toFloat();
			vec.w = ChildGet("W")->GetValue().toFloat();
			curVariantValue.SetVector4(vec);
		}
		break;
    case DAVA::VariantType::TYPE_COLOR:
		{
//			DAVA::Color color;
//			color.r = ChildGet("R")->GetValue().toFloat();
//			color.g = ChildGet("G")->GetValue().toFloat();
//			color.b = ChildGet("B")->GetValue().toFloat();
//			color.a = ChildGet("A")->GetValue().toFloat();
//			curVariantValue.SetColor(color);
		}
        break;
        case DAVA::VariantType::TYPE_AABBOX3:
        {
            DAVA::AABBox3 box;
            
            QtPropertyData* min = ChildGet("min");
            box.min.x = min->ChildGet("X")->GetValue().toFloat();
            box.min.y = min->ChildGet("Y")->GetValue().toFloat();
            box.min.z = min->ChildGet("Z")->GetValue().toFloat();
            
            QtPropertyData* max = ChildGet("max");
            box.max.x = max->ChildGet("X")->GetValue().toFloat();
            box.max.y = max->ChildGet("Y")->GetValue().toFloat();
            box.max.z = max->ChildGet("Z")->GetValue().toFloat();
            
            curVariantValue.SetAABBox3(box);
        }
            break;
	}
}