diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index ff5ce64d4..09cc3d641 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -1,303 +1,315 @@ /******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2014 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 "decoratedclient.h" #include "decorationpalette.h" #include "decorationrenderer.h" #include "abstract_client.h" #include "composite.h" #include "cursor.h" #include "options.h" #include "platform.h" #include "workspace.h" #include #include #include +#include namespace KWin { namespace Decoration { DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration) : QObject() , ApplicationMenuEnabledDecoratedClientPrivate(decoratedClient, decoration) , m_client(client) , m_clientSize(client->clientSize()) , m_renderer(nullptr) { createRenderer(); client->setDecoratedClient(QPointer(this)); connect(client, &AbstractClient::activeChanged, this, [decoratedClient, client]() { emit decoratedClient->activeChanged(client->isActive()); } ); connect(client, &AbstractClient::geometryChanged, this, [decoratedClient, this]() { if (m_client->clientSize() == m_clientSize) { return; } const auto oldSize = m_clientSize; m_clientSize = m_client->clientSize(); if (oldSize.width() != m_clientSize.width()) { emit decoratedClient->widthChanged(m_clientSize.width()); } if (oldSize.height() != m_clientSize.height()) { emit decoratedClient->heightChanged(m_clientSize.height()); } } ); connect(client, &AbstractClient::desktopChanged, this, [decoratedClient, client]() { emit decoratedClient->onAllDesktopsChanged(client->isOnAllDesktops()); } ); connect(client, &AbstractClient::captionChanged, this, [decoratedClient, client]() { emit decoratedClient->captionChanged(client->caption()); } ); connect(client, &AbstractClient::iconChanged, this, [decoratedClient, client]() { emit decoratedClient->iconChanged(client->icon()); } ); connect(client, &AbstractClient::shadeChanged, this, &Decoration::DecoratedClientImpl::signalShadeChange); connect(client, &AbstractClient::keepAboveChanged, decoratedClient, &KDecoration2::DecoratedClient::keepAboveChanged); connect(client, &AbstractClient::keepBelowChanged, decoratedClient, &KDecoration2::DecoratedClient::keepBelowChanged); m_compositorToggledConnection = connect(Compositor::self(), &Compositor::compositingToggled, this, [this, decoration]() { delete m_renderer; m_renderer = nullptr; createRenderer(); decoration->update(); } ); connect(Compositor::self(), &Compositor::aboutToDestroy, this, [this] { disconnect(m_compositorToggledConnection); m_compositorToggledConnection = QMetaObject::Connection(); } ); connect(client, &AbstractClient::quickTileModeChanged, decoratedClient, [this, decoratedClient]() { emit decoratedClient->adjacentScreenEdgesChanged(adjacentScreenEdges()); } ); connect(client, &AbstractClient::closeableChanged, decoratedClient, &KDecoration2::DecoratedClient::closeableChanged); connect(client, &AbstractClient::shadeableChanged, decoratedClient, &KDecoration2::DecoratedClient::shadeableChanged); connect(client, &AbstractClient::minimizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::minimizeableChanged); connect(client, &AbstractClient::maximizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::maximizeableChanged); connect(client, &AbstractClient::paletteChanged, decoratedClient, &KDecoration2::DecoratedClient::paletteChanged); connect(client, &AbstractClient::hasApplicationMenuChanged, decoratedClient, &KDecoration2::DecoratedClient::hasApplicationMenuChanged); connect(client, &AbstractClient::applicationMenuActiveChanged, decoratedClient, &KDecoration2::DecoratedClient::applicationMenuActiveChanged); } DecoratedClientImpl::~DecoratedClientImpl() = default; void DecoratedClientImpl::signalShadeChange() { emit decoratedClient()->shadedChanged(m_client->isShade()); } #define DELEGATE(type, name, clientName) \ type DecoratedClientImpl::name() const \ { \ return m_client->clientName(); \ } #define DELEGATE2(type, name) DELEGATE(type, name, name) DELEGATE2(QString, caption) DELEGATE2(bool, isActive) DELEGATE2(bool, isCloseable) DELEGATE(bool, isMaximizeable, isMaximizable) DELEGATE(bool, isMinimizeable, isMinimizable) DELEGATE2(bool, isModal) DELEGATE(bool, isMoveable, isMovable) DELEGATE(bool, isResizeable, isResizable) DELEGATE2(bool, isShadeable) DELEGATE2(bool, providesContextHelp) DELEGATE2(int, desktop) DELEGATE2(bool, isOnAllDesktops) DELEGATE2(QPalette, palette) DELEGATE2(QIcon, icon) #undef DELEGATE2 #undef DELEGATE #define DELEGATE(type, name, clientName) \ type DecoratedClientImpl::name() const \ { \ return m_client->clientName(); \ } DELEGATE(bool, isKeepAbove, keepAbove) DELEGATE(bool, isKeepBelow, keepBelow) DELEGATE(bool, isShaded, isShade) DELEGATE(WId, windowId, windowId) DELEGATE(WId, decorationId, frameId) #undef DELEGATE #define DELEGATE(name, op) \ void DecoratedClientImpl::name() \ { \ Workspace::self()->performWindowOperation(m_client, Options::op); \ } DELEGATE(requestToggleShade, ShadeOp) DELEGATE(requestToggleOnAllDesktops, OnAllDesktopsOp) DELEGATE(requestToggleKeepAbove, KeepAboveOp) DELEGATE(requestToggleKeepBelow, KeepBelowOp) #undef DELEGATE #define DELEGATE(name, clientName) \ void DecoratedClientImpl::name() \ { \ m_client->clientName(); \ } DELEGATE(requestContextHelp, showContextHelp) DELEGATE(requestMinimize, minimize) #undef DELEGATE void DecoratedClientImpl::requestClose() { QMetaObject::invokeMethod(m_client, "closeWindow", Qt::QueuedConnection); } QColor DecoratedClientImpl::color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const { auto dp = m_client->decorationPalette(); if (dp) { return dp->color(group, role); } return QColor(); } +void DecoratedClientImpl::requestShowToolTip(const QString &text) +{ + QPoint pos = Cursor::pos(); + QToolTip::showText(pos, text); +} + +void DecoratedClientImpl::requestHideToolTip() +{ + QToolTip::hideText(); +} + void DecoratedClientImpl::requestShowWindowMenu() { // TODO: add rect to requestShowWindowMenu Workspace::self()->showWindowMenu(QRect(Cursor::pos(), Cursor::pos()), m_client); } void DecoratedClientImpl::requestShowApplicationMenu(const QRect &rect, int actionId) { Workspace::self()->showApplicationMenu(rect, m_client, actionId); } void DecoratedClientImpl::showApplicationMenu(int actionId) { decoration()->showApplicationMenu(actionId); } void DecoratedClientImpl::requestToggleMaximization(Qt::MouseButtons buttons) { QMetaObject::invokeMethod(this, "delayedRequestToggleMaximization", Qt::QueuedConnection, Q_ARG(Options::WindowOperation, options->operationMaxButtonClick(buttons))); } void DecoratedClientImpl::delayedRequestToggleMaximization(Options::WindowOperation operation) { Workspace::self()->performWindowOperation(m_client, operation); } int DecoratedClientImpl::width() const { return m_clientSize.width(); } int DecoratedClientImpl::height() const { return m_clientSize.height(); } bool DecoratedClientImpl::isMaximizedVertically() const { return m_client->maximizeMode() & MaximizeVertical; } bool DecoratedClientImpl::isMaximized() const { return isMaximizedHorizontally() && isMaximizedVertically(); } bool DecoratedClientImpl::isMaximizedHorizontally() const { return m_client->maximizeMode() & MaximizeHorizontal; } Qt::Edges DecoratedClientImpl::adjacentScreenEdges() const { Qt::Edges edges; const QuickTileMode mode = m_client->quickTileMode(); if (mode.testFlag(QuickTileFlag::Left)) { edges |= Qt::LeftEdge; if (!mode.testFlag(QuickTileFlag::Top) && !mode.testFlag(QuickTileFlag::Bottom)) { // using complete side edges |= Qt::TopEdge | Qt::BottomEdge; } } if (mode.testFlag(QuickTileFlag::Top)) { edges |= Qt::TopEdge; } if (mode.testFlag(QuickTileFlag::Right)) { edges |= Qt::RightEdge; if (!mode.testFlag(QuickTileFlag::Top) && !mode.testFlag(QuickTileFlag::Bottom)) { // using complete side edges |= Qt::TopEdge | Qt::BottomEdge; } } if (mode.testFlag(QuickTileFlag::Bottom)) { edges |= Qt::BottomEdge; } return edges; } bool DecoratedClientImpl::hasApplicationMenu() const { return m_client->hasApplicationMenu(); } bool DecoratedClientImpl::isApplicationMenuActive() const { return m_client->applicationMenuActive(); } void DecoratedClientImpl::createRenderer() { m_renderer = kwinApp()->platform()->createDecorationRenderer(this); } void DecoratedClientImpl::destroyRenderer() { delete m_renderer; m_renderer = nullptr; } } } diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index e01a2e6a0..5323a0041 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -1,115 +1,117 @@ /******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2014 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_DECORATED_CLIENT_H #define KWIN_DECORATED_CLIENT_H #include "options.h" #include #include namespace KWin { class AbstractClient; namespace Decoration { class Renderer; class DecoratedClientImpl : public QObject, public KDecoration2::ApplicationMenuEnabledDecoratedClientPrivate { Q_OBJECT public: explicit DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration); virtual ~DecoratedClientImpl(); QString caption() const override; WId decorationId() const override; int desktop() const override; int height() const override; QIcon icon() const override; bool isActive() const override; bool isCloseable() const override; bool isKeepAbove() const override; bool isKeepBelow() const override; bool isMaximizeable() const override; bool isMaximized() const override; bool isMaximizedHorizontally() const override; bool isMaximizedVertically() const override; bool isMinimizeable() const override; bool isModal() const override; bool isMoveable() const override; bool isOnAllDesktops() const override; bool isResizeable() const override; bool isShadeable() const override; bool isShaded() const override; QPalette palette() const override; QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override; bool providesContextHelp() const override; int width() const override; WId windowId() const override; Qt::Edges adjacentScreenEdges() const override; bool hasApplicationMenu() const override; bool isApplicationMenuActive() const override; + void requestShowToolTip(const QString &text) override; + void requestHideToolTip() override; void requestClose() override; void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override; void requestMinimize() override; void requestShowWindowMenu() override; void requestShowApplicationMenu(const QRect &rect, int actionId) override; void requestToggleKeepAbove() override; void requestToggleKeepBelow() override; void requestToggleOnAllDesktops() override; void requestToggleShade() override; void showApplicationMenu(int actionId); AbstractClient *client() { return m_client; } Renderer *renderer() { return m_renderer; } void destroyRenderer(); KDecoration2::DecoratedClient *decoratedClient() { return KDecoration2::DecoratedClientPrivate::client(); } void signalShadeChange(); private Q_SLOTS: void delayedRequestToggleMaximization(Options::WindowOperation operation); private: void createRenderer(); AbstractClient *m_client; QSize m_clientSize; Renderer *m_renderer; QMetaObject::Connection m_compositorToggledConnection; }; } } #endif diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 2a022473f..c5856ebd5 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -1,455 +1,465 @@ /* * Copyright 2014 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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 "previewclient.h" #include #include #include #include #include #include namespace KDecoration2 { namespace Preview { PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) : QObject(decoration) , ApplicationMenuEnabledDecoratedClientPrivate(c, decoration) , m_icon(QIcon::fromTheme(QStringLiteral("start-here-kde"))) , m_iconName(m_icon.name()) , m_palette(QStringLiteral("kdeglobals")) , m_active(true) , m_closeable(true) , m_keepBelow(false) , m_keepAbove(false) , m_maximizable(true) , m_maximizedHorizontally(false) , m_maximizedVertically(false) , m_minimizable(true) , m_modal(false) , m_movable(true) , m_resizable(true) , m_shadeable(true) , m_shaded(false) , m_providesContextHelp(false) , m_desktop(1) , m_width(0) , m_height(0) , m_bordersTopEdge(false) , m_bordersLeftEdge(false) , m_bordersRightEdge(false) , m_bordersBottomEdge(false) { connect(this, &PreviewClient::captionChanged, c, &DecoratedClient::captionChanged); connect(this, &PreviewClient::activeChanged, c, &DecoratedClient::activeChanged); connect(this, &PreviewClient::closeableChanged, c, &DecoratedClient::closeableChanged); connect(this, &PreviewClient::keepAboveChanged, c, &DecoratedClient::keepAboveChanged); connect(this, &PreviewClient::keepBelowChanged, c, &DecoratedClient::keepBelowChanged); connect(this, &PreviewClient::maximizableChanged, c, &DecoratedClient::maximizeableChanged); connect(this, &PreviewClient::maximizedChanged, c, &DecoratedClient::maximizedChanged); connect(this, &PreviewClient::maximizedVerticallyChanged, c, &DecoratedClient::maximizedVerticallyChanged); connect(this, &PreviewClient::maximizedHorizontallyChanged, c, &DecoratedClient::maximizedHorizontallyChanged); connect(this, &PreviewClient::minimizableChanged, c, &DecoratedClient::minimizeableChanged); // connect(this, &PreviewClient::modalChanged, c, &DecoratedClient::modalChanged); connect(this, &PreviewClient::movableChanged, c, &DecoratedClient::moveableChanged); connect(this, &PreviewClient::onAllDesktopsChanged, c, &DecoratedClient::onAllDesktopsChanged); connect(this, &PreviewClient::resizableChanged, c, &DecoratedClient::resizeableChanged); connect(this, &PreviewClient::shadeableChanged, c, &DecoratedClient::shadeableChanged); connect(this, &PreviewClient::shadedChanged, c, &DecoratedClient::shadedChanged); connect(this, &PreviewClient::providesContextHelpChanged, c, &DecoratedClient::providesContextHelpChanged); connect(this, &PreviewClient::onAllDesktopsChanged, c, &DecoratedClient::onAllDesktopsChanged); connect(this, &PreviewClient::widthChanged, c, &DecoratedClient::widthChanged); connect(this, &PreviewClient::heightChanged, c, &DecoratedClient::heightChanged); connect(this, &PreviewClient::iconChanged, c, &DecoratedClient::iconChanged); connect(this, &PreviewClient::paletteChanged, c, &DecoratedClient::paletteChanged); // connect(this, &PreviewClient::, c, &DecoratedClient::); connect(this, &PreviewClient::maximizedVerticallyChanged, this, [this]() { emit maximizedChanged(isMaximized()); } ); connect(this, &PreviewClient::maximizedHorizontallyChanged, this, [this]() { emit maximizedChanged(isMaximized()); } ); connect(this, &PreviewClient::iconNameChanged, this, [this]() { m_icon = QIcon::fromTheme(m_iconName); emit iconChanged(m_icon); } ); connect(this, &PreviewClient::desktopChanged, this, [this]() { emit onAllDesktopsChanged(isOnAllDesktops()); } ); connect(&m_palette, &KWin::Decoration::DecorationPalette::changed, [this]() { emit paletteChanged(m_palette.palette()); }); auto emitEdgesChanged = [this, c]() { c->adjacentScreenEdgesChanged(adjacentScreenEdges()); }; connect(this, &PreviewClient::bordersTopEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersLeftEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersRightEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersBottomEdgeChanged, this, emitEdgesChanged); qApp->installEventFilter(this); } PreviewClient::~PreviewClient() = default; void PreviewClient::setIcon(const QIcon &pixmap) { m_icon = pixmap; emit iconChanged(m_icon); } int PreviewClient::width() const { return m_width; } int PreviewClient::height() const { return m_height; } QString PreviewClient::caption() const { return m_caption; } WId PreviewClient::decorationId() const { return 0; } int PreviewClient::desktop() const { return m_desktop; } void PreviewClient::setDesktop(int desktop) { if (desktop == 0) { desktop = 1; } if (m_desktop == desktop) { return; } m_desktop = desktop; emit desktopChanged(m_desktop); } QIcon PreviewClient::icon() const { return m_icon; } QString PreviewClient::iconName() const { return m_iconName; } bool PreviewClient::isActive() const { return m_active; } bool PreviewClient::isCloseable() const { return m_closeable; } bool PreviewClient::isKeepAbove() const { return m_keepAbove; } bool PreviewClient::isKeepBelow() const { return m_keepBelow; } bool PreviewClient::isMaximizeable() const { return m_maximizable; } bool PreviewClient::isMaximized() const { return isMaximizedHorizontally() && isMaximizedVertically(); } bool PreviewClient::isMaximizedHorizontally() const { return m_maximizedHorizontally; } bool PreviewClient::isMaximizedVertically() const { return m_maximizedVertically; } bool PreviewClient::isMinimizeable() const { return m_minimizable; } bool PreviewClient::isModal() const { return m_modal; } bool PreviewClient::isMoveable() const { return m_movable; } bool PreviewClient::isOnAllDesktops() const { return desktop() == -1; } bool PreviewClient::isResizeable() const { return m_resizable; } bool PreviewClient::isShadeable() const { return m_shadeable; } bool PreviewClient::isShaded() const { return m_shaded; } bool PreviewClient::providesContextHelp() const { return m_providesContextHelp; } WId PreviewClient::windowId() const { return 0; } QPalette PreviewClient::palette() const { return m_palette.palette(); } QColor PreviewClient::color(ColorGroup group, ColorRole role) const { return m_palette.color(group, role); } Qt::Edges PreviewClient::adjacentScreenEdges() const { Qt::Edges edges; if (m_bordersBottomEdge) { edges |= Qt::BottomEdge; } if (m_bordersLeftEdge) { edges |= Qt::LeftEdge; } if (m_bordersRightEdge) { edges |= Qt::RightEdge; } if (m_bordersTopEdge) { edges |= Qt::TopEdge; } return edges; } bool PreviewClient::hasApplicationMenu() const { return true; } bool PreviewClient::isApplicationMenuActive() const { return false; } bool PreviewClient::bordersBottomEdge() const { return m_bordersBottomEdge; } bool PreviewClient::bordersLeftEdge() const { return m_bordersLeftEdge; } bool PreviewClient::bordersRightEdge() const { return m_bordersRightEdge; } bool PreviewClient::bordersTopEdge() const { return m_bordersTopEdge; } void PreviewClient::setBordersBottomEdge(bool enabled) { if (m_bordersBottomEdge == enabled) { return; } m_bordersBottomEdge = enabled; emit bordersBottomEdgeChanged(enabled); } void PreviewClient::setBordersLeftEdge(bool enabled) { if (m_bordersLeftEdge == enabled) { return; } m_bordersLeftEdge = enabled; emit bordersLeftEdgeChanged(enabled); } void PreviewClient::setBordersRightEdge(bool enabled) { if (m_bordersRightEdge == enabled) { return; } m_bordersRightEdge = enabled; emit bordersRightEdgeChanged(enabled); } void PreviewClient::setBordersTopEdge(bool enabled) { if (m_bordersTopEdge == enabled) { return; } m_bordersTopEdge = enabled; emit bordersTopEdgeChanged(enabled); } +void PreviewClient::requestShowToolTip(const QString &text) +{ + qDebug() << "tooltip show requested with text:" << text; +} + +void PreviewClient::requestHideToolTip() +{ + qDebug() << "tooltip hide requested"; +} + void PreviewClient::requestClose() { emit closeRequested(); } void PreviewClient::requestContextHelp() { qDebug() << "context help requested"; } void PreviewClient::requestToggleMaximization(Qt::MouseButtons buttons) { if (buttons.testFlag(Qt::LeftButton)) { const bool set = !isMaximized(); setMaximizedHorizontally(set); setMaximizedVertically(set); } else if (buttons.testFlag(Qt::RightButton)) { setMaximizedHorizontally(!isMaximizedHorizontally()); } else if (buttons.testFlag(Qt::MiddleButton)) { setMaximizedVertically(!isMaximizedVertically()); } } void PreviewClient::requestMinimize() { emit minimizeRequested(); } void PreviewClient::requestToggleKeepAbove() { setKeepAbove(!isKeepAbove()); } void PreviewClient::requestToggleKeepBelow() { setKeepBelow(!isKeepBelow()); } void PreviewClient::requestShowWindowMenu() { emit showWindowMenuRequested(); } void PreviewClient::requestShowApplicationMenu(const QRect &rect, int actionId) { Q_UNUSED(rect); Q_UNUSED(actionId); } void PreviewClient::showApplicationMenu(int actionId) { Q_UNUSED(actionId) } void PreviewClient::requestToggleOnAllDesktops() { setDesktop(isOnAllDesktops() ? 1 : -1); } void PreviewClient::requestToggleShade() { setShaded(!isShaded()); } #define SETTER(type, name, variable) \ void PreviewClient::name(type variable) \ { \ if (m_##variable == variable) { \ return; \ } \ qDebug() << "Setting " << #variable << ":" << variable;\ m_##variable = variable; \ emit variable##Changed(m_##variable); \ } #define SETTER2(name, variable) SETTER(bool, name, variable) SETTER(const QString &, setCaption, caption) SETTER(const QString &, setIconName, iconName) SETTER(int, setWidth, width) SETTER(int, setHeight, height) SETTER2(setActive, active) SETTER2(setCloseable, closeable) SETTER2(setMaximizable, maximizable) SETTER2(setKeepBelow, keepBelow) SETTER2(setKeepAbove, keepAbove) SETTER2(setMaximizedHorizontally, maximizedHorizontally) SETTER2(setMaximizedVertically, maximizedVertically) SETTER2(setMinimizable, minimizable) SETTER2(setModal, modal) SETTER2(setMovable, movable) SETTER2(setResizable, resizable) SETTER2(setShadeable, shadeable) SETTER2(setShaded, shaded) SETTER2(setProvidesContextHelp, providesContextHelp) #undef SETTER2 #undef SETTER } // namespace Preview } // namespace KDecoration2 diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h index 8fb681e1e..df3608393 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h @@ -1,212 +1,214 @@ /* * Copyright 2014 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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 KDECOARTIONS_PREVIEW_CLIENT_H #define KDECOARTIONS_PREVIEW_CLIENT_H #include "../../../decorations/decorationpalette.h" #include #include #include class QAbstractItemModel; namespace KDecoration2 { namespace Preview { class PreviewClient : public QObject, public ApplicationMenuEnabledDecoratedClientPrivate { Q_OBJECT Q_PROPERTY(KDecoration2::Decoration *decoration READ decoration CONSTANT) Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged) Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged) Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool closeable READ isCloseable WRITE setCloseable NOTIFY closeableChanged) Q_PROPERTY(bool keepAbove READ isKeepAbove WRITE setKeepAbove NOTIFY keepAboveChanged) Q_PROPERTY(bool keepBelow READ isKeepBelow WRITE setKeepBelow NOTIFY keepBelowChanged) Q_PROPERTY(bool maximizable READ isMaximizeable WRITE setMaximizable NOTIFY maximizableChanged) Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizedChanged) Q_PROPERTY(bool maximizedVertically READ isMaximizedVertically WRITE setMaximizedVertically NOTIFY maximizedVerticallyChanged) Q_PROPERTY(bool maximizedHorizontally READ isMaximizedHorizontally WRITE setMaximizedHorizontally NOTIFY maximizedHorizontallyChanged) Q_PROPERTY(bool minimizable READ isMinimizeable WRITE setMinimizable NOTIFY minimizableChanged) Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged) Q_PROPERTY(bool movable READ isMoveable WRITE setMovable NOTIFY movableChanged) Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY onAllDesktopsChanged) Q_PROPERTY(bool resizable READ isResizeable WRITE setResizable NOTIFY resizableChanged) Q_PROPERTY(bool shadeable READ isShadeable WRITE setShadeable NOTIFY shadeableChanged) Q_PROPERTY(bool shaded READ isShaded WRITE setShaded NOTIFY shadedChanged) Q_PROPERTY(bool providesContextHelp READ providesContextHelp WRITE setProvidesContextHelp NOTIFY providesContextHelpChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) Q_PROPERTY(bool bordersTopEdge READ bordersTopEdge WRITE setBordersTopEdge NOTIFY bordersTopEdgeChanged) Q_PROPERTY(bool bordersLeftEdge READ bordersLeftEdge WRITE setBordersLeftEdge NOTIFY bordersLeftEdgeChanged) Q_PROPERTY(bool bordersRightEdge READ bordersRightEdge WRITE setBordersRightEdge NOTIFY bordersRightEdgeChanged) Q_PROPERTY(bool bordersBottomEdge READ bordersBottomEdge WRITE setBordersBottomEdge NOTIFY bordersBottomEdgeChanged) public: explicit PreviewClient(DecoratedClient *client, Decoration *decoration); virtual ~PreviewClient(); QString caption() const override; WId decorationId() const override; WId windowId() const override; int desktop() const override; QIcon icon() const override; bool isActive() const override; bool isCloseable() const override; bool isKeepAbove() const override; bool isKeepBelow() const override; bool isMaximizeable() const override; bool isMaximized() const override; bool isMaximizedVertically() const override; bool isMaximizedHorizontally() const override; bool isMinimizeable() const override; bool isModal() const override; bool isMoveable() const override; bool isOnAllDesktops() const override; bool isResizeable() const override; bool isShadeable() const override; bool isShaded() const override; bool providesContextHelp() const override; int width() const override; int height() const override; QPalette palette() const override; QColor color(ColorGroup group, ColorRole role) const override; Qt::Edges adjacentScreenEdges() const override; bool hasApplicationMenu() const override; bool isApplicationMenuActive() const override; + void requestShowToolTip(const QString &text) override; + void requestHideToolTip() override; void requestClose() override; void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override; void requestMinimize() override; void requestToggleKeepAbove() override; void requestToggleKeepBelow() override; void requestToggleShade() override; void requestShowWindowMenu() override; void requestShowApplicationMenu(const QRect &rect, int actionId) override; void requestToggleOnAllDesktops() override; void showApplicationMenu(int actionId); void setCaption(const QString &caption); void setActive(bool active); void setCloseable(bool closeable); void setMaximizable(bool maximizable); void setKeepBelow(bool keepBelow); void setKeepAbove(bool keepAbove); void setMaximizedHorizontally(bool maximized); void setMaximizedVertically(bool maximized); void setMinimizable(bool minimizable); void setModal(bool modal); void setMovable(bool movable); void setResizable(bool resizable); void setShadeable(bool shadeable); void setShaded(bool shaded); void setProvidesContextHelp(bool contextHelp); void setDesktop(int desktop); void setWidth(int width); void setHeight(int height); QString iconName() const; void setIconName(const QString &icon); void setIcon(const QIcon &icon); bool bordersTopEdge() const; bool bordersLeftEdge() const; bool bordersRightEdge() const; bool bordersBottomEdge() const; void setBordersTopEdge(bool enabled); void setBordersLeftEdge(bool enabled); void setBordersRightEdge(bool enabled); void setBordersBottomEdge(bool enabled); Q_SIGNALS: void captionChanged(const QString &); void iconChanged(const QIcon &); void iconNameChanged(const QString &); void activeChanged(bool); void closeableChanged(bool); void keepAboveChanged(bool); void keepBelowChanged(bool); void maximizableChanged(bool); void maximizedChanged(bool); void maximizedVerticallyChanged(bool); void maximizedHorizontallyChanged(bool); void minimizableChanged(bool); void modalChanged(bool); void movableChanged(bool); void onAllDesktopsChanged(bool); void resizableChanged(bool); void shadeableChanged(bool); void shadedChanged(bool); void providesContextHelpChanged(bool); void desktopChanged(int); void widthChanged(int); void heightChanged(int); void paletteChanged(const QPalette&); void bordersTopEdgeChanged(bool); void bordersLeftEdgeChanged(bool); void bordersRightEdgeChanged(bool); void bordersBottomEdgeChanged(bool); void showWindowMenuRequested(); void showApplicationMenuRequested(); void minimizeRequested(); void closeRequested(); private: QString m_caption; QIcon m_icon; QString m_iconName; KWin::Decoration::DecorationPalette m_palette; bool m_active; bool m_closeable; bool m_keepBelow; bool m_keepAbove; bool m_maximizable; bool m_maximizedHorizontally; bool m_maximizedVertically; bool m_minimizable; bool m_modal; bool m_movable; bool m_resizable; bool m_shadeable; bool m_shaded; bool m_providesContextHelp; int m_desktop; int m_width; int m_height; bool m_bordersTopEdge; bool m_bordersLeftEdge; bool m_bordersRightEdge; bool m_bordersBottomEdge; }; } // namespace Preview } // namespace KDecoration2 #endif