forked from Shinonome/dots-hyprland
sidebar: grey out bluetooth button if unavailable
This commit is contained in:
+1
@@ -12,6 +12,7 @@ AndroidQuickToggleButton {
|
|||||||
name: Translation.tr("Bluetooth")
|
name: Translation.tr("Bluetooth")
|
||||||
statusText: BluetoothStatus.firstActiveDevice?.name ?? Translation.tr("No device")
|
statusText: BluetoothStatus.firstActiveDevice?.name ?? Translation.tr("No device")
|
||||||
|
|
||||||
|
available: BluetoothStatus.available
|
||||||
toggled: BluetoothStatus.enabled
|
toggled: BluetoothStatus.enabled
|
||||||
buttonIcon: BluetoothStatus.connected ? "bluetooth_connected" : BluetoothStatus.enabled ? "bluetooth" : "bluetooth_disabled"
|
buttonIcon: BluetoothStatus.connected ? "bluetooth_connected" : BluetoothStatus.enabled ? "bluetooth" : "bluetooth_disabled"
|
||||||
mainAction: () => {
|
mainAction: () => {
|
||||||
|
|||||||
+4
-2
@@ -15,6 +15,7 @@ GroupButton {
|
|||||||
required property string name
|
required property string name
|
||||||
required property var mainAction
|
required property var mainAction
|
||||||
property string statusText: toggled ? Translation.tr("Active") : Translation.tr("Inactive")
|
property string statusText: toggled ? Translation.tr("Active") : Translation.tr("Inactive")
|
||||||
|
property bool available: true
|
||||||
|
|
||||||
required property real baseCellWidth
|
required property real baseCellWidth
|
||||||
required property real baseCellHeight
|
required property real baseCellHeight
|
||||||
@@ -42,6 +43,7 @@ GroupButton {
|
|||||||
|
|
||||||
signal openMenu()
|
signal openMenu()
|
||||||
|
|
||||||
|
enabled: available || editMode
|
||||||
padding: 6
|
padding: 6
|
||||||
horizontalPadding: padding
|
horizontalPadding: padding
|
||||||
verticalPadding: padding
|
verticalPadding: padding
|
||||||
@@ -52,8 +54,8 @@ GroupButton {
|
|||||||
colBackgroundToggledActive: (altAction && expandedSize) ? Appearance.colors.colLayer2Active : Appearance.colors.colPrimaryActive
|
colBackgroundToggledActive: (altAction && expandedSize) ? Appearance.colors.colLayer2Active : Appearance.colors.colPrimaryActive
|
||||||
buttonRadius: toggled ? Appearance.rounding.large : height / 2
|
buttonRadius: toggled ? Appearance.rounding.large : height / 2
|
||||||
buttonRadiusPressed: Appearance.rounding.normal
|
buttonRadiusPressed: Appearance.rounding.normal
|
||||||
property color colText: (toggled && !(altAction && expandedSize)) ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer2
|
property color colText: (toggled && !(altAction && expandedSize) && enabled) ? Appearance.colors.colOnPrimary : ColorUtils.transparentize(Appearance.colors.colOnLayer2, enabled ? 0 : 0.7)
|
||||||
property color colIcon: expandedSize ? (root.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer3) : colText
|
property color colIcon: expandedSize ? ((root.toggled) ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer3) : colText
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.expandedSize && root.altAction) root.altAction();
|
if (root.expandedSize && root.altAction) root.altAction();
|
||||||
|
|||||||
Reference in New Issue
Block a user