Warning, /plasma/latte-dock/containment/package/contents/ui/layouts/AppletsContainer.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.7
0007 
0008 import org.kde.plasma.core 2.0 as PlasmaCore
0009 
0010 import org.kde.latte.core 0.2 as LatteCore
0011 
0012 Grid {
0013     id: appletsContainer
0014 
0015     columns: root.isVertical ? 1 : 0
0016     columnSpacing: 0
0017     flow: isHorizontal ? Grid.LeftToRight : Grid.TopToBottom
0018     rows: root.isHorizontal ? 1 : 0
0019     rowSpacing: 0
0020 
0021     opacity: {
0022         if (root.inConfigureAppletsMode && root.myView.alignment===LatteCore.Types.Justify && layoutsContainer.mainLayout.isCoveredFromSideLayouts){
0023             if (dragOverlay && (!dragOverlay.currentHoveredLayout || dragOverlay.currentHoveredLayout === appletsContainer)) {
0024                 return 1;
0025             } else {
0026                 return 0.3;
0027             }
0028         }
0029 
0030         return 1;
0031     }
0032 
0033     readonly property real length : root.isHorizontal ? width - ignoredLength : height - ignoredLength
0034     property real ignoredLength: 0
0035 
0036     property int alignment: LatteCore.Types.BottomEdgeCenterAlign
0037     property int beginIndex: 0
0038     property int offset: 0
0039 
0040     //////////////////////////BEGIN states
0041     //user set Panel Positions
0042     // 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom
0043     states: [
0044         ///Left Edge
0045         State {
0046             name: "leftCenter"
0047             when: appletsContainer.alignment === LatteCore.Types.LeftEdgeCenterAlign
0048 
0049             AnchorChanges {
0050                 target: appletsContainer
0051                 anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
0052             }
0053             PropertyChanges{
0054                 target: appletsContainer; horizontalItemAlignment: Grid.AlignLeft; verticalItemAlignment: Grid.AlignVCenter;
0055                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:0;    anchors.bottomMargin:0;
0056                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: appletsContainer.offset;
0057             }
0058         },
0059         State {
0060             name: "leftTop"
0061             when: appletsContainer.alignment === LatteCore.Types.LeftEdgeTopAlign
0062 
0063             AnchorChanges {
0064                 target: appletsContainer
0065                 anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
0066             }
0067             PropertyChanges{
0068                 target: appletsContainer; horizontalItemAlignment: Grid.AlignLeft; verticalItemAlignment: Grid.AlignVCenter;
0069                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:appletsContainer.offset;    anchors.bottomMargin:appletsContainer.lastMargin;
0070                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0071             }
0072         },
0073         State {
0074             name: "leftBottom"
0075             when: appletsContainer.alignment === LatteCore.Types.LeftEdgeBottomAlign
0076 
0077             AnchorChanges {
0078                 target: appletsContainer
0079                 anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
0080             }
0081             PropertyChanges{
0082                 target: appletsContainer; horizontalItemAlignment: Grid.AlignLeft; verticalItemAlignment: Grid.AlignVCenter;
0083                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:appletsContainer.lastMargin;    anchors.bottomMargin:appletsContainer.offset;
0084                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0085             }
0086         },
0087         ///Right Edge
0088         State {
0089             name: "rightCenter"
0090             when: appletsContainer.alignment === LatteCore.Types.RightEdgeCenterAlign
0091 
0092             AnchorChanges {
0093                 target: appletsContainer
0094                 anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
0095             }
0096             PropertyChanges{
0097                 target: appletsContainer; horizontalItemAlignment: Grid.AlignRight; verticalItemAlignment: Grid.AlignVCenter;
0098                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:0;    anchors.bottomMargin:0;
0099                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: appletsContainer.offset;
0100             }
0101         },
0102         State {
0103             name: "rightTop"
0104             when: appletsContainer.alignment === LatteCore.Types.RightEdgeTopAlign
0105 
0106             AnchorChanges {
0107                 target: appletsContainer
0108                 anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
0109             }
0110             PropertyChanges{
0111                 target: appletsContainer; horizontalItemAlignment: Grid.AlignRight; verticalItemAlignment: Grid.AlignVCenter;
0112                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:appletsContainer.offset;    anchors.bottomMargin:appletsContainer.lastMargin;
0113                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0114             }
0115         },
0116         State {
0117             name: "rightBottom"
0118             when: appletsContainer.alignment === LatteCore.Types.RightEdgeBottomAlign
0119 
0120             AnchorChanges {
0121                 target: appletsContainer
0122                 anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
0123             }
0124             PropertyChanges{
0125                 target: appletsContainer; horizontalItemAlignment: Grid.AlignRight; verticalItemAlignment: Grid.AlignVCenter;
0126                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:appletsContainer.lastMargin;    anchors.bottomMargin:appletsContainer.offset;
0127                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0128             }
0129         },
0130         ///Bottom Edge
0131         State {
0132             name: "bottomCenter"
0133             when: appletsContainer.alignment === LatteCore.Types.BottomEdgeCenterAlign
0134 
0135             AnchorChanges {
0136                 target: appletsContainer
0137                 anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
0138             }
0139             PropertyChanges{
0140                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignBottom
0141                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:0;    anchors.bottomMargin:0;
0142                 anchors.horizontalCenterOffset: appletsContainer.offset; anchors.verticalCenterOffset: 0;
0143             }
0144         },
0145         State {
0146             name: "bottomLeft"
0147             when: appletsContainer.alignment === LatteCore.Types.BottomEdgeLeftAlign
0148 
0149             AnchorChanges {
0150                 target: appletsContainer
0151                 anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
0152             }
0153             PropertyChanges{
0154                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignBottom
0155                 anchors.leftMargin: appletsContainer.offset;    anchors.rightMargin:appletsContainer.lastMargin;     anchors.topMargin:0;    anchors.bottomMargin:0;
0156                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0157             }
0158         },
0159         State {
0160             name: "bottomRight"
0161             when: appletsContainer.alignment === LatteCore.Types.BottomEdgeRightAlign
0162 
0163             AnchorChanges {
0164                 target: appletsContainer
0165                 anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
0166             }
0167             PropertyChanges{
0168                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignBottom
0169                 anchors.leftMargin: appletsContainer.lastMargin;    anchors.rightMargin:appletsContainer.offset;     anchors.topMargin:0;    anchors.bottomMargin:0;
0170                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0171             }
0172         },
0173         ///Top Edge
0174         State {
0175             name: "topCenter"
0176             when: appletsContainer.alignment === LatteCore.Types.TopEdgeCenterAlign
0177 
0178             AnchorChanges {
0179                 target: appletsContainer
0180                 anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
0181             }
0182             PropertyChanges{
0183                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignTop
0184                 anchors.leftMargin: 0;    anchors.rightMargin:0;     anchors.topMargin:0;    anchors.bottomMargin:0;
0185                 anchors.horizontalCenterOffset: appletsContainer.offset; anchors.verticalCenterOffset: 0;
0186             }
0187         },
0188         State {
0189             name: "topLeft"
0190             when: appletsContainer.alignment === LatteCore.Types.TopEdgeLeftAlign
0191 
0192             AnchorChanges {
0193                 target: appletsContainer
0194                 anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:undefined}
0195             }
0196             PropertyChanges{
0197                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignTop
0198                 anchors.leftMargin: appletsContainer.offset;    anchors.rightMargin:appletsContainer.lastMargin;     anchors.topMargin:0;    anchors.bottomMargin:0;
0199                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0200             }
0201         },
0202         State {
0203             name: "topRight"
0204             when: appletsContainer.alignment === LatteCore.Types.TopEdgeRightAlign
0205 
0206             AnchorChanges {
0207                 target: appletsContainer
0208                 anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:undefined}
0209             }
0210             PropertyChanges{
0211                 target: appletsContainer; horizontalItemAlignment: Grid.AlignHCenter; verticalItemAlignment: Grid.AlignTop
0212                 anchors.leftMargin: appletsContainer.lastMargin;    anchors.rightMargin:appletsContainer.offset;     anchors.topMargin:0;    anchors.bottomMargin:0;
0213                 anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
0214             }
0215         }
0216     ]
0217     ////////////////END states
0218 }