diff --git a/containment/package/contents/ui/applet/HiddenSpacer.qml b/containment/package/contents/ui/applet/HiddenSpacer.qml index 3a582ee3..85a43162 100644 --- a/containment/package/contents/ui/applet/HiddenSpacer.qml +++ b/containment/package/contents/ui/applet/HiddenSpacer.qml @@ -1,98 +1,98 @@ /* * Copyright 2016 Smith AR * 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.1 import org.kde.latte 0.2 as Latte import org.kde.latte.core 0.2 as LatteCore Item{ id: hiddenSpacer //we add one missing pixel from calculations width: root.isHorizontal ? nHiddenSize : wrapper.width height: root.isHorizontal ? wrapper.height : nHiddenSize ///check also if this is the first/last plasmoid in anylayout visible: (rightSpacer ? appletItem.lastAppletInContainer : appletItem.firstAppletInContainer) || separatorSpace>0 property bool neighbourSeparator: false; property int separatorSpace: neighbourSeparator && !appletItem.isSeparator && root.parabolicEffectEnabled && !appletItem.latteApplet ? ((LatteCore.Environment.separatorLength/2)+root.lengthExtMargin) : subtrackedMargins property real nHiddenSize: { if (isSeparator || !communicator.requires.lengthMarginsEnabled) { return 0; } return (nScale > 0) ? (appletItem.spacersMaxSize * nScale) + separatorSpace : separatorSpace } property bool rightSpacer: false readonly property bool atEdgeForcingFittsLaw: !isSeparator && !parabolicEffectMarginsEnabled && atScreenEdge readonly property int subtrackedMargins: { if (atEdgeForcingFittsLaw && ((firstAppletInContainer && rightSpacer) || (lastAppletInContainer && !rightSpacer ))) { - return (wrapperAlias.requires.edgeLengthMarginsDisabled ? root.lengthExtMargin + appletItem.lengthAppletIntMargin : root.lengthExtMargin); + return (wrapperAlias.edgeLengthMarginsDisabled ? root.lengthExtMargin + appletItem.lengthAppletIntMargin : root.lengthExtMargin); } return 0; } property real nScale: 0 Behavior on nHiddenSize { id: animatedBehavior enabled: !root.globalDirectRender || restoreAnimation.running NumberAnimation { duration: 3 * appletItem.animationTime } } Behavior on nHiddenSize { id: directBehavior enabled: !animatedBehavior.running NumberAnimation { duration: root.directRenderAnimationTime } } Connections{ target: root onSeparatorsUpdated: updateNeighbour(); } function updateNeighbour() { hiddenSpacer.neighbourSeparator = hiddenSpacer.rightSpacer ? parabolicManager.isSeparator(index+1) : parabolicManager.isSeparator(index-1) } Loader{ active: root.debugModeSpacers sourceComponent: Rectangle{ width: !root.isVertical ? hiddenSpacer.width : 1 height: !root.isVertical ? 1 : hiddenSpacer.height x: root.isVertical ? hiddenSpacer.width/2 : 0 y: !root.isVertical ? hiddenSpacer.height/2 : 0 border.width: 1 border.color: "red" color: "transparent" } } } diff --git a/containment/package/contents/ui/applet/communicator/Actions.qml b/containment/package/contents/ui/applet/communicator/Actions.qml index b37d909f..b5912fd5 100644 --- a/containment/package/contents/ui/applet/communicator/Actions.qml +++ b/containment/package/contents/ui/applet/communicator/Actions.qml @@ -1,128 +1,75 @@ /* * 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 import org.kde.latte.core 0.2 as LatteCore 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.requires.latteSideColoringEnabled = value; } else if (parameter === "latteIconOverlayEnabled") { mainCommunicator.requires.latteIconOverlayEnabled = value; } else if (parameter === "activeIndicatorEnabled") { mainCommunicator.requires.activeIndicatorEnabled = value; } else if (parameter === "lengthMarginsEnabled") { mainCommunicator.requires.lengthMarginsEnabled = value; } else if (parameter === "parabolicEffectLocked") { mainCommunicator.requires.parabolicEffectLocked = value; } else if (parameter === "screenEdgeMarginSupported") { mainCommunicator.requires.screenEdgeMarginSupported = value; } else if (parameter === "windowsTrackingEnabled") { mainCommunicator.requires.windowsTrackingEnabled = value; } } function getProperty(appletId, parameter) { if (parameter === "latteSideColoringEnabled") { return mainCommunicator.requires.latteSideColoringEnabled; } else if (parameter === "latteIconOverlayEnabled") { return mainCommunicator.requires.latteIconOverlayEnabled; } else if (parameter === "activeIndicatorEnabled") { return mainCommunicator.requires.activeIndicatorEnabled; } else if (parameter === "lengthMarginsEnabled") { return mainCommunicator.requires.lengthMarginsEnabled; } else if (parameter === "parabolicEffectLocked") { return mainCommunicator.requires.parabolicEffectLocked; } else if (parameter === "screenEdgeMarginSupported") { return mainCommunicator.requires.screenEdgeMarginSupported; } else if (parameter === "windowsTrackingEnabled") { return mainCommunicator.requires.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(receiverPluginId, action, value) { root.broadcastedToApplet(receiverPluginId, action, value); } function version(major, minor, patch) { return LatteCore.Environment.makeVersion(major, minor, patch) } } diff --git a/containment/package/contents/ui/applet/communicator/Engine.qml b/containment/package/contents/ui/applet/communicator/Engine.qml index fed5b488..7c820eeb 100644 --- a/containment/package/contents/ui/applet/communicator/Engine.qml +++ b/containment/package/contents/ui/applet/communicator/Engine.qml @@ -1,149 +1,143 @@ /* * 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.abilities 0.1 as Abilities + import "../../../code/AppletIdentifier.js" as AppletIdentifier Item{ id: mainCommunicator // ------------------------------------- // BEGIN OF INTERNAL APPLET PROPERTIES // LATTE<->APPLET COMMUNICATION PROTOCOL // ------------------------------------- // // NAME: latteBridge // USAGE: property QtObject latteBridge: null // EXPLANATION: The main shared object that Latte is using to communicate with the applet property bool appletContainsLatteBridge: appletRootItem && appletRootItem.hasOwnProperty("latteBridge") ? true : false //! END OF INTERNAL APPLET PROPERTIES // ------------------------------------- //! BEGIN OF PROPERTIES //this is used for folderView and icon widgets to fake their visual icons readonly property bool canShowOverlaiedLatteIcon: appletIconItem && appletIconItem.visible readonly property bool overlayLatteIconIsActive: canShowOverlaiedLatteIcon && requires.latteIconOverlayEnabled property Item appletRootItem: appletDiscoveredRootItem ? appletDiscoveredRootItem : appletDefaultRootItem property Item appletDiscoveredRootItem: null property Item appletDefaultRootItem: applet && applet.children && applet.children.length>0 ? applet.children[0] : null property Item appletIconItem; //first applet's IconItem to be used by Latte property Item appletImageItem; //first applet's ImageItem to be used by Latte //! END OF PROPERTIES //! BEGIN OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS - readonly property Item requires: Item { - property bool latteSideColoringEnabled: true - property bool latteIconOverlayEnabled: true - property bool activeIndicatorEnabled: true - property bool lengthMarginsEnabled: true - property bool windowsTrackingEnabled: false - property bool parabolicEffectLocked: false - property bool screenEdgeMarginSupported: false - } + readonly property Item requires: Abilities.AppletRequirements{} //! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS //! BEGIN OF PROPERTY CHANGES //! END OF PROPERTY CHANGES property bool windowsTrackingEnabledSent: false //! BEGIN OF FUNCTIONS function appletIconItemIsShown() { return appletIconItem && appletIconItem.visible; } function appletImageItemIsShown() { return appletImageItem && appletImageItem.visible; } function reconsiderAppletIconItem() { AppletIdentifier.reconsiderAppletIconItem(); } function setAppletIconItemActive(isActive) { if (appletIconItem) { appletIconItem.active = isActive; } } //! END OF FUNCTIONS Connections { target: requires onWindowsTrackingEnabledChanged: { if (requires.windowsTrackingEnabled && !mainCommunicator.windowsTrackingEnabledSent) { mainCommunicator.windowsTrackingEnabledSent = true; root.slotAppletsNeedWindowsTracking(1); } else if (!requires.windowsTrackingEnabled && mainCommunicator.windowsTrackingEnabledSent) { mainCommunicator.windowsTrackingEnabledSent = false; root.slotAppletsNeedWindowsTracking(-1); } } } //! BEGIN OF CONNECTIONS Connections{ target: appletItem onAppletChanged: { if (applet) { AppletIdentifier.checkAndUpdateAppletRootItem(); AppletIdentifier.reconsiderAppletIconItem(); overlayInitTimer.start(); } } } Component.onDestruction: { if (requires.windowsTrackingEnabled && windowsTrackingEnabledSent) { windowsTrackingEnabledSent = false; root.slotAppletsNeedWindowsTracking(-1); } } //! END OF CONNECTIONS //! BEGIN OF LOADERS Loader{ id: bridgeLoader active: appletContainsLatteBridge sourceComponent: LatteBridge{} } //! END OF LOADERS //! BEGIN OF TIMERS //a timer that is used in order to init some Communicator values Timer { id: overlayInitTimer interval: 4000 onTriggered: { AppletIdentifier.checkAndUpdateAppletRootItem(); AppletIdentifier.reconsiderAppletIconItem(); if (root.debugModeTimers) { console.log("containment timer: appletItem fakeInitTimer called..."); } } } //! END OF TIMERS } diff --git a/declarativeimports/CMakeLists.txt b/declarativeimports/CMakeLists.txt index 2d1e2507..22e164a5 100644 --- a/declarativeimports/CMakeLists.txt +++ b/declarativeimports/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(core) +install(DIRECTORY abilities/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte/abilities) install(DIRECTORY components/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte/components) diff --git a/declarativeimports/abilities/AppletRequirements.qml b/declarativeimports/abilities/AppletRequirements.qml new file mode 100644 index 00000000..a3029f13 --- /dev/null +++ b/declarativeimports/abilities/AppletRequirements.qml @@ -0,0 +1,74 @@ +/* +* Copyright 2020 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.0 + +Item{ + property bool activeIndicatorEnabled: true + property bool latteSideColoringEnabled: true + property bool latteIconOverlayEnabled: true + property bool lengthMarginsEnabled: true + property bool parabolicEffectLocked: false + property bool screenEdgeMarginSupported: false + property bool windowsTrackingEnabled: false + + // NAME: activeIndicatorEnabled + // 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: latteSideColoringEnabled + // 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 + // 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: lengthMarginsEnabled + // 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: parabolicEffectLocked + // EXPLANATION: For TRUE, this applet is considered locked + // and can not be zoomed. + // SINCE: 0.9 + + // NAME: screenEdgeMarginSupported + // EXPLANATION: For TRUE, this applet can handle the screen edge margin on + // its own and Latte should not take any special actions to help it + // work properly. + // SINCE: 0.10 + + // NAME: windowsTrackingEnabled + // EXPLANATION: when is TRUE, Latte is informed that applet requests + // windows tracking functionality. + // SINCE: 0.9 +} diff --git a/declarativeimports/abilities/qmldir b/declarativeimports/abilities/qmldir new file mode 100644 index 00000000..384e2628 --- /dev/null +++ b/declarativeimports/abilities/qmldir @@ -0,0 +1,3 @@ +module org.kde.latte.abilities + +AppletRequirements 0.1 AppletRequirements.qml diff --git a/indicators/default/package/config/config.qml b/indicators/default/package/config/config.qml index b12f3e0f..503f42f4 100644 --- a/indicators/default/package/config/config.qml +++ b/indicators/default/package/config/config.qml @@ -1,294 +1,293 @@ /* * 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 QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.plasmoid 2.0 -import org.kde.latte 0.2 as Latte import org.kde.latte.components 1.0 as LatteComponents ColumnLayout { id: root Layout.fillWidth: true LatteComponents.SubHeader { text: i18nc("active indicator style","Style For Active") } RowLayout { Layout.fillWidth: true spacing: 2 property int indicatorType: indicator.configuration.activeStyle readonly property int buttonsCount: 2 readonly property int buttonSize: (dialog.optionsWidth - (spacing * buttonsCount-1)) / buttonsCount ExclusiveGroup { id: activeIndicatorTypeGroup onCurrentChanged: { if (current.checked) { indicator.configuration.activeStyle = current.indicatorType; } } } PlasmaComponents.Button { Layout.minimumWidth: parent.buttonSize Layout.maximumWidth: Layout.minimumWidth text: i18nc("line indicator","Line") checked: parent.indicatorType === indicatorType checkable: true exclusiveGroup: activeIndicatorTypeGroup tooltip: i18n("Show a line indicator for active items") readonly property int indicatorType: 0 /*Line*/ } PlasmaComponents.Button { Layout.minimumWidth: parent.buttonSize Layout.maximumWidth: Layout.minimumWidth text: i18nc("dot indicator", "Dot") checked: parent.indicatorType === indicatorType checkable: true exclusiveGroup: activeIndicatorTypeGroup tooltip: i18n("Show a dot indicator for active items") readonly property int indicatorType: 1 /*Dot*/ } } LatteComponents.HeaderSwitch { id: glowEnabled Layout.fillWidth: true Layout.minimumHeight: implicitHeight Layout.bottomMargin: units.smallSpacing checked: indicator.configuration.glowEnabled level: 2 text: i18n("Glow") tooltip: i18n("Enable/disable indicator glow") onPressed: { indicator.configuration.glowEnabled = !indicator.configuration.glowEnabled; } } RowLayout { Layout.fillWidth: true spacing: 2 enabled: indicator.configuration.glowEnabled property int option: indicator.configuration.glowApplyTo readonly property int buttonsCount: 2 readonly property int buttonSize: (dialog.optionsWidth - (spacing * buttonsCount-1)) / buttonsCount ExclusiveGroup { id: glowGroup onCurrentChanged: { if (current.checked) indicator.configuration.glowApplyTo = current.option } } PlasmaComponents.Button { Layout.minimumWidth: parent.buttonSize Layout.maximumWidth: Layout.minimumWidth text: i18nc("glow only to active task/applet indicators","On Active") checked: parent.option === option checkable: true exclusiveGroup: glowGroup tooltip: i18n("Add glow only to active task/applet indicator") readonly property int option: 1 /*OnActive*/ } PlasmaComponents.Button { Layout.minimumWidth: parent.buttonSize Layout.maximumWidth: Layout.minimumWidth text: i18nc("glow to all task/applet indicators","All") checked: parent.option === option checkable: true exclusiveGroup: glowGroup tooltip: i18n("Add glow to all task/applet indicators") readonly property int option: 2 /*All*/ } } RowLayout { Layout.fillWidth: true spacing: 2 enabled: indicator.configuration.glowEnabled PlasmaComponents.Label { Layout.minimumWidth: implicitWidth horizontalAlignment: Text.AlignLeft Layout.rightMargin: units.smallSpacing text: i18n("Opacity") } LatteComponents.Slider { id: glowOpacitySlider Layout.fillWidth: true leftPadding: 0 value: indicator.configuration.glowOpacity * 100 from: 0 to: 100 stepSize: 5 wheelEnabled: false function updateGlowOpacity() { if (!pressed) indicator.configuration.glowOpacity = value/100; } onPressedChanged: { updateGlowOpacity(); } Component.onCompleted: { valueChanged.connect(updateGlowOpacity); } Component.onDestruction: { valueChanged.disconnect(updateGlowOpacity); } } PlasmaComponents.Label { text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(glowOpacitySlider.value) horizontalAlignment: Text.AlignRight Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 } } LatteComponents.SubHeader { text: i18n("Padding") } RowLayout { Layout.fillWidth: true spacing: units.smallSpacing PlasmaComponents.Label { text: i18n("Length") horizontalAlignment: Text.AlignLeft } LatteComponents.Slider { id: lengthIntMarginSlider Layout.fillWidth: true value: Math.round(indicator.configuration.lengthPadding * 100) from: 0 to: maxMargin stepSize: 1 wheelEnabled: false readonly property int maxMargin: 80 onPressedChanged: { if (!pressed) { indicator.configuration.lengthPadding = value / 100; } } } PlasmaComponents.Label { text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(currentValue) horizontalAlignment: Text.AlignRight Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 readonly property int currentValue: lengthIntMarginSlider.value } } ColumnLayout { spacing: 0 visible: indicator.latteTasksArePresent LatteComponents.SubHeader { enabled: indicator.configuration.glowApplyTo!==0/*None*/ text: i18n("Tasks") } LatteComponents.CheckBoxesColumn { LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Different color for minimized windows") checked: indicator.configuration.minimizedTaskColoredDifferently onClicked: { indicator.configuration.minimizedTaskColoredDifferently = checked; } } LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Show an extra dot for grouped windows when active") checked: indicator.configuration.extraDotOnActive tooltip: i18n("Grouped windows show both a line and a dot when one of them is active and the Line Active Indicator is enabled") enabled: indicator.configuration.activeStyle === 0 /*Line*/ onClicked: { indicator.configuration.extraDotOnActive = checked; } } } } LatteComponents.SubHeader { enabled: indicator.configuration.glowApplyTo!==0/*None*/ text: i18n("Options") } LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Show indicators for applets") checked: indicator.configuration.enabledForApplets tooltip: i18n("Indicators are shown for applets") onClicked: { indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets; } } LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Reverse indicator style") checked: indicator.configuration.reversed onClicked: { indicator.configuration.reversed = !indicator.configuration.reversed; } } } diff --git a/indicators/org.kde.latte.plasma/package/config/config.qml b/indicators/org.kde.latte.plasma/package/config/config.qml index ef0af8eb..ad030bdc 100644 --- a/indicators/org.kde.latte.plasma/package/config/config.qml +++ b/indicators/org.kde.latte.plasma/package/config/config.qml @@ -1,115 +1,114 @@ /* * 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 QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.latte 0.2 as Latte import org.kde.latte.components 1.0 as LatteComponents ColumnLayout { id: root Layout.fillWidth: true LatteComponents.SubHeader { text: i18n("Padding") } RowLayout { Layout.fillWidth: true spacing: units.smallSpacing PlasmaComponents.Label { text: i18n("Length") horizontalAlignment: Text.AlignLeft } LatteComponents.Slider { id: lengthIntMarginSlider Layout.fillWidth: true value: Math.round(indicator.configuration.lengthPadding * 100) from: 0 to: maxMargin stepSize: 1 wheelEnabled: false readonly property int maxMargin: 80 onPressedChanged: { if (!pressed) { indicator.configuration.lengthPadding = value / 100; } } } PlasmaComponents.Label { text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(currentValue) horizontalAlignment: Text.AlignRight Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 readonly property int currentValue: lengthIntMarginSlider.value } } LatteComponents.SubHeader { text: i18n("Options") } LatteComponents.CheckBoxesColumn { Layout.topMargin: 1.5 * units.smallSpacing LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Reverse indicator style") checked: indicator.configuration.reversed onClicked: { indicator.configuration.reversed = !indicator.configuration.reversed; } } LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Growing circle animation when clicked") checked: indicator.configuration.clickedAnimationEnabled onClicked: { indicator.configuration.clickedAnimationEnabled = !indicator.configuration.clickedAnimationEnabled; } } LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Show indicators for applets") checked: indicator.configuration.enabledForApplets tooltip: i18n("Indicators are shown for applets") onClicked: { indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets; } } } } diff --git a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml index facdefb0..cebb3ee7 100644 --- a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml @@ -1,84 +1,82 @@ /* * Copyright 2019 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.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.latte 0.2 as Latte - PlasmaCore.FrameSvgItem { id: frame property string basePrefix: "normal" imagePath: "widgets/tasks" rotation: root.reversedEnabled ? 180 : 0 opacity: 1 prefix: root.taskPrefix(basePrefix) states: [ State { name: "launcher" when: indicator.isLauncher || (indicator.isApplet && !indicator.isActive) PropertyChanges { target: frame basePrefix: "" } }, State { name: "hovered" when: indicator.isHovered && frame.hasElementPrefix("hover") PropertyChanges { target: frame basePrefix: "hover" } }, State { name: "attention" when: indicator.inAttention PropertyChanges { target: frame basePrefix: "attention" } }, State { name: "minimized" when: indicator.isMinimized PropertyChanges { target: frame basePrefix: "minimized" } }, State { name: "active" when: indicator.isActive PropertyChanges { target: frame basePrefix: "focus" } } ] } diff --git a/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml b/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml index b85f7842..d0a37328 100644 --- a/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml @@ -1,270 +1,268 @@ /* * Copyright 2019 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.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.latte 0.2 as Latte - Item { anchors.fill: parent Item { id: relevantItem anchors.fill: parent clip: true Item{ id: clickedCenter readonly property int center: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? parent.width/2 : parent.height/2 states:[ State { name: "bottom" when: (plasmoid.location === PlasmaCore.Types.BottomEdge) AnchorChanges { target: clickedCenter anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined} } }, State { name: "left" when: (plasmoid.location === PlasmaCore.Types.LeftEdge) AnchorChanges { target: clickedCenter anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:parent.verticalCenter} } }, State { name: "right" when: (plasmoid.location === PlasmaCore.Types.RightEdge) AnchorChanges { target: clickedCenter anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:parent.verticalCenter} } }, State { name: "top" when: (plasmoid.location === PlasmaCore.Types.TopEdge) AnchorChanges { target: clickedCenter anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined} } } ] } Rectangle { id: clickedRectangle anchors.centerIn: clickedCenter opacity: 0 radius: width/2 height: width color: theme.highlightColor } } SequentialAnimation { id: clickedAnimation ScriptAction{ script: { clickedRectangle.width = 0; clickedRectangle.opacity = 0.75; clickedRectangle.anchors.rightMargin = 0; clickedRectangle.anchors.leftMargin = 0; clickedRectangle.anchors.topMargin = 0; clickedRectangle.anchors.bottomMargin = 0; clickedRectangle.anchors.horizontalCenterOffset = 0; clickedRectangle.anchors.verticalCenterOffset = 0; } } ParallelAnimation{ PropertyAnimation { target: clickedRectangle property: "width" //! Don't animate above for length to: maxLength * multiplier duration: 700 easing.type: Easing.Linear readonly property int multiplier: indicator.scaleFactor * 2 readonly property int maxLength: Math.min(indicator.currentIconSize*10, Math.max(relevantItem.width, relevantItem.height)) } PropertyAnimation { target: clickedRectangle property: "opacity" to: 0 duration: 700 easing.type: Easing.Linear } } } Connections { target: level enabled: root.clickedAnimationEnabled onMousePressed: { var fixedX = 0; var fixedY = 0; if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) { fixedX = x - clickedCenter.center; } else { if (plasmoid.location === PlasmaCore.Types.RightEdge) { fixedX = relevantItem.width - x; } else { fixedX = x; } } if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { fixedY = y - clickedCenter.center; } else { if (plasmoid.location === PlasmaCore.Types.BottomEdge) { fixedY = relevantItem.height - y; } else { fixedY = y; } } if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) { clickedCenter.anchors.horizontalCenterOffset = fixedX; } else { if (plasmoid.location === PlasmaCore.Types.LeftEdge) { clickedCenter.anchors.leftMargin = fixedX; } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { clickedCenter.anchors.rightMargin = fixedX; } } if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { clickedCenter.anchors.verticalCenterOffset = fixedY; } else { if (plasmoid.location === PlasmaCore.Types.BottomEdge) { clickedCenter.anchors.bottomMargin = fixedY; } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { clickedCenter.anchors.topMargin = fixedY; } } clickedCenter.anchors.verticalCenterOffset = fixedY; clickedAnimation.start(); } } Loader { anchors.fill: parent anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? indicator.screenEdgeMargin : 0 anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? indicator.screenEdgeMargin : 0 anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? indicator.screenEdgeMargin : 0 anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? indicator.screenEdgeMargin : 0 visible: !indicator.isApplet && indicator.isGroup sourceComponent: Item{ anchors.fill: parent Item { id: iconBox anchors.centerIn: parent width: indicator.currentIconSize height: width } PlasmaCore.SvgItem { id: arrow implicitWidth: 0.25 * iconBox.width implicitHeight: implicitWidth svg: groupSvg elementId: elementForLocation(plasmoid.location) readonly property QtObject groupSvg: indicator.resources.svgs.length > 0 ? indicator.resources.svgs[0] : null function elementForLocation(location) { switch (location) { case PlasmaCore.Types.LeftEdge: return "group-expander-left"; case PlasmaCore.Types.TopEdge: return "group-expander-top"; case PlasmaCore.Types.RightEdge: return "group-expander-right"; case PlasmaCore.Types.BottomEdge: default: return "group-expander-bottom"; } } } states: [ State { name: "bottom" when: plasmoid.location === PlasmaCore.Types.BottomEdge AnchorChanges { target: arrow anchors.top: undefined; anchors.left: undefined; anchors.right: undefined; anchors.bottom: arrow.parent.bottom; anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined; } }, State { name: "top" when: plasmoid.location === PlasmaCore.Types.TopEdge AnchorChanges { target: arrow anchors.top: arrow.parent.top; anchors.left: undefined; anchors.right: undefined; anchors.bottom: undefined; anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined; } }, State { name: "left" when: plasmoid.location === PlasmaCore.Types.LeftEdge AnchorChanges { target: arrow anchors.top: undefined; anchors.left: arrow.parent.left; anchors.right: undefined; anchors.bottom: undefined; anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter; } }, State { name: "right" when: plasmoid.location === PlasmaCore.Types.RightEdge AnchorChanges { target: arrow anchors.top: undefined; anchors.left: undefined; anchors.right: arrow.parent.right; anchors.bottom: undefined; anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter; } } ] } } } diff --git a/indicators/org.kde.latte.plasma/package/ui/main.qml b/indicators/org.kde.latte.plasma/package/ui/main.qml index deaa89f4..47e63d15 100644 --- a/indicators/org.kde.latte.plasma/package/ui/main.qml +++ b/indicators/org.kde.latte.plasma/package/ui/main.qml @@ -1,128 +1,127 @@ /* * Copyright 2019 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.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.latte 0.2 as Latte import org.kde.latte.components 1.0 as LatteComponents LatteComponents.IndicatorItem { id: root needsMouseEventCoordinates: true providesClickedAnimation: clickedAnimationEnabled //providesHoveredAnimation: true providesFrontLayer: true svgImagePaths: ["widgets/tasks"] enabledForApplets: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ? indicator.configuration.enabledForApplets : true lengthPadding: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ? indicator.configuration.lengthPadding : 0.08 //! config options readonly property bool clickedAnimationEnabled: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined && indicator.configuration.clickedAnimationEnabled readonly property bool reversedEnabled: configurationIsReady && indicator.configuration.reversed !== undefined && indicator.configuration.reversed readonly property bool configurationIsReady: indicator && indicator.configuration //! Background Layer Loader{ id: backLayer anchors.fill: parent anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? indicator.screenEdgeMargin : 0 anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? indicator.screenEdgeMargin : 0 anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? indicator.screenEdgeMargin : 0 anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? indicator.screenEdgeMargin : 0 active: level.isBackground && !indicator.isEmptySpace sourceComponent: BackLayer{} } /* progress overlay for BackLayer*/ /* it is not added in the BackLayer because the BackLayer is rotated in some cases*/ Loader { anchors.fill: backLayer asynchronous: true active: level.isBackground && indicator.progressVisible sourceComponent: Item { id: background Item { anchors { top: parent.top left: parent.left bottom: parent.bottom } width: parent.width * (Math.min(indicator.progress, 100) / 100) clip: true PlasmaCore.FrameSvgItem { id: progressFrame width: background.width height: background.height imagePath: "widgets/tasks" prefix: root.taskPrefix("progress").concat(root.taskPrefix("hover")) } } } } //! Foreground Layer to draw arrows Loader{ id: frontLayer anchors.fill: parent active: (level.isForeground && !indicator.isApplet && indicator.isGroup) || providesClickedAnimation sourceComponent: FrontLayer{} } function taskPrefix(prefix) { var effectivePrefix; if (plasmoid.location === PlasmaCore.Types.LeftEdge) { effectivePrefix = "west-" + prefix; } if (plasmoid.location === PlasmaCore.Types.TopEdge) { effectivePrefix = "north-" + prefix; } if (plasmoid.location === PlasmaCore.Types.RightEdge) { effectivePrefix = "east-" + prefix; } if (plasmoid.location === PlasmaCore.Types.BottomEdge) { effectivePrefix = "south-" + prefix; } return [effectivePrefix, prefix]; } } diff --git a/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml index 61fc41cf..1c5de6de 100644 --- a/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml @@ -1,105 +1,103 @@ /* * Copyright 2020 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.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.latte 0.2 as Latte - PlasmaCore.FrameSvgItem { id: frame property string basePrefix: "normal" imagePath: "widgets/tabbar" rotation: 0 opacity: 1 prefix: { if (!indicator.isActive) { return ""; } if (plasmoid.location === PlasmaCore.Types.LeftEdge) { return "west-active-tab"; } if (plasmoid.location === PlasmaCore.Types.TopEdge) { return "north-active-tab"; } if (plasmoid.location === PlasmaCore.Types.RightEdge) { return "east-active-tab"; } if (plasmoid.location === PlasmaCore.Types.BottomEdge) { return "south-active-tab"; } return "south-active-tab"; } states: [ State { name: "launcher" when: indicator.isLauncher || (indicator.isApplet && !indicator.isActive) PropertyChanges { target: frame basePrefix: "" } }, State { name: "hovered" when: indicator.isHovered && frame.hasElementPrefix("hover") PropertyChanges { target: frame basePrefix: "hover" } }, State { name: "attention" when: indicator.inAttention PropertyChanges { target: frame basePrefix: "attention" } }, State { name: "minimized" when: indicator.isMinimized PropertyChanges { target: frame basePrefix: "minimized" } }, State { name: "active" when: indicator.isActive PropertyChanges { target: frame basePrefix: "focus" } } ] } diff --git a/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml b/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml index de6f1e7f..21730c92 100644 --- a/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml +++ b/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml @@ -1,44 +1,43 @@ /* * Copyright 2020 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.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.latte 0.2 as Latte import org.kde.latte.components 1.0 as LatteComponents LatteComponents.IndicatorItem { id: root lengthPadding: 0.08 //! Background Layer Loader{ id: backLayer anchors.fill: parent anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? indicator.screenEdgeMargin : 0 anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? indicator.screenEdgeMargin : 0 anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? indicator.screenEdgeMargin : 0 anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? indicator.screenEdgeMargin : 0 active: level.isBackground && !indicator.isEmptySpace sourceComponent: BackLayer{} } }