Warning, /plasma/discover/discover/qml/CarouselNavigationButton.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls as QQC2 0009 import QtQuick.Templates as T 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.kirigamiaddons.components as KirigamiComponents 0012 0013 KirigamiComponents.FloatingButton { 0014 id: controlRoot 0015 0016 /* 0017 * This property controls whether opacity and translation should be animated. 0018 * Note that any cuurently running animations can not be stopped. 0019 */ 0020 required property bool animated 0021 0022 /* 0023 * Two properties reflecting whether the current item is the first one in 0024 * carousel, and/or whether it is the last one. Note that they are not 0025 * mutually exclusive, if the carousel contains only a single item. 0026 */ 0027 required property bool atBeginning 0028 required property bool atEnd 0029 0030 /* 0031 * Extra offset toward the button's primary direction to add on top of the 0032 * default padding. 0033 */ 0034 property real edgeMargin: Kirigami.Units.gridUnit 0035 0036 property int role: Qt.AlignLeading 0037 0038 readonly property int effectiveRole: mirrored ? (role === Qt.AlignLeading ? Qt.AlignTrailing : Qt.AlignLeading) : role 0039 0040 anchors { 0041 left: role === Qt.AlignLeading ? parent?.left : undefined 0042 right: role === Qt.AlignTrailing ? parent?.right : undefined 0043 } 0044 0045 height: parent?.height ?? undefined 0046 0047 leftMargin: effectiveRole === Qt.AlignLeading ? edgeMargin : 0 0048 rightMargin: effectiveRole === Qt.AlignTrailing ? edgeMargin : 0 0049 0050 radius: Infinity 0051 0052 icon.name: effectiveRole === Qt.AlignLeading 0053 ? "arrow-left-symbolic" : "arrow-right-symbolic" 0054 0055 text: effectiveRole === Qt.AlignLeading 0056 ? i18nc("@action:button", "Previous Screenshot") : i18nc("@action:button", "Next Screenshot") 0057 0058 focusPolicy: Qt.NoFocus 0059 0060 enabled: role === Qt.AlignLeading 0061 ? !atBeginning : !atEnd 0062 0063 opacity: enabled ? 1 : 0 0064 0065 Behavior on opacity { 0066 enabled: controlRoot.visible && controlRoot.animated 0067 NumberAnimation { 0068 duration: Kirigami.Units.longDuration 0069 easing.type: Easing.OutCubic 0070 } 0071 } 0072 0073 transform: Translate { 0074 x: controlRoot.enabled ? 0 0075 : Kirigami.Units.gridUnit * 2 * (controlRoot.effectiveRole === Qt.AlignLeading ? -1 : 1) 0076 0077 Behavior on x { 0078 enabled: controlRoot.visible && controlRoot.animated 0079 NumberAnimation { 0080 duration: Kirigami.Units.longDuration 0081 easing.type: Easing.OutCubic 0082 } 0083 } 0084 } 0085 }