2021-07-09 10:36:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-07-09 10:36:33 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-04-11 04:37:15 +03:00
|
|
|
//import QtGraphicalEffects 1.12
|
2021-07-09 10:36:33 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.5
|
2022-03-06 21:51:17 +03:00
|
|
|
import QtQuick.Layouts 1.2
|
2022-04-15 03:58:44 +03:00
|
|
|
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-04-16 03:13:01 +03:00
|
|
|
property string iconImage: ""
|
|
|
|
|
|
|
|
hoverEnabled: true
|
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)
|
|
|
|
|
2022-04-16 03:13:01 +03:00
|
|
|
background: Rectangle {
|
|
|
|
color: Qt.lighter(timelineRoot.palette.dark, control.down ? 1.4 : (control.hovered ? 1.2 : 1))
|
|
|
|
//height: control.contentItem.implicitHeight * 2
|
|
|
|
//width: control.contentItem.implicitWidth * 2
|
|
|
|
radius: height / 8
|
|
|
|
}
|
2022-03-06 21:51:17 +03:00
|
|
|
|
2022-04-11 04:37:15 +03:00
|
|
|
//DropShadow {
|
|
|
|
// anchors.fill: control.background
|
|
|
|
// horizontalOffset: 3
|
|
|
|
// verticalOffset: 3
|
|
|
|
// radius: 8
|
|
|
|
// samples: 17
|
|
|
|
// cached: true
|
|
|
|
// color: "#80000000"
|
|
|
|
// source: control.background
|
|
|
|
//}
|
2022-03-06 21:51:17 +03:00
|
|
|
contentItem: RowLayout {
|
|
|
|
anchors.centerIn: parent
|
2022-04-16 03:13:01 +03:00
|
|
|
spacing: 0
|
|
|
|
|
2022-03-06 21:51:17 +03:00
|
|
|
Image {
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.leftMargin: Nheko.paddingMedium
|
2022-03-06 21:51:17 +03:00
|
|
|
Layout.preferredHeight: fontMetrics.font.pixelSize * 1.5
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.preferredWidth: fontMetrics.font.pixelSize * 1.5
|
2022-03-06 21:51:17 +03:00
|
|
|
source: iconImage
|
2022-04-16 03:13:01 +03:00
|
|
|
visible: !!iconImage
|
2022-03-06 21:51:17 +03:00
|
|
|
}
|
|
|
|
Text {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-04-16 03:13:01 +03:00
|
|
|
//font.capitalization: Font.AllUppercase
|
|
|
|
color: timelineRoot.palette.light
|
|
|
|
elide: Text.ElideRight
|
2022-03-06 21:51:17 +03:00
|
|
|
//font: control.font
|
|
|
|
font.capitalization: Font.AllUppercase
|
|
|
|
font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5)
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-04-16 03:13:01 +03:00
|
|
|
text: control.text
|
2022-03-06 21:51:17 +03:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
2021-07-09 10:36:33 +03:00
|
|
|
}
|
|
|
|
}
|