update plasmoid to support scrolling

pull/5/head
Michail Vourlakos 6 years ago
parent 32904be361
commit 6710be3ae5

@ -89,6 +89,7 @@ Item {
checkedBackgroundColor: colorizerManager.buttonFocusColor
checked: root.inConfigureAppletsMode
hoveredExternal: rearrangeTooltipBtn.hovered
property color normalBackground: Qt.rgba(colorizerManager.buttonHoverColor.r,
colorizerManager.buttonHoverColor.g,
@ -108,6 +109,7 @@ Item {
}
PlasmaComponents.Button {
id: rearrangeTooltipBtn
anchors.fill: rearrangeBtn
opacity: 0
tooltip: headerSettings.tooltip

@ -35,11 +35,12 @@ Item{
signal pressed();
property bool checked: false
property bool hoveredExternal: false
property bool reverseIcon: false
property string text: "Default Text"
property string tooltip: ""
readonly property bool containsMouse: buttonMouseArea.containsMouse
readonly property bool containsMouse: buttonMouseArea.containsMouse || hoveredExternal
readonly property int implicitHeight: visibleButton.height
readonly property color appliedTextColor: checked ? checkedTextColor : textColor

@ -165,7 +165,6 @@ DragDrop.DropArea {
property bool isHovered: latteApplet ? ((latteAppletHoveredIndex !== -1) || (layoutsContainer.hoveredIndex !== -1)) //|| wholeArea.containsMouse
: (layoutsContainer.hoveredIndex !== -1) //|| wholeArea.containsMouse
property bool mouseWheelActions: plasmoid.configuration.mouseWheelActions
property bool normalState : false
property bool onlyAddingStarup: true //is used for the initialization phase in startup where there aren't removals, this variable provides a way to grow icon size
property bool shrinkThickMargins: plasmoid.configuration.shrinkThickMargins
property bool showLatteShortcutBadges: false

@ -30,6 +30,7 @@ Item{
property int shadowDirection: PlasmaCore.Types.BottomEdge
property int shadowSize: 7
property real shadowOpacity: 1
property color shadowColor: "#040404"
readonly property bool isHorizontal : (shadowDirection !== PlasmaCore.Types.LeftEdge) && (shadowDirection !== PlasmaCore.Types.RightEdge)
@ -55,7 +56,7 @@ Item{
radius: shadowSize
fast: true
samples: 2 * radius
color: "#040404"
color: shadowRoot.shadowColor
}
}
@ -67,8 +68,7 @@ Item{
AnchorChanges {
target: editShadow
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:parent.undefined}
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined}
}
PropertyChanges{
target: editShadow
@ -82,8 +82,7 @@ Item{
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined}
}
PropertyChanges{
target: editShadow
@ -97,8 +96,7 @@ Item{
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
anchors{ top:parent.top; bottom: undefined; left:parent.left; right:undefined}
}
PropertyChanges{
target: editShadow
@ -112,8 +110,7 @@ Item{
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:undefined}
anchors{top:parent.top; bottom:undefined; left:undefined; right:parent.right}
}
PropertyChanges{
target: editShadow

@ -0,0 +1,103 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This program 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.
*
* This program 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 QtQuick.Controls 1.4
import QtGraphicalEffects 1.2
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
id: shadowsContainer
opacity: 0.4
readonly property int gradientLength: root.iconSize / 3
readonly property int thickness: latteView ? latteView.realPanelSize : root.iconSize + root.thickMargins
readonly property color appliedColor: root.appShadowColorSolid
LinearGradient {
id: firstGradient
width: !root.vertical ? gradientLength : shadowsContainer.thickness
height: !root.vertical ? shadowsContainer.thickness : gradientLength
start: Qt.point(0, 0)
end: !root.vertical ? Qt.point(width, 0) : Qt.point(0,height)
gradient: Gradient {
GradientStop { position: 0.0; color: (scrollableList.currentPos > scrollableList.scrollFirstPos ? appliedColor : "transparent") }
GradientStop { position: 1.0; color: "transparent" }
}
}
LinearGradient {
id: lastGradient
width: firstGradient.width
height: firstGradient.height
start: firstGradient.start
end: firstGradient.end
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: (scrollableList.currentPos < scrollableList.scrollLastPos ? appliedColor : "transparent") }
}
}
states: [
///Left Edge
State {
name: "bottom"
when: plasmoid.location === PlasmaCore.Types.BottomEdge
AnchorChanges {
target: firstGradient
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: lastGradient
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: shadowsContainer
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
},
State {
name: "left"
when: plasmoid.location === PlasmaCore.Types.LeftEdge
AnchorChanges {
target: firstGradient
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: lastGradient
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: shadowsContainer
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
}
]
}

@ -0,0 +1,113 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This program 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.
*
* This program 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 QtQuick.Controls 1.4
import QtGraphicalEffects 1.2
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
readonly property int gradientLength: root.iconSize / 3
LinearGradient {
id: firstGradient
width: !root.vertical ? gradientLength : scrollableList.thickness
height: !root.vertical ? scrollableList.thickness : gradientLength
start: Qt.point(0, 0)
end: !root.vertical ? Qt.point(gradientLength, 0) : Qt.point(0, gradientLength)
gradient: Gradient {
GradientStop { position: 0.0; color: scrollableList.currentPos <= scrollableList.scrollFirstPos ? "white" : "transparent" }
GradientStop { position: 1.0; color: "white" }
}
}
Rectangle {
id: centralRectangle
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: !root.vertical ? length : firstGradient.width
height: !root.vertical ? firstGradient.height : length
color: "white"
property int length: !root.vertical ? parent.width - 2*gradientLength : parent.height - 2*gradientLength
}
LinearGradient {
id: lastGradient
anchors.top: parent.top
anchors.right: parent.right
width: firstGradient.width
height: firstGradient.height
start: firstGradient.start
end: firstGradient.end
gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: 1.0; color: (scrollableList.currentPos >= scrollableList.scrollLastPos ? "white" : "transparent") }
}
}
states: [
///Left Edge
State {
name: "bottom"
when: plasmoid.location === PlasmaCore.Types.BottomEdge
AnchorChanges {
target: firstGradient
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: centralRectangle
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
AnchorChanges {
target: lastGradient
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:undefined}
}
},
State {
name: "left"
when: plasmoid.location === PlasmaCore.Types.LeftEdge
AnchorChanges {
target: firstGradient
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
AnchorChanges {
target: centralRectangle
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
AnchorChanges {
target: lastGradient
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
}
]
}

@ -0,0 +1,278 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This program 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.
*
* This program 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 QtQuick.Controls 1.4
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
Flickable{
id: flickableContainer
clip: false
flickableDirection: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? Flickable.HorizontalFlick : Flickable.VerticalFlick
interactive: false
property int alignment: Latte.Types.BottomEdgeCenterAlign
property int offset: 0
readonly property bool contentsExceed: !root.vertical ? Math.floor(contentWidth) > width : Math.floor(contentHeight) > height
readonly property int contentsExtraSpace: {
if (contentsExceed) {
if (!root.vertical) {
return contentWidth - width;
} else {
return contentHeight - height;
}
}
return 0;
}
readonly property int scrollFirstPos: 0
readonly property int scrollLastPos: contentsExtraSpace
readonly property int scrollStep: root.iconSize * 1.5
readonly property int currentPos: !root.vertical ? contentX : contentY
function increasePos() {
if (!root.vertical) {
contentX = Math.min(scrollLastPos, contentX + scrollStep);
} else {
contentY = Math.min(scrollLastPos, contentY + scrollStep);
}
}
function decreasePos() {
if (!root.vertical) {
contentX = Math.max(scrollFirstPos, contentX - scrollStep);
} else {
contentY = Math.max(scrollFirstPos, contentY - scrollStep);
}
}
onContentsExtraSpaceChanged: {
if (!root.vertical) {
if (contentX < scrollFirstPos) {
contentX = scrollFirstPos;
} else if (contentX > scrollLastPos) {
contentX = scrollLastPos;
}
} else {
if (contentY < scrollFirstPos) {
contentY = scrollFirstPos;
} else if (contentY > scrollLastPos) {
contentY = scrollLastPos;
}
}
}
Behavior on contentX {
NumberAnimation {
duration: root.durationTime*units.longDuration
easing.type: Easing.OutQuad
}
}
Behavior on contentY {
NumberAnimation {
duration: root.durationTime*units.longDuration
easing.type: Easing.OutQuad
}
}
//////////////////////////BEGIN states
//user set Panel Positions
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom
states: [
///Left Edge
State {
name: "leftCenter"
when: flickableContainer.alignment === Latte.Types.LeftEdgeCenterAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: flickableContainer.offset;
}
},
State {
name: "leftTop"
when: flickableContainer.alignment === Latte.Types.LeftEdgeTopAlign
AnchorChanges {
target: flickableContainer
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:flickableContainer.offset; anchors.bottomMargin:flickableContainer.lastMargin;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State {
name: "leftBottom"
when: flickableContainer.alignment === Latte.Types.LeftEdgeBottomAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:flickableContainer.lastMargin; anchors.bottomMargin:flickableContainer.offset;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
///Right Edge
State {
name: "rightCenter"
when: flickableContainer.alignment === Latte.Types.RightEdgeCenterAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: flickableContainer.offset;
}
},
State {
name: "rightTop"
when: flickableContainer.alignment === Latte.Types.RightEdgeTopAlign
AnchorChanges {
target: flickableContainer
anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:flickableContainer.offset; anchors.bottomMargin:flickableContainer.lastMargin;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State {
name: "rightBottom"
when: flickableContainer.alignment === Latte.Types.RightEdgeBottomAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:flickableContainer.lastMargin; anchors.bottomMargin:flickableContainer.offset;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
///Bottom Edge
State {
name: "bottomCenter"
when: flickableContainer.alignment === Latte.Types.BottomEdgeCenterAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: flickableContainer.offset; anchors.verticalCenterOffset: 0;
}
},
State {
name: "bottomLeft"
when: flickableContainer.alignment === Latte.Types.BottomEdgeLeftAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: flickableContainer.offset; anchors.rightMargin:flickableContainer.lastMargin; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State {
name: "bottomRight"
when: flickableContainer.alignment === Latte.Types.BottomEdgeRightAlign
AnchorChanges {
target: flickableContainer
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: flickableContainer.lastMargin; anchors.rightMargin:flickableContainer.offset; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
///Top Edge
State {
name: "topCenter"
when: flickableContainer.alignment === Latte.Types.TopEdgeCenterAlign
AnchorChanges {
target: flickableContainer
anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: flickableContainer.offset; anchors.verticalCenterOffset: 0;
}
},
State {
name: "topLeft"
when: flickableContainer.alignment === Latte.Types.TopEdgeLeftAlign
AnchorChanges {
target: flickableContainer
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: flickableContainer.offset; anchors.rightMargin:flickableContainer.lastMargin; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State {
name: "topRight"
when: flickableContainer.alignment === Latte.Types.TopEdgeRightAlign
AnchorChanges {
target: flickableContainer
anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: flickableContainer;
anchors.leftMargin: flickableContainer.lastMargin; anchors.rightMargin:flickableContainer.offset; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
}
]
}

@ -41,16 +41,19 @@ import "../code/ColorizerTools.js" as ColorizerTools
Item {
id:root
// Layout.fillHeight: userPanelPosition === 0 ? true : false
// Layout.fillWidth: userPanelPosition === 0 ? true : false
Layout.fillWidth: scrollingEnabled && !root.vertical ? true : false
Layout.fillHeight: scrollingEnabled && root.vertical ? true : false
///IMPORTANT: These values must be tested when the Now Dock Panel support
///also the four new anchors. A small issue is shown between the animation
/// of the now dock plasmoid and the neighbour widgets...
Layout.minimumWidth: (userPanelPosition !== 0)&&(!latteView) ? clearWidth : -1
Layout.minimumHeight: (userPanelPosition !== 0)&&(!latteView) ? clearHeight : -1
Layout.preferredWidth: (userPanelPosition !== 0)&&(!latteView) ? tasksWidth : -1
Layout.preferredHeight: (userPanelPosition !== 0)&&(!latteView) ? tasksHeight : -1
Layout.minimumWidth: -1 //(userPanelPosition !== 0)&&(!latteView) ? clearWidth : -1
Layout.minimumHeight: -1 //(userPanelPosition !== 0)&&(!latteView) ? clearHeight : -1
Layout.preferredWidth: tasksWidth //(userPanelPosition !== 0)&&(!latteView) ? tasksWidth : tasksWidth
Layout.preferredHeight: tasksHeight //(userPanelPosition !== 0)&&(!latteView) ? tasksHeight : tasksHeight
Layout.maximumWidth: -1
Layout.maximumHeight: -1
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical
LayoutMirroring.childrenInherit: true
@ -77,8 +80,7 @@ Item {
property bool useThemePanel: plasmoid.configuration.useThemePanel
property bool taskInAnimation: noTasksInAnimation > 0 ? true : false
property bool transparentPanel: plasmoid.configuration.transparentPanel
property bool vertical: ((root.position === PlasmaCore.Types.LeftPositioned) ||
(root.position === PlasmaCore.Types.RightPositioned)) ? true : false
property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical ? true : false
property int clearWidth
property int clearHeight
@ -171,6 +173,8 @@ Item {
property bool showWindowActions: latteView ? latteView.showWindowActions : plasmoid.configuration.showWindowActions
property bool showWindowsOnlyFromLaunchers: latteView ? latteView.showWindowsOnlyFromLaunchers : false
property bool scrollingEnabled: true
property bool titleTooltips: latteView ? latteView.titleTooltips : false
property alias windowPreviewIsShown: windowsPreviewDlg.visible
@ -1058,14 +1062,6 @@ Item {
Item{
id:barLine
/* anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? parent.bottom : undefined
anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? parent.top : undefined
anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? parent.left : undefined
anchors.right: (root.position === PlasmaCore.Types.RightPositioned) ? parent.right : undefined
anchors.horizontalCenter: !parent.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: parent.vertical ? parent.verticalCenter : undefined */
width: ( icList.orientation === Qt.Horizontal ) ? icList.width + spacing : smallSize
height: ( icList.orientation === Qt.Vertical ) ? icList.height + spacing : smallSize
@ -1151,13 +1147,13 @@ Item {
MouseHandler {
id: mouseHandler
anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? icList.bottom : undefined
anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? icList.top : undefined
anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? icList.left : undefined
anchors.right: (root.position === PlasmaCore.Types.RightPositioned) ? icList.right : undefined
anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? scrollableList.bottom : undefined
anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? scrollableList.top : undefined
anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? scrollableList.left : undefined
anchors.right: (root.position === PlasmaCore.Types.RightPositioned) ? scrollableList.right : undefined
anchors.horizontalCenter: !root.vertical ? icList.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? icList.verticalCenter : undefined
anchors.horizontalCenter: !root.vertical ? scrollableList.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? scrollableList.verticalCenter : undefined
width: root.vertical ? maxSize : icList.width
height: root.vertical ? icList.height : maxSize
@ -1209,94 +1205,159 @@ Item {
}
}
ScrollableList {
id: scrollableList
width: !root.vertical ? Math.min(root.width, icList.width) : thickness
height: root.vertical ? Math.min(root.height, icList.height) : thickness
contentWidth: icList.width
contentHeight: icList.height
ListView {
id:icList
boundsBehavior: Flickable.StopAtBounds
readonly property bool centered: userPanelPosition === Latte.Types.Center
readonly property bool reversed: Qt.application.layoutDirection === Qt.RightToLeft
property int currentSpot : -1000
property int hoveredIndex : -1
property int previousCount : 0
property int thickness: !thickAnimated ? root.thickMargins + root.iconSize : (root.thickMargins + root.iconSize) * root.zoomFactor
property int tasksCount: tasksModel.count
readonly property bool thickAnimated: latteView && (latteView.animationsNeedBothAxis>0 || latteView.animationsNeedThickness>0)
property bool directRender: false
//onCurrentPosChanged: console.log("CP :: "+ currentPos + " icW:"+icList.width + " rw: "+root.width + " w:" +width);
// onTasksCountChanged: updateImplicits();
alignment: {
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
if (centered) return Latte.Types.LeftEdgeCenterAlign;
if (root.panelAlignment === Latte.Types.Top) return Latte.Types.LeftEdgeTopAlign;
if (root.panelAlignment === Latte.Types.Bottom) return Latte.Types.LeftEdgeBottomAlign;
}
// property int count: children ? children.length : 0
/* anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? parent.bottom : undefined
anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? parent.top : undefined
anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? parent.left : undefined
anchors.right: (root.position === PlasmaCore.Types.RightPositioned) ? parent.right : undefined
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
if (centered) return Latte.Types.RightEdgeCenterAlign;
if (root.panelAlignment === Latte.Types.Top) return Latte.Types.RightEdgeTopAlign;
if (root.panelAlignment === Latte.Types.Bottom) return Latte.Types.RightEdgeBottomAlign;
}
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined */
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
if (centered) return Latte.Types.BottomEdgeCenterAlign;
width: !root.vertical ? contentWidth : mouseHandler.maxSize
height: root.vertical ? contentHeight : mouseHandler.maxSize
if ((root.panelAlignment === Latte.Types.Left && !reversed)
|| (root.panelAlignment === Latte.Types.Right && reversed)) {
return Latte.Types.BottomEdgeLeftAlign;
}
orientation: Qt.Horizontal
if ((root.panelAlignment === Latte.Types.Right && !reversed)
|| (root.panelAlignment === Latte.Types.Left && reversed)) {
return Latte.Types.BottomEdgeRightAlign;
}
}
delegate: Task.TaskItem{}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
if (centered) return Latte.Types.TopEdgeCenterAlign;
/* Rectangle{
anchors.fill: parent
border.width: 1
border.color: "red"
color: "transparent"
} */
if ((root.panelAlignment === Latte.Types.Left && !reversed)
|| (root.panelAlignment === Latte.Types.Right && reversed)) {
return Latte.Types.TopEdgeLeftAlign;
}
//the duration of this animation should be as small as possible
//it fixes a small issue with the dragging an item to change it's
//position, if the duration is too big there is a point in the
//list that an item is going back and forth too fast
if ((root.panelAlignment === Latte.Types.Right && !reversed)
|| (root.panelAlignment === Latte.Types.Left && reversed)) {
return Latte.Types.TopEdgeRightAlign;
}
}
//more of a trouble
moveDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: root.durationTime*units.longDuration; easing.type: Easing.Linear }
return Latte.Types.BottomEdgeCenterAlign;
}
///this transition can not be used with dragging !!!! I breaks
///the lists indexes !!!!!
/* move: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.Linear }
} */
layer.enabled: contentsExceed && root.scrollingEnabled
layer.effect: OpacityMask {
maskSource: ScrollOpacityMask{
width: scrollableList.width + root.lengthMargins
height: scrollableList.height
}
}
Rectangle {
id: listViewBase
x: !root.vertical ? icList.width / 2 : 0
y: !root.vertical ? 0 : icList.height / 2
width: !root.vertical ? 1 : scrollableList.width
height: !root.vertical ? scrollableList.height : 1
color: "transparent"
border.width: 1
border.color: "transparent"//"purple"
ListView {
id:icList
width: !root.vertical ? contentWidth : mouseHandler.maxSize
height: root.vertical ? contentHeight : mouseHandler.maxSize
boundsBehavior: Flickable.StopAtBounds
orientation: Qt.Horizontal
delegate: Task.TaskItem{}
function childAtPos(x, y){
var tasks = icList.contentItem.children;
property int currentSpot : -1000
property int hoveredIndex : -1
property int previousCount : 0
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
property int tasksCount: tasksModel.count
var choords = mapFromItem(task,0, 0);
property bool directRender: false
if( (task.objectName==="TaskItem") && (x>=choords.x) && (x<=choords.x+task.width)
&& (y>=choords.y) && (y<=choords.y+task.height)){
return task;
//the duration of this animation should be as small as possible
//it fixes a small issue with the dragging an item to change it's
//position, if the duration is too big there is a point in the
//list that an item is going back and forth too fast
//more of a trouble
moveDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: root.durationTime*units.longDuration; easing.type: Easing.Linear }
}
}
return null;
}
///this transition can not be used with dragging !!!! I breaks
///the lists indexes !!!!!
///move: Transition {
/// NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.Linear }
///}
function childAtIndex(position) {
var tasks = icList.contentItem.children;
function childAtPos(x, y){
var tasks = icList.contentItem.children;
if (position < 0)
return;
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
var choords = mapFromItem(task,0, 0);
if (task.lastValidIndex === position
|| (task.lastValidIndex === -1 && task.itemIndex === position )) {
return task;
if( (task.objectName==="TaskItem") && (x>=choords.x) && (x<=choords.x+task.width)
&& (y>=choords.y) && (y<=choords.y+task.height)){
return task;
}
}
return null;
}
}
return undefined;
function childAtIndex(position) {
var tasks = icList.contentItem.children;
if (position < 0)
return;
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
if (task.lastValidIndex === position
|| (task.lastValidIndex === -1 && task.itemIndex === position )) {
return task;
}
}
return undefined;
}
}
}
} // ScrollableList
ScrollEdgeShadows {
id: scrollShadows
width: !root.vertical ? scrollableList.width : thickness
height: !root.vertical ? thickness : scrollableList.height
visible: scrollableList.contentsExceed
}
Task.VisualAddItem{
@ -1306,6 +1367,7 @@ Item {
visible: opacity == 0 ? false : true
opacity: root.dropNewLauncher && mouseHandler.onlyLaunchers && (root.dragSource == null)? 1 : 0
}
}
//// helpers

@ -575,7 +575,6 @@ MouseArea{
restoreAnimation.stop();
}
// console.log("entered task:" + icList.hoveredIndex);
if (icList.hoveredIndex === -1 && root.dockHoveredIndex ===-1) {
root.startDirectRenderDelayerDuringEntering();
}
@ -834,7 +833,7 @@ MouseArea{
}
}
onWheel: {
onWheel: {
if (isSeparator || !root.mouseWheelActions || wheelIsBlocked || inBouncingAnimation
|| (latteView && (latteView.dockIsHidden || latteView.inSlidingIn || latteView.inSlidingOut))){
@ -848,38 +847,46 @@ MouseArea{
//positive direction
if (angle > 12) {
if (isLauncher || root.disableAllWindowsFunctionality) {
wrapper.runLauncherAnimation();
} else if (isGroupParent) {
subWindows.activateNextTask();
if (root.scrollingEnabled && scrollableList.contentsExceed) {
scrollableList.increasePos();
} else {
var taskIndex = modelIndex();
if (isLauncher || root.disableAllWindowsFunctionality) {
wrapper.runLauncherAnimation();
} else if (isGroupParent) {
subWindows.activateNextTask();
} else {
var taskIndex = modelIndex();
if (isMinimized) {
tasksModel.requestToggleMinimized(taskIndex);
}
if (isMinimized) {
tasksModel.requestToggleMinimized(taskIndex);
tasksModel.requestActivate(taskIndex);
}
tasksModel.requestActivate(taskIndex);
hidePreviewWindow();
}
hidePreviewWindow();
//negative direction
} else if (angle < -12) {
if (isLauncher || root.disableAllWindowsFunctionality) {
// do nothing
} else if (isGroupParent) {
subWindows.activatePreviousTask();
//negative direction
if (root.scrollingEnabled && scrollableList.contentsExceed) {
scrollableList.decreasePos();
} else {
var taskIndex = modelIndex();
if (isLauncher || root.disableAllWindowsFunctionality) {
// do nothing
} else if (isGroupParent) {
subWindows.activatePreviousTask();
} else {
var taskIndex = modelIndex();
if (isMinimized) {
tasksModel.requestToggleMinimized(taskIndex);
if (isMinimized) {
tasksModel.requestToggleMinimized(taskIndex);
}
tasksModel.requestActivate(taskIndex);
}
tasksModel.requestActivate(taskIndex);
hidePreviewWindow();
}
hidePreviewWindow();
}
}

Loading…
Cancel
Save