Export CompositingTypeIndex enum to QML

Use the dedicated enum values instead of trying to map the indices.

REVIEW: 116690
This commit is contained in:
Martin Gräßlin 2014-03-10 09:37:17 +01:00
parent 74d9185f49
commit a31efea704
2 changed files with 8 additions and 10 deletions

View file

@ -104,6 +104,7 @@ class CompositingType : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS(CompositingTypeIndex)
public: public:

View file

@ -34,7 +34,7 @@ Item {
property alias unredirectFullScreenChecked: unredirectFullScreen.checked property alias unredirectFullScreenChecked: unredirectFullScreen.checked
property alias glSwapStrategyIndex: glSwapStrategy.currentIndex property alias glSwapStrategyIndex: glSwapStrategy.currentIndex
property alias glColorCorrectionChecked: glColorCorrection.checked property alias glColorCorrectionChecked: glColorCorrection.checked
property alias compositingTypeIndex: openGLType.type property alias compositingTypeIndex: backend.type
property bool compositingEnabledChecked: useCompositing.checked property bool compositingEnabledChecked: useCompositing.checked
CompositingType { CompositingType {
@ -78,14 +78,11 @@ Item {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
ComboBox { ComboBox {
id: openGLType id: backend
property int type: 0 property int type: 0
model: compositingType model: compositingType
textRole: "NameRole" textRole: "NameRole"
onCurrentIndexChanged: { onCurrentIndexChanged: {
glScaleFilter.visible = currentIndex != 3;
xrScaleFilter.visible = currentIndex == 3;
glColorCorrection.enabled = currentIndex !=3 && glColorCorrection !=4;
type = compositingType.compositingTypeForIndex(currentIndex); type = compositingType.compositingTypeForIndex(currentIndex);
} }
Component.onCompleted: { Component.onCompleted: {
@ -94,7 +91,7 @@ Item {
Connections { Connections {
target: compositing target: compositing
onCompositingTypeChanged: { onCompositingTypeChanged: {
openGLType.currentIndex = compositingType.indexForCompositingType(compositing.compositingType) backend.currentIndex = compositingType.indexForCompositingType(compositing.compositingType)
} }
} }
Layout.fillWidth: true Layout.fillWidth: true
@ -110,7 +107,7 @@ Item {
ComboBox { ComboBox {
id: glScaleFilter id: glScaleFilter
model: [i18n("Crisp"), i18n("Smooth"), i18n("Accurate")] model: [i18n("Crisp"), i18n("Smooth"), i18n("Accurate")]
visible: openGLType.currentIndex != 3 visible: backend.type != CompositingType.XRENDER_INDEX
currentIndex: compositing.glScaleFilter currentIndex: compositing.glScaleFilter
Layout.fillWidth: true Layout.fillWidth: true
} }
@ -124,7 +121,7 @@ Item {
ComboBox { ComboBox {
id: xrScaleFilter id: xrScaleFilter
model: [i18n("Crisp"), i18n("Smooth (slower)")] model: [i18n("Crisp"), i18n("Smooth (slower)")]
visible: openGLType.currentIndex == 3 visible: backend.type == CompositingType.XRENDER_INDEX
currentIndex: compositing.xrScaleFilter ? 1 : 0 currentIndex: compositing.xrScaleFilter ? 1 : 0
Layout.fillWidth: true Layout.fillWidth: true
} }
@ -180,7 +177,7 @@ Item {
CheckBox { CheckBox {
id: glColorCorrection id: glColorCorrection
checked: compositing.glColorCorrection checked: compositing.glColorCorrection
enabled: openGLType.currentIndex != 3 && openGLType.currentIndex != 4 enabled: backend.type == CompositingType.OPENGL31_INDEX || backend.type == CompositingType.OPENGL20_INDEX
text: i18n("Enable color correction") text: i18n("Enable color correction")
Connections { Connections {
target: compositing target: compositing
@ -196,7 +193,7 @@ Item {
} }
} }
Connections { Connections {
target: openGLType target: backend
onCurrentIndexChanged: changed() onCurrentIndexChanged: changed()
} }
}//End item }//End item