move stuff into components
This commit is contained in:
parent
14292e6683
commit
186c9a3aa2
3 changed files with 26 additions and 21 deletions
|
|
@ -2,10 +2,12 @@ import QtQuick
|
|||
import Quickshell.Io
|
||||
import "." as M
|
||||
|
||||
Text {
|
||||
M.BarSection {
|
||||
id: root
|
||||
spacing: 4
|
||||
tooltip: root.weatherTooltip
|
||||
|
||||
property string label: ""
|
||||
property string weatherTooltip: ""
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
|
|
@ -15,9 +17,11 @@ Text {
|
|||
onStreamFinished: {
|
||||
try {
|
||||
const data = JSON.parse(text);
|
||||
root.label = data.text ?? "";
|
||||
label.text = data.text ?? "";
|
||||
root.weatherTooltip = data.tooltip ?? "";
|
||||
} catch (e) {
|
||||
root.label = "";
|
||||
label.text = "";
|
||||
root.weatherTooltip = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,9 +33,11 @@ Text {
|
|||
onTriggered: proc.running = true
|
||||
}
|
||||
|
||||
text: root.label
|
||||
color: M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.iconFontFamily
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Text {
|
||||
id: label
|
||||
color: M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.iconFontFamily
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue