1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-02-05 05:47:26 +03:00

fixes for ParabolicEffect client ability

This commit is contained in:
Michail Vourlakos 2021-01-31 13:41:03 +02:00
parent 4051bf687f
commit ea489b3c7b
4 changed files with 136 additions and 11 deletions

View File

@ -0,0 +1,107 @@
/*
* Copyright 2021 Michail Vourlakos <mvourlakos@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
import org.kde.latte.abilities.client 0.1 as AbilityClient
Item {
id: _abilityContainer
property Item bridge: null
property Item layout: null
//! basic
readonly property alias animations: _animations
readonly property alias containment: _containment
readonly property alias debug: _debug
readonly property alias indexer: _indexer
readonly property alias indicators: _indicators
readonly property alias metrics: _metrics
readonly property alias myView: _myView
readonly property alias parabolic: _parabolic
readonly property alias shortcuts: _shortcuts
readonly property alias requires: _requires
readonly property alias thinTooltip: _thinTooltip
readonly property alias userRequests: _userRequests
AbilityClient.Animations {
id: _animations
bridge: _abilityContainer.bridge
}
AbilityClient.Containment {
id: _containment
bridge: _abilityContainer.bridge
}
AbilityClient.Debug {
id: _debug
bridge: _abilityContainer.bridge
}
AbilityClient.Indexer {
id: _indexer
bridge: _abilityContainer.bridge
layout: _abilityContainer.layout
}
AbilityClient.Indicators {
id: _indicators
bridge: _abilityContainer.bridge
}
AbilityClient.Metrics {
id: _metrics
bridge: _abilityContainer.bridge
parabolic: _parabolic
}
AbilityClient.MyView {
id: _myView
bridge: _abilityContainer.bridge
}
AbilityClient.ParabolicEffect {
id: _parabolic
bridge: _abilityContainer.bridge
indexer: _indexer
layout: _abilityContainer.layout
}
AbilityClient.PositionShortcuts {
id: _shortcuts
bridge: _abilityContainer.bridge
indexer: _indexer
}
AbilityClient.ThinTooltip {
id: _thinTooltip
bridge: _abilityContainer.bridge
}
AbilityClient.Requirements{
id: _requires
bridge: _abilityContainer.bridge
}
AbilityClient.UserRequests {
id: _userRequests
bridge: _abilityContainer.bridge
}
}

View File

@ -33,6 +33,7 @@ AbilityDefinition.Indexer {
readonly property bool headAppletIsSeparator: isActive ? bridge.indexer.headAppletIsSeparator : false
readonly property bool isReady: !updateIsBlocked
readonly property int maxIndex: 99999
readonly property alias itemsCount: _privates.itemsCount
readonly property alias visibleItemsCount: _privates.visibleItemsCount
readonly property alias firstVisibleItemIndex: _privates.firstVisibleItemIndex
readonly property alias lastVisibleItemIndex: _privates.lastVisibleItemIndex
@ -41,6 +42,7 @@ AbilityDefinition.Indexer {
id: _privates
property int firstVisibleItemIndex: -1
property int lastVisibleItemIndex: -1
property int itemsCount: 0
property int visibleItemsCount: 0
}
@ -166,6 +168,22 @@ AbilityDefinition.Indexer {
}
}
Binding {
target: _privates
property: "itemsCount"
value: {
var count = 0;
for(var i=0; i<layout.children.length; ++i) {
var item = layout.children[i];
if (item && item.itemIndex>=0) {
count = count + 1;
}
}
return count;
}
}
Binding {
target: _indexer
property: "separators"

View File

@ -25,6 +25,7 @@ import org.kde.latte.abilities.definition 0.1 as AbilityDefinition
AbilityDefinition.ParabolicEffect {
id: parabolic
property Item bridge: null
property Item indexer: null
property Item layout: null
isEnabled: ref.parabolic.isEnabled
@ -45,8 +46,6 @@ AbilityDefinition.ParabolicEffect {
return false;
}
readonly property int itemsCount: layout ? layout.children.length : 0
readonly property AbilityDefinition.ParabolicEffect local: AbilityDefinition.ParabolicEffect {
id: _localref
readonly property bool directRenderingEnabled: _localref._privates.directRenderingEnabled
@ -146,7 +145,7 @@ AbilityDefinition.ParabolicEffect {
function hostRequestUpdateLowerItemScale(newScale, step){
//! function called from host
sglUpdateLowerItemScale(itemsCount-1, newScale, step);
sglUpdateLowerItemScale(indexer.itemsCount-1, newScale, step);
}
function hostRequestUpdateHigherItemScale(newScale, step){
@ -156,22 +155,22 @@ AbilityDefinition.ParabolicEffect {
function sltTrackLowerItemScale(delegateIndex, newScale, step){
//! send update signal to host
if (latteBridge) {
if (bridge) {
if (delegateIndex === -1) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(newScale, step);
bridge.parabolic.clientRequestUpdateLowerItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex>=0) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(1, 0);
bridge.parabolic.clientRequestUpdateLowerItemScale(1, 0);
}
}
}
function sltTrackHigherItemScale(delegateIndex, newScale, step) {
//! send update signal to host
if (latteBridge) {
if (delegateIndex >= itemsCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex<itemsCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(1, 0);
if (bridge) {
if (delegateIndex >= indexer.itemsCount) {
bridge.parabolic.clientRequestUpdateHigherItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex<indexer.itemsCount) {
bridge.parabolic.clientRequestUpdateHigherItemScale(1, 0);
}
}
}

View File

@ -1,6 +1,7 @@
module org.kde.latte.abilities.client
Animations 0.1 Animations.qml
AppletAbilities 0.1 AppletAbilities.qml
Containment 0.1 Containment.qml
Debug 0.1 Debug.qml
Indexer 0.1 Indexer.qml