Warning, /plasma/plasma-sdk/plasmoidviewer/qmlpackages/shell/contents/configuration/PanelConfiguration.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.0
0008 import org.kde.plasma.core as PlasmaCore
0009 import org.kde.plasma.configuration 2.0
0010 import org.kde.kirigami 2.20 as Kirigami
0011 import org.kde.ksvg 1.0 as KSvg
0012 import "panelconfiguration"
0013 
0014 
0015 //TODO: all of this will be done with desktop components
0016 KSvg.FrameSvgItem {
0017     id: dialogRoot
0018 
0019     signal closeContextMenu
0020 
0021 //BEGIN Properties
0022     width: 640
0023     height: 64
0024     imagePath: "dialogs/background"
0025 
0026     LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
0027     LayoutMirroring.childrenInherit: true
0028 
0029     state: {
0030         switch (panel.location) {
0031         case PlasmaCore.Types.TopEdge:
0032             return "TopEdge"
0033         case PlasmaCore.Types.LeftEdge:
0034             return "LeftEdge"
0035         case PlasmaCore.Types.RightEdge:
0036             return "RightEdge"
0037         case PlasmaCore.Types.BottomEdge:
0038         default:
0039             return "BottomEdge"
0040         }
0041     }
0042 
0043     property bool vertical: (panel.location === PlasmaCore.Types.LeftEdge || panel.location === PlasmaCore.Types.RightEdge)
0044 //END properties
0045 
0046 //BEGIN Connections
0047     Connections {
0048         target: panel
0049         function onOffsetChanged() {
0050             ruler.offset = panel.offset
0051         }
0052         function onMinimumLengthChanged() {
0053             ruler.minimumLength = panel.minimumLength
0054         }
0055         function onMaximumLengthChanged() {
0056             ruler.maximumLength = panel.maximumLength
0057         }
0058     }
0059 
0060     Connections {
0061         target: plasmoid
0062         function onImmutableChanged() {
0063             configDialog.close()
0064         }
0065     }
0066 //END Connections
0067 
0068 
0069 //BEGIN UI components
0070 
0071     Ruler {
0072         id: ruler
0073         state: dialogRoot.state
0074     }
0075 
0076     ToolBar {
0077         id: toolBar
0078     }
0079 //END UI components
0080 
0081 //BEGIN Animations
0082     //when EdgeHandle is released animate to old panel position
0083     ParallelAnimation {
0084         id: panelResetAnimation
0085         NumberAnimation {
0086             target: panel
0087             properties: (panel.location === PlasmaCore.Types.LeftEdge || panel.location === PlasmaCore.Types.RightEdge) ? "x" : "y"
0088             to:  {
0089                 switch (panel.location) {
0090                 case PlasmaCore.Types.TopEdge:
0091                     return panel.screenGeometry.y + panel.distance
0092                 case PlasmaCore.Types.LeftEdge:
0093                     return panel.screenGeometry.x + panel.distance
0094                 case PlasmaCore.Types.RightEdge:
0095                     return panel.screenGeometry.x + panel.screenGeometry.width - panel.width - panel.distance
0096                 case PlasmaCore.Types.BottomEdge:
0097                 default:
0098                     return panel.screenGeometry.y + panel.screenGeometry.height - panel.height - panel.distance
0099                 }
0100             }
0101             duration: Kirigami.Units.shortDuration
0102         }
0103 
0104         NumberAnimation {
0105             target: configDialog
0106             properties: (panel.location === PlasmaCore.Types.LeftEdge || panel.location === PlasmaCore.Types.RightEdge) ? "x" : "y"
0107             to: {
0108                 switch (panel.location) {
0109                 case PlasmaCore.Types.TopEdge:
0110                     return panel.screenGeometry.y + panel.height + panel.distance
0111                 case PlasmaCore.Types.LeftEdge:
0112                     return panel.screenGeometry.x + panel.width + panel.distance
0113                 case PlasmaCore.Types.RightEdge:
0114                     return panel.screenGeometry.x + panel.screenGeometry.width - panel.width - configDialog.width - panel.distance
0115                 case PlasmaCore.Types.BottomEdge:
0116                 default:
0117                     return panel.screenGeometry.y + panel.screenGeometry.height - panel.height - configDialog.height - panel.distance
0118                 }
0119             }
0120             duration: Kirigami.Units.shortDuration
0121         }
0122     }
0123 //END Animations
0124 
0125 //BEGIN States
0126 states: [
0127         State {
0128             name: "TopEdge"
0129             PropertyChanges {
0130                 target: dialogRoot
0131                 enabledBorders: "TopBorder|BottomBorder"
0132             }
0133             PropertyChanges {
0134                 target: dialogRoot
0135                 implicitHeight: ruler.implicitHeight + toolBar.implicitHeight
0136             }
0137         },
0138         State {
0139             name: "BottomEdge"
0140             PropertyChanges {
0141                 target: dialogRoot
0142                 enabledBorders: "TopBorder|BottomBorder"
0143             }
0144             PropertyChanges {
0145                 target: dialogRoot
0146                 implicitHeight: ruler.implicitHeight + toolBar.implicitHeight
0147             }
0148         },
0149         State {
0150             name: "LeftEdge"
0151             PropertyChanges {
0152                 target: dialogRoot
0153                 enabledBorders: "LeftBorder|RightBorder"
0154             }
0155             PropertyChanges {
0156                 target: dialogRoot
0157                 implicitWidth: ruler.implicitWidth + toolBar.implicitWidth
0158             }
0159         },
0160         State {
0161             name: "RightEdge"
0162             PropertyChanges {
0163                 target: dialogRoot
0164                 enabledBorders: "LeftBorder|RightBorder"
0165             }
0166             PropertyChanges {
0167                 target: dialogRoot
0168                 implicitWidth: ruler.implicitWidth + toolBar.implicitWidth
0169             }
0170         }
0171     ]
0172 //END States
0173 }