Support for Application Menu in Aurorae
Aurorae supports in general the Aurorae button. So far themes are not able to style the button, instead the window's icon is used.
This commit is contained in:
parent
6fd8db7af9
commit
7163c9faf4
14 changed files with 73 additions and 1 deletions
|
@ -41,11 +41,13 @@ install( FILES
|
|||
qml/Decoration.qml
|
||||
qml/DecorationButton.qml
|
||||
qml/MenuButton.qml
|
||||
qml/AppMenuButton.qml
|
||||
DESTINATION ${DATA_INSTALL_DIR}/kwin/aurorae )
|
||||
install( FILES
|
||||
qml/Decoration.qml
|
||||
qml/DecorationButton.qml
|
||||
qml/MenuButton.qml
|
||||
qml/AppMenuButton.qml
|
||||
qml/ButtonGroup.qml
|
||||
qml/qmldir
|
||||
DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration )
|
||||
|
|
|
@ -192,6 +192,7 @@ bool AuroraeFactory::supports(Ability ability) const
|
|||
case AbilityButtonShade:
|
||||
case AbilityButtonOnAllDesktops:
|
||||
case AbilityButtonHelp:
|
||||
case AbilityButtonApplicationMenu:
|
||||
case AbilityProvidesShadow:
|
||||
return true; // TODO: correct value from theme
|
||||
case AbilityTabbing:
|
||||
|
@ -240,6 +241,8 @@ AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *fact
|
|||
connect(AuroraeFactory::instance(), SIGNAL(configChanged()), SIGNAL(configChanged()));
|
||||
connect(AuroraeFactory::instance(), SIGNAL(titleFontChanged()), SIGNAL(fontChanged()));
|
||||
connect(m_item, SIGNAL(alphaChanged()), SLOT(slotAlphaChanged()));
|
||||
connect(this, SIGNAL(appMenuAvailable()), SIGNAL(appMenuAvailableChanged()));
|
||||
connect(this, SIGNAL(appMenuUnavailable()), SIGNAL(appMenuAvailableChanged()));
|
||||
}
|
||||
|
||||
AuroraeClient::~AuroraeClient()
|
||||
|
@ -441,6 +444,11 @@ void AuroraeClient::menuClicked()
|
|||
showWindowMenu(QCursor::pos());
|
||||
}
|
||||
|
||||
void AuroraeClient::appMenuClicked()
|
||||
{
|
||||
showApplicationMenu(QCursor::pos());
|
||||
}
|
||||
|
||||
void AuroraeClient::toggleShade()
|
||||
{
|
||||
setShade(!isShade());
|
||||
|
|
|
@ -106,6 +106,7 @@ class AuroraeClient : public KDecorationUnstable
|
|||
Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper)
|
||||
Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizeChanged)
|
||||
Q_PROPERTY(bool providesContextHelp READ providesContextHelp)
|
||||
Q_PROPERTY(bool appMenu READ menuAvailable NOTIFY appMenuAvailableChanged)
|
||||
Q_PROPERTY(QRect transparentRect READ transparentRect)
|
||||
Q_PROPERTY(int width READ width)
|
||||
Q_PROPERTY(qulonglong windowId READ windowId CONSTANT)
|
||||
|
@ -150,9 +151,11 @@ Q_SIGNALS:
|
|||
**/
|
||||
void configChanged();
|
||||
void fontChanged();
|
||||
void appMenuAvailableChanged();
|
||||
|
||||
public slots:
|
||||
void menuClicked();
|
||||
void appMenuClicked();
|
||||
void toggleShade();
|
||||
void toggleKeepAbove();
|
||||
void toggleKeepBelow();
|
||||
|
|
|
@ -167,6 +167,8 @@ QLatin1String AuroraeTheme::mapButtonToName(AuroraeButtonType type)
|
|||
return QLatin1String("help");
|
||||
case MenuButton:
|
||||
return QLatin1String("menu");
|
||||
case AppMenuButton:
|
||||
return QLatin1String("appmenu");
|
||||
default:
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
@ -363,6 +365,7 @@ THEME_CONFIG(buttonWidthKeepBelow)
|
|||
THEME_CONFIG(buttonWidthShade)
|
||||
THEME_CONFIG(buttonWidthHelp)
|
||||
THEME_CONFIG(buttonWidthMenu)
|
||||
THEME_CONFIG(buttonWidthAppMenu)
|
||||
THEME_CONFIG(buttonHeight)
|
||||
THEME_CONFIG(buttonSpacing)
|
||||
THEME_CONFIG(buttonMarginTop)
|
||||
|
|
|
@ -42,7 +42,8 @@ enum AuroraeButtonType {
|
|||
KeepBelowButton,
|
||||
ShadeButton,
|
||||
HelpButton,
|
||||
MenuButton
|
||||
MenuButton,
|
||||
AppMenuButton
|
||||
};
|
||||
|
||||
enum DecorationPosition {
|
||||
|
@ -79,6 +80,7 @@ class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject
|
|||
Q_PROPERTY(int buttonWidthShade READ buttonWidthShade NOTIFY themeChanged)
|
||||
Q_PROPERTY(int buttonWidthHelp READ buttonWidthHelp NOTIFY themeChanged)
|
||||
Q_PROPERTY(int buttonWidthMenu READ buttonWidthMenu NOTIFY themeChanged)
|
||||
Q_PROPERTY(int buttonWidthAppMenu READ buttonWidthAppMenu NOTIFY themeChanged)
|
||||
Q_PROPERTY(int buttonSpacing READ buttonSpacing NOTIFY themeChanged)
|
||||
Q_PROPERTY(int buttonMarginTop READ buttonMarginTop NOTIFY themeChanged)
|
||||
Q_PROPERTY(int explicitButtonSpacer READ explicitButtonSpacer NOTIFY themeChanged)
|
||||
|
@ -138,6 +140,7 @@ public:
|
|||
int buttonWidthShade() const;
|
||||
int buttonWidthHelp() const;
|
||||
int buttonWidthMenu() const;
|
||||
int buttonWidthAppMenu() const;
|
||||
int buttonHeight() const;
|
||||
int buttonSpacing() const;
|
||||
int buttonMarginTop() const;
|
||||
|
|
|
@ -67,6 +67,7 @@ ThemeConfig::ThemeConfig()
|
|||
, m_buttonWidthShade(defaultButtonWidthShade())
|
||||
, m_buttonWidthHelp(defaultButtonWidthHelp())
|
||||
, m_buttonWidthMenu(defaultButtonWidthMenu())
|
||||
, m_buttonWidthAppMenu(defaultButtonWidthAppMenu())
|
||||
, m_buttonHeight(defaultButtonHeight())
|
||||
, m_buttonSpacing(defaultButtonSpacing())
|
||||
, m_buttonMarginTop(defaultButtonMarginTop())
|
||||
|
@ -155,6 +156,7 @@ void ThemeConfig::load(const KConfig &conf)
|
|||
m_buttonWidthShade = border.readEntry("ButtonWidthShade", m_buttonWidth);
|
||||
m_buttonWidthHelp = border.readEntry("ButtonWidthHelp", m_buttonWidth);
|
||||
m_buttonWidthMenu = border.readEntry("ButtonWidthMenu", m_buttonWidth);
|
||||
m_buttonWidthAppMenu = border.readEntry("ButtonWidthAppMenu", m_buttonWidthMenu);
|
||||
m_buttonHeight = border.readEntry("ButtonHeight", defaultButtonHeight());
|
||||
m_buttonSpacing = border.readEntry("ButtonSpacing", defaultButtonSpacing());
|
||||
m_buttonMarginTop = border.readEntry("ButtonMarginTop", defaultButtonMarginTop());
|
||||
|
|
|
@ -145,6 +145,9 @@ public:
|
|||
int buttonWidthMenu() const {
|
||||
return m_buttonWidthMenu;
|
||||
}
|
||||
int buttonWidthAppMenu() const {
|
||||
return m_buttonWidthAppMenu;
|
||||
}
|
||||
int buttonHeight() const {
|
||||
return m_buttonHeight;
|
||||
}
|
||||
|
@ -308,6 +311,9 @@ public:
|
|||
static int defaultButtonWidthMenu() {
|
||||
return defaultButtonWidth();
|
||||
}
|
||||
static int defaultButtonWidthAppMenu() {
|
||||
return defaultButtonWidthMenu();
|
||||
}
|
||||
static int defaultButtonHeight() {
|
||||
return 20;
|
||||
}
|
||||
|
@ -389,6 +395,7 @@ private:
|
|||
int m_buttonWidthShade;
|
||||
int m_buttonWidthHelp;
|
||||
int m_buttonWidthMenu;
|
||||
int m_buttonWidthAppMenu;
|
||||
int m_buttonHeight;
|
||||
int m_buttonSpacing;
|
||||
int m_buttonMarginTop;
|
||||
|
|
28
clients/aurorae/src/qml/AppMenuButton.qml
Normal file
28
clients/aurorae/src/qml/AppMenuButton.qml
Normal file
|
@ -0,0 +1,28 @@
|
|||
/********************************************************************
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
import QtQuick 1.1
|
||||
import org.kde.qtextracomponents 0.1 as QtExtra
|
||||
|
||||
DecorationButton {
|
||||
id: appMenuButton
|
||||
buttonType: "N"
|
||||
visible: decoration.appMenu
|
||||
QtExtra.QIconItem {
|
||||
icon: decoration.icon
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
|
@ -23,6 +23,9 @@ DecorationButton {
|
|||
case "M":
|
||||
// menu
|
||||
return auroraeTheme.buttonWidthMenu;
|
||||
case "N":
|
||||
// app menu
|
||||
return auroraeTheme.buttonWidthAppMenu;
|
||||
case "S":
|
||||
// all desktops
|
||||
return auroraeTheme.buttonWidthAllDesktops;
|
||||
|
|
|
@ -27,6 +27,9 @@ Item {
|
|||
} else if (buttons.charAt(i) == "M") {
|
||||
Qt.createQmlObject("import QtQuick 1.1; MenuButton { width: auroraeTheme.buttonWidthMenu * auroraeTheme.buttonSizeFactor; height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor }",
|
||||
groupRow, "menuButton" + buttons + i);
|
||||
} else if (buttons.charAt(i) == "N") {
|
||||
Qt.createQmlObject("import QtQuick 1.1; AppMenuButton { width: auroraeTheme.buttonWidthAppMenu * auroraeTheme.buttonSizeFactor; height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor }",
|
||||
groupRow, "appMenuButton" + buttons + i);
|
||||
} else if (buttons.charAt(i) == "A") {
|
||||
var maximizeComponent = Qt.createComponent("AuroraeMaximizeButton.qml");
|
||||
maximizeComponent.createObject(groupRow);
|
||||
|
|
|
@ -45,6 +45,9 @@ Item {
|
|||
case "M":
|
||||
component = group.menuButton;
|
||||
break;
|
||||
case "N":
|
||||
component = group.appMenuButton;
|
||||
break;
|
||||
case "S":
|
||||
component = group.allDesktopsButton;
|
||||
break;
|
||||
|
@ -70,6 +73,7 @@ Item {
|
|||
property variant keepBelowButton
|
||||
property variant maximizeButton
|
||||
property variant menuButton
|
||||
property variant appMenuButton
|
||||
property variant minimizeButton
|
||||
property variant allDesktopsButton
|
||||
property variant shadeButton
|
||||
|
|
|
@ -62,6 +62,10 @@ Item {
|
|||
// menu
|
||||
decoration.menuClicked();
|
||||
break;
|
||||
case "N":
|
||||
// app menu
|
||||
decoration.appMenuClicked();
|
||||
break;
|
||||
case "S":
|
||||
// all desktops
|
||||
decoration.toggleOnAllDesktops();
|
||||
|
|
|
@ -3,4 +3,5 @@ plugin decorationplugin
|
|||
Decoration 0.1 Decoration.qml
|
||||
DecorationButton 0.1 DecorationButton.qml
|
||||
MenuButton 0.1 MenuButton.qml
|
||||
AppMenuButton 0.1 AppMenuButton.qml
|
||||
ButtonGroup 0.1 ButtonGroup.qml
|
||||
|
|
|
@ -41,6 +41,7 @@ Item {
|
|||
property bool keepBelow: false
|
||||
property bool maximized: false
|
||||
property bool providesContextHelp: true
|
||||
property bool appMenu: true
|
||||
property string leftButtons: "MS"
|
||||
property string rightButtons: "HIA__X"
|
||||
function titleMouseMoved() {}
|
||||
|
|
Loading…
Reference in a new issue