Exemple #1
0
PropertyBrowser::PropertyBrowser(GraphModel *model, GraphScene *scene, QWidget *parent) :
    QtTreePropertyBrowser(parent),
    m_currentId(-1),
    m_model(model),
    m_scene(scene)
{
    m_doubleManager = new QtDoublePropertyManager(this);
    m_stringManager = new QtStringPropertyManager(this);
    m_colorManager = new QtColorPropertyManager(this);
    m_intManager = new QtIntPropertyManager(this);
    m_sizeManager = new QtSizePropertyManager(this);

    connect(m_intManager, SIGNAL(valueChanged(QtProperty *, const int &)),
            this, SLOT(valueChanged(QtProperty *, const int &)));
    connect(m_doubleManager, SIGNAL(valueChanged(QtProperty *, const double &)),
            this, SLOT(valueChanged(QtProperty *, const double &)));
    connect(m_stringManager, SIGNAL(valueChanged(QtProperty *, const QString &)),
            this, SLOT(valueChanged(QtProperty *, const QString &)));
    connect(m_colorManager, SIGNAL(valueChanged(QtProperty *, const QColor &)),
            this, SLOT(valueChanged(QtProperty *, const QColor &)));
    connect(m_sizeManager, SIGNAL(valueChanged(QtProperty *, const QSize &)),
            this, SLOT(valueChanged(QtProperty *, const QSize &)));

    QtDoubleSpinBoxFactory *doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
    QtSpinBoxFactory *spinBoxFactory = new QtSpinBoxFactory(this);
    QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this);

    setFactoryForManager(m_doubleManager, doubleSpinBoxFactory);
    setFactoryForManager(m_stringManager, lineEditFactory);
    setFactoryForManager(m_colorManager->subIntPropertyManager(), spinBoxFactory);
    setFactoryForManager(m_intManager, spinBoxFactory);
    setFactoryForManager(m_sizeManager->subIntPropertyManager(), spinBoxFactory);
}
TreePropertyWidget::TreePropertyWidget(TreeLeftSideInfo* _info, QWidget *_parent)
    : QtTreePropertyBrowser(_parent),
      m_leftSide(_info),
      m_normalised(false),
      m_precision(2),
      m_variantManager(new QtVariantPropertyManager())
{
    QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory();
    setFactoryForManager(m_variantManager, variantFactory);
    setPropertiesWithoutValueMarked(true);
    setRootIsDecorated(false);

    fillLeftSide();
}
Exemple #3
0
TextureProperties::TextureProperties(QWidget *parent /* = 0 */)
	: QtGroupBoxPropertyBrowser(parent)//QtTreePropertyBrowser(parent)
	, curTexture(NULL)
	, curTextureDescriptor(NULL)
	, reactOnPropertyChange(true)
	, texturePropertiesChanged(false)
{
	// initialize list with string for different comboboxs
	{
		helperPVRFormats.push_back("None", DAVA::FORMAT_INVALID);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA8888), DAVA::FORMAT_RGBA8888);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA5551), DAVA::FORMAT_RGBA5551);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA4444), DAVA::FORMAT_RGBA4444);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGB565), DAVA::FORMAT_RGB565);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_A8), DAVA::FORMAT_A8);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_PVR4), DAVA::FORMAT_PVR4);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_PVR2), DAVA::FORMAT_PVR2);
		helperPVRFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_ETC1), DAVA::FORMAT_ETC1);


		helperDXTFormats.push_back("None", DAVA::FORMAT_INVALID);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA8888), DAVA::FORMAT_RGBA8888);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT1), DAVA::FORMAT_DXT1);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT1NM), DAVA::FORMAT_DXT1NM);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT1A), DAVA::FORMAT_DXT1A);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT3), DAVA::FORMAT_DXT3);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT5), DAVA::FORMAT_DXT5);
		helperDXTFormats.push_back(DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_DXT5NM), DAVA::FORMAT_DXT5NM);

		helperWrapModes.push_back("Clamp", DAVA::Texture::WRAP_CLAMP_TO_EDGE);
		helperWrapModes.push_back("Repeat", DAVA::Texture::WRAP_REPEAT);

		helperMinGLModes.push_back("Nearest", DAVA::Texture::FILTER_NEAREST);
		helperMinGLModes.push_back("Linear", DAVA::Texture::FILTER_LINEAR);

		helperMinGLModesWithMipmap.push_back("Nearest", DAVA::Texture::FILTER_NEAREST);
		helperMinGLModesWithMipmap.push_back("Linear", DAVA::Texture::FILTER_LINEAR);
		helperMinGLModesWithMipmap.push_back("Nearest, Mipmap Nearest", DAVA::Texture::FILTER_NEAREST_MIPMAP_NEAREST);
		helperMinGLModesWithMipmap.push_back("Linear, Mipmap Nearest", DAVA::Texture::FILTER_LINEAR_MIPMAP_NEAREST);
		helperMinGLModesWithMipmap.push_back("Nearest, Mipmap Linear", DAVA::Texture::FILTER_NEAREST_MIPMAP_LINEAR);
		helperMinGLModesWithMipmap.push_back("Linear, Mipmap Linear", DAVA::Texture::FILTER_LINEAR_MIPMAP_LINEAR);

		helperMagGLModes.push_back("Nearest", DAVA::Texture::FILTER_NEAREST);
		helperMagGLModes.push_back("Linear", DAVA::Texture::FILTER_LINEAR);
	}

	// parent widget
	oneForAllParent = new QWidget();

	// property managers
	propertiesGroup = new QtGroupPropertyManager(oneForAllParent);
	propertiesInt = new QtIntPropertyManager(oneForAllParent);
	propertiesBool = new QtBoolPropertyManager(oneForAllParent);
	propertiesEnum = new QtEnumPropertyManager(oneForAllParent);
	propertiesString = new QtStringPropertyManager(oneForAllParent);

	// property editors
	editorInt = new QtSpinBoxFactory(oneForAllParent);
	editorBool = new QtCheckBoxFactory(oneForAllParent);
	editorString = new QtLineEditFactory(oneForAllParent);
	editorEnum = new QtEnumEditorFactory(oneForAllParent);

	// setup property managers with appropriate property editors
	setFactoryForManager(propertiesInt, editorInt);
	setFactoryForManager(propertiesBool, editorBool);
	setFactoryForManager(propertiesEnum, editorEnum);
	setFactoryForManager(propertiesString, editorString);

	// Adding properties

	// groups
	QtProperty* groupPVR = propertiesGroup->addProperty("PVR");
	QtProperty* groupDXT = propertiesGroup->addProperty("DXT");
	QtProperty* groupCommon = propertiesGroup->addProperty("Common");

	// PVR group
	enumPVRFormat = propertiesEnum->addProperty("Format");
	propertiesEnum->setEnumNames(enumPVRFormat, helperPVRFormats.keyList());

	enumBasePVRMipmapLevel = propertiesEnum->addProperty("Base Mipmap level");

	groupPVR->addSubProperty(enumPVRFormat);
	groupPVR->addSubProperty(enumBasePVRMipmapLevel);
	addProperty(groupPVR);

	// DXT group
	enumDXTFormat = propertiesEnum->addProperty("Format");
	propertiesEnum->setEnumNames(enumDXTFormat, helperDXTFormats.keyList());

	enumBaseDXTMipmapLevel = propertiesEnum->addProperty("Base Mipmap level");

	groupDXT->addSubProperty(enumDXTFormat);
	groupDXT->addSubProperty(enumBaseDXTMipmapLevel);
	addProperty(groupDXT);

	// Common group

	// Mip maps
	boolGenerateMipMaps = propertiesBool->addProperty("Generate MipMaps");
	groupCommon->addSubProperty(boolGenerateMipMaps);

	// wrapmode t
	enumWrapModeS = propertiesEnum->addProperty("Wrap mode S");
	propertiesEnum->setEnumNames(enumWrapModeS, helperWrapModes.keyList());
	groupCommon->addSubProperty(enumWrapModeS);

	// wrapmode s
	enumWrapModeT = propertiesEnum->addProperty("Wrap mode T");
	propertiesEnum->setEnumNames(enumWrapModeT, helperWrapModes.keyList());
	groupCommon->addSubProperty(enumWrapModeT);

	// min OpenGL filter
	enumMinGL = propertiesEnum->addProperty("Min Filter");
	propertiesEnum->setEnumNames(enumMinGL, helperMinGLModes.keyList());
	groupCommon->addSubProperty(enumMinGL);

	// mag OpenGl filter
	enumMagGL = propertiesEnum->addProperty("Mag Filter");
	propertiesEnum->setEnumNames(enumMagGL, helperMagGLModes.keyList());
	groupCommon->addSubProperty(enumMagGL);

	addProperty(groupCommon);

	QObject::connect(propertiesEnum, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
	QObject::connect(propertiesInt, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
	QObject::connect(propertiesBool, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
	QObject::connect(propertiesString, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *)));
}
void CPropBrowserEngineGeneral::show(QWidget* parentWindow)
{
	setPropertiesWithoutValueMarked(true); // so that group properties stand out
	setRootIsDecorated(true); // keep true, otherwise subcategories won't work correctly
	setAlternatingRowColors(true);
	setHeaderVisible(true);
	//setIndentation(60);
	//setStatusTip("bla");
	//setToolTip("Bla");
	setResizeMode(QtTreePropertyBrowser::Interactive);
	setSplitterPosition(_splitterPos);
	setWindowTitle("Physics Engines Properties - General");


	variantManager = new QtVariantPropertyManager();
	variantFactory = new QtVariantEditorFactory();
	setFactoryForManager(variantManager,variantFactory);


	buttonManager = new ButtonEditManager();
	buttonFactory  = new PushButtonEditFactory();
	setFactoryForManager(buttonManager,buttonFactory);


	QStringList configurationEnum;
	configurationEnum << "Very accurate" << "Accurate (default)" << "Fast" << "Very fast" << "Customized";
	p_configuration = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),"");
	p_configuration->setAttribute("enumNames", configurationEnum);
	QtBrowserItem* anItem=addProperty(p_configuration);
	setBackgroundColor(anItem,QTPROPERTYBROWSER_COLOR_GREY);


	QtProperty *bulletGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Bullet properties");
	bulletGroup->theBrightness=140;
	bulletGroupItem=addProperty(bulletGroup);
	setBackgroundColor(bulletGroupItem,QTPROPERTYBROWSER_COLOR_RED);
	setExpanded(bulletGroupItem,_bulletPropertiesExpanded);

	QtProperty *odeGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"ODE properties");
	odeGroup->theBrightness=140;
	odeGroupItem=addProperty(odeGroup);
	setBackgroundColor(odeGroupItem,QTPROPERTYBROWSER_COLOR_GREEN);
	setExpanded(odeGroupItem,_odePropertiesExpanded);

	QtProperty *vortexGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Vortex properties");
	vortexGroup->theBrightness=140;
	vortexGroupItem=addProperty(vortexGroup);
	setBackgroundColor(vortexGroupItem,QTPROPERTYBROWSER_COLOR_BLUE);
	setExpanded(vortexGroupItem,_vortexPropertiesExpanded);

	// Bullet:
	p_bulletTimeStep = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletTimeStep);
	p_bulletConstraintSolvIterat = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletConstraintSolvIterat);
	p_bulletInternalScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletInternalScaling);
	p_bulletInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	bulletGroup->addSubProperty(p_bulletInternalFullScaling);
	p_bulletCollMarginScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletCollMarginScaling);

	// ODE:
	p_odeTimeStep = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeTimeStep);
	p_odeQuickStep = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeQuickStep);
	p_odeIterations = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeIterations);
	p_odeInternalScaling = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeInternalScaling);
	p_odeInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeInternalFullScaling);
	p_odeGlobalErp = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalErp);
	p_odeGlobalCfm = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalCfm);

	// Vortex:
	p_vortexTimeStep = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexTimeStep);
	p_vortexContactTolerance = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexContactTolerance);
	p_vortexInternalScaling = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexInternalScaling);
	p_vortexInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexInternalFullScaling);
	p_vortexAutoSleep = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexAutoSleep);
	p_vortexMultithreading = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexMultithreading);

	QtProperty* vortexConstraint = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Constraint properties");
	vortexGroup->addSubProperty(vortexConstraint);
	vortexConstraintItem=getSubPropertyBrowserItem(vortexGroupItem,vortexConstraint);
	setExpanded(vortexConstraintItem,_vortexConstraintPropertiesExpanded);

	p_vortexConstraintLinearCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearCompliance);
	p_vortexConstraintLinearDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearDamping);
	p_vortexConstraintLinearKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearKinLoss);
	p_vortexConstraintAngularCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularCompliance);
	p_vortexConstraintAngularDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularDamping);
	p_vortexConstraintAngularKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularKinLoss);


	refresh();

	enableNotifications(true);

//	setWindowFlags(Qt::CustomizeWindowHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint);
//	setWindowModality(Qt::ApplicationModal);
	setGeometry(_dlgPosX,_dlgPosY,_dlgSizeX,_dlgSizeY);

}