|
|
|
@ -28,126 +28,129 @@ import org.kde.latte.private.containment 0.1 as LatteContainment
|
|
|
|
|
|
|
|
|
|
import "canvas" as CanvasComponent
|
|
|
|
|
|
|
|
|
|
Item{
|
|
|
|
|
id: root
|
|
|
|
|
Loader {
|
|
|
|
|
active: plasmoid && plasmoid.configuration && latteView
|
|
|
|
|
|
|
|
|
|
sourceComponent: Item{
|
|
|
|
|
id: root
|
|
|
|
|
readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
|
|
|
|
|
readonly property bool isHorizontal: !isVertical
|
|
|
|
|
|
|
|
|
|
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? 500 : 0
|
|
|
|
|
property int panelAlignment: plasmoid.configuration.alignment
|
|
|
|
|
|
|
|
|
|
readonly property real appliedOpacity: imageTiler.opacity
|
|
|
|
|
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
|
|
|
|
|
1 : plasmoid.configuration.editBackgroundOpacity
|
|
|
|
|
|
|
|
|
|
property real offset: {
|
|
|
|
|
if (root.isHorizontal) {
|
|
|
|
|
return width * (plasmoid.configuration.offset/100);
|
|
|
|
|
} else {
|
|
|
|
|
return height * (plasmoid.configuration.offset/100)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
|
|
|
|
|
readonly property bool isHorizontal: !isVertical
|
|
|
|
|
property string appChosenShadowColor: {
|
|
|
|
|
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
|
|
|
|
|
var strC = String(theme.textColor);
|
|
|
|
|
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
|
|
|
|
|
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
|
|
|
|
|
return plasmoid.configuration.shadowColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? 500 : 0
|
|
|
|
|
property int panelAlignment: plasmoid.configuration.alignment
|
|
|
|
|
// default shadow color
|
|
|
|
|
return "080808";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly property real appliedOpacity: imageTiler.opacity
|
|
|
|
|
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
|
|
|
|
|
1 : plasmoid.configuration.editBackgroundOpacity
|
|
|
|
|
property string appShadowColorSolid: "#" + appChosenShadowColor
|
|
|
|
|
|
|
|
|
|
property real offset: {
|
|
|
|
|
if (root.isHorizontal) {
|
|
|
|
|
return width * (plasmoid.configuration.offset/100);
|
|
|
|
|
} else {
|
|
|
|
|
return height * (plasmoid.configuration.offset/100)
|
|
|
|
|
//// BEGIN OF Behaviors
|
|
|
|
|
Behavior on offset {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
id: offsetAnimation
|
|
|
|
|
duration: animationSpeed
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//// END OF Behaviors
|
|
|
|
|
|
|
|
|
|
property string appChosenShadowColor: {
|
|
|
|
|
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
|
|
|
|
|
var strC = String(theme.textColor);
|
|
|
|
|
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
|
|
|
|
|
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
|
|
|
|
|
return plasmoid.configuration.shadowColor;
|
|
|
|
|
Item {
|
|
|
|
|
id: graphicsSystem
|
|
|
|
|
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
|
|
|
|
|
&& (GraphicsInfo.api !== GraphicsInfo.Unknown)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// default shadow color
|
|
|
|
|
return "080808";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property string appShadowColorSolid: "#" + appChosenShadowColor
|
|
|
|
|
|
|
|
|
|
//// BEGIN OF Behaviors
|
|
|
|
|
Behavior on offset {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
id: offsetAnimation
|
|
|
|
|
duration: animationSpeed
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
Image{
|
|
|
|
|
id: imageTiler
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
opacity: root.maxOpacity
|
|
|
|
|
fillMode: Image.Tile
|
|
|
|
|
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
|
|
|
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
duration: 0.8 * root.animationSpeed
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//// END OF Behaviors
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: graphicsSystem
|
|
|
|
|
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
|
|
|
|
|
&& (GraphicsInfo.api !== GraphicsInfo.Unknown)
|
|
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: editBackMouseArea
|
|
|
|
|
anchors.fill: imageTiler
|
|
|
|
|
visible: !plasmoid.configuration.inConfigureAppletsMode
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
|
|
Image{
|
|
|
|
|
id: imageTiler
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
opacity: root.maxOpacity
|
|
|
|
|
fillMode: Image.Tile
|
|
|
|
|
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
duration: 0.8 * root.animationSpeed
|
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
|
onWheel: {
|
|
|
|
|
processWheel(wheel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: editBackMouseArea
|
|
|
|
|
anchors.fill: imageTiler
|
|
|
|
|
visible: !plasmoid.configuration.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))
|
|
|
|
|
function processWheel(wheel) {
|
|
|
|
|
if (wheelIsBlocked) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onWheel: {
|
|
|
|
|
processWheel(wheel);
|
|
|
|
|
}
|
|
|
|
|
wheelIsBlocked = true;
|
|
|
|
|
scrollDelayer.start();
|
|
|
|
|
|
|
|
|
|
var angle = wheel.angleDelta.y / 8;
|
|
|
|
|
|
|
|
|
|
function processWheel(wheel) {
|
|
|
|
|
if (wheelIsBlocked) {
|
|
|
|
|
return;
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wheelIsBlocked = true;
|
|
|
|
|
scrollDelayer.start();
|
|
|
|
|
//! 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
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
interval: 80
|
|
|
|
|
onTriggered: editBackMouseArea.wheelIsBlocked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! 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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
|
anchors.fill: editBackMouseArea
|
|
|
|
|
opacity: 0
|
|
|
|
|
tooltip: editBackMouseArea.tooltip
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Settings Overlay
|
|
|
|
|
CanvasComponent.SettingsOverlay {
|
|
|
|
|
id: settingsOverlay
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
//! Settings Overlay
|
|
|
|
|
CanvasComponent.SettingsOverlay {
|
|
|
|
|
id: settingsOverlay
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|