1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-09 00:58:15 +03:00

abilities: drop parabolic.lastindex property

--new approach is much cleaner to use
This commit is contained in:
Michail Vourlakos 2021-01-05 20:50:48 +02:00
parent e9d5ae1ace
commit 5fbabaf58f
7 changed files with 38 additions and 10 deletions

View File

@ -81,8 +81,10 @@ Item{
//! when Latte behaves as Plasma panel
property int thicknessAsPanel: metrics.totals.thickness
readonly property bool appletIsDragged: root.dragOverlay && root.dragOverlay.pressed
property int appletsTrackingWindowsCount: 0
property Item applets: null
property Item layouts: null
Binding{
target: latteView
@ -311,7 +313,7 @@ Item{
&& !(latteView.visibility.mode === LatteCore.Types.AlwaysVisible /* Visibility */
|| latteView.visibility.mode === LatteCore.Types.WindowsGoBelow
|| latteView.visibility.mode === LatteCore.Types.AutoHide))
|| applets.require.windowsTrackingCount > 0 /*Applets Need Windows Tracking */
|| appletsTrackingWindowsCount > 0 /*Applets Need Windows Tracking */
|| root.dragActiveWindowEnabled /*Dragging Active Window(Empty Areas)*/
|| ((root.backgroundOnlyOnMaximized /*Dynamic Background */
|| plasmoid.configuration.solidBackgroundForMaximized
@ -321,6 +323,38 @@ Item{
&& plasmoid.configuration.hideFloatingGapForMaximized)
}
//! Local Bindings
Binding{
target: manager
property: "appletsTrackingWindowsCount"
when: !appletIsDragged
value: {
var cnts = 0;
var grid;
for (var l=0; l<=2; ++l) {
if (l===0) {
grid = layouts.startLayout;
} else if (l===1) {
grid = layouts.mainLayout;
} else if (l===2) {
grid = layouts.endLayout;
}
for (var i=0; i<grid.children.length; ++i){
var appletItem = grid.children[i];
if (appletItem
&& appletItem.communicator
&& appletItem.communicator.requires.windowsTrackingEnabled) {
cnts = cnts + 1;
}
}
}
return cnts;
}
}
Connections{
target: background.totals
onVisualLengthChanged: updateMaskArea();

View File

@ -821,7 +821,7 @@ Window{
}
Text{
text: layoutsContainer.applets.require.windowsTrackingCount
text: visibilityManager.appletsTrackingWindowsCount
}
Text{

View File

@ -1242,7 +1242,7 @@ Item {
VisibilityManager{
id: visibilityManager
applets: layoutsContainer.applets
layouts: layoutsContainer
}
DragDropArea {

View File

@ -34,12 +34,10 @@ AbilityDefinition.ParabolicEffect {
//! private properties can not go to definition because can not be made readonly in there
//! special care must be taken in order to be redefined in local properties
readonly property bool directRenderingEnabled: ref.parabolic._privates.directRenderingEnabled
readonly property int lastIndex: local._privates.lastIndex /*special property that needs to remain the same*/
readonly property AbilityDefinition.ParabolicEffect local: AbilityDefinition.ParabolicEffect {
id: _localref
readonly property bool directRenderingEnabled: _localref._privates.directRenderingEnabled
readonly property int lastIndex: _localref._privates.lastIndex
}
Item {

View File

@ -32,7 +32,6 @@ Item {
readonly property ParabolicEffectTypes.PrivateProperties _privates: ParabolicEffectTypes.PrivateProperties {
directRenderingEnabled: false
lastIndex: -1
}
property Item currentParabolicItem: null

View File

@ -21,5 +21,4 @@ import QtQuick 2.7
Item {
property bool directRenderingEnabled: false
property int lastIndex: -1
}

View File

@ -25,7 +25,6 @@ AbilityDefinition.ParabolicEffect {
id: apis
readonly property bool directRenderingEnabled: _privates.directRenderingEnabled
readonly property int lastIndex: _privates.lastIndex
//! This needs to be rethought and rechecked in order for public api to provide
//! functionality that functionality must already exist in the definition
@ -33,7 +32,6 @@ AbilityDefinition.ParabolicEffect {
readonly property alias isEnabled: apis.isEnabled
readonly property alias directRenderingEnabled: apis.directRenderingEnabled
readonly property alias factor: apis.factor
readonly property alias lastIndex: apis.lastIndex
readonly property alias restoreZoomIsBlocked: apis.restoreZoomIsBlocked
readonly property alias currentParabolicItem: apis.currentParabolicItem