From 673dcd6ad35ee4d83594897ca823faf38d1e8d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 27 Jul 2012 10:03:22 +0200 Subject: [PATCH] Declarative extension plugin for window decorations The generic QML components from Aurorae are split out into an own declarative plugin. In addition two new helper classes are added to this plugin: * A ColorHelper to map a few function of KColorSheme and making it possible to actually work with colors in QML. The need emerged from trying to port Plastik to QML which makes strong use of color shading. * A DecorationOptions class which is a wrapper around KWin's KDecorationOptions but in a more useable way for QML. The various options are provided as properties and the value of the properties changes automatically depending on whether the decoration is active or inactive. Aurorae itself is not yet adjusted to these changes, but it should also be adjusted as some of the options are currently exported in the factory and the factory is injected into the Aurorae QML decoration. --- clients/aurorae/src/CMakeLists.txt | 25 ++- clients/aurorae/src/aurorae.cpp | 4 +- clients/aurorae/src/aurorae.h | 1 + clients/aurorae/src/colorhelper.cpp | 65 ++++++ clients/aurorae/src/colorhelper.h | 240 ++++++++++++++++++++++ clients/aurorae/src/decorationoptions.cpp | 126 ++++++++++++ clients/aurorae/src/decorationoptions.h | 144 +++++++++++++ clients/aurorae/src/decorationplugin.cpp | 30 +++ clients/aurorae/src/decorationplugin.h | 28 +++ clients/aurorae/src/qml/ButtonGroup.qml | 88 ++++++++ clients/aurorae/src/qml/qmldir | 6 + 11 files changed, 753 insertions(+), 4 deletions(-) create mode 100644 clients/aurorae/src/colorhelper.cpp create mode 100644 clients/aurorae/src/colorhelper.h create mode 100644 clients/aurorae/src/decorationoptions.cpp create mode 100644 clients/aurorae/src/decorationoptions.h create mode 100644 clients/aurorae/src/decorationplugin.cpp create mode 100644 clients/aurorae/src/decorationplugin.h create mode 100644 clients/aurorae/src/qml/ButtonGroup.qml create mode 100644 clients/aurorae/src/qml/qmldir diff --git a/clients/aurorae/src/CMakeLists.txt b/clients/aurorae/src/CMakeLists.txt index 6d2f9de9ad..41ab990a00 100644 --- a/clients/aurorae/src/CMakeLists.txt +++ b/clients/aurorae/src/CMakeLists.txt @@ -1,5 +1,9 @@ ########### decoration ############### -include_directories( ./lib ) +include_directories( + ./lib + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) set(kwin3_aurorae_PART_SRCS aurorae.cpp @@ -13,6 +17,18 @@ target_link_libraries(kwin3_aurorae ${KDE4_KDEUI_LIBS} ${QT_QTDECLARATIVE_LIBRAR install(TARGETS kwin3_aurorae DESTINATION ${PLUGIN_INSTALL_DIR} ) +set(decoration_plugin_SRCS + decorationplugin.cpp + decorationoptions.cpp + colorhelper.cpp + ) + +qt4_automoc(${decoration_plugin_SRCS}) + +add_library(decorationplugin SHARED ${decoration_plugin_SRCS}) +target_link_libraries(decorationplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KDEUI_LIBRARY} kdecorations) +install(TARGETS decorationplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration) + ########### install files ############### install( FILES aurorae.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin ) @@ -26,4 +42,11 @@ install( FILES qml/DecorationButton.qml qml/MenuButton.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/aurorae ) +install( FILES + qml/Decoration.qml + qml/DecorationButton.qml + qml/MenuButton.qml + qml/ButtonGroup.qml + qml/qmldir + DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration ) install( FILES kwindecoration.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 57e4af6b9b..cae98f585a 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -116,9 +116,6 @@ void AuroraeFactory::initQML(const KConfigGroup &group) foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) { m_engine->addImportPath(importPath); } - foreach (const QString &importPath, KGlobal::dirs()->findDirs("data", QLatin1String(KWIN_NAME) + "/aurorae/")) { - m_engine->addImportPath(importPath); - } m_component->loadUrl(QUrl::fromLocalFile(file)); } @@ -244,6 +241,7 @@ AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *fact { connect(this, SIGNAL(keepAboveChanged(bool)), SIGNAL(keepAboveChangedWrapper())); connect(this, SIGNAL(keepBelowChanged(bool)), SIGNAL(keepBelowChangedWrapper())); + connect(AuroraeFactory::instance(), SIGNAL(buttonsChanged()), SIGNAL(buttonsChanged())); } AuroraeClient::~AuroraeClient() diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 48bc347d9d..f37e1f4a08 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -147,6 +147,7 @@ Q_SIGNALS: void shadeChanged(); void keepAboveChangedWrapper(); void keepBelowChangedWrapper(); + void buttonsChanged(); public slots: void menuClicked(); diff --git a/clients/aurorae/src/colorhelper.cpp b/clients/aurorae/src/colorhelper.cpp new file mode 100644 index 0000000000..fe43385563 --- /dev/null +++ b/clients/aurorae/src/colorhelper.cpp @@ -0,0 +1,65 @@ +/******************************************************************** +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 . +*********************************************************************/ +#include "colorhelper.h" + +#include +#include + +ColorHelper::ColorHelper(QObject *parent) + : QObject(parent) +{ +} + +ColorHelper::~ColorHelper() +{ +} + +QColor ColorHelper::shade(const QColor &color, ColorHelper::ShadeRole role) +{ + return KColorScheme::shade(color, static_cast(role)); +} + +QColor ColorHelper::shade(const QColor &color, ColorHelper::ShadeRole role, qreal contrast) +{ + return KColorScheme::shade(color, static_cast(role), contrast); +} + +qreal ColorHelper::contrast() const +{ + return KGlobalSettings::contrastF(); +} + +QColor ColorHelper::multiplyAlpha(const QColor &color, qreal alpha) +{ + QColor retCol(color); + retCol.setAlphaF(color.alphaF() * alpha); + return retCol; +} + +QColor ColorHelper::background(bool active, ColorHelper::BackgroundRole role) const +{ + KColorScheme kcs(active ? QPalette::Active : QPalette::Inactive, KColorScheme::Button); + return kcs.background(static_cast(role)).color(); +} + +QColor ColorHelper::foreground(bool active, ColorHelper::ForegroundRole role) const +{ + KColorScheme kcs(active ? QPalette::Active : QPalette::Inactive, KColorScheme::Button); + return kcs.foreground(static_cast(role)).color(); +} + +#include "colorhelper.moc" diff --git a/clients/aurorae/src/colorhelper.h b/clients/aurorae/src/colorhelper.h new file mode 100644 index 0000000000..ece5a512ba --- /dev/null +++ b/clients/aurorae/src/colorhelper.h @@ -0,0 +1,240 @@ +/******************************************************************** +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 . +*********************************************************************/ +#ifndef COLOR_HELPER_H +#define COLOR_HELPER_H + +#include +#include + +/** + * @short Helper to manipulate colors. + * + * Exports a few functions from KColorScheme. + **/ +class ColorHelper : public QObject +{ + Q_OBJECT + Q_ENUMS(ShadeRole) + Q_ENUMS(ForegroundRole) + Q_ENUMS(BackgroundRole) + /** + * Same as KGlobalSettings::contrastF. + **/ + Q_PROPERTY(qreal contrast READ contrast CONSTANT) +public: + ColorHelper(QObject *parent = 0); + ~ColorHelper(); + /** + * This enumeration describes the color shade being selected from the given + * set. + * + * Color shades are used to draw "3d" elements, such as frames and bevels. + * They are neither foreground nor background colors. Text should not be + * painted over a shade, and shades should not be used to draw text. + */ + enum ShadeRole { + /** + * The light color is lighter than dark() or shadow() and contrasts + * with the base color. + */ + LightShade, + /** + * The midlight color is in between base() and light(). + */ + MidlightShade, + /** + * The mid color is in between base() and dark(). + */ + MidShade, + /** + * The dark color is in between mid() and shadow(). + */ + DarkShade, + /** + * The shadow color is darker than light() or midlight() and contrasts + * the base color. + */ + ShadowShade + }; + /** + * This enumeration describes the background color being selected from the + * given set. + * + * Background colors are suitable for drawing under text, and should never + * be used to draw text. In combination with one of the overloads of + * KColorScheme::shade, they may be used to generate colors for drawing + * frames, bevels, and similar decorations. + */ + enum BackgroundRole { + /** + * Normal background. + */ + NormalBackground = 0, + /** + * Alternate background; for example, for use in lists. + * + * This color may be the same as BackgroundNormal, especially in sets + * other than View and Window. + */ + AlternateBackground = 1, + /** + * Third color; for example, items which are new, active, requesting + * attention, etc. + * + * Alerting the user that a certain field must be filled out would be a + * good usage (although NegativeBackground could be used to the same + * effect, depending on what you are trying to achieve). Unlike + * ActiveText, this should not be used for mouseover effects. + */ + ActiveBackground = 2, + /** + * Fourth color; corresponds to (unvisited) links. + * + * Exactly what this might be used for is somewhat harder to qualify; + * it might be used for bookmarks, as a 'you can click here' indicator, + * or to highlight recent content (i.e. in a most-recently-accessed + * list). + */ + LinkBackground = 3, + /** + * Fifth color; corresponds to visited links. + * + * This can also be used to indicate "not recent" content, especially + * when a color is needed to denote content which is "old" or + * "archival". + */ + VisitedBackground = 4, + /** + * Sixth color; for example, errors, untrusted content, etc. + */ + NegativeBackground = 5, + /** + * Seventh color; for example, warnings, secure/encrypted content. + */ + NeutralBackground = 6, + /** + * Eigth color; for example, success messages, trusted content. + */ + PositiveBackground = 7 + }; + + /** + * This enumeration describes the foreground color being selected from the + * given set. + * + * Foreground colors are suitable for drawing text or glyphs (such as the + * symbols on window decoration buttons, assuming a suitable background + * brush is used), and should never be used to draw backgrounds. + * + * For window decorations, the following is suggested, but not set in + * stone: + * @li Maximize - PositiveText + * @li Minimize - NeutralText + * @li Close - NegativeText + * @li WhatsThis - LinkText + * @li Sticky - ActiveText + */ + enum ForegroundRole { + /** + * Normal foreground. + */ + NormalText = 0, + /** + * Second color; for example, comments, items which are old, inactive + * or disabled. Generally used for things that are meant to be "less + * important". InactiveText is not the same role as NormalText in the + * inactive state. + */ + InactiveText = 1, + /** + * Third color; for example items which are new, active, requesting + * attention, etc. May be used as a hover color for clickable items. + */ + ActiveText = 2, + /** + * Fourth color; use for (unvisited) links. May also be used for other + * clickable items or content that indicates relationships, items that + * indicate somewhere the user can visit, etc. + */ + LinkText = 3, + /** + * Fifth color; used for (visited) links. As with LinkText, may be used + * for items that have already been "visited" or accessed. May also be + * used to indicate "historical" (i.e. "old") items or information, + * especially if InactiveText is being used in the same context to + * express something different. + */ + VisitedText = 4, + /** + * Sixth color; for example, errors, untrusted content, deletions, + * etc. + */ + NegativeText = 5, + /** + * Seventh color; for example, warnings, secure/encrypted content. + */ + NeutralText = 6, + /** + * Eigth color; for example, additions, success messages, trusted + * content. + */ + PositiveText = 7 + }; + /** + * Retrieve the requested shade color, using the specified color as the + * base color and the system contrast setting. + * + * @note Shades are chosen such that all shades would contrast with the + * base color. This means that if base is very dark, the 'dark' shades will + * be lighter than the base color, with midlight() == shadow(). + * Conversely, if the base color is very light, the 'light' shades will be + * darker than the base color, with light() == mid(). + */ + Q_INVOKABLE QColor shade(const QColor& color, ShadeRole role); + Q_INVOKABLE QColor shade(const QColor& color, ShadeRole role, qreal contrast); /** + * Retrieve the requested shade color, using the specified color as the + * base color and the specified contrast. + * + * @param contrast Amount roughly specifying the contrast by which to + * adjust the base color, between -1.0 and 1.0 (values between 0.0 and 1.0 + * correspond to the value from KGlobalSettings::contrastF) + * + * @note Shades are chosen such that all shades would contrast with the + * base color. This means that if base is very dark, the 'dark' shades will + * be lighter than the base color, with midlight() == shadow(). + * Conversely, if the base color is very light, the 'light' shades will be + * darker than the base color, with light() == mid(). + * + * @see KColorUtils::shade + */ + Q_INVOKABLE QColor multiplyAlpha(const QColor& color, qreal alpha); + /** + * Retrieve the requested background brush's color for the @p active button. + * @param active Whether the active or inactive palette should be used. + */ + Q_INVOKABLE QColor background(bool active, BackgroundRole role = NormalBackground) const; + + /** + * Retrieve the requested foreground brush's color for the @p active button. + * @param active Whether the active or inactive palette should be used. + */ + Q_INVOKABLE QColor foreground(bool active, ForegroundRole role = NormalText) const; + + qreal contrast() const; +}; + +#endif diff --git a/clients/aurorae/src/decorationoptions.cpp b/clients/aurorae/src/decorationoptions.cpp new file mode 100644 index 0000000000..866b0ea68c --- /dev/null +++ b/clients/aurorae/src/decorationoptions.cpp @@ -0,0 +1,126 @@ +/******************************************************************** +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 . +*********************************************************************/ +#include "decorationoptions.h" +#include + +namespace KWin +{ + +DecorationOptions::DecorationOptions(QObject *parent) + : QObject(parent) + , m_active(true) + , m_decoration(NULL) +{ + connect(this, SIGNAL(decorationChanged()), SLOT(slotActiveChanged())); + connect(this, SIGNAL(decorationChanged()), SIGNAL(colorsChanged())); + connect(this, SIGNAL(decorationChanged()), SIGNAL(fontChanged())); +} + +DecorationOptions::~DecorationOptions() +{ +} + +QColor DecorationOptions::borderColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorFrame, m_active); +} + +QColor DecorationOptions::buttonColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorButtonBg, m_active); +} + +QColor DecorationOptions::fontColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorFont, m_active); +} + +QColor DecorationOptions::resizeHandleColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorHandle, m_active); +} + +QColor DecorationOptions::titleBarBlendColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorTitleBlend, m_active); +} + +QColor DecorationOptions::titleBarColor() const +{ + return KDecoration::options()->color(KDecorationDefines::ColorTitleBar, m_active); +} + +QFont DecorationOptions::titleFont() const +{ + return KDecoration::options()->font(m_active); +} + +QString DecorationOptions::titleButtonsLeft() const +{ + if (KDecoration::options()->customButtonPositions()) { + return KDecoration::options()->titleButtonsLeft(); + } else { + return KDecorationOptions::defaultTitleButtonsLeft(); + } +} + +QString DecorationOptions::titleButtonsRight() const +{ + if (KDecoration::options()->customButtonPositions()) { + return KDecoration::options()->titleButtonsRight(); + } else { + return KDecorationOptions::defaultTitleButtonsRight(); + } +} + +QObject *DecorationOptions::decoration() const +{ + return m_decoration; +} + +void DecorationOptions::setDecoration(QObject *decoration) +{ + if (m_decoration == decoration) { + return; + } + if (m_decoration) { + // disconnect from existing decoration + disconnect(m_decoration, SIGNAL(activeChanged()), this, SLOT(slotActiveChanged())); + disconnect(m_decoration, SIGNAL(buttonsChanged()), this, SIGNAL(titleButtonsChanged())); + } + m_decoration = decoration; + connect(m_decoration, SIGNAL(activeChanged()), SLOT(slotActiveChanged())); + connect(m_decoration, SIGNAL(buttonsChanged()), SIGNAL(titleButtonsChanged())); + emit decorationChanged(); +} + +void DecorationOptions::slotActiveChanged() +{ + if (!m_decoration) { + return; + } + if (m_active == m_decoration->property("active").toBool()) { + return; + } + m_active = m_decoration->property("active").toBool(); + emit colorsChanged(); + emit fontChanged(); +} + +} // namespace + +#include "decorationoptions.moc" diff --git a/clients/aurorae/src/decorationoptions.h b/clients/aurorae/src/decorationoptions.h new file mode 100644 index 0000000000..fd508b0f74 --- /dev/null +++ b/clients/aurorae/src/decorationoptions.h @@ -0,0 +1,144 @@ +/******************************************************************** +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 . +*********************************************************************/ +#ifndef KWIN_DECORATION_OPTIONS_H +#define KWIN_DECORATION_OPTIONS_H + +#include +#include +#include + +namespace KWin +{ + +/** + * @short Common Window Decoration Options. + * + * This Class provides common window decoration options which can be used, but do not have to + * be used by a window decoration. The class provides properties for global settings such as + * color, font and decoration button position. + * + * If a window decoration wants to follow the global color scheme it should honor the values + * provided by the properties. + * + * In any case it makes sense to respect the font settings for the decoration as this is also + * an accessibility feature. + * + * In order to use the options in a QML based window decoration an instance of this object needs + * to be created and the as a context property available "decoration" needs to be passed to the + * DecorationOptions instance: + * + * @code + * DecorationOptions { + * id: options + * deco: decoration + * } + * @endcode + **/ +class DecorationOptions : public QObject +{ + Q_OBJECT + /** + * The decoration Object for which this set of options should be used. The decoration is + * required to get the correct colors and fonts depending on whether the decoration represents + * an active or inactive window. + * + * Best pass the decoration object available as a context property to this property. + **/ + Q_PROPERTY(QObject *deco READ decoration WRITE setDecoration NOTIFY decorationChanged) + /** + * The color for the titlebar depending on the decoration's active state. + **/ + Q_PROPERTY(QColor titleBarColor READ titleBarColor NOTIFY colorsChanged) + /** + * The blend color for the titlebar depending on the decoration's active state. + **/ + Q_PROPERTY(QColor titleBarBlendColor READ titleBarBlendColor NOTIFY colorsChanged) + /** + * The titlebar text color depending on the decoration's active state. + **/ + Q_PROPERTY(QColor fontColor READ fontColor NOTIFY colorsChanged) + /** + * The color to use for titlebar buttons depending on the decoration's active state. + **/ + Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY colorsChanged) + /** + * The color for the window frame (border) depending on the decoration's active state. + **/ + Q_PROPERTY(QColor borderColor READ borderColor NOTIFY colorsChanged) + /** + * The color for the resize handle depending on the decoration's active state. + **/ + Q_PROPERTY(QColor resizeHandleColor READ resizeHandleColor NOTIFY colorsChanged) + /** + * The font to be used for the decoration caption depending on the decoration's active state. + **/ + Q_PROPERTY(QFont titleFont READ titleFont NOTIFY fontChanged) + /** + * The buttons to be positioned on the left side of the titlebar from left to right. + * + * Characters in the returned string have the following meaning: + *
    + *
  • 'M' menu button
  • + *
  • 'S' on all desktops button
  • + *
  • 'H' quickhelp button
  • + *
  • 'I' minimize button
  • + *
  • 'A' maximize button
  • + *
  • 'X' close button
  • + *
  • 'F' keep above button
  • + *
  • 'B' keep below button
  • + *
  • 'L' shade button
  • + *
  • '_' explicit spacer
  • + *
