From a31efea704a199c4da923e9c24c762d9827b9ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 10 Mar 2014 09:37:17 +0100 Subject: [PATCH] Export CompositingTypeIndex enum to QML Use the dedicated enum values instead of trying to map the indices. REVIEW: 116690 --- kcmkwin/kwincompositing/compositing.h | 1 + kcmkwin/kwincompositing/qml/CompositingView.qml | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/kcmkwin/kwincompositing/compositing.h b/kcmkwin/kwincompositing/compositing.h index 4930085281..ff2e7254e1 100644 --- a/kcmkwin/kwincompositing/compositing.h +++ b/kcmkwin/kwincompositing/compositing.h @@ -104,6 +104,7 @@ class CompositingType : public QAbstractItemModel { Q_OBJECT + Q_ENUMS(CompositingTypeIndex) public: diff --git a/kcmkwin/kwincompositing/qml/CompositingView.qml b/kcmkwin/kwincompositing/qml/CompositingView.qml index e29fda16f1..bb18019566 100644 --- a/kcmkwin/kwincompositing/qml/CompositingView.qml +++ b/kcmkwin/kwincompositing/qml/CompositingView.qml @@ -34,7 +34,7 @@ Item { property alias unredirectFullScreenChecked: unredirectFullScreen.checked property alias glSwapStrategyIndex: glSwapStrategy.currentIndex property alias glColorCorrectionChecked: glColorCorrection.checked - property alias compositingTypeIndex: openGLType.type + property alias compositingTypeIndex: backend.type property bool compositingEnabledChecked: useCompositing.checked CompositingType { @@ -78,14 +78,11 @@ Item { Layout.alignment: Qt.AlignRight } ComboBox { - id: openGLType + id: backend property int type: 0 model: compositingType textRole: "NameRole" onCurrentIndexChanged: { - glScaleFilter.visible = currentIndex != 3; - xrScaleFilter.visible = currentIndex == 3; - glColorCorrection.enabled = currentIndex !=3 && glColorCorrection !=4; type = compositingType.compositingTypeForIndex(currentIndex); } Component.onCompleted: { @@ -94,7 +91,7 @@ Item { Connections { target: compositing onCompositingTypeChanged: { - openGLType.currentIndex = compositingType.indexForCompositingType(compositing.compositingType) + backend.currentIndex = compositingType.indexForCompositingType(compositing.compositingType) } } Layout.fillWidth: true @@ -110,7 +107,7 @@ Item { ComboBox { id: glScaleFilter model: [i18n("Crisp"), i18n("Smooth"), i18n("Accurate")] - visible: openGLType.currentIndex != 3 + visible: backend.type != CompositingType.XRENDER_INDEX currentIndex: compositing.glScaleFilter Layout.fillWidth: true } @@ -124,7 +121,7 @@ Item { ComboBox { id: xrScaleFilter model: [i18n("Crisp"), i18n("Smooth (slower)")] - visible: openGLType.currentIndex == 3 + visible: backend.type == CompositingType.XRENDER_INDEX currentIndex: compositing.xrScaleFilter ? 1 : 0 Layout.fillWidth: true } @@ -180,7 +177,7 @@ Item { CheckBox { id: 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") Connections { target: compositing @@ -196,7 +193,7 @@ Item { } } Connections { - target: openGLType + target: backend onCurrentIndexChanged: changed() } }//End item