From d81df32a4f9c77fd0570d73422d34511000d0fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 25 Aug 2012 11:09:57 +0200 Subject: [PATCH] Support for Plastik's configuration options Adding a KConfigXT xml file and an ui file to configure the QML variant of Plastik. Currently supported options: * title alignment * title shadow * animation of buttons Missing option: * colored borders --- .../plastik/package/contents/config/main.xml | 28 ++++++ .../package/contents/ui/PlastikButton.qml | 8 +- .../plastik/package/contents/ui/config.ui | 99 +++++++++++++++++++ .../plastik/package/contents/ui/main.qml | 20 +++- 4 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 clients/aurorae/themes/plastik/package/contents/config/main.xml create mode 100644 clients/aurorae/themes/plastik/package/contents/ui/config.ui diff --git a/clients/aurorae/themes/plastik/package/contents/config/main.xml b/clients/aurorae/themes/plastik/package/contents/config/main.xml new file mode 100644 index 0000000000..99f1126561 --- /dev/null +++ b/clients/aurorae/themes/plastik/package/contents/config/main.xml @@ -0,0 +1,28 @@ + + + + + + + true + + + false + + + false + + + true + + + true + + + true + + + diff --git a/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml b/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml index 18266415ac..6a065463ef 100644 --- a/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml +++ b/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml @@ -62,16 +62,16 @@ DecorationButton { property color baseSurfaceTop: colorHelper.shade(options.titleBarColor, ColorHelper.MidlightShade, colorHelper.contrast - 0.4) property color baseSurfaceBottom: colorHelper.shade(options.titleBarColor, ColorHelper.LightShade, colorHelper.contrast - 0.4) Behavior on conturTop { - ColorAnimation { duration: root.animationDuration } + ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } Behavior on conturBottom { - ColorAnimation { duration: root.animationDuration } + ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } Behavior on surfaceTop { - ColorAnimation { duration: root.animationDuration } + ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } Behavior on surfaceBottom { - ColorAnimation { duration: root.animationDuration } + ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } width: size height: size diff --git a/clients/aurorae/themes/plastik/package/contents/ui/config.ui b/clients/aurorae/themes/plastik/package/contents/ui/config.ui new file mode 100644 index 0000000000..b2670db3d1 --- /dev/null +++ b/clients/aurorae/themes/plastik/package/contents/ui/config.ui @@ -0,0 +1,99 @@ + + + PlastikConfigDialog + + + + 0 + 0 + 541 + 176 + + + + Config Dialog + + + + 0 + + + + + Title &Alignment + + + + + + Left + + + + + + + Center + + + + + + + Right + + + + + + + + + + Check this option if the window border should be painted in the titlebar color. Otherwise it will be painted in the background color. + + + Colored window border + + + + + + + + + + Check this option if you want the titlebar text to have a 3D look with a shadow behind it. + + + Use shadowed &text + + + + + + + Check this option if you want the buttons to fade in when the mouse pointer hovers over them and fade out again when it moves away. + + + Animate buttons + + + + + + + + KButtonGroup + QGroupBox +
kbuttongroup.h
+ 1 +
+
+ + kcfg_animateButtons + kcfg_titleShadow + + + +
diff --git a/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/clients/aurorae/themes/plastik/package/contents/ui/main.qml index 80d94f75cd..7805a50aec 100644 --- a/clients/aurorae/themes/plastik/package/contents/ui/main.qml +++ b/clients/aurorae/themes/plastik/package/contents/ui/main.qml @@ -44,6 +44,21 @@ Decoration { root.borderSize = 4; break; } + var titleAlignLeft = decoration.readConfig("titleAlignLeft", true); + var titleAlignCenter = decoration.readConfig("titleAlignCenter", false); + var titleAlignRight = decoration.readConfig("titleAlignRight", false); + if (titleAlignRight) { + root.titleAlignment = Text.AlignRight; + } else if (titleAlignCenter) { + root.titleAlignment = Text.AlignHCenter; + } else { + if (!titleAlignLeft) { + console.log("Error reading title alignment: all alignment options are false"); + } + root.titleAlignment = Text.AlignLeft; + } + root.animateButtons = decoration.readConfig("animateButtons", true); + root.titleShadow = decoration.readConfig("titleShadow", true); } ColorHelper { id: colorHelper @@ -53,8 +68,11 @@ Decoration { deco: decoration } property alias buttonSize: titleRow.captionHeight + property alias titleAlignment: caption.horizontalAlignment property color titleBarColor: options.titleBarColor property int animationDuration: 150 + property bool animateButtons: true + property bool titleShadow: true Behavior on titleBarColor { ColorAnimation { duration: root.animationDuration @@ -256,7 +274,7 @@ Decoration { } text: decoration.caption font: options.titleFont - style: Text.Raised + style: root.titleShadow ? Text.Raised : Text.Normal styleColor: colorHelper.shade(color, ColorHelper.ShadowShade) elide: Text.ElideMiddle }