Warning, /multimedia/kasts/src/qml/GenericHeader.qml is written in an unsupported language. File is not indexed.
0001 /**
0002 * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
0003 *
0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Controls as Controls
0009 import QtQuick.Layouts
0010 import QtQuick.Effects
0011
0012 import org.kde.kirigami as Kirigami
0013
0014 import org.kde.kasts
0015
0016 Item {
0017 id: root
0018 required property string image
0019 required property string title
0020
0021 property string subtitle: ""
0022 property var headerHeight: Kirigami.Units.gridUnit * 5
0023
0024 property bool titleClickable: false
0025 property bool subtitleClickable: false
0026 signal titleClicked()
0027 signal subtitleClicked()
0028
0029 implicitHeight: headerHeight
0030 implicitWidth: parent.width
0031
0032 MultiEffect {
0033 id: backgroundImage
0034 source: backgroundImageRaw
0035 anchors.fill: parent
0036
0037 brightness: -0.15
0038 saturation: 0.6
0039 contrast: -0.4
0040 blurMax: 64
0041 blur: 1.0
0042 blurEnabled: true
0043 autoPaddingEnabled: false
0044
0045 ImageWithFallback {
0046 id: backgroundImageRaw
0047 anchors.fill: parent
0048 visible: false
0049 imageSource: image
0050 imageResize: false // no "stuttering" on resizing the window
0051 }
0052 }
0053
0054 RowLayout {
0055 property int size: root.headerHeight - 2 * margin
0056 property int margin: Kirigami.Units.gridUnit * 1
0057 height: size
0058 anchors.bottom: parent.bottom
0059 anchors.left: parent.left
0060 anchors.right: parent.right
0061 anchors.leftMargin: margin
0062 anchors.rightMargin: margin
0063 anchors.bottomMargin: margin
0064
0065 ImageWithFallback {
0066 id: frontImage
0067 imageSource: image
0068 Layout.maximumHeight: parent.size
0069 Layout.maximumWidth: parent.size
0070 Layout.minimumHeight: parent.size
0071 Layout.minimumWidth: parent.size
0072 absoluteRadius: Kirigami.Units.smallSpacing
0073 MouseArea {
0074 anchors.fill: parent
0075 cursorShape: Qt.PointingHandCursor
0076 onClicked: {
0077 fullScreenImageLoader.setSource("qrc:/qt/qml/org/kde/kasts/qml/FullScreenImage.qml", {
0078 "image": root.image,
0079 "description": root.title,
0080 "loader": fullScreenImageLoader
0081 });
0082 fullScreenImageLoader.active = true;
0083 fullScreenImageLoader.item.open();
0084 }
0085 }
0086 }
0087
0088 ColumnLayout {
0089 Layout.fillWidth: true
0090 Layout.fillHeight: true
0091 Layout.leftMargin: parent.margin/2
0092 Controls.Label {
0093 Layout.fillWidth: true
0094 Layout.fillHeight: true
0095 text: title
0096 fontSizeMode: Text.Fit
0097 font.pointSize: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.4)
0098 minimumPointSize: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.2)
0099 horizontalAlignment: Text.AlignLeft
0100 verticalAlignment: Text.AlignBottom
0101 color: "#eff0f1" // breeze light text color
0102 opacity: 1
0103 elide: Text.ElideRight
0104 wrapMode: Text.WordWrap
0105 MouseArea {
0106 anchors.fill: parent
0107 cursorShape: root.titleClickable ? Qt.PointingHandCursor : undefined
0108 onClicked: {
0109 if (root.titleClickable) {
0110 root.titleClicked();
0111 }
0112 }
0113 }
0114 }
0115
0116 Controls.Label {
0117 Layout.fillWidth: true
0118 visible: subtitle !== ""
0119 text: subtitle
0120 fontSizeMode: Text.Fit
0121 font.pointSize: Kirigami.Theme.defaultFont.pointSize
0122 minimumPointSize: Kirigami.Theme.defaultFont.pointSize
0123 font.bold: true
0124 horizontalAlignment: Text.AlignLeft
0125 color: "#eff0f1" // breeze light text color
0126 elide: Text.ElideRight
0127 opacity: 1
0128 MouseArea {
0129 anchors.fill: parent
0130 cursorShape: root.subtitleClickable ? Qt.PointingHandCursor : undefined
0131 onClicked: {
0132 if (root.subtitleClickable) {
0133 root.subtitleClicked();
0134 }
0135 }
0136 }
0137 }
0138 }
0139 }
0140 }
0141
0142