diff --git a/indicators/org.kde.latte.plasma/metadata.desktop b/indicators/org.kde.latte.plasma/metadata.desktop index 6b0bae6f..9016a1af 100644 --- a/indicators/org.kde.latte.plasma/metadata.desktop +++ b/indicators/org.kde.latte.plasma/metadata.desktop @@ -1,44 +1,46 @@ [Desktop Entry] Name=Plasma Name[ca]=Plasma Name[ca@valencia]=Plasma Name[de]=Plasma Name[en_GB]=Plasma Name[es]=Plasma Name[fr]=Plasma Name[gl]=Plasma Name[it]=Plasma Name[nl]=Plasma Name[pt]=Plasma Name[sv]=Plasma Name[uk]=Плазма Name[x-test]=xxPlasmaxx Comment=Latte Plasma style indicator Comment[ca]=Indicador a l'estil Plasma del Latte Comment[ca@valencia]=Indicador a l'estil Plasma del Latte Comment[en_GB]=Latte Plasma style indicator Comment[es]=Estilo del indicador Plasma Latte Comment[gl]=Indicador de estilo Plasma de Latte Comment[it]=Indicatore stile di Plasma di Latte Comment[nl]=Plasma stijlindicator van Latte Comment[pt]=Indicador de estilo do Plasma no Latte Comment[sv]=Latte Plasmastilindikator Comment[uk]=Індикатор стилю Плазми Латте Comment[x-test]=xxLatte Plasma style indicatorxx Encoding=UTF-8 Type=Service Icon=latte-dock X-Plasma-API=declarativeappletscript X-KDE-ServiceTypes=Latte/Indicator X-Latte-MainScript=ui/main.qml +X-Latte-ConfigUi=config/config.qml +X-Latte-ConfigXml=config/main.xml X-KDE-PluginInfo-Author=Michail Vourlakos X-KDE-PluginInfo-Email=mvourlakos@gmail.com X-KDE-PluginInfo-Name=org.kde.latte.plasma X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Category=Latte Indicator X-KDE-PluginInfo-License=GPL v2+ X-KDE-PluginInfo-EnabledByDefault=true diff --git a/indicators/org.kde.latte.plasma/package/config/config.qml b/indicators/org.kde.latte.plasma/package/config/config.qml new file mode 100644 index 00000000..a43fad45 --- /dev/null +++ b/indicators/org.kde.latte.plasma/package/config/config.qml @@ -0,0 +1,57 @@ +/* +* 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.latte 0.2 as Latte +import org.kde.latte.components 1.0 as LatteComponents + +ColumnLayout { + id: root + Layout.fillWidth: true + + 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; + } + } + } +} diff --git a/indicators/org.kde.latte.plasma/package/config/main.xml b/indicators/org.kde.latte.plasma/package/config/main.xml new file mode 100644 index 00000000..8b88f024 --- /dev/null +++ b/indicators/org.kde.latte.plasma/package/config/main.xml @@ -0,0 +1,16 @@ + + + + + + false + + + false + + + + diff --git a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml index c71e0afe..f88a5088 100644 --- a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml @@ -1,132 +1,132 @@ /* * 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: indicator.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks" - rotation: indicator.shared.reversed ? 180 : 0 + rotation: root.reversedEnabled ? 180 : 0 opacity: state === "hovered" ? 0.5 : 1 prefix: { if (indicator.usePlasmaTabsStyle) { 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"; } else { return taskPrefix(basePrefix); } } 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]; } 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 dfa8c68c..bb6f91a7 100644 --- a/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/FrontLayer.qml @@ -1,267 +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.0 +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.buttonFocusColor } } SequentialAnimation { id: clickedAnimation ScriptAction{ script: { clickedRectangle.width = 0; clickedRectangle.opacity = 0.85; 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" to: Math.max(relevantItem.width, relevantItem.height) * indicator.scaleFactor * 2 duration: 700 easing.type: Easing.Linear } 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 visible: !indicator.isApplet && indicator.isGroup sourceComponent: Item{ anchors.fill: parent PlasmaCore.Svg { id: taskSvg imagePath: "widgets/tasks" } Item { id: iconBox anchors.centerIn: parent width: indicator.currentIconSize height: width } PlasmaCore.SvgItem { id: arrow implicitWidth: 0.25 * iconBox.width implicitHeight: implicitWidth svg: taskSvg elementId: elementForLocation(plasmoid.location) 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 a92fc8a5..1a8b2598 100644 --- a/indicators/org.kde.latte.plasma/package/ui/main.qml +++ b/indicators/org.kde.latte.plasma/package/ui/main.qml @@ -1,53 +1,64 @@ /* * 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 + //! options published readonly property bool needsMouseEventCoordinates: true - readonly property bool providesClickedAnimation: true + readonly property bool providesClickedAnimation: clickedAnimationEnabled readonly property bool providesHoveredAnimation: true readonly property bool providesFrontLayer: true + //! config options + readonly property bool clickedAnimationEnabled: indicator && indicator.configuration + && indicator.configuration.clickedAnimationEnabled !== undefined + && indicator.configuration.clickedAnimationEnabled + + readonly property bool reversedEnabled: indicator && indicator.configuration + && indicator.configuration.reversed !== undefined + && indicator.configuration.reversed + + //! Background Layer Loader{ id: backLayer anchors.fill: parent active: level.isBackground sourceComponent: BackLayer{} } //! Foreground Layer to draw arrows Loader{ id: frontLayer anchors.fill: parent - active: level.isForeground //&& !indicator.isApplet && indicator.isGroup + active: (level.isForeground && !indicator.isApplet && indicator.isGroup) || providesClickedAnimation sourceComponent: FrontLayer{} } }