Skip to content

Commit

Permalink
minor ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
efeciftci committed Jun 25, 2024
1 parent afaf79e commit 203278d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
40 changes: 34 additions & 6 deletions package/contents/ui/configSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ KCM.SimpleKCM {
property alias cfg_ipAddress: ipAddr.text
property alias cfg_animSudden: animSudden.checked
property alias cfg_animDuration: animDuration.value
property var bulbs: []
property var bulbList: []

headerPaddingEnabled: false
header: ColumnLayout {
Kirigami.InlineMessage {
id: noBulbsNotification
Layout.fillWidth: true
position: Kirigami.InlineMessage.Position.Header
type: Kirigami.MessageType.Error
text: i18n('No bulbs have been found on the local network.')
visible: false
}
}

Kirigami.FormLayout {
RowLayout {
Expand All @@ -39,7 +51,7 @@ KCM.SimpleKCM {
id: ipAddr
}
Kirigami.ContextualHelpButton {
toolTipText: xi18nc('@info:description', 'IP address of the bulb. Can be filled in manually, or one can be selected via the list of bulbs displayed by the <interface>Scan Network</interface> button.')
toolTipText: xi18nc('@info:whatsthis', 'IP address of the bulb. Can be filled in manually, or one can be selected via the list of bulbs displayed by the <interface>Scan Network</interface> button.')
}
}

Expand All @@ -49,8 +61,13 @@ KCM.SimpleKCM {
text: i18n("Scan Network...")

onClicked: {
root.bulbs = JSON.parse(bulbs.search())
discoveryDialog.open()
root.bulbList = JSON.parse(bulbs.search())
if (root.bulbList.length > 0)
discoveryDialog.open()
else {
noBulbsNotification.visible = true
warningTimer.running = true
}
}
}

Expand Down Expand Up @@ -104,12 +121,12 @@ KCM.SimpleKCM {

Kirigami.OverlaySheet {
id: discoveryDialog
title: i18n('Available Bulbs')
title: i18n('Discovered Bulbs')

ListView {
id: listView
implicitWidth: Kirigami.Units.gridUnit * 20
model: root.bulbs
model: root.bulbList
delegate: QQC2.RadioDelegate {
topPadding: Kirigami.Units.smallSpacing * 2
bottomPadding: Kirigami.Units.smallSpacing * 2
Expand All @@ -135,5 +152,16 @@ KCM.SimpleKCM {
onRejected: discoveryDialog.close()
}
}

Yeelight.BulbDiscovery { id: bulbs }

Timer {
id: warningTimer
interval: 5000
running: false
repeat: false
onTriggered: {
noBulbsNotification.visible = false
}
}
}
1 change: 1 addition & 0 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ PlasmoidItem {
width: parent.width - (Kirigami.Units.gridUnit * 4)
visible: Plasmoid.configuration.ipAddress == ''
text: i18n('No bulbs have been configured yet')
iconName: 'redshift-status-off'

helpfulAction: QQC2.Action {
text: i18n('Configure')
Expand Down
2 changes: 1 addition & 1 deletion package/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"Icon": "redshift-status-on",
"Id": "com.efeciftci.yeelight",
"Name": "Yeelight Control",
"Version": "0.3",
"Version": "0.3-1",
"Website": "https://github.com/efeciftci/plasma-widget-yeelight"
},
"X-Plasma-API-Minimum-Version": "6.0",
Expand Down

0 comments on commit 203278d

Please sign in to comment.