controlcenter: cleaning up ui to match
This commit is contained in:
parent
d20a5095bb
commit
615d1d9a49
2 changed files with 175 additions and 67 deletions
|
|
@ -29,58 +29,31 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
ToggleButton {
|
||||||
implicitWidth: implicitHeight
|
toggled: Network.wifiEnabled
|
||||||
implicitHeight: wifiIcon.implicitHeight + Appearance.padding.normal * 2
|
icon: "wifi"
|
||||||
|
accent: "Tertiary"
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: Network.wifiEnabled ? Colours.palette.m3tertiary : Colours.palette.m3tertiaryContainer
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
Network.toggleWifi();
|
Network.toggleWifi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
ToggleButton {
|
||||||
id: wifiIcon
|
toggled: Network.scanning
|
||||||
|
icon: "wifi_find"
|
||||||
|
accent: "Secondary"
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "wifi"
|
|
||||||
color: Network.wifiEnabled ? Colours.palette.m3onTertiary : Colours.palette.m3onTertiaryContainer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledRect {
|
|
||||||
implicitWidth: implicitHeight
|
|
||||||
implicitHeight: scanIcon.implicitHeight + Appearance.padding.normal * 2
|
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: Network.scanning ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
Network.rescanWifi();
|
Network.rescanWifi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
ToggleButton {
|
||||||
id: scanIcon
|
toggled: !root.session.network.active
|
||||||
|
icon: "settings"
|
||||||
|
accent: "Primary"
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "wifi_find"
|
|
||||||
color: Network.scanning ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledRect {
|
|
||||||
implicitWidth: implicitHeight
|
|
||||||
implicitHeight: settingsIcon.implicitHeight + Appearance.padding.normal * 2
|
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: !root.session.network.active ? Colours.palette.m3primary : Colours.palette.m3primaryContainer
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
if (root.session.network.active)
|
if (root.session.network.active)
|
||||||
root.session.network.active = null;
|
root.session.network.active = null;
|
||||||
|
|
@ -89,15 +62,6 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: settingsIcon
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "settings"
|
|
||||||
color: !root.session.network.active ? Colours.palette.m3onPrimary : Colours.palette.m3onPrimaryContainer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
@ -258,4 +222,79 @@ ColumnLayout {
|
||||||
implicitHeight: rowLayout.implicitHeight + Appearance.padding.normal * 2
|
implicitHeight: rowLayout.implicitHeight + Appearance.padding.normal * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component ToggleButton: StyledRect {
|
||||||
|
id: toggleBtn
|
||||||
|
|
||||||
|
required property bool toggled
|
||||||
|
property string icon
|
||||||
|
property string label
|
||||||
|
property string accent: "Secondary"
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
Layout.preferredWidth: implicitWidth + (toggleStateLayer.pressed ? Appearance.padding.normal * 2 : toggled ? Appearance.padding.small * 2 : 0)
|
||||||
|
implicitWidth: toggleBtnInner.implicitWidth + Appearance.padding.large * 2
|
||||||
|
implicitHeight: toggleBtnIcon.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
|
||||||
|
radius: toggled || toggleStateLayer.pressed ? Appearance.rounding.small : Math.min(width, height) / 2 * Math.min(1, Appearance.rounding.scale)
|
||||||
|
color: toggled ? Colours.palette[`m3${accent.toLowerCase()}`] : Colours.palette[`m3${accent.toLowerCase()}Container`]
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
id: toggleStateLayer
|
||||||
|
|
||||||
|
color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`]
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
toggleBtn.onClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: toggleBtnInner
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: toggleBtnIcon
|
||||||
|
|
||||||
|
visible: !!text
|
||||||
|
fill: toggleBtn.toggled ? 1 : 0
|
||||||
|
text: toggleBtn.icon
|
||||||
|
color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`]
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
|
||||||
|
Behavior on fill {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
asynchronous: true
|
||||||
|
active: !!toggleBtn.label
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: StyledText {
|
||||||
|
text: toggleBtn.label
|
||||||
|
color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on radius {
|
||||||
|
Anim {
|
||||||
|
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on Layout.preferredWidth {
|
||||||
|
Anim {
|
||||||
|
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import qs.components
|
||||||
import qs.components.effects
|
import qs.components.effects
|
||||||
import qs.components.containers
|
import qs.components.containers
|
||||||
import qs.config
|
import qs.config
|
||||||
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
|
@ -41,32 +42,94 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.rightMargin: Appearance.padding.normal / 2
|
||||||
|
|
||||||
|
radius: rightBorder.innerRadius
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: loader
|
id: loader
|
||||||
|
|
||||||
|
property var pane: root.session.network.active
|
||||||
|
property string paneId: pane ? (pane.ssid || pane.bssid || "") : ""
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Appearance.padding.large * 2
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
||||||
sourceComponent: root.session.network.active ? details : settings
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
transformOrigin: Item.Center
|
||||||
|
|
||||||
Behavior on opacity {
|
clip: false
|
||||||
NumberAnimation {
|
asynchronous: true
|
||||||
duration: 200
|
sourceComponent: pane ? details : settings
|
||||||
|
|
||||||
|
Behavior on paneId {
|
||||||
|
SequentialAnimation {
|
||||||
|
ParallelAnimation {
|
||||||
|
Anim {
|
||||||
|
target: loader
|
||||||
|
property: "opacity"
|
||||||
|
to: 0
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
target: loader
|
||||||
|
property: "scale"
|
||||||
|
to: 0.8
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyAction {}
|
||||||
|
ParallelAnimation {
|
||||||
|
Anim {
|
||||||
|
target: loader
|
||||||
|
property: "opacity"
|
||||||
|
to: 1
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
target: loader
|
||||||
|
property: "scale"
|
||||||
|
to: 1
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPaneChanged: {
|
||||||
|
paneId = pane ? (pane.ssid || pane.bssid || "") : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InnerBorder {
|
InnerBorder {
|
||||||
|
id: rightBorder
|
||||||
|
|
||||||
leftThickness: Appearance.padding.normal / 2
|
leftThickness: Appearance.padding.normal / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: settings
|
id: settings
|
||||||
|
|
||||||
|
StyledFlickable {
|
||||||
|
flickableDirection: Flickable.VerticalFlick
|
||||||
|
contentHeight: settingsInner.height
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
|
id: settingsInner
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
session: root.session
|
session: root.session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: details
|
id: details
|
||||||
|
|
@ -82,4 +145,10 @@ RowLayout {
|
||||||
session: root.session
|
session: root.session
|
||||||
z: 1000
|
z: 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
target: loader
|
||||||
|
duration: Appearance.anim.durations.normal / 2
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue