Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85969615
D386.1796225879.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D386.1796225879.diff
View Options
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -208,6 +208,7 @@
ClosableScrollableOverlay.qml
SelfDestroyableOverlaySheet.qml
FocusRingBackground.qml
+ RichButton.qml
RoomListView.qml
RoomListViewItemDelegate.qml
RoomPage.qml
diff --git a/src/contents/ui/EventReadIndicator.qml b/src/contents/ui/EventReadIndicator.qml
--- a/src/contents/ui/EventReadIndicator.qml
+++ b/src/contents/ui/EventReadIndicator.qml
@@ -13,7 +13,7 @@
import '.' as Kazv
import 'matrix-helpers.js' as Helpers
-AbstractButton {
+Kazv.RichButton {
id: readIndicator
property var shouldShow: true
property var model
@@ -21,16 +21,7 @@
property var avatarSize: Kirigami.Units.iconSizes.sizeForLabels || Kirigami.Units.iconSizes.small / 2
property var actualItems: Math.min(model.count, maxItems)
- focusPolicy: Qt.StrongFocus
- leftInset: 0
- topInset: 0
- bottomInset: 0
- rightInset: 0
- padding: Kirigami.Units.smallSpacing
visible: shouldShow && readIndicator.model.count > 0
- background: Kazv.FocusRingBackground {
- target: readIndicator
- }
contentItem: RowLayout {
id: layout
diff --git a/src/contents/ui/RichButton.qml b/src/contents/ui/RichButton.qml
new file mode 100644
--- /dev/null
+++ b/src/contents/ui/RichButton.qml
@@ -0,0 +1,29 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2020-2026 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Controls
+import org.kde.kirigami as Kirigami
+import '.' as Kazv
+
+AbstractButton {
+ id: btn
+ property alias backgroundRadius: bg.radius
+ property alias borderWidth: bg.border.width
+ Accessible.role: Accessible.Button
+ focusPolicy: Qt.StrongFocus
+ leftInset: 0
+ topInset: 0
+ bottomInset: 0
+ rightInset: 0
+ padding: Kirigami.Units.smallSpacing
+ hoverEnabled: true
+ background: Kazv.FocusRingBackground {
+ id: bg
+ target: btn
+ }
+}
diff --git a/src/contents/ui/StickerPicker.qml b/src/contents/ui/StickerPicker.qml
--- a/src/contents/ui/StickerPicker.qml
+++ b/src/contents/ui/StickerPicker.qml
@@ -100,16 +100,12 @@
cellHeight: stickerPicker.stickerSize + stickerPicker.stickerMargin
focus: true
focusPolicy: Qt.StrongFocus
- delegate: AbstractButton {
+ delegate: Kazv.RichButton {
id: stickerButton
objectName: `sticker${index}`
property var sticker: currentPack.at(index)
height: stickerPicker.stickerSize + stickerPicker.stickerMargin
width: stickerPicker.stickerSize + stickerPicker.stickerMargin
- topInset: 0
- bottomInset: 0
- leftInset: 0
- rightInset: 0
padding: stickerPicker.stickerMargin
contentItem: Kazv.ImageAdapter {
@@ -119,14 +115,7 @@
mxcUri: sticker.mxcUri
}
- hoverEnabled: true
- background: Kazv.FocusRingBackground {
- target: stickerButton
- }
-
- Accessible.role: Accessible.Button
Accessible.name: sticker.body
- Accessible.onPressAction: requestSendMessage()
onClicked: requestSendMessage()
function requestSendMessage() {
diff --git a/src/contents/ui/event-types/Image.qml b/src/contents/ui/event-types/Image.qml
--- a/src/contents/ui/event-types/Image.qml
+++ b/src/contents/ui/event-types/Image.qml
@@ -73,21 +73,9 @@
visible: !compactMode
}
- property var image: AbstractButton {
+ property var image: Kazv.RichButton {
id: imgButton
Accessible.name: l10n.get('event-image-open-viewer-action')
- Accessible.role: Accessible.Button
- Accessible.onPressAction: pushMediaViewerPage(event)
- hoverEnabled: true
- focusPolicy: Qt.StrongFocus
- background: Kazv.FocusRingBackground {
- target: imgButton
- }
- topInset: 0
- bottomInset: 0
- leftInset: 0
- rightInset: 0
- padding: Kirigami.Units.smallSpacing
onClicked: pushMediaViewerPage(event)
contentItem: Item {
implicitWidth: image.width
diff --git a/src/contents/ui/event-types/Simple.qml b/src/contents/ui/event-types/Simple.qml
--- a/src/contents/ui/event-types/Simple.qml
+++ b/src/contents/ui/event-types/Simple.qml
@@ -56,24 +56,15 @@
Layout.topMargin: shouldCollapseSender ? 0 : Kirigami.Units.largeSpacing
Layout.bottomMargin: 0
- AbstractButton {
+ Kazv.RichButton {
id: avatarButton
objectName: 'senderAvatar'
Layout.alignment: Qt.AlignTop
visible: !compactMode && !shouldCollapseSender
- focusPolicy: Qt.StrongFocus
onClicked: goToUser()
Accessible.name: senderNickname
- leftInset: 0
- topInset: 0
- bottomInset: 0
- rightInset: 0
- padding: Kirigami.Units.smallSpacing
- background: Kazv.FocusRingBackground {
- target: avatarButton
- radius: height / 2
- border.width: avatarButton.padding / 2
- }
+ backgroundRadius: height / 2
+ borderWidth: avatarButton.padding / 2
contentItem: Kazv.AvatarAdapter {
id: avatar
diff --git a/src/contents/ui/media/PlayButton.qml b/src/contents/ui/media/PlayButton.qml
--- a/src/contents/ui/media/PlayButton.qml
+++ b/src/contents/ui/media/PlayButton.qml
@@ -12,16 +12,12 @@
import org.kde.kirigami as Kirigami
-AbstractButton {
+Kazv.RichButton {
id: button
- focusPolicy: Qt.StrongFocus
- background: Kazv.FocusRingBackground {
- target: button
- radius: width / 2
- }
+ backgroundRadius: width / 2
- Rectangle {
+ contentItem: Rectangle {
id: r
anchors.centerIn: parent
implicitWidth: Kirigami.Units.iconSizes.large
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 2, 7:37 AM (21 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1854656
Default Alt Text
D386.1796225879.diff (5 KB)
Attached To
Mode
D386: Unify custom buttons
Attached
Detach File
Event Timeline