Warning, /utilities/powerplant/src/contents/ui/components/ActionButton.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import QtQuick 2.1
0006 import QtQuick.Controls 2.12 as Controls
0007 import QtQuick.Layouts 1.3
0008 import org.kde.kirigami 2.19 as Kirigami
0009 import org.kde.powerplant 1.0
0010 
0011 import ".."
0012 
0013 
0014 Controls.Button {
0015     id: root
0016 
0017     property int margin: 10
0018 
0019     height: 55
0020     width: 55
0021     background: Kirigami.ShadowedRectangle{
0022         Kirigami.Theme.inherit: false
0023         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0024 
0025         radius: 10
0026 
0027         border {
0028             width: 1
0029             color: if (parent.down){
0030                 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.4)
0031             } else if (parent.hovered){
0032                 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.6)
0033             } else {
0034                 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.2)
0035             }
0036         }
0037 
0038         color: if (parent.down) {
0039             Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.6)
0040         } else if (parent.hovered) {
0041             Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.8)
0042         } else {
0043             Kirigami.Theme.backgroundColor
0044         }
0045 
0046         shadow {
0047             size: 10
0048             xOffset: 2
0049             yOffset: 2
0050             color: Qt.rgba(0, 0, 0, 0.2)
0051         }
0052 
0053         Behavior on color {
0054             ColorAnimation {
0055                 duration: Kirigami.Units.longDuration
0056                 easing.type: Easing.OutCubic
0057             }
0058         }
0059 
0060         Behavior on border.color {
0061             ColorAnimation {
0062                 duration: Kirigami.Units.longDuration
0063                 easing.type: Easing.OutCubic
0064             }
0065         }
0066     }
0067     contentItem: Item {
0068         Kirigami.Icon {
0069             implicitHeight: Math.round(Kirigami.Units.gridUnit * 1.2)
0070             source: root.icon.name
0071             anchors.centerIn: parent
0072         }
0073     }
0074 }