2023-02-22 01:48:49 +03:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2021-07-09 10:36:33 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-06-02 01:43:38 +03:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Effects
|
|
|
|
import im.nheko
|
2021-07-09 10:36:33 +03:00
|
|
|
|
2022-01-11 06:12:42 +03:00
|
|
|
// FIXME(Nico): Don't use hardcoded colors.
|
2021-07-09 10:36:33 +03:00
|
|
|
Button {
|
|
|
|
id: control
|
|
|
|
|
2022-01-12 21:09:46 +03:00
|
|
|
implicitHeight: Math.ceil(control.contentItem.implicitHeight * 1.70)
|
2021-07-09 10:36:33 +03:00
|
|
|
implicitWidth: Math.ceil(control.contentItem.implicitWidth + control.contentItem.implicitHeight)
|
|
|
|
hoverEnabled: true
|
|
|
|
|
2022-03-06 21:51:17 +03:00
|
|
|
property string iconImage: ""
|
|
|
|
|
2023-06-02 01:43:38 +03:00
|
|
|
MultiEffect {
|
2021-07-09 10:36:33 +03:00
|
|
|
anchors.fill: control.background
|
2023-06-02 01:43:38 +03:00
|
|
|
shadowHorizontalOffset: 3
|
|
|
|
shadowVerticalOffset: 3
|
|
|
|
shadowBlur: 8
|
|
|
|
shadowEnabled: true
|
|
|
|
shadowColor: "#80000000"
|
2021-07-09 10:36:33 +03:00
|
|
|
source: control.background
|
|
|
|
}
|
|
|
|
|
2022-03-06 21:51:17 +03:00
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: 0
|
|
|
|
anchors.centerIn: parent
|
|
|
|
Image {
|
|
|
|
Layout.leftMargin: Nheko.paddingMedium
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
|
|
Layout.preferredHeight: fontMetrics.font.pixelSize * 1.5
|
|
|
|
Layout.preferredWidth: fontMetrics.font.pixelSize * 1.5
|
|
|
|
visible: !!iconImage
|
|
|
|
source: iconImage
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
text: control.text
|
|
|
|
//font: control.font
|
|
|
|
font.capitalization: Font.AllUppercase
|
|
|
|
font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5)
|
|
|
|
//font.capitalization: Font.AllUppercase
|
2023-06-02 02:29:05 +03:00
|
|
|
color: palette.light
|
2022-03-06 21:51:17 +03:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2021-07-09 10:36:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
//height: control.contentItem.implicitHeight * 2
|
|
|
|
//width: control.contentItem.implicitWidth * 2
|
2022-01-12 21:09:46 +03:00
|
|
|
radius: height / 8
|
2023-06-02 02:29:05 +03:00
|
|
|
color: Qt.lighter(palette.dark, control.down ? 1.4 : (control.hovered ? 1.2 : 1))
|
2021-07-09 10:36:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|