remove AppletsRecords container ability

--use the all new much better infrastructure
to track applet abilities requirements
pull/15/head
Michail Vourlakos 5 years ago
parent e3e4ee4c5a
commit 87ffc22f6a

@ -786,7 +786,7 @@ Window{
}
Text{
text: appletsRecords.windowsTrackingCount
text: layoutsContainer.applets.require.windowsTrackingCount
}
Text{

@ -131,6 +131,8 @@ Item{
return 0;
}
property Item applets: null
Binding{
target: latteView
property:"maxThickness"
@ -347,7 +349,7 @@ Item{
&& !(latteView.visibility.mode === LatteCore.Types.AlwaysVisible /* Visibility */
|| latteView.visibility.mode === LatteCore.Types.WindowsGoBelow
|| latteView.visibility.mode === LatteCore.Types.AutoHide))
|| appletsRecords.windowsTrackingCount > 0 /*Applets Need Windows Tracking */
|| applets.require.windowsTrackingCount > 0 /*Applets Need Windows Tracking */
|| root.dragActiveWindowEnabled /*Dragging Active Window(Empty Areas)*/
|| ((root.backgroundOnlyOnMaximized /*Dynamic Background */
|| plasmoid.configuration.solidBackgroundForMaximized

@ -1,122 +0,0 @@
/*
* Copyright 2020 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.0
Item {
id: records
property int windowsTrackingCount: 0 //! number of applets requesting windows tracking
property real maxInnerZoomFactor: 1.0 //! maximum inner zoom factor based on all applets
property var applets: []
function indexOf(applet) {
var len = applets.length;
for (var i=0; i<len; ++i) {
if (applets[i].id === applet) {
return i;
}
}
return -1;
}
function removeApplet(applet) {
var ind = indexOf(applet);
if (ind>=0) {
//! remove
applets.splice(ind, 1);
updateValues();
}
}
function addDefaultRecord(applet) {
applets.push({id: applet, innerZoomFactor: 1.0, windowsTrackingEnabled: false});
}
function setInnerZoomFactor(applet, inner) {
var len = applets.length;
var ind = indexOf(applet);
if (ind >=0) {
//! update
if(applets[ind].innerZoomFactor !== inner) {
applets[ind].innerZoomFactor = inner;
updateInnerZoomFactor();
}
} else {
//! add
addDefaultRecord(applet);
applets[len].innerZoomFactor = inner;
updateInnerZoomFactor();
}
}
function setWindowsTrackingEnabled(applet, value) {
var len = applets.length;
var ind = indexOf(applet);
if (ind>=0) {
//! update
if(applets[ind].windowsTrackingEnabled !== value) {
applets[ind].windowsTrackingEnabled = value;
updateWindowsTrackingCount();
}
} else {
//! add
addDefaultRecord(applet);
applets[len].windowsTrackingEnabled = value;
updateWindowsTrackingCount();
}
}
function updateValues() {
updateInnerZoomFactor();
updateWindowsTrackingCount();
}
function updateInnerZoomFactor() {
var len = applets.length;
var max = 1;
for (var i=0; i<len; ++i) {
if (applets[i].innerZoomFactor > max) {
max = applets[i].innerZoomFactor;
}
}
maxInnerZoomFactor = max;
}
function updateWindowsTrackingCount() {
var len = applets.length;
var cnt = 0;
for (var i=0; i<len; ++i) {
if (applets[i].windowsTrackingEnabled) {
cnt = cnt + 1;
}
}
windowsTrackingCount = cnt;
}
}

@ -28,6 +28,6 @@ import "./privates" as Ability
Ability.ParabolicEffectPrivate {
factor.zoom: LatteCore.WindowSystem.compositingActive && animations.active ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
factor.maxZoom: Math.max(factor.zoom, appletsRecords.maxInnerZoomFactor)
restoreZoomIsBlocked: (view && view.contextMenuIsShown) || (layouts.ability.parabolic.restoreZoomIsBlocked)
factor.maxZoom: Math.max(factor.zoom, applets.require.maxInnerZoomFactor)
restoreZoomIsBlocked: (view && view.contextMenuIsShown) || (applets.parabolic.restoreZoomIsBlocked)
}

@ -30,8 +30,7 @@ ContainerAbility.ParabolicEffect {
id: parabolic
property Item animations: null
property Item appletsRecords: null
property Item layouts: null
property Item applets: null
property QtObject view: null
readonly property bool horizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal

@ -223,7 +223,6 @@ Item {
readonly property alias wrapper: _wrapper
property Item animations: null
property Item appletsRecords: null
property Item metrics: null
property Item parabolic: null
@ -523,7 +522,6 @@ Item {
Component.onDestruction: {
appletItem.animations.needBothAxis.removeEvent(appletItem);
appletItem.appletsRecords.removeApplet(appletItem);
if (isSeparator){
parabolicManager.setSeparator(previousIndex, -1);

@ -52,7 +52,7 @@ Item{
//! END OF PROPERTIES
//! BEGIN OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
readonly property Item requires: AbilityDefinition.AppletRequirements{}
readonly property Item requires: AbilityDefinition.AppletRequirements{}
//! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
//! BEGIN OF ABILITIES SUPPORT
@ -81,18 +81,6 @@ Item{
}
//! END OF FUNCTIONS
Connections {
target: requires
onInnerZoomFactorChanged: {
appletItem.appletsRecords.setInnerZoomFactor(appletItem, requires.innerZoomFactor);
}
onWindowsTrackingEnabledChanged: {
appletItem.appletsRecords.setWindowsTrackingEnabled(appletItem, requires.windowsTrackingEnabled);
}
}
//! BEGIN OF CONNECTIONS
Connections{
target: appletItem

@ -48,7 +48,7 @@ Item{
readonly property alias mainLayout: _mainLayout
readonly property alias endLayout: _endLayout
readonly property AbilitiesTypes.AbilityLayouts ability: AbilitiesTypes.AbilityLayouts{
readonly property AbilitiesTypes.AbilityLayouts applets: AbilitiesTypes.AbilityLayouts{
startLayout: _startLayout
mainLayout: _mainLayout
endLayout: _endLayout

@ -25,7 +25,6 @@ AbilityGridPrivate {
id: grid
ability.parabolic.restoreZoomIsBlocked: {
var cnts = 0;
for (var i=0; i<grid.children.length; ++i){
var appletItem = grid.children[i];
@ -38,4 +37,30 @@ AbilityGridPrivate {
return false;
}
ability.require.windowsTrackingCount: {
var cnts = 0;
for (var i=0; i<grid.children.length; ++i){
var appletItem = grid.children[i];
if (appletItem && appletItem.communicator.requires.windowsTrackingEnabled) {
cnts = cnts + 1;
}
}
return cnts;
}
ability.require.maxInnerZoomFactor: {
var max = 1.0;
for (var i=0; i<grid.children.length; ++i){
var appletItem = grid.children[i];
if (appletItem && appletItem.communicator.requires.innerZoomFactor > max) {
max = appletItem.communicator.requires.innerZoomFactor;
}
}
return max;
}
}

@ -23,4 +23,12 @@ AbilityLayoutsPrivate {
parabolic.restoreZoomIsBlocked: startLayout.ability.parabolic.restoreZoomIsBlocked
|| mainLayout.ability.parabolic.restoreZoomIsBlocked
|| endLayout.ability.parabolic.restoreZoomIsBlocked
require.windowsTrackingCount: startLayout.ability.require.windowsTrackingCount +
mainLayout.ability.require.windowsTrackingCount +
endLayout.ability.require.windowsTrackingCount
require.maxInnerZoomFactor: Math.max(startLayout.ability.require.maxInnerZoomFactor,
mainLayout.ability.require.maxInnerZoomFactor,
endLayout.ability.require.maxInnerZoomFactor)
}

@ -29,4 +29,5 @@ Item {
property Item endLayout: null
readonly property AbilityTypes.ParabolicEffect parabolic: AbilityTypes.ParabolicEffect{}
readonly property AbilityTypes.Requirements require: AbilityTypes.Requirements{}
}

@ -21,4 +21,5 @@ import QtQuick 2.7
Item {
readonly property ParabolicEffect parabolic: ParabolicEffect{}
readonly property Requirements require: Requirements{}
}

@ -0,0 +1,25 @@
/*
* Copyright 2020 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
Item {
property int windowsTrackingCount: 0 //! number of applets requesting windows tracking
property real maxInnerZoomFactor: 1.0 //! maximum inner zoom factor based on all applets
}

@ -409,7 +409,6 @@ Item {
property Item latteApplet
readonly property alias animations: _animations
readonly property alias appletsRecords: _appletsRecords
readonly property alias autosize: _autosize
readonly property alias indicatorsManager: indicators
readonly property alias metrics: _metrics
@ -1345,7 +1344,6 @@ Item {
id: appletContainerComponent
Applet.AppletItem{
animations: _animations
appletsRecords: _appletsRecords
metrics: _metrics
parabolic: _parabolic
}
@ -1424,7 +1422,10 @@ Item {
}
}
VisibilityManager{ id: visibilityManager }
VisibilityManager{
id: visibilityManager
applets: layoutsContainer.applets
}
DragDropArea {
id: backDropArea
@ -1558,10 +1559,6 @@ Item {
settings: universalSettings
}
Ability.AppletsRecords {
id: _appletsRecords
}
Ability.AutoSize {
id: _autosize
layouts: layoutsContainer
@ -1579,8 +1576,7 @@ Item {
Ability.ParabolicEffect {
id: _parabolic
animations: _animations
appletsRecords: _appletsRecords
layouts: layoutsContainer
applets: layoutsContainer.applets
view: latteView
}

Loading…
Cancel
Save