Warning, /multimedia/rattlesnake/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.rattlesnake 1.0
0010 
0011 import ".."
0012 
0013 
0014 Controls.Button {
0015     id: root
0016     property Kirigami.Action singleAction
0017 
0018     property int margin: 10
0019 
0020     height: 55
0021     width: 55
0022     Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
0023     Controls.ToolTip.visible: hovered
0024     Controls.ToolTip.text: root.singleAction.text
0025     background: Kirigami.ShadowedRectangle{
0026         Kirigami.Theme.inherit: false
0027         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0028         border.width: 1
0029         border.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         color: if (parent.down){
0037                 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.6)
0038             }else if(parent.hovered){
0039                 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.hoverColor, Kirigami.Theme.backgroundColor, 0.8)
0040             }else{
0041                 Kirigami.Theme.backgroundColor
0042             }
0043         shadow.size: 10
0044         shadow.xOffset: 2
0045         shadow.yOffset: 2
0046         shadow.color: Qt.rgba(0, 0, 0, 0.2)
0047         Behavior on color {
0048                 enabled: highlightBackground
0049                 ColorAnimation {
0050                     duration: Kirigami.Units.longDuration
0051                     easing.type: Easing.OutCubic
0052                 }
0053             }
0054         Behavior on border.color {
0055             enabled: highlightBorder
0056             ColorAnimation {
0057                 duration: Kirigami.Units.longDuration
0058                 easing.type: Easing.OutCubic
0059             }
0060         }
0061         radius: 10
0062     }
0063     contentItem: Item{
0064         Kirigami.Icon{
0065             implicitHeight: Kirigami.Units.gridUnit * 1.2
0066             source: root.singleAction.icon.name
0067             anchors.centerIn: parent
0068         }
0069     }
0070     text: root.singleAction.text
0071     onClicked: root.singleAction.triggered()
0072 }