From 54479225a3ad35aefe3877d1bd8b3ad3cfeabf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 27 Dec 2012 10:53:56 +0100 Subject: [PATCH] Application Menu button support for Plastik New icon with three lines similar to the one used in Oxygen is added for application menu support. REVIEW: 107937 --- clients/aurorae/themes/plastik/code/plastikbutton.cpp | 9 +++++++++ clients/aurorae/themes/plastik/code/plastikbutton.h | 1 + .../themes/plastik/package/contents/ui/PlastikButton.qml | 8 ++++++++ .../aurorae/themes/plastik/package/contents/ui/main.qml | 9 +++++++++ 4 files changed, 27 insertions(+) diff --git a/clients/aurorae/themes/plastik/code/plastikbutton.cpp b/clients/aurorae/themes/plastik/code/plastikbutton.cpp index 902cbc8d9f..1e3976bbd0 100644 --- a/clients/aurorae/themes/plastik/code/plastikbutton.cpp +++ b/clients/aurorae/themes/plastik/code/plastikbutton.cpp @@ -91,6 +91,8 @@ QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, con } else { button = ShadeIcon; } + } else if (idParts[0] == "N") { + button = AppMenuIcon; } else { // not recognized icon return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize); @@ -360,6 +362,13 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool break; } + case AppMenuIcon: + { + drawObject(p, HorizontalLine, r.x(), r.top()+(lwTitleBar-1), r.width(), lwTitleBar); + drawObject(p, HorizontalLine, r.x(), r.center().y(), r.width(), lwTitleBar); + drawObject(p, HorizontalLine, r.x(), r.bottom()-(lwTitleBar-1), r.width(), lwTitleBar); + break; + } default: break; diff --git a/clients/aurorae/themes/plastik/code/plastikbutton.h b/clients/aurorae/themes/plastik/code/plastikbutton.h index 3eb47b1503..96e8d7bf02 100644 --- a/clients/aurorae/themes/plastik/code/plastikbutton.h +++ b/clients/aurorae/themes/plastik/code/plastikbutton.h @@ -43,6 +43,7 @@ private: NoKeepBelowIcon, ShadeIcon, UnShadeIcon, + AppMenuIcon, NumButtonIcons }; enum Object { diff --git a/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml b/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml index 6a065463ef..1b3c215086 100644 --- a/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml +++ b/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml @@ -143,11 +143,19 @@ DecorationButton { if (buttonType == "H") { visible = decoration.providesContextHelp; } + if (buttonType == "N") { + visible = decoration.appMenu; + } } onHoveredChanged: colorize() onPressedChanged: colorize() Connections { target: decoration onActiveChanged: button.colorize() + onAppMenuChanged: { + if (buttonType == "N") { + visible = decoration.appMenu; + } + } } } diff --git a/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/clients/aurorae/themes/plastik/package/contents/ui/main.qml index c6b3042baf..f868fe79e7 100644 --- a/clients/aurorae/themes/plastik/package/contents/ui/main.qml +++ b/clients/aurorae/themes/plastik/package/contents/ui/main.qml @@ -267,6 +267,7 @@ Decoration { spacing: 1 explicitSpacer: root.buttonSize menuButton: menuButtonComponent + appMenuButton: appMenuButtonComponent minimizeButton: minimizeButtonComponent maximizeButton: maximizeButtonComponent keepBelowButton: keepBelowButtonComponent @@ -305,6 +306,7 @@ Decoration { spacing: 1 explicitSpacer: root.buttonSize menuButton: menuButtonComponent + appMenuButton: appMenuButtonComponent minimizeButton: minimizeButtonComponent maximizeButton: maximizeButtonComponent keepBelowButton: keepBelowButtonComponent @@ -402,6 +404,13 @@ Decoration { height: root.buttonSize } } + Component { + id: appMenuButtonComponent + PlastikButton { + buttonType: "N" + size: root.buttonSize + } + } Component.onCompleted: readConfig() Connections { target: decoration