waffle: action center: wifi menu (without auth)

This commit is contained in:
end-4
2025-11-22 00:19:53 +01:00
parent fbfb81c83b
commit 79762e4193
15 changed files with 313 additions and 48 deletions
@@ -39,8 +39,10 @@ Singleton {
property color bg2Hover: root.dark ? "#383838" : "#FDFDFD"
property color bg2Active: root.dark ? "#333333" : "#FDFDFD"
property color bg2Border: root.dark ? "#464646" : "#EEEEEE"
property color subfg: root.dark ? "#CED1D7" : "#5C5C5C"
property color fg: root.dark ? "#FFFFFF" : "#000000"
property color fg1: root.dark ? "#D1D1D1" : "#626262"
property color inactiveIcon: root.dark ? "#494949" : "#C4C4C4"
property color controlBg: root.dark ? "#9B9B9B" : "#868686"
property color controlFg: root.dark ? "#454545" : "#FFFFFF"
property color danger: "#C42B1C"
@@ -103,13 +105,21 @@ Singleton {
}
property Component opacity: Component {
NumberAnimation{
NumberAnimation {
duration: 120
easing.type: Easing.BezierSpline
easing.bezierCurve: transition.easing.bezierCurve.easeIn
}
}
property Component resize: Component { // TODO: better curve needed
NumberAnimation {
duration: 200
easing.type: Easing.BezierSpline
easing.bezierCurve: transition.easing.bezierCurve.easeIn
}
}
property Component enter: Component {
NumberAnimation {
duration: 250
@@ -16,6 +16,7 @@ Button {
property color colBackgroundToggledHover: Looks.colors.accentHover
property color colBackgroundToggledActive: Looks.colors.accentActive
property color colForeground: Looks.colors.fg
property color colForegroundToggled: Looks.colors.accentFg
property alias backgroundOpacity: backgroundRect.opacity
property color color: {
if (root.checked) {
@@ -35,25 +36,32 @@ Button {
return root.colBackground;
}
}
property color fgColor: root.checked ? root.colForegroundToggled : root.colForeground
property alias horizontalAlignment: buttonText.horizontalAlignment
font {
family: Looks.font.family.ui
pixelSize: Looks.font.pixelSize.large
weight: Looks.font.weight.regular
}
// Hover stuff
signal hoverTimedOut()
signal hoverTimedOut
property bool shouldShowTooltip: false
property Timer hoverTimer: Timer {
id: hoverTimer
running: root.hovered
interval: 400
onTriggered: {
root.hoverTimedOut()
root.hoverTimedOut();
}
}
onHoverTimedOut: {
root.shouldShowTooltip = true
root.shouldShowTooltip = true;
}
onHoveredChanged: {
if (!root.hovered) {
root.shouldShowTooltip = false
root.hoverTimer.stop()
root.shouldShowTooltip = false;
root.hoverTimer.stop();
}
}
@@ -92,10 +100,13 @@ Button {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton | Qt.MiddleButton
onClicked: (event) => {
if (event.button === Qt.LeftButton) root.clicked();
if (event.button === Qt.RightButton) root.altAction();
if (event.button === Qt.MiddleButton) root.middleClickAction();
onClicked: event => {
if (event.button === Qt.LeftButton)
root.clicked();
if (event.button === Qt.RightButton)
root.altAction();
if (event.button === Qt.MiddleButton)
root.middleClickAction();
}
}
@@ -122,18 +133,17 @@ Button {
Layout.fillWidth: false
Layout.alignment: Qt.AlignVCenter
icon: root.icon.name
color: root.colForeground
color: root.fgColor
visible: root.icon.name !== ""
}
WText {
id: buttonText
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
text: root.text
horizontalAlignment: Text.AlignLeft
font {
pixelSize: Looks.font.pixelSize.large
}
color: root.colForeground
font: root.font
color: root.fgColor
}
}
}
@@ -11,6 +11,8 @@ import qs.modules.waffle.looks
WButton {
id: root
property bool animateChoiceHighlight: true
Layout.fillWidth: true
implicitWidth: contentItem.implicitWidth
horizontalPadding: 10
@@ -18,7 +20,7 @@ WButton {
inset: 0
buttonSpacing: 8
property color color: {
color: {
if (root.checked) {
if (root.down) {
return root.colBackgroundHover;
@@ -36,6 +38,7 @@ WButton {
return root.colBackground;
}
}
fgColor: colForeground
background: Rectangle {
id: backgroundRect
@@ -54,11 +57,14 @@ WButton {
implicitHeight: 3
radius: width / 2
color: Looks.colors.accent
property bool forceZeroHeight: true
height: forceZeroHeight ? 0 : Math.max(16, root.background.height - 18 * 2)
Component.onCompleted: {
implicitHeight = 16;
forceZeroHeight = false;
}
Behavior on implicitHeight {
Behavior on height {
enabled: root.animateChoiceHighlight
animation: Looks.transition.opacity.createObject(this)
}
}
@@ -7,18 +7,22 @@ import qs.services
Singleton {
id: root
function wifiIconForStrength(strength) {
if (strength > 75)
return "wifi-1";
if (strength > 50)
return "wifi-2";
if (strength > 25)
return "wifi-3";
return "wifi-4";
}
property string internetIcon: {
if (Network.ethernet)
return "ethernet";
if (Network.wifiEnabled) {
const strength = Network.networkStrength;
if (strength > 75)
return "wifi-1";
if (strength > 50)
return "wifi-2";
if (strength > 25)
return "wifi-3";
return "wifi-4";
return wifiIconForStrength(strength);
}
if (Network.wifiStatus === "connecting")
return "wifi-4";