diff --git a/containment/package/contents/ui/applet/communicator/Actions.qml b/containment/package/contents/ui/applet/communicator/Actions.qml index 055ecf8f..ee25fb39 100644 --- a/containment/package/contents/ui/applet/communicator/Actions.qml +++ b/containment/package/contents/ui/applet/communicator/Actions.qml @@ -1,123 +1,123 @@ /* * Copyright 2018 Michail Vourlakos * * This file is part of Latte-Dock * * Latte-Dock 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. * * Latte-Dock 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.7 import org.kde.latte 0.2 as Latte Item{ // NAME: latteSideColoringEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is FALSE, Latte is not painting/colorizing this applet // in any case. In such case the applet can use 'palette' // in order to access the color palette used at all cases from Latte // USE CASE: when Latte is transparent and applets colors need to be adjusted in order // to look consistent with the underlying desktop background OR the applet // is not using monochromatic icons but rather colorful ones. // @since: 0.9 // NAME: latteIconOverlayEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is FALSE, Latte is not overlaying any icons above // the applet or alters the applet visual in any sense. // That means that the applet is responsible to provide a coherent // parabolic effect experience. // @since: 0.9 // NAME: activeIndicatorEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is TRUE, Latte can show its own Active Indicator // when needed. For FALSE, the Latte Active Indicator is not drawn // or used for that applet. // @since: 0.9 // NAME: lengthMarginsEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is TRUE, all length margins are drawn including // indicator padding and applets distance. For FALSE, length margins // are not drawn at all. // @since: 0.9 // NAME: parabolicEffectEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is TRUE, Latte can use Parabolic Effect in order // to draw that applet. For FALSE, this applet is considered locked // and can not be zoomed. // @since: 0.9 // NAME: windowsTrackingEnabled // TYPE: bool // USAGE: writable through actions.setProperty // EXPLANATION: when is TRUE, Latte is informed that this applet requests // windows tracking. For FALSE, this applet is not requesting // windows tracking. // @since: 0.9 function setProperty(appletId, parameter, value) { if (parameter === "latteSideColoringEnabled") { mainCommunicator.latteSideColoringEnabled = value; } else if (parameter === "latteIconOverlayEnabled") { mainCommunicator.latteIconOverlayEnabled = value; } else if (parameter === "activeIndicatorEnabled") { mainCommunicator.activeIndicatorEnabled = value; } else if (parameter === "lengthMarginsEnabled") { mainCommunicator.lengthMarginsEnabled = value; } else if (parameter === "parabolicEffectLocked") { mainCommunicator.parabolicEffectLocked = value; } else if (parameter === "windowsTrackingEnabled") { mainCommunicator.windowsTrackingEnabled = value; } } - function getProperty(appletId, parameter, value) { + function getProperty(appletId, parameter) { if (parameter === "latteSideColoringEnabled") { return mainCommunicator.latteSideColoringEnabled; } else if (parameter === "latteIconOverlayEnabled") { return mainCommunicator.latteIconOverlayEnabled; } else if (parameter === "activeIndicatorEnabled") { return mainCommunicator.activeIndicatorEnabled; } else if (parameter === "lengthMarginsEnabled") { return mainCommunicator.lengthMarginsEnabled; } else if (parameter === "parabolicEffectLocked") { return mainCommunicator.parabolicEffectLocked; } else if (parameter === "windowsTrackingEnabled") { return mainCommunicator.windowsTrackingEnabled; } return null; } //! USAGE: send message to , for command and set its property to //! EXPLANATION: applets can send messages/commands to other applets //! in order to communicate with each other - function broadcastToApplet(pluginName, action, value) { - root.broadcastedToApplet(pluginName, action, value); + function broadcastToApplet(receiverPluginId, action, value) { + root.broadcastedToApplet(receiverPluginId, action, value); } function version(major, minor, patch) { return Latte.WindowSystem.makeVersion(major, minor, patch) } } diff --git a/containment/package/contents/ui/applet/communicator/LatteBridge.qml b/containment/package/contents/ui/applet/communicator/LatteBridge.qml index 693258e8..6cdaf883 100644 --- a/containment/package/contents/ui/applet/communicator/LatteBridge.qml +++ b/containment/package/contents/ui/applet/communicator/LatteBridge.qml @@ -1,115 +1,123 @@ /* * Copyright 2018 Michail Vourlakos * * This file is part of Latte-Dock * * Latte-Dock 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. * * Latte-Dock 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.7 Item{ id: settings //! EXPOSED SIGNALS //! USAGE: signals from other applets, , //! EXPLANATION: applets can receive signals from other applets //! to catch signals from other applets in order to communicate with //! each other signal broadcasted(string action, variant value); //! EXPOSED PROPERTIES // NAME: version // USAGE: read-only // EXPLANATION: Latte communication version in order for the applet to use only properties // and parameters that are valid // @since: 0.9 readonly property int version: root.version // NAME: inEditMode // USAGE: read-only // EXPLANATION: Latte sets it to true when this applet is in a Latte containment and Latte // is also in EditMode, that means when the user is altering applets and Latte latteView settings // @since: 0.9 readonly property bool inEditMode: root.inConfigureAppletsMode + // NAME: inPlasmaPanelStyle + // USAGE: read-only + // EXPLANATION: Latte sets it to true when this view behaves as Plasma panel concerning + // drawing background shadows externally and applets can take this into account in order + // to adjust their appearance and behavior + // @since: 0.9 + readonly property bool inPlasmaPanelStyle: root.behaveAsPlasmaPanel + // NAME: palette // USAGE: read-only // EXPLANATION: Latte updates it to its coloring palette in order for the applet // to take responsibility of its coloring. // USE CASE: when Latte is transparent and applets colors need to be adjusted in order // to look consistent with the underlying desktop background // @since: 0.9 readonly property QtObject palette: !latteSideColoringEnabled ? colorizerManager : null // NAME: applyPalette // USAGE: read-only // EXPLANATION: Latte updates it to TRUE when the applet must use the provided // Latte "palette" and FALSE otherwise // USE CASE: when Latte is transparent and applets colors need to be adjusted in order // to look consistent with the underlying desktop background // @since: 0.9 readonly property bool applyPalette: !latteSideColoringEnabled ? colorizerManager.mustBeShown : false // NAME: parabolicEffectEnabled // USAGE: read-only // EXPLANATION: Parabolic Effect is enabled or not for this Latte View // USE CASE: it can be used from applets that want to be adjusted based // on the parabolic Effect or not // @since: 0.9 readonly property bool parabolicEffectEnabled: root.parabolicEffectEnabled && !appletItem.originalAppletBehavior // NAME: iconSize // USAGE: read-only // EXPLANATION: The current icon size used in the Latte View // USE CASE: it can be used from applets that want their size to be always // relevant to the view icon size // @since: 0.9 readonly property int iconSize: root.iconSize // NAME: maxZoomFactor // USAGE: read-only // EXPLANATION: The maximum zoom factor currently used // USE CASE: it can be used from applets that want to be informed what is the maximum // zoom factor currently used // @since: 0.9 readonly property real maxZoomFactor: root.zoomFactor // NAME: windowsTracker // USAGE: read-only // EXPLANATION: windows tracking based on the view this applet is present // USE CASE: it can be used from applets that want windows tracking in order // to update their appearance or their behavior accordingly // @since: 0.9 readonly property QtObject windowsTracker: mainCommunicator.windowsTrackingEnabled && latteView && latteView.windowsTracker ? latteView.windowsTracker : null property Item actions: Actions{} Connections { target: root onBroadcastedToApplet: { if (appletItem.applet && appletItem.applet.pluginName === pluginName) { settings.broadcasted(action, value); } } } //! Initialize Component.onCompleted: { appletRootItem.latteBridge = settings; } }