+ * @todo: make this a list of enum values + **/ + Q_PROPERTY(QString titleButtonsLeft READ titleButtonsLeft NOTIFY titleButtonsChanged) + /** + * The buttons to be positioned on the right side of the titlebar from left to right. + * @see titleButtonsRight + **/ + Q_PROPERTY(QString titleButtonsRight READ titleButtonsRight NOTIFY titleButtonsChanged) +public: + explicit DecorationOptions(QObject *parent = 0); + virtual ~DecorationOptions(); + + QColor titleBarColor() const; + QColor titleBarBlendColor() const; + QColor fontColor() const; + QColor buttonColor() const; + QColor borderColor() const; + QColor resizeHandleColor() const; + QFont titleFont() const; + QString titleButtonsLeft() const; + QString titleButtonsRight() const; + QObject *decoration() const; + void setDecoration(QObject *decoration); + +signals: + void colorsChanged(); + void fontChanged(); + void decorationChanged(); + void titleButtonsChanged(); + +private slots: + void slotActiveChanged(); + +private: + bool m_active; + QObject *m_decoration; +}; +} // namespace +#endif // KWIN_DECORATION_OPTIONS_H diff --git a/clients/aurorae/src/decorationplugin.cpp b/clients/aurorae/src/decorationplugin.cpp new file mode 100644 index 0000000000..2571f21958 --- /dev/null +++ b/clients/aurorae/src/decorationplugin.cpp @@ -0,0 +1,30 @@ +/******************************************************************** +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 . +*********************************************************************/ +#include "decorationplugin.h" +#include "colorhelper.h" +#include "decorationoptions.h" +#include +Q_EXPORT_PLUGIN2(decorationplugin, DecorationPlugin) + +void DecorationPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kde.kwin.decoration")); + qmlRegisterType(uri, 0, 1, "ColorHelper"); + qmlRegisterType(uri, 0, 1, "DecorationOptions"); +} + +#include "decorationplugin.moc" diff --git a/clients/aurorae/src/decorationplugin.h b/clients/aurorae/src/decorationplugin.h new file mode 100644 index 0000000000..0a9ef7c33c --- /dev/null +++ b/clients/aurorae/src/decorationplugin.h @@ -0,0 +1,28 @@ +/******************************************************************** +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 . +*********************************************************************/ +#ifndef DECORATION_PLUGIN_H +#define DECORATION_PLUGIN_H +#include + +class DecorationPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + void registerTypes(const char *uri); +}; + +#endif diff --git a/clients/aurorae/src/qml/ButtonGroup.qml b/clients/aurorae/src/qml/ButtonGroup.qml new file mode 100644 index 0000000000..578bb753bf --- /dev/null +++ b/clients/aurorae/src/qml/ButtonGroup.qml @@ -0,0 +1,88 @@ +/******************************************************************** +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 1.1 + +Item { + function createButtons() { + for (var i=0; i