diff --git a/plugins/kdecorations/aurorae/src/qml/AppMenuButton.qml b/plugins/kdecorations/aurorae/src/qml/AppMenuButton.qml index e60579a80..58841a7f4 100644 --- a/plugins/kdecorations/aurorae/src/qml/AppMenuButton.qml +++ b/plugins/kdecorations/aurorae/src/qml/AppMenuButton.qml @@ -1,29 +1,29 @@ /******************************************************************** Copyright (C) 2012 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ import QtQuick 2.0 import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons import org.kde.kwin.decoration 0.1 DecorationButton { id: appMenuButton buttonType: DecorationOptions.DecorationButtonApplicationMenu - visible: false //decoration.appMenu + visible: decoration.client.hasApplicationMenu KQuickControlsAddons.QIconItem { icon: decoration.client.icon anchors.fill: parent } } diff --git a/plugins/kdecorations/aurorae/src/qml/DecorationButton.qml b/plugins/kdecorations/aurorae/src/qml/DecorationButton.qml index 6c295d09a..32d699095 100644 --- a/plugins/kdecorations/aurorae/src/qml/DecorationButton.qml +++ b/plugins/kdecorations/aurorae/src/qml/DecorationButton.qml @@ -1,124 +1,125 @@ /******************************************************************** Copyright (C) 2012 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ import QtQuick 2.0 import org.kde.kwin.decoration 0.1 Item { id: button property int buttonType : DecorationOptions.DecorationButtonNone property bool hovered: false property bool pressed: false property bool toggled: false enabled: { switch (button.buttonType) { case DecorationOptions.DecorationButtonClose: return decoration.client.closeable; case DecorationOptions.DecorationButtonMaximizeRestore: return decoration.client.maximizeable; case DecorationOptions.DecorationButtonMinimize: return decoration.client.minimizeable; case DecorationOptions.DecorationButtonExplicitSpacer: return false; default: return true; } } MouseArea { anchors.fill: parent acceptedButtons: { switch (button.buttonType) { case DecorationOptions.DecorationButtonMenu: return Qt.LeftButton | Qt.RightButton; case DecorationOptions.DecorationButtonMaximizeRestore: return Qt.LeftButton | Qt.RightButton | Qt.MiddleButton; default: return Qt.LeftButton; } } hoverEnabled: true onEntered: button.hovered = true onExited: button.hovered = false onPressed: button.pressed = true onReleased: button.pressed = false onClicked: { switch (button.buttonType) { case DecorationOptions.DecorationButtonMenu: // menu decoration.requestShowWindowMenu(); break; case DecorationOptions.DecorationButtonApplicationMenu: // app menu -// decoration.appMenuClicked(); + var pos = button.mapToItem(null, 0, 0); // null = "map to scene" + decoration.requestShowApplicationMenu(Qt.rect(pos.x, pos.y, button.width, button.height), 0) break; case DecorationOptions.DecorationButtonOnAllDesktops: // all desktops decoration.requestToggleOnAllDesktops(); break; case DecorationOptions.DecorationButtonQuickHelp: // help decoration.requestContextHelp(); break; case DecorationOptions.DecorationButtonMinimize: // minimize decoration.requestMinimize(); break; case DecorationOptions.DecorationButtonMaximizeRestore: // maximize decoration.requestToggleMaximization(mouse.button); break; case DecorationOptions.DecorationButtonClose: // close decoration.requestClose(); break; case DecorationOptions.DecorationButtonKeepAbove: // keep above decoration.requestToggleKeepAbove(); break; case DecorationOptions.DecorationButtonKeepBelow: // keep below decoration.requestToggleKeepBelow(); break; case DecorationOptions.DecorationButtonShade: // shade decoration.requestToggleShade(); break; } } onDoubleClicked: { if (button.buttonType == DecorationOptions.DecorationButtonMenu) { decoration.requestClose(); } } Component.onCompleted: { switch (button.buttonType) { case DecorationOptions.DecorationButtonOnAllDesktops: // all desktops button.toggled = Qt.binding(function() { return decoration.client.onAllDesktops; }); break; case DecorationOptions.DecorationButtonKeepAbove: button.toggled = Qt.binding(function() { return decoration.client.keepAbove; }); break; case DecorationOptions.DecorationButtonKeepBelow: button.toggled = Qt.binding(function() { return decoration.client.keepBelow; }); break; case DecorationOptions.DecorationButtonShade: button.toggled = Qt.binding(function() { return decoration.client.shaded; }); break; } } } } diff --git a/plugins/kdecorations/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml b/plugins/kdecorations/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml index 97571a26c..39132f725 100644 --- a/plugins/kdecorations/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml +++ b/plugins/kdecorations/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml @@ -1,161 +1,160 @@ /******************************************************************** Copyright (C) 2012 Martin Gräßlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ import QtQuick 2.0 import org.kde.kwin.decoration 0.1 import org.kde.kwin.decorations.plastik 1.0 DecorationButton { id: button function colorize() { var highlightColor = null; if (button.pressed) { if (button.buttonType == DecorationOptions.DecorationButtonClose) { highlightColor = colorHelper.foreground(decoration.client.active, ColorHelper.NegativeText); } else { highlightColor = options.titleBarColor; } highlightColor = colorHelper.shade(highlightColor, ColorHelper.ShadowShade); highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.3); } else if (button.hovered) { if (button.buttonType == DecorationOptions.DecorationButtonClose) { highlightColor = colorHelper.foreground(decoration.client.active, ColorHelper.NegativeText); } else { highlightColor = options.titleBarColor; } highlightColor = colorHelper.shade(highlightColor, ColorHelper.LightShade, Math.min(1.0, colorHelper.contrast + 0.4)); highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.6); } if (highlightColor) { button.surfaceTop = Qt.tint(button.baseSurfaceTop, highlightColor); button.surfaceBottom = Qt.tint(button.baseSurfaceBottom, highlightColor); highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.4); button.conturTop = Qt.tint(button.baseConturTop, highlightColor); button.conturBottom = Qt.tint(button.baseConturBottom, highlightColor); } else { button.conturTop = button.baseConturTop; button.conturBottom = button.baseConturBottom; button.surfaceTop = button.baseSurfaceTop; button.surfaceBottom = button.baseSurfaceBottom; } } property real size property color conturTop property color conturBottom property color surfaceTop property color surfaceBottom property color baseConturTop: colorHelper.shade(options.titleBarColor, ColorHelper.DarkShade, colorHelper.contrast - 0.4) property color baseConturBottom: colorHelper.shade(options.titleBarColor, ColorHelper.MidShade) 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.animateButtons ? root.animationDuration : 0 } } Behavior on conturBottom { ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } Behavior on surfaceTop { ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } Behavior on surfaceBottom { ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } } width: size height: size Rectangle { radius: 2 smooth: true anchors.fill: parent gradient: Gradient { GradientStop { position: 0.0 color: button.conturTop } GradientStop { position: 1.0 color: button.conturBottom } } Rectangle { radius: 2 smooth: true anchors { fill: parent leftMargin: 1 rightMargin: 1 topMargin: 1 bottomMargin: 1 } gradient: Gradient { GradientStop { position: 0.0 color: button.surfaceTop } GradientStop { position: 1.0 color: button.surfaceBottom } } } } Item { property int imageWidth: button.width > 14 ? button.width - 2 * Math.floor(button.width/3.5) : button.width - 6 property int imageHeight: button.height > 14 ? button.height - 2 * Math.floor(button.height/3.5) : button.height - 6 property string source: "image://plastik/" + button.buttonType + "/" + decoration.client.active + "/" + ((buttonType == DecorationOptions.DecorationButtonMaximizeRestore) ? decoration.client.maximized : button.toggled) anchors.fill: parent Image { id: shadowImage x: button.x + button.width / 2 - width / 2 + 1 y: button.y + button.height / 2 - height / 2 + 1 source: parent.source + "/true" width: parent.imageWidth height: parent.imageHeight sourceSize.width: width sourceSize.height: height visible: !button.pressed } Image { id: image x: button.x + button.width / 2 - width / 2 y: button.y + button.height / 2 - height / 2 + (button.pressed ? 1 : 0) source: parent.source width: parent.imageWidth height: parent.imageHeight sourceSize.width: width sourceSize.height: height } } Component.onCompleted: { colorize(); if (buttonType == DecorationOptions.DecorationButtonQuickHelp) { visible = Qt.binding(function() { return decoration.client.providesContextHelp}); } if (buttonType == DecorationOptions.DecorationButtonApplicationMenu) { -// visible = decoration.appMenu; - visible = false; + visible = Qt.binding(function() { return decoration.client.hasApplicationMenu; }); } } onHoveredChanged: colorize() onPressedChanged: colorize() Connections { target: decoration.client onActiveChanged: button.colorize() } Connections { target: options onColorsChanged: button.colorize(); } }