From d0f0537c56b134cd075b5ec1d16e43affac25f82 Mon Sep 17 00:00:00 2001 From: belalshehab Date: Wed, 3 Jul 2024 02:26:36 +0300 Subject: [PATCH] feat(wallet)_: add loadingIndicatorSize and mirror properties to StatusButton - Added `loadingIndicatorSize` property to `StatusBaseButton` to allow customization of loading indicator size. - Introduced `mirror` property in `StatusIcon` to support icon mirroring. resolves: #1365 --- ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml | 12 ++++++++++-- ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml b/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml index 09f900c42a..d011ff031d 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml @@ -55,6 +55,9 @@ Button { property int type: StatusBaseButton.Type.Normal property int textPosition: StatusBaseButton.TextPosition.Right + // use Size.Small as default value to not change old behavior which had default size of 20x20 + property int loadingIndicatorSize: StatusBaseButton.Size.Small + property bool isRoundIcon: false QtObject { @@ -69,8 +72,10 @@ Button { } readonly property bool iconOnly: root.display === AbstractButton.IconOnly || root.text === "" - readonly property int iconSize: { - switch(root.size) { + readonly property int iconSize: mapIconSize(root.size) + + function mapIconSize(buttonSize) { + switch(buttonSize) { case StatusBaseButton.Size.Tiny: return 16 case StatusBaseButton.Size.Small: @@ -152,6 +157,7 @@ Button { StatusIcon { icon: root.icon.name rotation: root.asset.rotation + mirror: root.asset.mirror opacity: !root.loading && root.icon.name !== "" && root.display !== AbstractButton.TextOnly color: root.icon.color } @@ -221,6 +227,8 @@ Button { Loader { anchors.centerIn: parent active: root.loading + width: d.mapIconSize(root.loadingIndicatorSize) + height: width sourceComponent: StatusLoadingIndicator { color: d.textColor } diff --git a/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml b/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml index 35c1af1575..f2a407f687 100644 --- a/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml +++ b/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml @@ -13,6 +13,7 @@ QtObject { property color hoverColor property color disabledColor property int rotation + property bool mirror property bool isLetterIdenticon property bool useAcronymForLetterIdenticon: true