diff options
| -rw-r--r-- | bar/Network.qml | 14 | ||||
| -rw-r--r-- | bar/TimeDate.qml | 167 |
2 files changed, 101 insertions, 80 deletions
diff --git a/bar/Network.qml b/bar/Network.qml index f7d52a2..af6c58e 100644 --- a/bar/Network.qml +++ b/bar/Network.qml @@ -15,6 +15,8 @@ Item { property int significantUsage: 30 property string usageUnit: "M" + property bool isCollapsed: true + implicitWidth: container.implicitWidth implicitHeight: container.implicitHeight - General.rectMargin @@ -44,8 +46,13 @@ Item { } Icon { + visible: root.isCollapsed text: Services.Network.state } + IText { + visible: !root.isCollapsed + text: Services.Network.networkStrength + } RowLayout { spacing: Bar.resourceIconTextSpacing / 2 @@ -77,4 +84,11 @@ Item { } } } + MouseArea { + anchors.fill: container + cursorShape: Qt.PointingHandCursor + onClicked: { + root.isCollapsed = !root.isCollapsed; + } + } } diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml index cf7a450..b02cafb 100644 --- a/bar/TimeDate.qml +++ b/bar/TimeDate.qml @@ -7,7 +7,9 @@ import qs.config Item { id: root + property bool isAlt: false + property bool isCollapsed: false implicitWidth: container.implicitWidth implicitHeight: container.implicitHeight - General.rectMargin @@ -15,103 +17,108 @@ Item { id: container anchors { fill: parent - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter + centerIn: parent } - implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + General.rectMargin * 2 + // implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + General.rectMargin * 2 + implicitWidth: layout.width + General.rectMargin * 2 implicitHeight: Bar.height color: WallustColors.color4 radius: Style.rounding.large - Loader { - id: nonAlt - anchors.fill: parent - active: !root.isAlt - sourceComponent: Component { - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Bar.resourceIconTextSpacing - - Icon { - text: Icons.resource.clock - font.pixelSize: Style.font.size.larger - } + RowLayout { + id: layout + anchors.centerIn: parent + spacing: Bar.resourceIconTextSpacing + Loader { + id: nonAlt + active: !root.isAlt + visible: !root.isAlt + sourceComponent: Component { RowLayout { - property int h: Services.TimeDate.hours - property int m: Services.TimeDate.minutes - property int s: Services.TimeDate.seconds - spacing: 0 - IText { - animate: true - text: (parent.h >= 10 ? "" : "0") + parent.h - } - IText { - text: ":" + Item { + Layout.fillWidth: true } - IText { - animate: true - text: (parent.m >= 10 ? "" : "0") + parent.m + anchors.centerIn: parent + spacing: Bar.resourceIconTextSpacing + + Icon { + text: Icons.resource.clock + font.pixelSize: Style.font.size.larger } - IText { - text: ":" + RowLayout { + property int h: Services.TimeDate.hours + property int m: Services.TimeDate.minutes + property int s: Services.TimeDate.seconds + spacing: 0 + IText { + animate: true + text: (parent.h >= 10 ? "" : "0") + parent.h + } + IText { + text: ":" + } + IText { + animate: true + text: (parent.m >= 10 ? "" : "0") + parent.m + } + IText { + text: ":" + } + IText { + animate: true + text: (parent.s >= 10 ? "" : "0") + parent.s + } } - IText { - animate: true - text: (parent.s >= 10 ? "" : "0") + parent.s + Item { + Layout.fillWidth: true } - } - Item { - Layout.fillWidth: true - } - SequentialAnimation { - running: true - NumberAnimation { - target: parent - property: "opacity" - from: 0 - to: 1 - duration: General.animateDuration / 2 + SequentialAnimation { + running: true + NumberAnimation { + target: parent + property: "opacity" + from: 0 + to: 1 + duration: General.animateDuration / 2 + } } } } } - } - Loader { - id: alt - anchors.fill: parent - active: root.isAlt - sourceComponent: Component { - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Bar.resourceIconTextSpacing + Loader { + id: alt + active: root.isAlt + visible: root.isAlt + sourceComponent: Component { + RowLayout { + Item { + Layout.fillWidth: true + } + anchors.centerIn: parent + spacing: Bar.resourceIconTextSpacing - Icon { - text: Icons.resource.calendar - font.pixelSize: Style.font.size.larger - } - IText { - animate: true - text: Services.TimeDate.date - } - Item { - Layout.fillWidth: true - } - SequentialAnimation { - running: true - NumberAnimation { - target: parent - property: "opacity" - from: 0 - to: 1 - duration: General.animateDuration / 2 + Icon { + text: Icons.resource.calendar + font.pixelSize: Style.font.size.larger + } + IText { + animate: true + text: Services.TimeDate.date + } + Item { + Layout.fillWidth: true + } + SequentialAnimation { + running: true + NumberAnimation { + target: parent + property: "opacity" + from: 0 + to: 1 + duration: General.animateDuration / 2 + } } } } |
