diff --git a/containment/package/contents/ui/abilities/MyView.qml b/containment/package/contents/ui/abilities/MyView.qml index db7dc7a01..975bb3c2b 100644 --- a/containment/package/contents/ui/abilities/MyView.qml +++ b/containment/package/contents/ui/abilities/MyView.qml @@ -25,23 +25,27 @@ import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.abilities.host 0.1 as AbilityHost AbilityHost.MyView { + view: latteView + isReady: latteView inNormalState: ((animations.needBothAxis.count === 0) && (animations.needLength.count === 0)) - || (latteView && latteView.visibility.isHidden && !latteView.visibility.containsMouse && animations.needThickness.count === 0) - isHidden: isReady && latteView.visibility.isHidden + || (view && view.visibility.isHidden && !view.visibility.containsMouse && animations.needThickness.count === 0) + isHidden: isReady && view.visibility.isHidden isShownPartially: isReady && (inSlidingIn || inSlidingOut) isShownFully: isReady && !isHidden && !inSlidingIn && !inSlidingOut inSlidingIn: visibilityManager.inSlidingIn inSlidingOut: visibilityManager.inSlidingOut - inRelocationAnimation: latteView && latteView.positioner && latteView.positioner.inRelocationAnimation + inRelocationAnimation: view && view.positioner && view.positioner.inRelocationAnimation inRelocationHiding: visibilityManager.inRelocationHiding alignment: plasmoid.configuration.alignment - visibilityMode: latteView ? latteView.visibility.mode : LatteCore.Types.None + visibilityMode: view ? view.visibility.mode : LatteCore.Types.None + + lastUsedActivity: view && view.layout ? view.layout.lastUsedActivity : "" - containmentActions: isReady ? latteView.containmentActions() : [] + containmentActions: isReady ? view.containmentActions() : [] } diff --git a/containment/package/contents/ui/applet/communicator/LatteBridge.qml b/containment/package/contents/ui/applet/communicator/LatteBridge.qml index e0ff58837..b4bcca164 100644 --- a/containment/package/contents/ui/applet/communicator/LatteBridge.qml +++ b/containment/package/contents/ui/applet/communicator/LatteBridge.qml @@ -144,7 +144,7 @@ Item{ readonly property Item debug: appletItem.debug.publicApi readonly property Item launchers: appletItem.launchers readonly property Item metrics: appletItem.metrics.publicApi - readonly property Item myView: appletItem.myView.publicApi + readonly property Item myView: appletItem.myView readonly property Item userRequests: appletItem.userRequests readonly property AbilityBridge.Animations animations: AbilityBridge.Animations { diff --git a/containment/package/contents/ui/colorizer/Manager.qml b/containment/package/contents/ui/colorizer/Manager.qml index bc6ddbd4d..b5063fc2a 100644 --- a/containment/package/contents/ui/colorizer/Manager.qml +++ b/containment/package/contents/ui/colorizer/Manager.qml @@ -199,7 +199,7 @@ Loader{ } sourceComponent: LatteApp.BackgroundTracker { - activity: viewLayout ? viewLayout.lastUsedActivity : "" + activity: root.myView.isReady ? root.myView.lastUsedActivity : "" location: plasmoid.location screenName: latteView && latteView.positioner ? latteView.positioner.currentScreenName : "" } diff --git a/containment/package/contents/ui/editmode/Visual.qml b/containment/package/contents/ui/editmode/Visual.qml deleted file mode 100644 index ec55c7c3a..000000000 --- a/containment/package/contents/ui/editmode/Visual.qml +++ /dev/null @@ -1,331 +0,0 @@ -/* -* 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 QtGraphicalEffects 1.0 - -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.core 0.2 as LatteCore -import org.kde.latte.components 1.0 as LatteComponents - -import "../applet" as Applet - -Item{ - id: editVisual - width: root.isHorizontal ? (latteView ? latteView.width : root.width) : - visibilityManager.thicknessEditMode - height: root.isVertical ? (latteView ? latteView.height : root.height) : - visibilityManager.thicknessEditMode - - visible: editVisual.inEditMode - - readonly property int settingsThickness: settingsOverlay.thickness - - property int speed: LatteCore.WindowSystem.compositingActive ? animations.speedFactor.normal*3.6*animations.duration.large : 10 - property int thickness: visibilityManager.thicknessEditMode + root.editShadow - property int rootThickness: metrics.mask.thickness.maxZoomed + root.editShadow //- visibilityManager.thicknessEditMode - property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - metrics.maxIconSize/4 : root.width)://root.maxLength) : - (root.behaveAsPlasmaPanel ? root.height - metrics.maxIconSize/4 : root.height) - - property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge) - property bool editAnimationEnded: false - property bool editAnimationInFullThickness: false - property bool editAnimationRunning: false - property bool plasmaEditMode: plasmoid.userConfiguring - property bool inEditMode: false - - property rect efGeometry - - readonly property real appliedOpacity: imageTiler.opacity - readonly property real maxOpacity: root.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ? - 1 : plasmoid.configuration.editBackgroundOpacity - - LatteComponents.ExternalShadow{ - id: editExternalShadow - width: root.isHorizontal ? imageTiler.width : root.editShadow - height: root.isHorizontal ? root.editShadow : imageTiler.height - visible: !editTransition.running && root.editMode && LatteCore.WindowSystem.compositingActive - - shadowSize: root.editShadow - shadowOpacity: Math.max(0.35, imageTiler.opacity) - shadowDirection: plasmoid.location - - states: [ - ///topShadow - State { - name: "topShadow" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge) - - AnchorChanges { - target: editExternalShadow - anchors{ top:undefined; bottom:imageTiler.top; left:undefined; right:undefined; - horizontalCenter:imageTiler.horizontalCenter; verticalCenter:undefined} - } - }, - ///bottomShadow - State { - name: "bottomShadow" - when: (plasmoid.location === PlasmaCore.Types.TopEdge) - - AnchorChanges { - target: editExternalShadow - anchors{ top:imageTiler.bottom; bottom:undefined; left:undefined; right:undefined; - horizontalCenter:imageTiler.horizontalCenter; verticalCenter:undefined} - } - }, - ///leftShadow - State { - name: "leftShadow" - when: (plasmoid.location === PlasmaCore.Types.RightEdge) - - AnchorChanges { - target: editExternalShadow - anchors{ top:undefined; bottom:undefined; left:undefined; right:imageTiler.left; - horizontalCenter:undefined; verticalCenter:imageTiler.verticalCenter} - } - }, - ///rightShadow - State { - name: "rightShadow" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge) - - AnchorChanges { - target: editExternalShadow - anchors{ top:undefined; bottom:undefined; left:imageTiler.right; right:undefined; - horizontalCenter:undefined; verticalCenter:imageTiler.verticalCenter} - } - } - ] - } - - Image{ - id: imageTiler - anchors.centerIn: parent - width: parent.width - height: parent.height - opacity: 0 - - fillMode: Image.Tile - source: { - if (hasBackground) { - return viewLayout.background; - } - - return viewLayout ? "../../icons/"+viewLayout.background+"print.jpg" : "../../icons/blueprint.jpg" - } - - readonly property bool hasBackground: (viewLayout && viewLayout.background.startsWith("/")) ? true : false - - Connections { - target: editVisual - - onMaxOpacityChanged: { - if (editVisual.editAnimationEnded) { - imageTiler.opacity = editVisual.maxOpacity; - } - } - } - - Behavior on opacity { - enabled: editVisual.editAnimationEnded - NumberAnimation { - duration: 0.8 * animations.duration.proposed - easing.type: Easing.OutCubic - } - } - } - - MouseArea { - id: editBackMouseArea - anchors.fill: imageTiler - visible: editModeVisual.editAnimationEnded && !root.inConfigureAppletsMode - hoverEnabled: true - - property bool wheelIsBlocked: false; - readonly property double opacityStep: 0.1 - readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage", - "You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100)) - - onWheel: { - processWheel(wheel); - } - - - function processWheel(wheel) { - if (wheelIsBlocked) { - return; - } - - wheelIsBlocked = true; - scrollDelayer.start(); - - var angle = wheel.angleDelta.y / 8; - - if (angle > 10) { - plasmoid.configuration.editBackgroundOpacity = Math.min(100, plasmoid.configuration.editBackgroundOpacity + opacityStep) - } else if (angle < -10) { - plasmoid.configuration.editBackgroundOpacity = Math.max(0, plasmoid.configuration.editBackgroundOpacity - opacityStep) - } - } - - Connections { - target: root - onEmptyAreasWheel: { - if (root.editMode && !root.inConfigureAppletsMode) { - editBackMouseArea.processWheel(wheel); - } - } - } - - //! A timer is needed in order to handle also touchpads that probably - //! send too many signals very fast. This way the signals per sec are limited. - //! The user needs to have a steady normal scroll in order to not - //! notice a annoying delay - Timer{ - id: scrollDelayer - - interval: 80 - onTriggered: editBackMouseArea.wheelIsBlocked = false; - } - } - - PlasmaComponents.Button { - anchors.fill: editBackMouseArea - opacity: 0 - tooltip: editBackMouseArea.tooltip - } - - //! Settings Overlay - SettingsOverlay { - id: settingsOverlay - anchors.fill: parent - visible: root.editMode - } - - Applet.TitleTooltipParent { - id: titleTooltipParent - metrics: root.metrics - parabolic: root.parabolic - minimumThickness: visibilityManager.thicknessEditMode - maximumThickness: root.inConfigureAppletsMode ? visibilityManager.thicknessEditMode : 9999 - } - - Connections{ - target: root - onThemeColorsChanged: imageTiler.opacity = editVisual.maxOpacity - } - - Connections{ - target: plasmoid - onLocationChanged: initializeEditPosition(); - } - - onInEditModeChanged: { - if (inEditMode) { - latteView.visibility.addBlockHidingEvent("EditVisual[qml]::inEditMode()"); - } else { - latteView.visibility.removeBlockHidingEvent("EditVisual[qml]::inEditMode()"); - if (latteView.visibility.isHidden) { - latteView.visibility.mustBeShown(); - } - } - } - - onRootThicknessChanged: { - initializeEditPosition(); - } - - onThicknessChanged: { - initializeEditPosition(); - } - - onXChanged: updateEffectsArea(); - onYChanged: updateEffectsArea(); - - onWidthChanged: { - /*if (root.isHorizontal) { - initializeEditPosition(); - }*/ - - updateEffectsArea(); - } - - onHeightChanged: { - /* if (root.isVertical) { - initializeEditPosition(); - }*/ - - updateEffectsArea(); - } - - function updateEffectsArea(){ - if (LatteCore.WindowSystem.compositingActive || - !latteView || state !== "edit" || !editAnimationEnded) { - return; - } - - var rootGeometry = mapToItem(root, 0, 0); - - efGeometry.x = rootGeometry.x; - efGeometry.y = rootGeometry.y; - efGeometry.width = width; - efGeometry.height = height; - - latteView.effects.rect = efGeometry; - } - - - function initializeNormalPosition() { - if (plasmoid.location === PlasmaCore.Types.BottomEdge) { - y = rootThickness; - x = 0; - } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { - x = rootThickness; - y = 0; - } else if (plasmoid.location === PlasmaCore.Types.LeftEdge) { - x = -editVisual.thickness; - y = 0; - } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { - y = -editVisual.thickness; - x = 0; - } - } - - function initializeEditPosition() { - if (root.editMode) { - if (plasmoid.location === PlasmaCore.Types.LeftEdge){ - x = 0; - y = 0; - } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { - x = 0; - y = 0; - } else if (plasmoid.location === PlasmaCore.Types.BottomEdge) { - x = 0; - y = rootThickness - thickness; - } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { - x = rootThickness - thickness; - y = 0; - } - } - } -} diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index c5e59b1dc..74da67510 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -382,7 +382,6 @@ Item { readonly property alias themeExtended: _interfaces.themeExtended readonly property alias universalSettings: _interfaces.universalSettings - readonly property QtObject viewLayout: latteView && latteView.layout ? latteView.layout : null readonly property QtObject selectedWindowsTracker: { if (latteView && latteView.windowsTracker) { switch(plasmoid.configuration.activeWindowFilter) { @@ -1379,7 +1378,7 @@ Item { Ability.Launchers { id: _launchers - layoutName: viewLayout ? viewLayout.name : "" + layoutName: latteView && latteView.layout ? latteView.layout.name : "" } Ability.Layouter { diff --git a/declarativeimports/abilities/client/MyView.qml b/declarativeimports/abilities/client/MyView.qml index 83e49d637..d808f919c 100644 --- a/declarativeimports/abilities/client/MyView.qml +++ b/declarativeimports/abilities/client/MyView.qml @@ -40,6 +40,8 @@ AbilityDefinition.MyView { alignment: ref.myView.alignment visibilityMode: ref.myView.visibilityMode + lastUsedActivity: ref.myView.lastUsedActivity + containmentActions: ref.myView.containmentActions readonly property AbilityDefinition.MyView local: AbilityDefinition.MyView {} @@ -48,4 +50,12 @@ AbilityDefinition.MyView { id: ref readonly property Item myView: bridge ? bridge.myView : local } + + function inCurrentLayout() { + if (bridge && bridge.myView.isReady) { + return bridge.myView.inCurrentLayout(); + } else { + return true; + } + } } diff --git a/declarativeimports/abilities/definition/MyView.qml b/declarativeimports/abilities/definition/MyView.qml index 0f443475d..edc1fef03 100644 --- a/declarativeimports/abilities/definition/MyView.qml +++ b/declarativeimports/abilities/definition/MyView.qml @@ -21,7 +21,7 @@ import QtQuick 2.0 import org.kde.latte.core 0.2 as LatteCore -Item { +Item { property bool isReady: false property bool inNormalState: true @@ -38,5 +38,9 @@ Item { property int alignment: LatteCore.Types.Center property int visibilityMode: LatteCore.Types.None + property string lastUsedActivity: "" + property var containmentActions: [] + + //function inCurrentLayout(); } diff --git a/declarativeimports/abilities/host/MyView.qml b/declarativeimports/abilities/host/MyView.qml index d8966ace6..b4b841202 100644 --- a/declarativeimports/abilities/host/MyView.qml +++ b/declarativeimports/abilities/host/MyView.qml @@ -24,6 +24,12 @@ import org.kde.latte.abilities.definition 0.1 as AbilityDefinition AbilityDefinition.MyView { id: apis + property QtObject view: null + + function inCurrentLayout() { + return view && view.layout && view.layout.isCurrent(); + } + readonly property Item publicApi: Item { readonly property alias isReady: apis.isReady @@ -42,5 +48,9 @@ AbilityDefinition.MyView { readonly property alias visibilityMode: apis.visibilityMode readonly property alias containmentActions: apis.containmentActions + + function inCurrentLayout() { + return apis.inCurrentLayout(); + } } } diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 2a3afeb39..71b2e9907 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -207,8 +207,6 @@ Item { readonly property real screenGeometryHeightRatio: screenGeometry.height / screenGeometry.width readonly property rect screenGeometry: latteView ? latteView.screenGeometry : plasmoid.screenGeometry - readonly property QtObject viewLayout : latteView && latteView.viewLayout ? latteView.viewLayout : null - property Item latteView: null readonly property Item indicators: latteView ? latteView.indicatorsManager : indicatorsStandaloneLoader.item //END Latte Dock Panel properties @@ -549,7 +547,7 @@ Item { screenGeometry: root.screenGeometry // comment in order to support LTS Plasma 5.8 // screen: plasmoid.screen - activity: viewLayout ? viewLayout.lastUsedActivity : activityInfo.currentActivity + activity: appletAbilities.myView.isReady ? appletAbilities.myView.lastUsedActivity : activityInfo.currentActivity filterByVirtualDesktop: root.showOnlyCurrentDesktop filterByScreen: root.showOnlyCurrentScreen diff --git a/plasmoid/package/contents/ui/task/TaskItem.qml b/plasmoid/package/contents/ui/task/TaskItem.qml index 8e4870fd4..ead13511e 100644 --- a/plasmoid/package/contents/ui/task/TaskItem.qml +++ b/plasmoid/package/contents/ui/task/TaskItem.qml @@ -968,7 +968,7 @@ Item { function slotPublishGeometries() { //! this way we make sure that layouts that are in different activities that the current layout //! don't publish their geometries - if ( canPublishGeometries && (!latteView || (latteView && root.viewLayout && root.viewLayout.isCurrent()))) { + if ( canPublishGeometries && (!taskItem.abilities.myView.isReady || (taskItem.abilities.myView.isReady && taskItem.abilities.myView.inCurrentLayout()))) { var globalChoords = backend.globalRect(wrapper.visualIconItem); var limits = backend.globalRect(scrollableList);