Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/PulleyItemDash.qml is written in an unsupported language. File is not indexed.

0001 /* Copyright 2016 Aditya Mehra <aix.m@outlook.com>                            
0002 
0003     This library is free software; you can redistribute it and/or
0004     modify it under the terms of the GNU Lesser General Public
0005     License as published by the Free Software Foundation; either
0006     version 2.1 of the License, or (at your option) version 3, or any
0007     later version accepted by the membership of KDE e.V. (or its
0008     successor approved by the membership of KDE e.V.), which shall
0009     act as a proxy defined in Section 6 of version 3 of the license.
0010     
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Lesser General Public License for more details.
0015     
0016     You should have received a copy of the GNU Lesser General Public
0017     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 import QtQuick 2.9
0021 import org.kde.plasma.core 2.0 as PlasmaCore
0022 import org.kde.plasma.components 2.0 as PlasmaComponents
0023 import org.kde.plasma.extras 2.0 as PlasmaExtras
0024 import QtGraphicalEffects 1.0
0025 
0026 Item {
0027  id: pulleyFrame
0028  anchors.fill: parent
0029  property bool opened: state === "PulleyExpanded"
0030  property bool closed: state === "PulleyClosed"
0031  property bool _isVisible
0032  property var barColor
0033  signal pulleyExpanded()
0034  signal pulleyClosed()
0035 
0036  function open() {
0037      pulleyFrame.state = "PulleyExpanded";
0038      pulleyExpanded();
0039  }
0040 
0041  function close() {
0042      pulleyFrame.state = "PulleyClosed";
0043      pulleyClosed();
0044  }
0045 
0046  states: [
0047      State {
0048          name: "PulleyExpanded"
0049          PropertyChanges { target: pulleyMenu; height: cbheight / 6 - pulleyIconBar.height; }
0050          PropertyChanges { target: pulleydashMenu; visible: true; }
0051          PropertyChanges { target: menudrawIcon; source: "go-down";}
0052      },
0053      State {
0054          name: "PulleyClosed"
0055          PropertyChanges { target: pulleyMenu; height: 0; }
0056          PropertyChanges { target: pulleydashMenu; visible: false; }
0057          PropertyChanges { target: menudrawIcon; source: "go-up";}
0058      }
0059     ]
0060 
0061 
0062  transitions: [
0063      Transition {
0064          to: "*"
0065          NumberAnimation { target: pulleyMenu; properties: "height"; duration: 450; easing.type: Easing.OutCubic; }
0066      }
0067     ]
0068 
0069     Rectangle {
0070       id: pulleyIconBar
0071       anchors.bottom: pulleyMenu.top
0072       anchors.bottomMargin: 0
0073       height: units.gridUnit * 0.40
0074       color: barColor
0075       width: cbwidth
0076         PlasmaCore.IconItem {
0077                 id: menudrawIcon
0078                 visible: _isVisible
0079                 anchors.centerIn: parent
0080                 source: "go-up"
0081                 width: units.gridUnit * 1.25
0082                 height: units.gridUnit * 1.25
0083             }
0084 
0085         MouseArea{
0086             anchors.fill: parent
0087             propagateComposedEvents: true
0088             onClicked: {
0089                 if (pulleyFrame.opened) {
0090                     pulleyFrame.close();
0091                 } else {
0092                     pulleyFrame.open();
0093                 }
0094             }
0095         }
0096     }
0097 
0098     Rectangle {
0099         id: pulleyMenu
0100         width: parent.width
0101         color: PlasmaCore.ColorScope.backgroundColor
0102         anchors.bottom: parent.bottom
0103         height: 0
0104         
0105         Item {
0106             id: pulleydashMenu
0107             anchors.fill: parent
0108             visible: false
0109             
0110              PlasmaComponents.Button {
0111                     id: refreshDashBtn
0112                     anchors.left: parent.left
0113                     anchors.top: parent.top
0114                     width: parent.width / 2
0115                     height: parent.height
0116                     text: i18n("Refresh Dashboard")
0117                     
0118                     onClicked: {
0119                         convoLmodel.clear()
0120                         showDash("setVisible")
0121                     }
0122              }
0123              PlasmaComponents.Button {
0124                     id: settingsDashBtn
0125                     anchors.left: refreshDashBtn.right
0126                     anchors.top: parent.top
0127                     width: parent.width / 2
0128                     height: parent.height   
0129                     text: i18n("Change Settings")
0130                     
0131                     onClicked: {
0132                         tabBar.currentTab = mycroftSettingsTab
0133                         settingstabBar.currentTab = dashSettingsTab
0134                     }
0135            }
0136         }
0137         
0138          Item {
0139                 id: pulleyEndArea
0140                 anchors.bottom: parent.bottom
0141                 anchors.bottomMargin: units.gridUnit * 1.22
0142                 width: parent.width
0143                 height: units.gridUnit * 2.5
0144             }
0145         }
0146     }