Indicators protocol change attributes to level

--introduce a new class called level which contains
all the needed information concerning indicator level
and at the same time the bridge that provides information
for the specific indicator states
pull/5/head
Michail Vourlakos 6 years ago
parent 4e6b015b95
commit 262dfa6b09

@ -507,8 +507,10 @@ Item {
//! Indicator Back Layer
Indicator.Loader{
id: indicatorBackLayer
bridge: indicatorBridge
isBackground: true
level: Indicator.LevelOptions {
isBackground: true
bridge: indicatorBridge
}
}
ItemWrapper{
@ -541,8 +543,10 @@ Item {
//! Indicator Front Layer
Indicator.Loader{
id: indicatorFrontLayer
bridge: indicatorBridge
isBackground: false
level: Indicator.LevelOptions {
isForeground: true
bridge: indicatorBridge
}
}
//! Applet Shortcut Visual Badge

@ -0,0 +1,39 @@
/*
* Copyright 2019 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 0.2 as Latte
Item {
id: level
property bool isBackground: true
property bool isForeground: false
property Item bridge
onIsBackgroundChanged: {
isForeground = !isBackground;
}
onIsForegroundChanged: {
isBackground = !isForeground;
}
}

@ -21,11 +21,11 @@ import QtQuick 2.7
import org.kde.latte 0.2 as Latte
Loader{
Loader {
id: indicatorLoader
anchors.fill: parent
active: bridge && bridge.active && (isBackground || (isForeground && indicators.info.providesFrontLayer))
active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer))
sourceComponent: {
if (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) {
return indicators.plasmaStyleComponent;
@ -34,7 +34,5 @@ Loader{
return indicators.indicatorComponent;
}
property bool isBackground: true
readonly property bool isForeground: !isBackground
property Item bridge
property Item level
}

@ -61,10 +61,11 @@ Item{
opacity: 0
active: managerIndicator.isEnabled
readonly property bool isBackground: true
readonly property bool isForeground: false
readonly property Item bridge: AppletIndicator.Bridge{
appletIsValid: false
readonly property Item level: AppletIndicator.LevelOptions {
isBackground: true
bridge: AppletIndicator.Bridge{
appletIsValid: false
}
}
sourceComponent: managerIndicator.indicatorComponent

@ -20,6 +20,6 @@
import QtQuick 2.7
Item {
readonly property Item indicator: parent && parent.hasOwnProperty("bridge") ? parent.bridge : null
readonly property Item attributes: parent
readonly property Item level: parent && parent.hasOwnProperty("level") ? parent.level : null
readonly property Item indicator: parent && parent.hasOwnProperty("level") ? parent.level.bridge : null
}

@ -31,7 +31,7 @@ LatteComponents.IndicatorItem {
Loader{
id: backLayer
anchors.fill: parent
active: attributes.isBackground
active: level.isBackground
sourceComponent: BackLayer{}
}
@ -40,7 +40,7 @@ LatteComponents.IndicatorItem {
Loader{
id: frontLayer
anchors.fill: parent
active: attributes.isForeground && !indicator.isApplet && indicator.isGroup
active: level.isForeground && !indicator.isApplet && indicator.isGroup
sourceComponent: FrontLayer{}
}

@ -55,7 +55,7 @@ LatteComponents.IndicatorItem {
Loader{
id: backLayer
anchors.fill: parent
active: attributes.isBackground
active: level.isBackground
sourceComponent: BackLayer{}
}
@ -64,7 +64,7 @@ LatteComponents.IndicatorItem {
Loader{
id: frontLayer
anchors.fill: parent
active: attributes.isForeground
active: level.isForeground
sourceComponent:FrontLayer{}
}

@ -427,16 +427,20 @@ MouseArea{
Indicator.Loader{
id: indicatorBackLayer
bridge: indicatorBridge
isBackground: true
level: Indicator.LevelOptions {
isBackground: true
bridge: indicatorBridge
}
}
Wrapper{id: wrapper}
Indicator.Loader{
id: indicatorFrontLayer
bridge: indicatorBridge
isBackground: false
level: Indicator.LevelOptions {
isForeground: true
bridge: indicatorBridge
}
}
}

@ -0,0 +1,39 @@
/*
* Copyright 2019 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 0.2 as Latte
Item {
id: level
property bool isBackground: true
property bool isForeground: false
property Item bridge
onIsBackgroundChanged: {
isForeground = !isBackground;
}
onIsForegroundChanged: {
isBackground = !isForeground;
}
}

@ -34,11 +34,7 @@ Loader {
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined
property bool isBackground: true
readonly property bool isForeground: !isBackground
property Item bridge
active: bridge && bridge.active && (isBackground || (isForeground && indicators.info.providesFrontLayer))
active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer))
sourceComponent: indicators.indicatorComponent
width: {
@ -61,4 +57,6 @@ Loader {
property real visualLockedWidth: root.iconSize + root.internalWidthMargins
property real visualLockedHeight: root.iconSize + root.internalHeightMargins
property Item level
}

Loading…
Cancel
Save