Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34d4c6a57a | ||
|
|
e54f64516a | ||
|
|
c2428d1d76 | ||
|
|
f41075d316 | ||
|
|
dc77ea44a4 | ||
|
|
613242ae50 | ||
|
|
f2ce4862cc | ||
|
|
4c3d38f023 | ||
|
|
5618ba9e6b | ||
|
|
cc9aeca98b | ||
|
|
9ea1f846ae | ||
|
|
a1d96b60f6 | ||
|
|
25bee293b0 | ||
|
|
84d5abcaab | ||
|
|
7bc1db7f19 | ||
|
|
62c39a1c0c | ||
|
|
d9e1e5ede3 | ||
|
|
f4f57d03cf | ||
|
|
512aeb4ab9 | ||
|
|
99949ff255 | ||
|
|
a3178ad9cd | ||
|
|
02254a10d8 | ||
|
|
54d4676ddf | ||
|
|
cd3da1941b | ||
|
|
34dde4bbfb | ||
|
|
fcb848b6d2 | ||
|
|
ae5c1fa148 | ||
|
|
b254000737 | ||
|
|
04fe8b1e43 | ||
|
|
dfa6b010e6 | ||
|
|
8a4e9bac31 | ||
|
|
f20fa45b29 | ||
|
|
53a3c76dc0 | ||
|
|
617e87d64f | ||
|
|
ef2fb95fab | ||
|
|
2150859847 | ||
|
|
c9f7856982
|
||
|
|
51dc0fc026 | ||
|
|
cef91caebc | ||
|
|
c5a089adaf | ||
|
|
52feb6006a | ||
|
|
dbb51ceadd | ||
|
|
487615f482 | ||
|
|
d4e936a7e2 | ||
|
|
703d804746 | ||
|
|
327270f3fa | ||
|
|
8a66c3b064 |
@@ -1,5 +0,0 @@
|
|||||||
CompileFlags:
|
|
||||||
Remove:
|
|
||||||
# GCC-only flags from the system's default spec that clang/clangd cannot
|
|
||||||
# parse. They appear in compile_commands.json but are not set by the project.
|
|
||||||
- -mno-direct-extern-access
|
|
||||||
@@ -38,6 +38,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: OS
|
label: OS
|
||||||
options:
|
options:
|
||||||
|
- NixOS
|
||||||
- Arch
|
- Arch
|
||||||
- Debian / Ubuntu
|
- Debian / Ubuntu
|
||||||
- Fedora
|
- Fedora
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ body:
|
|||||||
- Refactor / style
|
- Refactor / style
|
||||||
- CI / build / tooling
|
- CI / build / tooling
|
||||||
- Documentation
|
- Documentation
|
||||||
- Other (Describe in description box with header "Issue type")
|
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -61,12 +61,10 @@ set(CMAKE_INSTALL_MESSAGE NEVER)
|
|||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
||||||
-Wnull-dereference -Wdouble-promotion
|
-Wold-style-cast -Wnull-dereference -Wdouble-promotion
|
||||||
-Wformat=2 -Wfloat-equal
|
-Wformat=2 -Wfloat-equal -Woverloaded-virtual
|
||||||
-Wsign-conversion -Wredundant-decls -Wswitch
|
-Wsign-conversion -Wredundant-decls -Wswitch
|
||||||
-Wunreachable-code
|
-Wunreachable-code
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -190,11 +188,4 @@ if("m3shapes" IN_LIST ENABLE_MODULES)
|
|||||||
if(TARGET m3shapesplugin)
|
if(TARGET m3shapesplugin)
|
||||||
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Silence warnings that come from m3shapes files we do not manage.
|
|
||||||
foreach(m3shapes_target m3shapes_core m3shapes_morph m3shapes_shapes m3shapes m3shapesplugin)
|
|
||||||
if(TARGET ${m3shapes_target})
|
|
||||||
target_compile_options(${m3shapes_target} PRIVATE -Wno-shadow -Wno-float-equal)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ CustomRect {
|
|||||||
property color activeOnColor
|
property color activeOnColor
|
||||||
property bool checked
|
property bool checked
|
||||||
property real checkedRadius: Tokens.rounding.medium
|
property real checkedRadius: Tokens.rounding.medium
|
||||||
property real defaultRadius: Math.min(width, height) / 2
|
property real defaultRadius: Tokens.rounding.large
|
||||||
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||||
property color disabledOnColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
property color disabledOnColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||||
property bool fillWidth
|
property bool fillWidth
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ BusyIndicator {
|
|||||||
property int animState
|
property int animState
|
||||||
property color bgColor: Colors.palette.m3secondaryContainer
|
property color bgColor: Colors.palette.m3secondaryContainer
|
||||||
property color fgColor: Colors.palette.m3primary
|
property color fgColor: Colors.palette.m3primary
|
||||||
property real implicitSize: Tokens.font.body.medium.pointSize * 3
|
property real implicitSize: Tokens.font.size.normal * 3
|
||||||
property real internalStrokeWidth: strokeWidth
|
property real internalStrokeWidth: strokeWidth
|
||||||
readonly property alias progress: manager.progress
|
readonly property alias progress: manager.progress
|
||||||
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||||
@@ -34,7 +34,6 @@ BusyIndicator {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
bgColor: root.bgColor
|
bgColor: root.bgColor
|
||||||
fgColor: root.fgColor
|
fgColor: root.fgColor
|
||||||
hasEndIndicator: false
|
|
||||||
padding: root.padding
|
padding: root.padding
|
||||||
rotation: manager.rotation
|
rotation: manager.rotation
|
||||||
startAngle: manager.startFraction * 360
|
startAngle: manager.startFraction * 360
|
||||||
@@ -54,7 +53,6 @@ BusyIndicator {
|
|||||||
Anim {
|
Anim {
|
||||||
duration: manager.completeEndDuration * Tokens.anim.durations.scale
|
duration: manager.completeEndDuration * Tokens.anim.durations.scale
|
||||||
properties: "opacity,internalStrokeWidth"
|
properties: "opacity,internalStrokeWidth"
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import ZShell.Components
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real radius
|
|
||||||
property real topLeftRadius: radius
|
|
||||||
property real topRightRadius: radius
|
|
||||||
property real bottomRightRadius: radius
|
|
||||||
property real bottomLeftRadius: radius
|
|
||||||
property color color: "transparent"
|
|
||||||
default property alias contentData: contentItem.data
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: contentItem
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource {
|
|
||||||
id: source
|
|
||||||
|
|
||||||
hideSource: true
|
|
||||||
sourceItem: contentItem
|
|
||||||
}
|
|
||||||
|
|
||||||
RoundedMask {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: source
|
|
||||||
topLeftRadius: root.topLeftRadius
|
|
||||||
topRightRadius: root.topRightRadius
|
|
||||||
bottomRightRadius: root.bottomRightRadius
|
|
||||||
bottomLeftRadius: root.bottomLeftRadius
|
|
||||||
color: root.color
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,6 @@ Flickable {
|
|||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
root.doneFakeFlick = false;
|
root.doneFakeFlick = false;
|
||||||
root.returnToBounds();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ ScrollBar {
|
|||||||
property bool inverted
|
property bool inverted
|
||||||
|
|
||||||
enabled: !ShellState.forActive().isDrawing
|
enabled: !ShellState.forActive().isDrawing
|
||||||
|
|
||||||
implicitWidth: size === 1 ? 0 : isHorizontal ? 0 : Tokens.padding.extraSmall * 2
|
implicitWidth: size === 1 ? 0 : isHorizontal ? 0 : Tokens.padding.extraSmall * 2
|
||||||
implicitHeight: size === 1 ? 0 : isHorizontal ? Tokens.padding.extraSmall * 2 : 0
|
implicitHeight: size === 1 ? 0 : isHorizontal ? Tokens.padding.extraSmall * 2 : 0
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,11 @@ Text {
|
|||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
font: Tokens.font.body.small
|
font: Tokens.font.body.small
|
||||||
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
||||||
renderType: Text.QtRendering
|
renderType: Text.NativeRendering
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Behavior on text {
|
Behavior on text {
|
||||||
enabled: root.animate
|
enabled: root.animate
|
||||||
@@ -33,8 +32,7 @@ Text {
|
|||||||
type: Anim.FastEffects
|
type: Anim.FastEffects
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyAction {
|
PropertyAction {}
|
||||||
}
|
|
||||||
|
|
||||||
TAnim {
|
TAnim {
|
||||||
target: root
|
target: root
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ TextFieldBase {
|
|||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
font.pointSize: Tokens.font.size.larger
|
|
||||||
text: root.leadingIcon
|
text: root.leadingIcon
|
||||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
@@ -2,57 +2,55 @@ import QtQuick
|
|||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
Item {
|
CustomClippingRect {
|
||||||
id: track
|
id: track
|
||||||
|
|
||||||
required property var scrollBar
|
required property var scrollBar
|
||||||
required property var mouseArea
|
required property var mouseArea
|
||||||
|
|
||||||
ClipRect {
|
anchors.left: parent.left
|
||||||
radius: Tokens.rounding.full
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
implicitHeight: handle.implicitHeight
|
||||||
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
id: handle
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
implicitHeight: handle.implicitHeight
|
color: Colors.palette.m3secondary
|
||||||
|
implicitWidth: track.scrollBar.width * track.scrollBar.effectiveSize
|
||||||
CustomRect {
|
implicitHeight: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
||||||
id: handle
|
opacity: {
|
||||||
|
if (!track.scrollBar.enabled)
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
color: Colors.palette.m3secondary
|
|
||||||
implicitWidth: track.scrollBar.width * track.scrollBar.effectiveSize
|
|
||||||
implicitHeight: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
|
||||||
opacity: {
|
|
||||||
if (!track.scrollBar.enabled)
|
|
||||||
return 0;
|
|
||||||
if (track.scrollBar.size === 1)
|
|
||||||
return 0;
|
|
||||||
if (track.mouseArea.pressed)
|
|
||||||
return 1;
|
|
||||||
if (track.mouseArea.containsMouse)
|
|
||||||
return 0.8;
|
|
||||||
if (track.scrollBar.policy === CustomScrollBar.AlwaysOn || track.scrollBar.shouldBeActive)
|
|
||||||
return 0.6;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
if (track.scrollBar.size === 1)
|
||||||
radius: Tokens.rounding.full
|
return 0;
|
||||||
x: track.scrollBar.reversed ? track.scrollBar.width * (1 + track.scrollBar.nonAnimY) * track.scrollBar.travelScale : track.scrollBar.width * track.scrollBar.nonAnimY * track.scrollBar.travelScale
|
if (track.mouseArea.pressed)
|
||||||
|
return 1;
|
||||||
|
if (track.mouseArea.containsMouse)
|
||||||
|
return 0.8;
|
||||||
|
if (track.scrollBar.policy === CustomScrollBar.AlwaysOn || track.scrollBar.shouldBeActive)
|
||||||
|
return 0.6;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
radius: Tokens.rounding.full
|
||||||
|
x: track.scrollBar.reversed ? track.scrollBar.width * (1 + track.scrollBar.nonAnimY) * track.scrollBar.travelScale : track.scrollBar.width * track.scrollBar.nonAnimY * track.scrollBar.travelScale
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {}
|
Anim {}
|
||||||
}
|
}
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
type: Anim.DefaultEffects
|
type: Anim.DefaultEffects
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,5 @@ CustomText {
|
|||||||
property int grade: Colors.light ? 0 : -25
|
property int grade: Colors.light ? 0 : -25
|
||||||
property font fontStyle: Tokens.font.icon.small
|
property font fontStyle: Tokens.font.icon.small
|
||||||
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-13
@@ -124,7 +124,7 @@ MouseArea {
|
|||||||
model: root.items
|
model: root.items
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
id: menuItem
|
id: item
|
||||||
|
|
||||||
readonly property bool active: modelData === root?.active
|
readonly property bool active: modelData === root?.active
|
||||||
required property int index
|
required property int index
|
||||||
@@ -142,13 +142,13 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||||
enabled: root.expanded
|
enabled: root.expanded
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.itemSelected(menuItem.modelData);
|
root.itemSelected(item.modelData);
|
||||||
root.active = menuItem.modelData;
|
root.active = item.modelData;
|
||||||
menuItem.modelData.clicked();
|
item.modelData.clicked();
|
||||||
root.expanded = false;
|
root.expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,27 +162,26 @@ MouseArea {
|
|||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||||
text: menuItem.modelData?.icon ?? ""
|
text: item.modelData?.icon ?? ""
|
||||||
visible: text !== ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||||
text: menuItem.modelData?.text ?? ""
|
text: item.modelData?.text ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
active: menuItem.modelData?.trailingIcon.length > 0
|
active: item.modelData?.trailingIcon.length > 0
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: active
|
visible: active
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||||
text: menuItem.modelData.trailingIcon
|
text: item.modelData.trailingIcon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ PersistentProperties {
|
|||||||
property bool sidebar
|
property bool sidebar
|
||||||
|
|
||||||
// Dashboard state
|
// Dashboard state
|
||||||
property int dashboardTab: 0
|
property int dashboardTab
|
||||||
property date dashboardDate: new Date()
|
property date dashboardDate: new Date()
|
||||||
|
|
||||||
// Sidebar state
|
// Sidebar state
|
||||||
property int sidebarTab: 0
|
property int sidebarTab
|
||||||
property list<string> expandedNotifs: []
|
property list<string> expandedNotifs: []
|
||||||
|
|
||||||
// Utilities state
|
// Utilities state
|
||||||
@@ -34,7 +34,4 @@ PersistentProperties {
|
|||||||
// Drawing state
|
// Drawing state
|
||||||
property color penColor: "white"
|
property color penColor: "white"
|
||||||
property int penWidth: 4
|
property int penWidth: 4
|
||||||
|
|
||||||
// Screenshot state
|
|
||||||
property bool screenshot
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ TextField {
|
|||||||
implicitHeight: contentHeight + topPadding + bottomPadding
|
implicitHeight: contentHeight + topPadding + bottomPadding
|
||||||
implicitWidth: contentWidth + leftPadding + rightPadding
|
implicitWidth: contentWidth + leftPadding + rightPadding
|
||||||
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
||||||
renderType: TextField.QtRendering
|
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
||||||
selectedTextColor: color
|
selectedTextColor: color
|
||||||
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
|
||||||
import qs.Effects
|
import qs.Effects
|
||||||
|
|
||||||
CustomFlickable {
|
CustomFlickable {
|
||||||
@@ -10,7 +9,6 @@ CustomFlickable {
|
|||||||
property real bottomFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
property real bottomFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
||||||
property real fadeAmount: 0.1
|
property real fadeAmount: 0.1
|
||||||
property real topFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
property real topFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
||||||
readonly property real dpr: Math.ceil((QsWindow.window as QsWindow)?.devicePixelRatio ?? 1)
|
|
||||||
|
|
||||||
function fadeShouldBeActive(isStart: bool): bool {
|
function fadeShouldBeActive(isStart: bool): bool {
|
||||||
// When content is smaller than flickable size, hide fade when rebound starts
|
// When content is smaller than flickable size, hide fade when rebound starts
|
||||||
@@ -30,7 +28,6 @@ CustomFlickable {
|
|||||||
type: Anim.SlowEffects
|
type: Anim.SlowEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layer.textureSize: Qt.size(width * dpr, height * dpr)
|
|
||||||
layer.effect: Mask {
|
layer.effect: Mask {
|
||||||
maskSource: mask
|
maskSource: mask
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,14 @@ Item {
|
|||||||
id: track
|
id: track
|
||||||
|
|
||||||
required property var scrollBar
|
required property var scrollBar
|
||||||
required property var mouseArea
|
required property CustomMouseArea mouseArea
|
||||||
|
|
||||||
ClipRect {
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
implicitWidth: Tokens.padding.extraSmall * 2
|
||||||
|
|
||||||
|
CustomClippingRect {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@@ -18,10 +23,10 @@ Item {
|
|||||||
CustomRect {
|
CustomRect {
|
||||||
id: handle
|
id: handle
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
color: Colors.palette.m3secondary
|
color: Colors.palette.m3secondary
|
||||||
implicitHeight: track.scrollBar.height * track.scrollBar.effectiveSize
|
implicitHeight: track.scrollBar.height * track.scrollBar.effectiveSize
|
||||||
implicitWidth: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
implicitWidth: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
||||||
|
anchors.right: parent.right
|
||||||
opacity: {
|
opacity: {
|
||||||
if (!track.scrollBar.enabled)
|
if (!track.scrollBar.enabled)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ Scope {
|
|||||||
name: "Bar-Exclusion"
|
name: "Bar-Exclusion"
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
|
|
||||||
mask: Region {}
|
mask: Region {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-36
@@ -11,18 +11,19 @@ CustomMouseArea {
|
|||||||
|
|
||||||
required property Item bar
|
required property Item bar
|
||||||
required property real borderThickness
|
required property real borderThickness
|
||||||
property bool dashboardShortcutActive
|
required property ScreenState screenState
|
||||||
property point dragStart
|
|
||||||
required property Drawing drawing
|
required property Drawing drawing
|
||||||
required property EdgeGeometry geometry
|
required property EdgeGeometry geometry
|
||||||
property bool osdShortcutActive
|
|
||||||
required property Panels panels
|
required property Panels panels
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
required property ScreenState screenState
|
|
||||||
property bool setInitialPoint: false
|
property bool dashboardShortcutActive
|
||||||
|
property bool osdShortcutActive
|
||||||
property bool singleGestureTriggered: false
|
property bool singleGestureTriggered: false
|
||||||
property bool utilitiesShortcutActive
|
property bool utilitiesShortcutActive
|
||||||
|
property bool setInitialPoint: false
|
||||||
|
property point dragStart
|
||||||
|
|
||||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||||
@@ -59,10 +60,39 @@ CustomMouseArea {
|
|||||||
return x >= panelX && x <= panelX + panel.width;
|
return x >= panelX && x <= panelX + panel.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptedButtons: bar.fullscreen ? Qt.NoButton : Qt.AllButtons
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
acceptedButtons: bar.fullscreen ? Qt.NoButton : Qt.AllButtons
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onPressed: event => {
|
||||||
|
dragStart = Qt.point(event.x, event.y);
|
||||||
|
|
||||||
|
if (screenState.isDrawing) {
|
||||||
|
if (event.button & Qt.RightButton) {
|
||||||
|
drawing.content.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||||
|
drawing.content.beginStroke(event.x, event.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPressedChanged: {
|
||||||
|
if (!pressed) {
|
||||||
|
if (screenState.isDrawing) {
|
||||||
|
setInitialPoint = false;
|
||||||
|
drawing.content.endStroke();
|
||||||
|
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||||
|
drawing.content.showHover(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (screenState.isDrawing) {
|
||||||
|
panels.drawing.collapse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onContainsMouseChanged: {
|
onContainsMouseChanged: {
|
||||||
if (!containsMouse) {
|
if (!containsMouse) {
|
||||||
if (!osdShortcutActive) {
|
if (!osdShortcutActive) {
|
||||||
@@ -81,6 +111,7 @@ CustomMouseArea {
|
|||||||
screenState.dashboard = false;
|
screenState.dashboard = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPositionChanged: event => {
|
onPositionChanged: event => {
|
||||||
const x = event.x;
|
const x = event.x;
|
||||||
const y = event.y;
|
const y = event.y;
|
||||||
@@ -113,8 +144,7 @@ CustomMouseArea {
|
|||||||
if (pressed && dragStart.y >= screen.height - Config.bar.border && dragStart.x > screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
if (pressed && dragStart.y >= screen.height - Config.bar.border && dragStart.x > screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||||
screenState.launcher = true;
|
screenState.launcher = true;
|
||||||
|
|
||||||
const entryAt = bar.entryAt(geometry.axisPos(x, y));
|
const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboardWrapper, x, y);
|
||||||
const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboardWrapper, x, y) && (!entryAt || entryAt === "activeWindow");
|
|
||||||
|
|
||||||
if (!dashboardShortcutActive) {
|
if (!dashboardShortcutActive) {
|
||||||
screenState.dashboard = showDashboard;
|
screenState.dashboard = showDashboard;
|
||||||
@@ -129,7 +159,7 @@ CustomMouseArea {
|
|||||||
screenState.dashboard = false;
|
screenState.dashboard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && !inTopPanel(panels.dashboardWrapper, dragStart.x, dragStart.y)) {
|
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && (Config.dashboard.showOnHover || !inTopPanel(panels.dashboardWrapper, dragStart.x, dragStart.y))) {
|
||||||
if (dragY > 20) {
|
if (dragY > 20) {
|
||||||
screenState.settings = true;
|
screenState.settings = true;
|
||||||
} else if (dragY < -20) {
|
} else if (dragY < -20) {
|
||||||
@@ -182,33 +212,6 @@ CustomMouseArea {
|
|||||||
if (geometry.barContains(x, y))
|
if (geometry.barContains(x, y))
|
||||||
bar.checkPopout(geometry.axisPos(x, y));
|
bar.checkPopout(geometry.axisPos(x, y));
|
||||||
}
|
}
|
||||||
onPressed: event => {
|
|
||||||
dragStart = Qt.point(event.x, event.y);
|
|
||||||
|
|
||||||
if (screenState.isDrawing) {
|
|
||||||
if (event.button & Qt.RightButton) {
|
|
||||||
drawing.content.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
|
||||||
drawing.content.beginStroke(event.x, event.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onPressedChanged: {
|
|
||||||
if (!pressed) {
|
|
||||||
if (screenState.isDrawing) {
|
|
||||||
setInitialPoint = false;
|
|
||||||
drawing.content.endStroke();
|
|
||||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
|
||||||
drawing.content.showHover(mouseX, mouseY);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (screenState.isDrawing) {
|
|
||||||
panels.drawing.collapse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: unhideTimer
|
id: unhideTimer
|
||||||
|
|||||||
+12
-13
@@ -3,8 +3,8 @@ import QtQuick
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Modules.Bar.Popouts as Popouts
|
import qs.Modules.Bar.Popouts as Popouts
|
||||||
import qs.Modules.Notifications as Notifications
|
import qs.Modules.Notifications as Notifications
|
||||||
import qs.Modules.Sidebar as Sidebar
|
import qs.Modules.Notifications.Sidebar as Sidebar
|
||||||
import qs.Modules.Sidebar.Utils as Utils
|
import qs.Modules.Notifications.Sidebar.Utils as Utils
|
||||||
import qs.Modules.Dashboard as Dashboard
|
import qs.Modules.Dashboard as Dashboard
|
||||||
import qs.Modules.Osd as Osd
|
import qs.Modules.Osd as Osd
|
||||||
import qs.Components.Toast as Toasts
|
import qs.Components.Toast as Toasts
|
||||||
@@ -19,11 +19,15 @@ import ZShell.Config
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property Item bar
|
||||||
|
required property real borderThickness
|
||||||
readonly property alias clipboard: clipboard
|
readonly property alias clipboard: clipboard
|
||||||
readonly property alias dashboard: dashboard
|
readonly property alias dashboard: dashboard
|
||||||
readonly property alias dashboardWrapper: dashboardWrapper
|
readonly property alias dashboardWrapper: dashboardWrapper
|
||||||
readonly property alias dock: dock
|
readonly property alias dock: dock
|
||||||
readonly property alias drawing: drawing
|
readonly property alias drawing: drawing
|
||||||
|
required property var drawingItem
|
||||||
|
required property EdgeGeometry geometry
|
||||||
readonly property alias launcher: launcher
|
readonly property alias launcher: launcher
|
||||||
readonly property alias notifications: notifications
|
readonly property alias notifications: notifications
|
||||||
readonly property alias osd: osd
|
readonly property alias osd: osd
|
||||||
@@ -32,17 +36,12 @@ Item {
|
|||||||
readonly property alias popoutsWrapper: popouts
|
readonly property alias popoutsWrapper: popouts
|
||||||
readonly property alias resources: resources
|
readonly property alias resources: resources
|
||||||
readonly property alias resourcesWrapper: resourcesWrapper
|
readonly property alias resourcesWrapper: resourcesWrapper
|
||||||
|
required property ShellScreen screen
|
||||||
readonly property alias settings: settings
|
readonly property alias settings: settings
|
||||||
readonly property alias settingsWrapper: settingsWrapper
|
readonly property alias settingsWrapper: settingsWrapper
|
||||||
readonly property alias sidebar: sidebar
|
readonly property alias sidebar: sidebar
|
||||||
readonly property alias toasts: toasts
|
readonly property alias toasts: toasts
|
||||||
readonly property alias utilities: utilities
|
readonly property alias utilities: utilities
|
||||||
|
|
||||||
required property Item bar
|
|
||||||
required property real borderThickness
|
|
||||||
required property var drawingItem
|
|
||||||
required property EdgeGeometry geometry
|
|
||||||
required property ShellScreen screen
|
|
||||||
required property ScreenState screenState
|
required property ScreenState screenState
|
||||||
|
|
||||||
anchors.bottomMargin: geometry.insetBottom(borderThickness)
|
anchors.bottomMargin: geometry.insetBottom(borderThickness)
|
||||||
@@ -85,8 +84,8 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
screenState: root.screenState
|
|
||||||
sidebarOrSessionVisible: sidebar.visible
|
sidebarOrSessionVisible: sidebar.visible
|
||||||
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,8 +121,8 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
panels: root
|
panels: root
|
||||||
screenState: root.screenState
|
|
||||||
sidebarPanel: sidebar
|
sidebarPanel: sidebar
|
||||||
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Launcher.Wrapper {
|
Launcher.Wrapper {
|
||||||
@@ -141,8 +140,8 @@ Item {
|
|||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
screenState: root.screenState
|
|
||||||
sidebar: sidebar
|
sidebar: sidebar
|
||||||
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -150,9 +149,9 @@ Item {
|
|||||||
|
|
||||||
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
clip: offsetScale > 0
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
clip: true
|
||||||
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
||||||
implicitWidth: dashboard.implicitWidth
|
implicitWidth: dashboard.implicitWidth
|
||||||
|
|
||||||
|
|||||||
+45
-44
@@ -11,7 +11,6 @@ import ZShell.Blobs
|
|||||||
import qs.Daemons
|
import qs.Daemons
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Modules.Bar
|
import qs.Modules.Bar
|
||||||
import qs.Modules.Bar.Popouts.Network as N
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Drawers
|
import qs.Drawers
|
||||||
@@ -53,14 +52,15 @@ CustomWindow {
|
|||||||
property var root: Quickshell.shellDir
|
property var root: Quickshell.shellDir
|
||||||
readonly property ScreenState screenState: ShellState.forScreen(screen)
|
readonly property ScreenState screenState: ShellState.forScreen(screen)
|
||||||
readonly property real sdfBorderOffset: 2 * fsTransitionProg
|
readonly property real sdfBorderOffset: 2 * fsTransitionProg
|
||||||
readonly property real shadowOpacity: 0.5 * (1 - (bar.isHovered ? 0 : fsTransitionProg))
|
readonly property real shadowOpacity: 0.7 * (1 - (bar.isHovered ? 0 : fsTransitionProg))
|
||||||
property color surfaceColor: Colors.tPalette.m3surface
|
property color surfaceColor: Colors.tPalette.m3surface
|
||||||
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
WlrLayershell.keyboardFocus: screenState.screenshot ? WlrKeyboardFocus.Exclusive : screenState.launcher || screenState.settings || screenState.sidebar ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: screenState.launcher || screenState.settings || screenState.sidebar ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
WlrLayershell.layer: (fsTransitionProg > 0 && Config.general.showOverFullscreen) || (hasSpecialWorkspace && hasFullscreenOnNormalWs) ? WlrLayer.Overlay : WlrLayer.Top
|
WlrLayershell.layer: (fsTransitionProg > 0 && Config.general.showOverFullscreen) || (hasSpecialWorkspace && hasFullscreenOnNormalWs) ? WlrLayer.Overlay : WlrLayer.Top
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
mask: screenState.isDrawing || screenState.screenshot ? null : (hasFullscreen && !bar.isHovered ? emptyRegion : regions)
|
contentItem.focus: true
|
||||||
|
mask: screenState.isDrawing ? null : (hasFullscreen && !bar.isHovered ? emptyRegion : regions)
|
||||||
name: "Bar"
|
name: "Bar"
|
||||||
|
|
||||||
Behavior on fsTransitionProg {
|
Behavior on fsTransitionProg {
|
||||||
@@ -143,6 +143,7 @@ CustomWindow {
|
|||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
id: focusGrab
|
id: focusGrab
|
||||||
|
|
||||||
|
windows: [root]
|
||||||
active: {
|
active: {
|
||||||
const s = root.screenState;
|
const s = root.screenState;
|
||||||
const c = Config;
|
const c = Config;
|
||||||
@@ -159,7 +160,6 @@ CustomWindow {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
windows: [root]
|
|
||||||
|
|
||||||
onCleared: {
|
onCleared: {
|
||||||
root.screenState.launcher = false;
|
root.screenState.launcher = false;
|
||||||
@@ -185,19 +185,23 @@ CustomWindow {
|
|||||||
id: surface
|
id: surface
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
opacity: root.surfaceColor.a
|
opacity: root.surfaceColor.a
|
||||||
|
|
||||||
BlobGroup2 {
|
layer.effect: MultiEffect {
|
||||||
|
blurMax: 32
|
||||||
|
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
||||||
|
shadowEnabled: true
|
||||||
|
}
|
||||||
|
|
||||||
|
BlobGroup {
|
||||||
id: blobGroup
|
id: blobGroup
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
color: root.surfaceColor
|
color: root.surfaceColor
|
||||||
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
|
||||||
shadowRadius: 18
|
|
||||||
smoothing: Config.bar.smoothing
|
smoothing: Config.bar.smoothing
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobInvertedRect2 {
|
BlobInvertedRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -50
|
anchors.margins: -50
|
||||||
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||||
@@ -247,7 +251,6 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: osdBg
|
id: osdBg
|
||||||
|
|
||||||
atRestOverride: panels.osd.offsetScale < 0.99
|
|
||||||
deformAmount: 0.1
|
deformAmount: 0.1
|
||||||
implicitHeight: panels.osd.height
|
implicitHeight: panels.osd.height
|
||||||
implicitWidth: panels.osd.width
|
implicitWidth: panels.osd.width
|
||||||
@@ -259,7 +262,6 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: notifsBg
|
id: notifsBg
|
||||||
|
|
||||||
atRestOverride: panel.implicitHeight > 0
|
|
||||||
panel: panels.notifications
|
panel: panels.notifications
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.large
|
||||||
}
|
}
|
||||||
@@ -294,16 +296,13 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: resourcesBg
|
id: resourcesBg
|
||||||
|
|
||||||
property real extraExtent: 0.2
|
|
||||||
|
|
||||||
atRestOverride: panels.resources.offsetScale < 0.99
|
|
||||||
deformAmount: 0.05
|
deformAmount: 0.05
|
||||||
implicitHeight: panels.resources.height * (1 + extraExtent)
|
implicitHeight: panels.resources.height
|
||||||
implicitWidth: panels.resources.width * (1 + extraExtent)
|
implicitWidth: panels.resources.width
|
||||||
panel: panels.resourcesWrapper
|
panel: panels.resourcesWrapper
|
||||||
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
||||||
x: panels.resourcesWrapper.x + panels.resources.x + geometry.insetLeft(root.borderThickness) - panels.resources.width * extraExtent
|
x: panels.resourcesWrapper.x + panels.resources.x + geometry.insetLeft(root.borderThickness)
|
||||||
y: panels.resourcesWrapper.y + panels.resources.y + geometry.insetTop(root.borderThickness) - panels.resources.height * extraExtent
|
y: panels.resourcesWrapper.y + panels.resources.y + geometry.insetTop(root.borderThickness)
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -333,15 +332,9 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: clipboardBg
|
id: clipboardBg
|
||||||
|
|
||||||
property real extraExtent: 0.2
|
|
||||||
|
|
||||||
deformAmount: 0.03
|
deformAmount: 0.03
|
||||||
implicitHeight: panels.clipboard.height * (1 + extraExtent)
|
|
||||||
implicitWidth: panels.clipboard.width * (1 + extraExtent)
|
|
||||||
panel: panels.clipboard
|
panel: panels.clipboard
|
||||||
radius: 29
|
radius: 29
|
||||||
x: panels.clipboard.x + geometry.insetLeft(root.borderThickness) - panels.clipboard.width * extraExtent
|
|
||||||
y: panels.clipboard.y + geometry.insetTop(root.borderThickness)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,8 +342,34 @@ CustomWindow {
|
|||||||
id: drawing
|
id: drawing
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
screenState: root.screenState
|
screenState: root.screenState
|
||||||
z: 2
|
z: 2
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
maskEnabled: true
|
||||||
|
maskInverted: true
|
||||||
|
maskSource: maskSource
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: maskSource
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
readonly property int extraWidth: radius
|
||||||
|
|
||||||
|
color: "white"
|
||||||
|
implicitHeight: panels.drawing.height
|
||||||
|
implicitWidth: panels.drawing.width + extraWidth
|
||||||
|
radius: drawingBg.radius
|
||||||
|
x: -extraWidth + root.borderThickness + panels.drawing.x
|
||||||
|
y: panels.drawing.y + bar.implicitHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Interactions2 {
|
Interactions2 {
|
||||||
@@ -430,28 +449,10 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoader {
|
component PanelBg: BlobRect {
|
||||||
id: loader
|
|
||||||
|
|
||||||
property bool closing: !root.screenState.screenshot
|
|
||||||
|
|
||||||
onClosingChanged: if (!closing)
|
|
||||||
activeAsync = true
|
|
||||||
|
|
||||||
Picker {
|
|
||||||
loader: loader
|
|
||||||
parent: root.contentItem
|
|
||||||
screen: root.screen
|
|
||||||
screenState: root.screenState
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component PanelBg: BlobRect2 {
|
|
||||||
property real deformAmount: 0.15
|
property real deformAmount: 0.15
|
||||||
required property Item panel
|
required property Item panel
|
||||||
|
|
||||||
atRestOverride: panel?.offsetScale < 0.99 ?? false
|
|
||||||
damping: 28.3
|
|
||||||
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||||
group: blobGroup
|
group: blobGroup
|
||||||
implicitHeight: panel.height
|
implicitHeight: panel.height
|
||||||
|
|||||||
+28
-12
@@ -27,21 +27,27 @@ ColumnLayout {
|
|||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: Colors.palette.m3secondary
|
color: Colors.palette.m3secondary
|
||||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
font.bold: true
|
||||||
|
font.family: Config.appearance.font.family.clock
|
||||||
|
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||||
text: Time.hourStr
|
text: Time.hourStr
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
font.bold: true
|
||||||
|
font.family: Config.appearance.font.family.clock
|
||||||
|
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||||
text: ":"
|
text: ":"
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: Colors.palette.m3secondary
|
color: Colors.palette.m3secondary
|
||||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
font.bold: true
|
||||||
|
font.family: Config.appearance.font.family.clock
|
||||||
|
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||||
text: Time.minuteStr
|
text: Time.minuteStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,11 +56,13 @@ ColumnLayout {
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.topMargin: -Tokens.padding.large * 2
|
Layout.topMargin: -Tokens.padding.large * 2
|
||||||
color: Colors.palette.m3tertiary
|
color: Colors.palette.m3tertiary
|
||||||
font: Tokens.font.title.builders.medium.weight(Font.DemiBold).build()
|
font.bold: true
|
||||||
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Math.floor(Tokens.font.size.extraLarge * root.centerScale)
|
||||||
text: Time.format("dddd, d MMMM yyyy")
|
text: Time.format("dddd, d MMMM yyyy")
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
@@ -65,7 +73,7 @@ ColumnLayout {
|
|||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
fontStyle: Tokens.font.icon.size(root.centerWidth / 4).build()
|
font.pointSize: Math.floor(root.centerWidth / 4)
|
||||||
text: "person"
|
text: "person"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +88,9 @@ ColumnLayout {
|
|||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
font: Tokens.font.body.large
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.normal
|
||||||
|
font.weight: 600
|
||||||
text: root.greeter.username
|
text: root.greeter.username
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
}
|
}
|
||||||
@@ -145,7 +155,8 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,6 +191,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
|
font.weight: 500
|
||||||
text: root.greeter.launching ? "hourglass_top" : "arrow_forward"
|
text: root.greeter.launching ? "hourglass_top" : "arrow_forward"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +204,8 @@ ColumnLayout {
|
|||||||
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
@@ -232,10 +245,12 @@ ColumnLayout {
|
|||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMsgChanged: {
|
onMsgChanged: {
|
||||||
@@ -277,7 +292,8 @@ ColumnLayout {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: isError ? Colors.palette.m3error : Colors.palette.m3primary
|
color: isError ? Colors.palette.m3error : Colors.palette.m3primary
|
||||||
font: Tokens.font.mono.medium
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.small
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
opacity: 0
|
opacity: 0
|
||||||
scale: 0.7
|
scale: 0.7
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ BusyIndicator {
|
|||||||
property int animState
|
property int animState
|
||||||
property color bgColor: Colors.palette.m3secondaryContainer
|
property color bgColor: Colors.palette.m3secondaryContainer
|
||||||
property color fgColor: Colors.palette.m3primary
|
property color fgColor: Colors.palette.m3primary
|
||||||
property real implicitSize: Tokens.font.body.medium.pointSize * 3
|
property real implicitSize: Tokens.font.size.normal * 3
|
||||||
property real internalStrokeWidth: strokeWidth
|
property real internalStrokeWidth: strokeWidth
|
||||||
readonly property alias progress: manager.progress
|
readonly property alias progress: manager.progress
|
||||||
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import ZShell.Components
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real radius
|
|
||||||
property real topLeftRadius: radius
|
|
||||||
property real topRightRadius: radius
|
|
||||||
property real bottomRightRadius: radius
|
|
||||||
property real bottomLeftRadius: radius
|
|
||||||
property color color: "transparent"
|
|
||||||
default property alias contentData: contentItem.data
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: contentItem
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource {
|
|
||||||
id: source
|
|
||||||
|
|
||||||
hideSource: true
|
|
||||||
sourceItem: contentItem
|
|
||||||
}
|
|
||||||
|
|
||||||
RoundedMask {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: source
|
|
||||||
topLeftRadius: root.topLeftRadius
|
|
||||||
topRightRadius: root.topRightRadius
|
|
||||||
bottomRightRadius: root.bottomRightRadius
|
|
||||||
bottomLeftRadius: root.bottomLeftRadius
|
|
||||||
color: root.color
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool doneFakeFlick
|
|
||||||
|
|
||||||
interactive: !ShellState.forActive().isDrawing
|
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
onRunningChanged: {
|
|
||||||
if (!running && !root.doneFakeFlick) {
|
|
||||||
root.doneFakeFlick = true;
|
|
||||||
root.flick(1, 1);
|
|
||||||
root.flick(-1, -1);
|
|
||||||
Qt.callLater(() => root.cancelFlick());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 10
|
|
||||||
running: root.doneFakeFlick
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
root.doneFakeFlick = false;
|
|
||||||
root.returnToBounds();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool doneFakeFlick
|
|
||||||
|
|
||||||
interactive: !ShellState.forActive()?.isDrawing
|
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
// onRunningChanged: {
|
|
||||||
// if (!running && !root.doneFakeFlick) {
|
|
||||||
// root.doneFakeFlick = true;
|
|
||||||
// root.flick(1, 1);
|
|
||||||
// root.flick(-1, -1);
|
|
||||||
// Qt.callLater(() => root.cancelFlick());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer {
|
|
||||||
// interval: 10
|
|
||||||
// running: root.doneFakeFlick
|
|
||||||
//
|
|
||||||
// onTriggered: {
|
|
||||||
// root.doneFakeFlick = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ MouseArea {
|
|||||||
property int scrollAccumulatedY: 0
|
property int scrollAccumulatedY: 0
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
function onWheel(event: WheelEvent): void {
|
||||||
event.accepted = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onWheel: event => {
|
onWheel: event => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Rectangle {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {}
|
CAnim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ Text {
|
|||||||
property real animateTo: 1
|
property real animateTo: 1
|
||||||
|
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
font: Tokens.font.body.small
|
font.family: Config.appearance.font.family.sans
|
||||||
|
font.pointSize: Tokens.font.size.normal
|
||||||
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
||||||
renderType: Text.QtRendering
|
renderType: Text.NativeRendering
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
@@ -27,25 +28,22 @@ Text {
|
|||||||
enabled: root.animate
|
enabled: root.animate
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
TAnim {
|
Anim {
|
||||||
target: root
|
|
||||||
to: root.animateFrom
|
to: root.animateFrom
|
||||||
type: Anim.FastEffects
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyAction {
|
PropertyAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
TAnim {
|
Anim {
|
||||||
target: root
|
|
||||||
to: root.animateTo
|
to: root.animateTo
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component TAnim: Anim {
|
component Anim: NumberAnimation {
|
||||||
duration: root.animateDuration / 2
|
duration: root.animateDuration / 2
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
properties: root.animateProp.split(",").length > 1 ? root.animateProp : ""
|
properties: root.animateProp.split(",").length > 1 ? root.animateProp : ""
|
||||||
property: root.animateProp.split(",").length === 1 ? root.animateProp : ""
|
property: root.animateProp.split(",").length === 1 ? root.animateProp : ""
|
||||||
target: root
|
target: root
|
||||||
|
|||||||
@@ -1,305 +1,76 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Controls
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
TextFieldBase {
|
TextField {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
enum TextFieldType {
|
background: null
|
||||||
Outlined,
|
color: Colors.palette.m3onSurface
|
||||||
Filled
|
cursorVisible: !readOnly
|
||||||
}
|
font.family: Config.appearance.font.family.sans
|
||||||
|
font.pointSize: Tokens.font.size.smaller
|
||||||
|
placeholderTextColor: Colors.palette.m3outline
|
||||||
|
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
||||||
|
|
||||||
readonly property int clampedRadius: Math.min(horizontalPadding, Math.min(width, height) / 2, radius)
|
Behavior on color {
|
||||||
readonly property string effectiveSupportingText: isError && errorText ? errorText : supportingText
|
CAnim {
|
||||||
readonly property int filledOffset: type === CustomTextField.Filled ? Tokens.spacing.small : 0
|
|
||||||
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
|
|
||||||
readonly property real smallFontScale: smallFontSize / font.pointSize
|
|
||||||
readonly property int supportingTextOffset: effectiveSupportingText ? supportingTextLoader.height + Tokens.spacing.extraSmall : 0
|
|
||||||
readonly property int trailingOffset: trailingIcon ? trailingIconLoader.width + trailingIconLoader.anchors.rightMargin : 0
|
|
||||||
readonly property bool valid: !validate || (!text && emptyIsValid) || (validate instanceof RegExp ? validate.test(text) : !!validate(text))
|
|
||||||
|
|
||||||
property int horizontalPadding: Tokens.padding.large
|
|
||||||
property int verticalPadding: Tokens.padding.large
|
|
||||||
|
|
||||||
property int radius: Tokens.rounding.small
|
|
||||||
|
|
||||||
property string supportingText
|
|
||||||
property string trailingIcon
|
|
||||||
property int smallFontSize: Tokens.font.label.small.pointSize
|
|
||||||
|
|
||||||
property int type: CustomTextField.Outlined
|
|
||||||
property var validate // Regex or function
|
|
||||||
property bool emptyIsValid: true
|
|
||||||
property string errorText
|
|
||||||
property bool isError
|
|
||||||
property string leadingIcon
|
|
||||||
|
|
||||||
bottomPadding: verticalPadding + supportingTextOffset - filledOffset
|
|
||||||
leftPadding: horizontalPadding + leadingOffset
|
|
||||||
rightPadding: horizontalPadding + trailingOffset
|
|
||||||
topPadding: verticalPadding + filledOffset
|
|
||||||
|
|
||||||
background: Loader {
|
|
||||||
anchors.bottomMargin: root.supportingTextOffset
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceComponent: root.type === CustomTextField.Filled ? filledComp : outlineComp
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
id: stateLayer
|
|
||||||
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
enabled: !root.activeFocus
|
|
||||||
manualPressOverride: tapHandler.pressed
|
|
||||||
radius: root.type === CustomTextField.Outlined ? root.clampedRadius : 0
|
|
||||||
topLeftRadius: root.clampedRadius
|
|
||||||
topRightRadius: root.clampedRadius
|
|
||||||
|
|
||||||
onClicked: root.focus = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cursorDelegate: CustomRect {
|
||||||
|
id: cursor
|
||||||
|
|
||||||
onEditingFinished: {
|
property bool disableBlink
|
||||||
if (!valid)
|
|
||||||
isError = true;
|
|
||||||
}
|
|
||||||
onPressed: {
|
|
||||||
if (stateLayer.enabled)
|
|
||||||
stateLayer.press(stateLayer.mouseX, stateLayer.mouseY);
|
|
||||||
}
|
|
||||||
onTextEdited: {
|
|
||||||
if (isError)
|
|
||||||
isError = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
color: Colors.palette.m3primary
|
||||||
id: contentWrapper
|
implicitWidth: 2
|
||||||
|
radius: Tokens.rounding.medium
|
||||||
|
|
||||||
anchors.bottomMargin: root.supportingTextOffset
|
Behavior on opacity {
|
||||||
anchors.fill: parent
|
Anim {
|
||||||
|
duration: Tokens.anim.durations.small
|
||||||
CustomText {
|
|
||||||
id: placeholder
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: root.leftPadding
|
|
||||||
anchors.topMargin: Tokens.padding.extraSmall
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
color: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : root.text ? Colors.palette.m3outline : root.placeholderTextColor)
|
|
||||||
font.family: root.font.family
|
|
||||||
font.pointSize: root.font.pointSize
|
|
||||||
font.variableAxes: root.font.variableAxes
|
|
||||||
font.weight: root.font.weight
|
|
||||||
renderType: Text.QtRendering
|
|
||||||
text: root.placeholderText
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "smallOutlined"
|
|
||||||
when: root.type === CustomTextField.Outlined && (root.activeFocus || root.text)
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding
|
|
||||||
placeholder.scale: root.smallFontScale
|
|
||||||
}
|
|
||||||
|
|
||||||
AnchorChanges {
|
|
||||||
anchors.verticalCenter: contentWrapper.top
|
|
||||||
target: placeholder
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "smallFilled"
|
|
||||||
when: root.type === CustomTextField.Filled && (root.activeFocus || root.text)
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding + root.leadingOffset
|
|
||||||
placeholder.scale: root.smallFontScale
|
|
||||||
}
|
|
||||||
|
|
||||||
AnchorChanges {
|
|
||||||
anchors.top: contentWrapper.top
|
|
||||||
anchors.verticalCenter: undefined
|
|
||||||
target: placeholder
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
transitions: Transition {
|
|
||||||
Anim {
|
|
||||||
properties: "scale,leftMargin"
|
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
|
||||||
|
|
||||||
AnchorAnim {
|
|
||||||
duration: Tokens.anim.durations.expressiveDefaultEffects
|
|
||||||
easing: Tokens.anim.expressiveDefaultEffects
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Connections {
|
||||||
id: leadingIconLoader
|
function onCursorPositionChanged(): void {
|
||||||
|
if (root.activeFocus && root.cursorVisible) {
|
||||||
active: root.leadingIcon
|
cursor.opacity = 1;
|
||||||
anchors.left: parent.left
|
cursor.disableBlink = true;
|
||||||
anchors.leftMargin: Tokens.padding.small
|
enableBlink.restart();
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
|
||||||
text: root.leadingIcon
|
|
||||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: trailingIconLoader
|
|
||||||
|
|
||||||
active: root.trailingIcon
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Tokens.padding.small
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
|
||||||
text: root.trailingIcon
|
|
||||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: supportingTextLoader
|
|
||||||
|
|
||||||
active: root.effectiveSupportingText
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: root.horizontalPadding
|
|
||||||
|
|
||||||
sourceComponent: CustomText {
|
|
||||||
color: root.isError ? Colors.palette.m3error : Colors.palette.m3onSurfaceVariant
|
|
||||||
font: Tokens.font.label.small
|
|
||||||
text: root.effectiveSupportingText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
id: tapHandler
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: outlineComp
|
|
||||||
|
|
||||||
Shape {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
|
||||||
|
|
||||||
ShapePath {
|
|
||||||
id: path
|
|
||||||
|
|
||||||
readonly property real inset: strokeWidth / 2
|
|
||||||
readonly property real outlineGap: placeholder.width * root.smallFontScale + Tokens.spacing.small * 2
|
|
||||||
property real outlineGapScale: root.activeFocus || root.text ? 1 : 0
|
|
||||||
|
|
||||||
capStyle: ShapePath.RoundCap
|
|
||||||
fillColor: "transparent"
|
|
||||||
startX: path.inset + root.horizontalPadding - root.clampedRadius + path.outlineGap * (1 - path.outlineGapScale) / 2 + path.outlineGap * path.outlineGapScale
|
|
||||||
startY: path.inset
|
|
||||||
strokeColor: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : Colors.palette.m3outline)
|
|
||||||
strokeWidth: root.activeFocus ? 2 : 1
|
|
||||||
|
|
||||||
Behavior on outlineGapScale {
|
|
||||||
Anim {
|
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on strokeColor {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
Behavior on strokeWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
|
|
||||||
PathLine {
|
|
||||||
x: bg.width - path.inset - root.clampedRadius
|
|
||||||
y: path.inset
|
|
||||||
}
|
|
||||||
|
|
||||||
PathArc {
|
|
||||||
radiusX: root.clampedRadius
|
|
||||||
radiusY: root.clampedRadius
|
|
||||||
x: bg.width - path.inset
|
|
||||||
y: path.inset + root.clampedRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
PathLine {
|
|
||||||
x: bg.width - path.inset
|
|
||||||
y: bg.height - path.inset - root.clampedRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
PathArc {
|
|
||||||
radiusX: root.clampedRadius
|
|
||||||
radiusY: root.clampedRadius
|
|
||||||
x: bg.width - path.inset - root.clampedRadius
|
|
||||||
y: bg.height - path.inset
|
|
||||||
}
|
|
||||||
|
|
||||||
PathLine {
|
|
||||||
x: path.inset + root.clampedRadius
|
|
||||||
y: bg.height - path.inset
|
|
||||||
}
|
|
||||||
|
|
||||||
PathArc {
|
|
||||||
radiusX: root.clampedRadius
|
|
||||||
radiusY: root.clampedRadius
|
|
||||||
x: path.inset
|
|
||||||
y: bg.height - path.inset - root.clampedRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
PathLine {
|
|
||||||
x: path.inset
|
|
||||||
y: path.inset + root.clampedRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
PathArc {
|
|
||||||
radiusX: root.clampedRadius
|
|
||||||
radiusY: root.clampedRadius
|
|
||||||
x: path.inset + root.clampedRadius
|
|
||||||
y: path.inset
|
|
||||||
}
|
|
||||||
|
|
||||||
PathLine {
|
|
||||||
x: path.inset + root.horizontalPadding - root.clampedRadius / 2 + path.outlineGap * (1 - path.outlineGapScale) / 2
|
|
||||||
y: path.inset
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target: root
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: enableBlink
|
||||||
|
|
||||||
|
interval: 100
|
||||||
|
|
||||||
|
onTriggered: cursor.disableBlink = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 500
|
||||||
|
repeat: true
|
||||||
|
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
|
||||||
|
triggeredOnStart: true
|
||||||
|
|
||||||
|
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
cursor.opacity: 0
|
||||||
|
when: !root.activeFocus || !root.cursorVisible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Behavior on placeholderTextColor {
|
||||||
Component {
|
CAnim {
|
||||||
id: filledComp
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
color: root.activeFocus ? Colors.tPalette.m3surfaceContainerHighest : Colors.tPalette.m3surfaceContainerHigh
|
|
||||||
topLeftRadius: root.clampedRadius
|
|
||||||
topRightRadius: root.clampedRadius
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
color: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : Colors.palette.m3outline)
|
|
||||||
implicitHeight: root.activeFocus ? 2 : 1
|
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
selectedTextColor: Colors.palette.m3onSecondaryContainer
|
selectedTextColor: Colors.palette.m3onSecondaryContainer
|
||||||
selectionColor: Colors.tPalette.colSecondaryContainer
|
selectionColor: Colors.tPalette.m3onSecondaryContainer
|
||||||
|
|
||||||
font {
|
font {
|
||||||
family: Config.appearance?.font.family.sans ?? "sans-serif"
|
family: Config.appearance?.font.family.sans ?? "sans-serif"
|
||||||
hintingPreference: Font.PreferFullHinting
|
hintingPreference: Font.PreferFullHinting
|
||||||
pixelSize: Config.appearance?.font.size.normal ?? 15
|
pixelSize: Tokens?.font.size.normal ?? 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import ZShell.Config
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property int fadeInAnim: Anim.DefaultEffects
|
|
||||||
property int fadeInLargeAnim: Anim.StandardLarge
|
|
||||||
property int fadeOutAnim: Anim.FastEffects
|
|
||||||
property bool fadingOut
|
|
||||||
property bool hadPrevious
|
|
||||||
property bool preventInit
|
|
||||||
|
|
||||||
function maybeStartInAnim(): void {
|
|
||||||
if (!preventInit && !opacityInAnim.running && status === Image.Ready) {
|
|
||||||
opacityInAnim.type = hadPrevious ? fadeInAnim : fadeInLargeAnim;
|
|
||||||
opacityInAnim.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
asynchronous: true
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
opacity: 0
|
|
||||||
retainWhileLoading: true
|
|
||||||
sourceSize: {
|
|
||||||
const dpr = (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1;
|
|
||||||
return Qt.size(width * dpr, height * dpr);
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim on opacity {
|
|
||||||
id: opacityInAnim
|
|
||||||
|
|
||||||
running: false
|
|
||||||
to: 1
|
|
||||||
}
|
|
||||||
Behavior on source {
|
|
||||||
SequentialAnimation {
|
|
||||||
ScriptAction {
|
|
||||||
script: opacityInAnim.stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
property: "fadingOut"
|
|
||||||
target: root
|
|
||||||
value: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
property: "opacity"
|
|
||||||
target: root
|
|
||||||
to: 0
|
|
||||||
type: root.fadeOutAnim
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
property: "fadingOut"
|
|
||||||
target: root
|
|
||||||
value: false
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
property: "hadPrevious"
|
|
||||||
target: root
|
|
||||||
value: root.source
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAction {
|
|
||||||
}
|
|
||||||
|
|
||||||
ScriptAction {
|
|
||||||
script: root.maybeStartInAnim()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPreventInitChanged: maybeStartInAnim()
|
|
||||||
onStatusChanged: maybeStartInAnim()
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import M3Shapes
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
MaterialShape {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool animated: true
|
|
||||||
property real cRotation
|
|
||||||
property bool containsIcon
|
|
||||||
property real dampingRatio: 0.6
|
|
||||||
property real lRotation
|
|
||||||
property int morphAnimRotation: 60
|
|
||||||
property real morphScale: 0.14
|
|
||||||
property alias rotateAnimDuration: rotateAnim.duration
|
|
||||||
property int shapeIndex
|
|
||||||
property list<int> shapes: {
|
|
||||||
if (containsIcon)
|
|
||||||
return [MaterialShape.SoftBurst, MaterialShape.Cookie9Sided, MaterialShape.Pill, MaterialShape.Sunny, MaterialShape.Cookie4Sided, MaterialShape.Oval];
|
|
||||||
return [MaterialShape.SoftBurst, MaterialShape.Cookie9Sided, MaterialShape.Pentagon, MaterialShape.Pill, MaterialShape.Sunny, MaterialShape.Cookie4Sided, MaterialShape.Oval];
|
|
||||||
}
|
|
||||||
readonly property real springDuration: {
|
|
||||||
const wn = Math.sqrt(stiffness);
|
|
||||||
const r = -dampingRatio * wn;
|
|
||||||
const c = 1 / Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
||||||
return Math.log(visibilityThreshold / c) / r;
|
|
||||||
}
|
|
||||||
readonly property real springMaxVelocity: {
|
|
||||||
const wn = Math.sqrt(stiffness);
|
|
||||||
const factor = Math.exp(-z * Math.acos(z) / Math.sqrt(1 - z * z));
|
|
||||||
return wn * factor;
|
|
||||||
}
|
|
||||||
property bool springSettled: true
|
|
||||||
property real stiffness: 180
|
|
||||||
property real thisLRotation
|
|
||||||
property real visibilityThreshold: 0.075
|
|
||||||
|
|
||||||
function spring(t: real): var {
|
|
||||||
const wn = Math.sqrt(stiffness);
|
|
||||||
const za = dampingRatio * wn;
|
|
||||||
|
|
||||||
const wd = wn * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
||||||
const r = za / wd;
|
|
||||||
const pos = 1 - Math.exp(-za * t) * (Math.cos(wd * t) + r * Math.sin(wd * t));
|
|
||||||
const vel = Math.exp(-za * t) * (wn * wn / wd) * Math.sin(wd * t);
|
|
||||||
|
|
||||||
return [pos, vel];
|
|
||||||
}
|
|
||||||
|
|
||||||
color: Colors.palette.m3primary
|
|
||||||
implicitSize: 38
|
|
||||||
toShape: shapes[0]
|
|
||||||
|
|
||||||
RotationAnimation on cRotation {
|
|
||||||
id: rotateAnim
|
|
||||||
|
|
||||||
duration: 4666
|
|
||||||
easing.type: Easing.Linear
|
|
||||||
from: 0
|
|
||||||
loops: Animation.Infinite
|
|
||||||
running: root.animated
|
|
||||||
to: 360
|
|
||||||
}
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ElapsedTimer {
|
|
||||||
id: timer
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameAnimation {
|
|
||||||
running: root.animated && !root.springSettled
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
const t = timer.elapsed();
|
|
||||||
|
|
||||||
if (t >= root.springDuration) {
|
|
||||||
root.springSettled = true;
|
|
||||||
} else {
|
|
||||||
const [pos, vel] = root.spring(t);
|
|
||||||
root.morphProgress = Math.min(1, pos); // Overshooting the morph looks weird
|
|
||||||
root.thisLRotation = pos * root.morphAnimRotation;
|
|
||||||
root.scale = 1 + vel * root.morphScale / root.springMaxVelocity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 650
|
|
||||||
repeat: true
|
|
||||||
running: root.animated
|
|
||||||
triggeredOnStart: true
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
root.beginBatchUpdate();
|
|
||||||
root.fromShape = root.toShape;
|
|
||||||
root.shapeIndex = (root.shapeIndex + 1) % root.shapes.length;
|
|
||||||
root.toShape = root.shapes[root.shapeIndex];
|
|
||||||
root.morphProgress = 0;
|
|
||||||
|
|
||||||
root.rotation = root.rotation;
|
|
||||||
root.lRotation = (root.lRotation + root.thisLRotation) % 360;
|
|
||||||
root.thisLRotation = 0;
|
|
||||||
root.rotation = Qt.binding(() => root.cRotation + root.lRotation + root.thisLRotation);
|
|
||||||
|
|
||||||
root.springSettled = false;
|
|
||||||
timer.restart();
|
|
||||||
root.endBatchUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
import QtQuick
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: root
|
property real fill
|
||||||
|
|
||||||
property real fill: 0
|
|
||||||
property int grade: Colors.light ? 0 : -25
|
property int grade: Colors.light ? 0 : -25
|
||||||
property font fontStyle: Tokens.font.icon.small
|
|
||||||
|
|
||||||
renderType: Text.NativeRendering
|
font.family: "Material Symbols Rounded"
|
||||||
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
font.pointSize: Tokens.font.size.larger
|
||||||
|
font.variableAxes: ({
|
||||||
|
FILL: fill.toFixed(1),
|
||||||
|
GRAD: grade,
|
||||||
|
opsz: fontInfo.pixelSize,
|
||||||
|
wght: fontInfo.weight
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
import ZShell
|
import ZShell
|
||||||
|
import ZShell.Components
|
||||||
|
import qs.Helpers
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -11,6 +13,7 @@ MouseArea {
|
|||||||
property alias bottomRightRadius: base.bottomRightRadius
|
property alias bottomRightRadius: base.bottomRightRadius
|
||||||
property real circleRadius
|
property real circleRadius
|
||||||
property alias color: base.color
|
property alias color: base.color
|
||||||
|
property bool disabled
|
||||||
readonly property real endRadius: {
|
readonly property real endRadius: {
|
||||||
const d1 = distSq(0, 0);
|
const d1 = distSq(0, 0);
|
||||||
const d2 = distSq(width, 0);
|
const d2 = distSq(width, 0);
|
||||||
@@ -19,7 +22,6 @@ MouseArea {
|
|||||||
return (Math.sqrt(Math.max(d1, d2, d3, d4)) + (shapeMorph ? 24 : 0)) * 1.3;
|
return (Math.sqrt(Math.max(d1, d2, d3, d4)) + (shapeMorph ? 24 : 0)) * 1.3;
|
||||||
}
|
}
|
||||||
property real endRadiusAtPress
|
property real endRadiusAtPress
|
||||||
property bool manualHoverOverride
|
|
||||||
property bool manualPressOverride
|
property bool manualPressOverride
|
||||||
property real pressX: width / 2
|
property real pressX: width / 2
|
||||||
property real pressY: height / 2
|
property real pressY: height / 2
|
||||||
@@ -27,7 +29,7 @@ MouseArea {
|
|||||||
readonly property alias rect: base
|
readonly property alias rect: base
|
||||||
property bool shapeMorph
|
property bool shapeMorph
|
||||||
property bool showHoverBackground: true
|
property bool showHoverBackground: true
|
||||||
property real stateOpacity: containsMouse || manualHoverOverride ? 0.08 : 0
|
property real stateOpacity: containsMouse ? 0.08 : 0
|
||||||
property alias topLeftRadius: base.topLeftRadius
|
property alias topLeftRadius: base.topLeftRadius
|
||||||
property alias topRightRadius: base.topRightRadius
|
property alias topRightRadius: base.topRightRadius
|
||||||
|
|
||||||
@@ -50,8 +52,8 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: !enabled ? undefined : Qt.PointingHandCursor
|
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
||||||
enabled: parent.enabled
|
enabled: !disabled
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
Behavior on stateOpacity {
|
Behavior on stateOpacity {
|
||||||
@@ -98,13 +100,13 @@ MouseArea {
|
|||||||
id: base
|
id: base
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||||
|
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
opacity: root.stateOpacity
|
opacity: root.stateOpacity
|
||||||
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
||||||
// qmllint disable missing-property
|
// qmllint disable missing-property
|
||||||
radius: root.parent?.radius ?? 0
|
radius: root.parent?.radius ?? 0
|
||||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
|
||||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
|
||||||
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
||||||
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
||||||
// qmllint enable missing-property
|
// qmllint enable missing-property
|
||||||
|
|||||||
+39
-16
@@ -13,16 +13,34 @@ RowLayout {
|
|||||||
|
|
||||||
spacing: Tokens.spacing.largeIncreased * 2
|
spacing: Tokens.spacing.largeIncreased * 2
|
||||||
|
|
||||||
CustomRect {
|
ColumnLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
topLeftRadius: Tokens.rounding.largeIncreased
|
spacing: Tokens.spacing.medium
|
||||||
bottomLeftRadius: Tokens.rounding.largeIncreased
|
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
|
||||||
radius: Tokens.rounding.small
|
|
||||||
|
|
||||||
UserDock {
|
CustomRect {
|
||||||
greeter: root.greeter
|
Layout.fillWidth: true
|
||||||
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
|
implicitHeight: weather.implicitHeight
|
||||||
|
radius: Tokens.rounding.small
|
||||||
|
topLeftRadius: Tokens.rounding.largeIncreased
|
||||||
|
|
||||||
|
WeatherInfo {
|
||||||
|
id: weather
|
||||||
|
|
||||||
|
rootHeight: root.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomClippingRect {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
bottomLeftRadius: Tokens.rounding.largeIncreased
|
||||||
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
|
radius: Tokens.rounding.small
|
||||||
|
|
||||||
|
UserDock {
|
||||||
|
greeter: root.greeter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,16 +49,21 @@ RowLayout {
|
|||||||
screenHeight: root.screenHeight
|
screenHeight: root.screenHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
ColumnLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
bottomRightRadius: Tokens.rounding.largeIncreased
|
spacing: Tokens.spacing.medium
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
|
||||||
radius: Tokens.rounding.small
|
|
||||||
topRightRadius: Tokens.rounding.largeIncreased
|
|
||||||
|
|
||||||
SessionDock {
|
CustomRect {
|
||||||
greeter: root.greeter
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
bottomRightRadius: Tokens.rounding.largeIncreased
|
||||||
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
|
radius: Tokens.rounding.small
|
||||||
|
topRightRadius: Tokens.rounding.largeIncreased
|
||||||
|
|
||||||
|
SessionDock {
|
||||||
|
greeter: root.greeter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ Scope {
|
|||||||
id: lockIcon
|
id: lockIcon
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
fontStyle: Tokens.font.icon.builders.extraLarge.size(Tokens.font.icon.extraLarge.pointSize * 3).build()
|
font.bold: true
|
||||||
|
font.pointSize: Tokens.font.size.extraLarge * 4
|
||||||
text: "lock"
|
text: "lock"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-8
@@ -39,7 +39,8 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
animate: true
|
animate: true
|
||||||
color: root.greeter.launching ? Colors.palette.m3secondary : Colors.palette.m3outline
|
color: root.greeter.launching ? Colors.palette.m3secondary : Colors.palette.m3outline
|
||||||
font: Tokens.font.mono.medium
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.normal
|
||||||
opacity: root.buffer ? 0 : 1
|
opacity: root.buffer ? 0 : 1
|
||||||
text: {
|
text: {
|
||||||
if (root.greeter.launching)
|
if (root.greeter.launching)
|
||||||
@@ -50,7 +51,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,13 +64,15 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
elide: Text.ElideLeft
|
elide: Text.ElideLeft
|
||||||
font: Tokens.font.mono.medium
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.normal
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
opacity: root.greeter.echoResponse && root.buffer ? 1 : 0
|
opacity: root.greeter.echoResponse && root.buffer ? 1 : 0
|
||||||
text: root.buffer
|
text: root.buffer
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +89,7 @@ Item {
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0
|
anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0
|
||||||
implicitHeight: Tokens.font.body.medium
|
implicitHeight: Tokens.font.size.normal
|
||||||
implicitWidth: fullWidth
|
implicitWidth: fullWidth
|
||||||
interactive: false
|
interactive: false
|
||||||
opacity: root.greeter.echoResponse ? 0 : 1
|
opacity: root.greeter.echoResponse ? 0 : 1
|
||||||
@@ -103,7 +107,8 @@ Item {
|
|||||||
scale: 0
|
scale: 0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
Anim {
|
Anim {
|
||||||
@@ -151,13 +156,15 @@ Item {
|
|||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
id: imWidthBehavior
|
id: imWidthBehavior
|
||||||
|
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: root.buffer.split("")
|
values: root.buffer.split("")
|
||||||
}
|
}
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-11
@@ -13,19 +13,22 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.large
|
anchors.margins: Tokens.padding.large
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: Colors.palette.m3outline
|
color: Colors.palette.m3outline
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.mono.builders.small.weight(Font.Medium).build()
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.weight: 500
|
||||||
text: root.greeter.sessions.length > 0 ? qsTr("%1 session%2").arg(root.greeter.sessions.length).arg(root.greeter.sessions.length === 1 ? "" : "s") : qsTr("Sessions")
|
text: root.greeter.sessions.length > 0 ? qsTr("%1 session%2").arg(root.greeter.sessions.length).arg(root.greeter.sessions.length === 1 ? "" : "s") : qsTr("Sessions")
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
CustomClippingRect {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
color: "transparent"
|
||||||
|
radius: Tokens.rounding.small
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: opacity > 0
|
active: opacity > 0
|
||||||
@@ -43,14 +46,16 @@ ColumnLayout {
|
|||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.palette.m3outlineVariant
|
color: Colors.palette.m3outlineVariant
|
||||||
fontStyle: Tokens.font.icon.large
|
font.pointSize: Tokens.font.size.extraLarge * 2
|
||||||
text: "desktop_windows"
|
text: "desktop_windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.palette.m3outlineVariant
|
color: Colors.palette.m3outlineVariant
|
||||||
font: Tokens.font.headline.builders.small.width(90).build()
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.large
|
||||||
|
font.weight: 500
|
||||||
text: qsTr("No Sessions Found")
|
text: qsTr("No Sessions Found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +68,6 @@ ColumnLayout {
|
|||||||
clip: true
|
clip: true
|
||||||
currentIndex: root.greeter.sessionIndex
|
currentIndex: root.greeter.sessionIndex
|
||||||
highlightFollowsCurrentItem: false
|
highlightFollowsCurrentItem: false
|
||||||
boundsBehavior: ListView.StopAtBounds
|
|
||||||
model: root.greeter.sessions
|
model: root.greeter.sessions
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@ ColumnLayout {
|
|||||||
anchors.left: parent?.left
|
anchors.left: parent?.left
|
||||||
anchors.right: parent?.right
|
anchors.right: parent?.right
|
||||||
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -93,7 +97,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
||||||
fontStyle: Tokens.font.icon.extraLarge
|
font.pointSize: Tokens.font.size.extraLarge
|
||||||
text: modelData.kind === "x11" ? "tv" : "desktop_windows"
|
text: modelData.kind === "x11" ? "tv" : "desktop_windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +109,8 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.body.builders.medium.weight(Font.Bold).build()
|
font.pointSize: Tokens.font.size.normal
|
||||||
|
font.weight: 600
|
||||||
text: modelData.name
|
text: modelData.name
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +118,8 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimaryFixedVariant : Colors.palette.m3onSurfaceVariant
|
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimaryFixedVariant : Colors.palette.m3onSurfaceVariant
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.mono.small
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.small
|
||||||
text: modelData.kind
|
text: modelData.kind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +129,7 @@ ColumnLayout {
|
|||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitHeight: sessions.currentItem?.implicitHeight ?? 0
|
implicitHeight: sessions.currentItem?.implicitHeight ?? 0
|
||||||
implicitWidth: sessions.width
|
implicitWidth: sessions.width
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
y: sessions.currentItem?.y ?? 0
|
y: sessions.currentItem?.y ?? 0
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
|
|||||||
+16
-11
@@ -14,19 +14,22 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.large
|
anchors.margins: Tokens.padding.large
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: Colors.palette.m3outline
|
color: Colors.palette.m3outline
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.mono.builders.small.weight(Font.Medium).build()
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.weight: 500
|
||||||
text: root.greeter.users.length > 0 ? qsTr("%1 user%2").arg(root.greeter.users.length).arg(root.greeter.users.length === 1 ? "" : "s") : qsTr("Users")
|
text: root.greeter.users.length > 0 ? qsTr("%1 user%2").arg(root.greeter.users.length).arg(root.greeter.users.length === 1 ? "" : "s") : qsTr("Users")
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
CustomClippingRect {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
color: "transparent"
|
||||||
|
radius: Tokens.rounding.small
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: opacity > 0
|
active: opacity > 0
|
||||||
@@ -45,14 +48,16 @@ ColumnLayout {
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.palette.m3outlineVariant
|
color: Colors.palette.m3outlineVariant
|
||||||
fill: 1
|
fill: 1
|
||||||
fontStyle: Tokens.font.icon.large
|
font.pointSize: Tokens.font.size.extraLarge * 2
|
||||||
text: "account_circle"
|
text: "account_circle"
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.palette.m3outlineVariant
|
color: Colors.palette.m3outlineVariant
|
||||||
font: Tokens.font.headline.builders.small.width(90).build()
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.pointSize: Tokens.font.size.large
|
||||||
|
font.weight: 500
|
||||||
text: qsTr("No Users Found")
|
text: qsTr("No Users Found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +70,6 @@ ColumnLayout {
|
|||||||
clip: true
|
clip: true
|
||||||
currentIndex: root.greeter.selectedUser ? root.greeter.users.indexOf(root.greeter.selectedUser) : -1
|
currentIndex: root.greeter.selectedUser ? root.greeter.users.indexOf(root.greeter.selectedUser) : -1
|
||||||
highlightFollowsCurrentItem: false
|
highlightFollowsCurrentItem: false
|
||||||
boundsBehavior: ListView.StopAtBounds
|
|
||||||
model: root.greeter.users
|
model: root.greeter.users
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
@@ -78,7 +82,7 @@ ColumnLayout {
|
|||||||
anchors.left: parent?.left
|
anchors.left: parent?.left
|
||||||
anchors.right: parent?.right
|
anchors.right: parent?.right
|
||||||
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -93,7 +97,7 @@ ColumnLayout {
|
|||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.small
|
||||||
spacing: Tokens.spacing.medium
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
Layout.preferredHeight: 50
|
Layout.preferredHeight: 50
|
||||||
Layout.preferredWidth: 50
|
Layout.preferredWidth: 50
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
@@ -102,7 +106,7 @@ ColumnLayout {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: user.index === users.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
color: user.index === users.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
||||||
fill: 1
|
fill: 1
|
||||||
fontStyle: Tokens.font.icon.extraLarge
|
font.pointSize: Tokens.font.size.extraLarge
|
||||||
text: modelData.kind === "x11" ? "tv" : "account_circle"
|
text: modelData.kind === "x11" ? "tv" : "account_circle"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +124,8 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: user.index === users.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: user.index === users.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.body.builders.medium.weight(Font.Bold).build()
|
font.pointSize: Tokens.font.size.normal
|
||||||
|
font.weight: 600
|
||||||
text: modelData.username
|
text: modelData.username
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +135,7 @@ ColumnLayout {
|
|||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitHeight: users.currentItem?.implicitHeight ?? 0
|
implicitHeight: users.currentItem?.implicitHeight ?? 0
|
||||||
implicitWidth: users.width
|
implicitWidth: users.width
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
y: users.currentItem?.y ?? 0
|
y: users.currentItem?.y ?? 0
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
|
|||||||
@@ -0,0 +1,171 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import ZShell.Config
|
||||||
|
import qs.Components
|
||||||
|
import qs.Helpers
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property int rootHeight
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: Tokens.padding.large * 2
|
||||||
|
anchors.right: parent.right
|
||||||
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.bottomMargin: -Tokens.padding.large
|
||||||
|
Layout.topMargin: Tokens.padding.large * 2
|
||||||
|
active: root.rootHeight > 610
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: CustomText {
|
||||||
|
color: Colors.palette.m3primary
|
||||||
|
font.pointSize: Tokens.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
text: qsTr("Weather")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
animate: true
|
||||||
|
color: Colors.palette.m3secondary
|
||||||
|
font.pointSize: Tokens.font.size.extraLarge * 2.5
|
||||||
|
text: Weather.icon
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
animate: true
|
||||||
|
color: Colors.palette.m3secondary
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.pointSize: Tokens.font.size.large
|
||||||
|
font.weight: 500
|
||||||
|
text: Weather.description
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
animate: true
|
||||||
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.pointSize: Tokens.font.size.normal
|
||||||
|
text: qsTr("Humidity: %1%").arg(Weather.humidity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
Layout.rightMargin: Tokens.padding.small
|
||||||
|
active: root.width > 400
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: ColumnLayout {
|
||||||
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
animate: true
|
||||||
|
color: Colors.palette.m3primary
|
||||||
|
elide: Text.ElideLeft
|
||||||
|
font.pointSize: Tokens.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
text: Weather.temp
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
animate: true
|
||||||
|
color: Colors.palette.m3outline
|
||||||
|
elide: Text.ElideLeft
|
||||||
|
font.pointSize: Tokens.font.size.smaller
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
text: qsTr("Feels like: %1").arg(Weather.feelsLike)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: forecastLoader
|
||||||
|
|
||||||
|
Layout.bottomMargin: Tokens.padding.large * 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: Tokens.spacing.small
|
||||||
|
active: root.rootHeight > 820
|
||||||
|
visible: active
|
||||||
|
|
||||||
|
sourceComponent: RowLayout {
|
||||||
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: {
|
||||||
|
const forecast = Weather.hourlyForecast;
|
||||||
|
const count = root.width < 320 ? 3 : root.width < 400 ? 4 : 5;
|
||||||
|
if (!forecast)
|
||||||
|
return Array.from({
|
||||||
|
length: count
|
||||||
|
}, () => null);
|
||||||
|
|
||||||
|
const start = Math.max(0, Weather.currentHourIndex);
|
||||||
|
return forecast.slice(start, start + count);
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: forecastHour
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
color: Colors.palette.m3outline
|
||||||
|
font.pointSize: Tokens.font.size.larger
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: {
|
||||||
|
const hour = forecastHour.modelData?.hour ?? 0;
|
||||||
|
return hour > 12 ? `${(hour - 12).toString().padStart(2, "0")} PM` : `${hour.toString().padStart(2, "0")} AM`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
font.pointSize: Tokens.font.size.extraLarge * 1.5
|
||||||
|
font.weight: 500
|
||||||
|
text: forecastHour.modelData?.icon ?? "cloud_alert"
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
color: Colors.palette.m3secondary
|
||||||
|
font.pointSize: Tokens.font.size.larger
|
||||||
|
text: Config.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 900000 // 15 minutes
|
||||||
|
repeat: true
|
||||||
|
running: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
|
||||||
|
onTriggered: Weather.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import ZShell
|
||||||
|
import qs.Components
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
LazyLoader {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool closing
|
||||||
|
property bool freeze
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: win
|
||||||
|
|
||||||
|
required property ShellScreen modelData
|
||||||
|
|
||||||
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
|
WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "areapicker"
|
||||||
|
color: "transparent"
|
||||||
|
mask: root.closing ? empty : null
|
||||||
|
screen: modelData
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
top: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Region {
|
||||||
|
id: empty
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Picker {
|
||||||
|
loader: root
|
||||||
|
screen: win.modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
function open(): void {
|
||||||
|
root.freeze = false;
|
||||||
|
root.closing = false;
|
||||||
|
root.activeAsync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFreeze(): void {
|
||||||
|
root.freeze = true;
|
||||||
|
root.closing = false;
|
||||||
|
root.activeAsync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target: "picker"
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "screenshot"
|
||||||
|
|
||||||
|
onPressed: {
|
||||||
|
root.freeze = false;
|
||||||
|
root.closing = false;
|
||||||
|
root.activeAsync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "screenshotFreeze"
|
||||||
|
|
||||||
|
onPressed: {
|
||||||
|
root.freeze = true;
|
||||||
|
root.closing = false;
|
||||||
|
root.activeAsync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,6 +77,16 @@ Singleton {
|
|||||||
"99": "thunderstorm"
|
"99": "thunderstorm"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function getAppCategoryIcon(name: string, fallback: string): string {
|
||||||
|
const categories = DesktopEntries.heuristicLookup(name)?.categories;
|
||||||
|
|
||||||
|
if (categories)
|
||||||
|
for (const [key, value] of Object.entries(categoryIcons))
|
||||||
|
if (categories.includes(key))
|
||||||
|
return value;
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
function getAppIcon(name: string, fallback: string): string {
|
function getAppIcon(name: string, fallback: string): string {
|
||||||
const icon = DesktopEntries.heuristicLookup(name)?.icon;
|
const icon = DesktopEntries.heuristicLookup(name)?.icon;
|
||||||
if (fallback !== "undefined")
|
if (fallback !== "undefined")
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Networking
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool active: false
|
|
||||||
readonly property list<Network> connectedNetworks: networks.filter(n => n.connected)
|
|
||||||
property Network connectingNetwork
|
|
||||||
readonly property list<NetworkDevice> devices: Networking.devices.values
|
|
||||||
property Network failedNetwork
|
|
||||||
readonly property list<Network> knownNetworks: networks.filter(n => n.known && !n.connected)
|
|
||||||
readonly property list<Network> networks: {
|
|
||||||
const list = [];
|
|
||||||
for (const d of wifiDevices) {
|
|
||||||
for (const n of d.networks.values) {
|
|
||||||
if (!list.includes(n))
|
|
||||||
list.push(n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
property bool scanning: false
|
|
||||||
readonly property list<Network> unknownNetworks: networks.filter(n => !n.known)
|
|
||||||
readonly property list<WifiDevice> wifiDevices: devices.filter(d => wifiDevice(d))
|
|
||||||
readonly property bool wifiEnabled: Networking.wifiEnabled
|
|
||||||
|
|
||||||
signal networkConnected
|
|
||||||
|
|
||||||
function forgetNetwork(target): void {
|
|
||||||
if (!target) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
target.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isSecure(security): bool {
|
|
||||||
return (security === WifiSecurityType.WpaPsk || security === WifiSecurityType.Wpa2Psk || security === WifiSecurityType.Sae);
|
|
||||||
}
|
|
||||||
|
|
||||||
function requestConnect(network: Network, secret = undefined): void {
|
|
||||||
connectingNetwork = network;
|
|
||||||
if (secret === undefined || secret === "") {
|
|
||||||
network.connect();
|
|
||||||
} else {
|
|
||||||
(network as WifiNetwork).connectWithPsk(secret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setScan(value: bool): void {
|
|
||||||
for (const d of wifiDevices) {
|
|
||||||
d.scannerEnabled = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setWifi(value: bool): void {
|
|
||||||
Networking.wifiEnabled = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function wifiDevice(dev): bool {
|
|
||||||
return dev.type === DeviceType.Wifi;
|
|
||||||
}
|
|
||||||
|
|
||||||
onActiveChanged: {
|
|
||||||
for (const d of wifiDevices)
|
|
||||||
d.scannerEnabled = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: flushFailed
|
|
||||||
|
|
||||||
interval: 5000
|
|
||||||
running: root.failedNetwork
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
root.failedNetwork = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: checkConnection
|
|
||||||
|
|
||||||
interval: 500
|
|
||||||
repeat: true
|
|
||||||
running: root.connectingNetwork
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
var completedNetwork;
|
|
||||||
|
|
||||||
switch (root.connectingNetwork.state) {
|
|
||||||
case ConnectionState.Connecting:
|
|
||||||
break;
|
|
||||||
case ConnectionState.Connected:
|
|
||||||
completedNetwork = root.connectingNetwork;
|
|
||||||
root.networkConnected();
|
|
||||||
break;
|
|
||||||
case ConnectionState.Disconnected:
|
|
||||||
root.failedNetwork = root.connectingNetwork;
|
|
||||||
completedNetwork = root.connectingNetwork;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (completedNetwork) {
|
|
||||||
root.connectingNetwork = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 10000
|
|
||||||
running: checkConnection.running
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
root.failedNetwork = root.connectingNetwork;
|
|
||||||
root.connectingNetwork = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Modules.Settings.Common
|
|
||||||
import qs.Modules.Bar.Popouts.Network
|
|
||||||
import qs.Components
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
required property var modelData
|
|
||||||
|
|
||||||
bottomPadding: Tokens.spacing.extraSmall
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Tokens.font.size.smaller
|
|
||||||
text: {
|
|
||||||
if (modelData.type === "known") {
|
|
||||||
const count = Network.knownNetworks.filter(n => !n.connected).length;
|
|
||||||
|
|
||||||
return qsTr("%1 known network%2").arg(count).arg(count === 1 ? "" : "s");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modelData.type === "unknown") {
|
|
||||||
const count = Network.unknownNetworks.filter(n => !n.connected).length;
|
|
||||||
|
|
||||||
return qsTr("%1 network%2 available").arg(count).arg(count === 1 ? "" : "s");
|
|
||||||
}
|
|
||||||
|
|
||||||
return qsTr("object unknown");
|
|
||||||
}
|
|
||||||
topPadding: Tokens.spacing.small
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Modules.Settings.Common
|
|
||||||
import qs.Modules.Bar.Popouts.Network
|
|
||||||
import qs.Components
|
|
||||||
import qs.Helpers
|
|
||||||
import qs.Helpers.Network
|
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
ConnectedRect {
|
|
||||||
id: networkItem
|
|
||||||
|
|
||||||
readonly property int connectedCount: Network.connectedNetworks.length
|
|
||||||
readonly property bool connecting: Network.connectingNetwork === modelData
|
|
||||||
property int horizontalPadding: Tokens.padding.largeIncreased
|
|
||||||
readonly property bool inConnectedGroup: index < connectedCount
|
|
||||||
// sectioning first / last item in list reminder
|
|
||||||
// if index === network.connectedNetworks.length - 1
|
|
||||||
// if index === network.connectedNetworks.length - 1 + network.knownNetworks.length - 2
|
|
||||||
// if index === network.connectedNetworks.length - 1 + network.knownNetworks.length
|
|
||||||
// list.model.values.length - 1
|
|
||||||
required property int index
|
|
||||||
readonly property bool isSecure: Network.isSecure(modelData.security)
|
|
||||||
required property ListView list
|
|
||||||
required property var modelData
|
|
||||||
property int verticalPadding: Tokens.padding.smaller
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
first: !inConnectedGroup && index === connectedCount + 1
|
|
||||||
implicitHeight: rowLayout.implicitHeight + verticalPadding * 2
|
|
||||||
last: inConnectedGroup ? index === connectedCount - 1 : index === (list?.count ?? -1)
|
|
||||||
radius: Tokens.rounding.small
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: rowLayout
|
|
||||||
|
|
||||||
Layout.preferredHeight: visible ? rowLayout.implicitHeight + Tokens.padding.smaller * 2 : 0
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: networkItem.horizontalPadding
|
|
||||||
anchors.rightMargin: networkItem.horizontalPadding
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: column
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: Tokens.spacing.extraSmall
|
|
||||||
Layout.rightMargin: Tokens.spacing.extraSmall
|
|
||||||
color: networkItem.modelData.active ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
|
||||||
elide: Text.ElideRight
|
|
||||||
text: networkItem.modelData.name ? networkItem.modelData.name : qsTr("Unknown Network")
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: subtext
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
color: Colors.palette.m3outline
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Tokens.font.size.small
|
|
||||||
text: networkItem.modelData.connected ? qsTr("Connected: %1 strength").arg(Math.round(networkItem.modelData.signalStrength * 100) + "%") : qsTr("%1 strength").arg(Math.round(networkItem.modelData.signalStrength * 100) + "%")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
implicitHeight: icon.height
|
|
||||||
implicitWidth: icon.width
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
color: networkItem.modelData.active ? Colors.palette.m3primary : Colors.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Tokens.font.size.large
|
|
||||||
opacity: networkItem.connecting ? 0 : 1
|
|
||||||
text: Icons.getNetworkIcon(networkItem.modelData.signalStrength * 100, networkItem.isSecure)
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: opacity > 0
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: networkItem.connecting ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceComponent: CircularIndicator {
|
|
||||||
bgColor: "transparent"
|
|
||||||
running: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
color: networkItem.modelData.active ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (networkItem.isSecure && !networkItem.known) {
|
|
||||||
PopupManager.requestOpen(Qt.resolvedUrl("../../Modules/Bar/Popouts/Network/PSKOverlay.qml"), {
|
|
||||||
network: networkItem.modelData
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Network.requestConnect(networkItem.modelData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Components
|
|
||||||
import qs.Modules.Settings.Common
|
|
||||||
|
|
||||||
CustomSwitch {
|
|
||||||
id: toggleItem
|
|
||||||
|
|
||||||
readonly property alias bg: bg
|
|
||||||
property alias first: bg.first
|
|
||||||
property alias last: bg.last
|
|
||||||
property string subtext
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
cLayer: 2
|
|
||||||
horizontalPadding: Tokens.padding.largeIncreased
|
|
||||||
implicitHeight: Math.max(implicitContentHeight, implicitIndicatorHeight) + verticalPadding * 2
|
|
||||||
implicitWidth: implicitContentWidth + implicitIndicatorWidth + horizontalPadding * 2
|
|
||||||
indicator.anchors.right: right
|
|
||||||
indicator.anchors.rightMargin: toggleItem.horizontalPadding
|
|
||||||
indicator.anchors.verticalCenter: verticalCenter
|
|
||||||
verticalPadding: Tokens.padding.normal
|
|
||||||
|
|
||||||
background: ConnectedRect {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
id: stateLayer
|
|
||||||
|
|
||||||
manualPressOverride: toggleItem.pressed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentItem: Item {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: toggleItem.horizontalPadding
|
|
||||||
anchors.right: toggleItem.indicator.left
|
|
||||||
anchors.rightMargin: Tokens.spacing.normal
|
|
||||||
implicitHeight: column.implicitHeight
|
|
||||||
implicitWidth: column.implicitWidth
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: column
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: label
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Tokens.font.size.smaller
|
|
||||||
text: toggleItem.text
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: subtext
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
color: Colors.palette.m3outline
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Tokens.font.size.small
|
|
||||||
text: toggleItem.subtext
|
|
||||||
visible: toggleItem.subtext
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: stateLayer.press(stateLayer.mouseX, stateLayer.mouseY)
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ Singleton {
|
|||||||
|
|
||||||
function toggleNightLight(): void {
|
function toggleNightLight(): void {
|
||||||
service.manualToggle = true;
|
service.manualToggle = true;
|
||||||
service.toggle(true);
|
service.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
NightlightManager {
|
NightlightManager {
|
||||||
|
|||||||
+36
-82
@@ -41,7 +41,6 @@ Item {
|
|||||||
property real rsy: Math.min(sy, ey)
|
property real rsy: Math.min(sy, ey)
|
||||||
readonly property real scaleRatio: Hypr.monitorFor(screen).scale
|
readonly property real scaleRatio: Hypr.monitorFor(screen).scale
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
required property ScreenState screenState
|
|
||||||
property real sh: Math.abs(sy - ey)
|
property real sh: Math.abs(sy - ey)
|
||||||
readonly property color shadowColor: Hypr.options.decoration.shadow?.color ?? "black"
|
readonly property color shadowColor: Hypr.options.decoration.shadow?.color ?? "black"
|
||||||
readonly property bool shadowEnabled: Hypr.options.decoration.shadow.enabled
|
readonly property bool shadowEnabled: Hypr.options.decoration.shadow.enabled
|
||||||
@@ -98,6 +97,10 @@ Item {
|
|||||||
const args = Config.screenshot.mode === "auto" ? ["--rounding", `${rounding}`, "--radius", root.cornerRadius, "--shadow", root.shadowEnabled, "--shadow-blur", `${shadow_blur}`, "--shadow-color", `${r},${g},${b},${a}`, "--shadow-offset-x", root.shadowOffset[0], "--shadow-offset-y", root.shadowOffset[1]] : [];
|
const args = Config.screenshot.mode === "auto" ? ["--rounding", `${rounding}`, "--radius", root.cornerRadius, "--shadow", root.shadowEnabled, "--shadow-blur", `${shadow_blur}`, "--shadow-color", `${r},${g},${b},${a}`, "--shadow-offset-x", root.shadowOffset[0], "--shadow-offset-y", root.shadowOffset[1]] : [];
|
||||||
const postCmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : null;
|
const postCmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : null;
|
||||||
|
|
||||||
|
overlay.visible = border.visible = false;
|
||||||
|
handles.visible = false;
|
||||||
|
toolbar.visible = false;
|
||||||
|
|
||||||
ZShellIo.saveItem(captureLayer, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => {
|
ZShellIo.saveItem(captureLayer, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => {
|
||||||
const finalize = finalPath => {
|
const finalize = finalPath => {
|
||||||
if (copyToClipboard) {
|
if (copyToClipboard) {
|
||||||
@@ -126,22 +129,22 @@ Item {
|
|||||||
Behavior on rsx {
|
Behavior on rsx {
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
Anim {}
|
ExAnim {}
|
||||||
}
|
}
|
||||||
Behavior on rsy {
|
Behavior on rsy {
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
Anim {}
|
ExAnim {}
|
||||||
}
|
}
|
||||||
Behavior on sh {
|
Behavior on sh {
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
Anim {}
|
ExAnim {}
|
||||||
}
|
}
|
||||||
Behavior on sw {
|
Behavior on sw {
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
Anim {}
|
ExAnim {}
|
||||||
}
|
}
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
@@ -151,7 +154,7 @@ Item {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Hypr.extras.refreshOptions();
|
Hypr.extras.refreshOptions();
|
||||||
root.forceActiveFocus();
|
screencopy.active = true;
|
||||||
|
|
||||||
opacity = 1;
|
opacity = 1;
|
||||||
|
|
||||||
@@ -216,63 +219,13 @@ Item {
|
|||||||
onReleased: root.enterEditMode()
|
onReleased: root.enterEditMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onClosingChanged(): void {
|
|
||||||
if (root.loader.closing)
|
|
||||||
closeAnim.start();
|
|
||||||
else {
|
|
||||||
closeAnim.stop();
|
|
||||||
returnAnim.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target: root.loader
|
|
||||||
}
|
|
||||||
|
|
||||||
ParallelAnimation {
|
|
||||||
id: returnAnim
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
duration: 300
|
|
||||||
property: "opacity"
|
|
||||||
target: root
|
|
||||||
to: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
property: "rsx"
|
|
||||||
target: root
|
|
||||||
to: Math.min(root.sx, root.ex)
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
property: "rsy"
|
|
||||||
target: root
|
|
||||||
to: Math.min(root.sy, root.ey)
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
property: "sw"
|
|
||||||
target: root
|
|
||||||
to: Math.abs(root.sx - root.ex)
|
|
||||||
}
|
|
||||||
|
|
||||||
Anim {
|
|
||||||
property: "sh"
|
|
||||||
target: root
|
|
||||||
to: Math.abs(root.sy - root.ey)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: closeAnim
|
id: closeAnim
|
||||||
|
|
||||||
ScriptAction {
|
PropertyAction {
|
||||||
script: {
|
property: "closing"
|
||||||
const states = ShellState.allStates();
|
target: root.loader
|
||||||
for (const s of states)
|
value: true
|
||||||
s.screenshot = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
@@ -283,19 +236,19 @@ Item {
|
|||||||
to: 0
|
to: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Anim {
|
ExAnim {
|
||||||
properties: "rsx,rsy"
|
properties: "rsx,rsy"
|
||||||
target: root
|
target: root
|
||||||
to: 0
|
to: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Anim {
|
ExAnim {
|
||||||
property: "sw"
|
property: "sw"
|
||||||
target: root
|
target: root
|
||||||
to: root.screen.width
|
to: root.screen.width
|
||||||
}
|
}
|
||||||
|
|
||||||
Anim {
|
ExAnim {
|
||||||
property: "sh"
|
property: "sh"
|
||||||
target: root
|
target: root
|
||||||
to: root.screen.height
|
to: root.screen.height
|
||||||
@@ -314,12 +267,17 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
ScreencopyView {
|
Loader {
|
||||||
id: screencopy
|
id: screencopy
|
||||||
|
|
||||||
|
active: false
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
captureSource: root.screen
|
asynchronous: true
|
||||||
paintCursor: false
|
|
||||||
|
sourceComponent: ScreencopyView {
|
||||||
|
captureSource: root.screen
|
||||||
|
paintCursor: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AnnotationCanvas {
|
AnnotationCanvas {
|
||||||
@@ -328,7 +286,6 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
inkColor: root.inkColor
|
inkColor: root.inkColor
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
selection: selectionRect
|
|
||||||
tool: root.mode === "edit" && root.tool !== "move" ? root.tool : "none"
|
tool: root.mode === "edit" && root.tool !== "move" ? root.tool : "none"
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
@@ -340,14 +297,15 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
Rectangle {
|
||||||
id: overlay
|
id: overlay
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
opacity: 0.3
|
opacity: 0.3
|
||||||
visible: screencopy.hasContent
|
radius: root.realRounding
|
||||||
|
visible: screencopy.item?.hasContent ?? false
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
maskEnabled: true
|
maskEnabled: true
|
||||||
@@ -376,15 +334,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
Rectangle {
|
||||||
id: border
|
id: border
|
||||||
|
|
||||||
border.color: Colors.palette.m3primary
|
border.color: Colors.palette.m3primary
|
||||||
border.width: root.realBorderWidth
|
border.width: root.realBorderWidth
|
||||||
|
color: "transparent"
|
||||||
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
|
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
|
||||||
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
|
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
|
||||||
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
|
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
|
||||||
visible: screencopy.hasContent
|
visible: screencopy.item?.hasContent ?? false
|
||||||
x: selectionRect.x - root.realBorderWidth
|
x: selectionRect.x - root.realBorderWidth
|
||||||
y: selectionRect.y - root.realBorderWidth
|
y: selectionRect.y - root.realBorderWidth
|
||||||
|
|
||||||
@@ -396,24 +355,17 @@ Item {
|
|||||||
SelectionHandles {
|
SelectionHandles {
|
||||||
id: handles
|
id: handles
|
||||||
|
|
||||||
border: root.realBorderWidth
|
|
||||||
selH: root.sh
|
selH: root.sh
|
||||||
selW: root.sw
|
selW: root.sw
|
||||||
selX: root.rsx
|
selX: root.rsx
|
||||||
selY: root.rsy
|
selY: root.rsy
|
||||||
selection: selectionRect
|
|
||||||
tool: root.tool
|
|
||||||
visible: root.mode === "edit" && root.tool === "move"
|
visible: root.mode === "edit" && root.tool === "move"
|
||||||
|
|
||||||
onBoundsChanged: (x, y, w, h) => {
|
onBoundsChanged: (x, y, w, h) => {
|
||||||
let nx = Math.max(0, x);
|
root.sx = x;
|
||||||
let ny = Math.max(0, y);
|
root.sy = y;
|
||||||
let nw = Math.min(w, root.screen.width - nx);
|
root.ex = x + w;
|
||||||
let nh = Math.min(h, root.screen.height - ny);
|
root.ey = y + h;
|
||||||
root.sx = nx;
|
|
||||||
root.sy = ny;
|
|
||||||
root.ex = nx + nw;
|
|
||||||
root.ey = ny + nh;
|
|
||||||
}
|
}
|
||||||
onMoveBy: (dx, dy) => {
|
onMoveBy: (dx, dy) => {
|
||||||
const w = root.sw, h = root.sh;
|
const w = root.sw, h = root.sh;
|
||||||
@@ -444,4 +396,6 @@ Item {
|
|||||||
onToolSelected: t => root.tool = t
|
onToolSelected: t => root.tool = t
|
||||||
onUndoRequested: annotations.undo()
|
onUndoRequested: annotations.undo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component ExAnim: Anim {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ Item {
|
|||||||
|
|
||||||
property color inkColor: "#ff3b30"
|
property color inkColor: "#ff3b30"
|
||||||
property real inkWidth: 4
|
property real inkWidth: 4
|
||||||
required property Rectangle selection
|
|
||||||
property string tool: "none"
|
property string tool: "none"
|
||||||
|
|
||||||
signal changed
|
signal changed
|
||||||
|
|
||||||
function clearAll() {
|
function clearAll() {
|
||||||
canvas.clear();
|
committedCanvas.clear();
|
||||||
|
previewCanvas.clear();
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,85 +54,90 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function undo() {
|
function undo() {
|
||||||
canvas.undoLastGroup();
|
committedCanvas.undoLastGroup();
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: tool !== "none"
|
|
||||||
|
|
||||||
StrokeCanvas {
|
StrokeCanvas {
|
||||||
id: canvas
|
id: committedCanvas
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
penColor: root.inkColor
|
penColor: root.inkColor
|
||||||
penWidth: root.inkWidth
|
penWidth: root.inkWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
StrokeCanvas {
|
||||||
|
id: previewCanvas
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
penColor: root.inkColor
|
||||||
|
penWidth: root.inkWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
PointHandler {
|
||||||
id: drawHandler
|
id: drawHandler
|
||||||
|
|
||||||
property real startX
|
property real startX
|
||||||
property real startY
|
property real startY
|
||||||
|
property bool started: false
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
anchors.fill: parent
|
enabled: root.tool !== "none"
|
||||||
cursorShape: undefined
|
|
||||||
enabled: root.enabled
|
|
||||||
|
|
||||||
onPositionChanged: e => {
|
onActiveChanged: {
|
||||||
const x = e.x;
|
if (active)
|
||||||
const y = e.y;
|
|
||||||
|
|
||||||
if (!pressed)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (root.tool === "pen") {
|
if (root.tool === "pen") {
|
||||||
canvas.appendPoint(x, y);
|
committedCanvas.endStroke();
|
||||||
|
} else if (started) {
|
||||||
|
const pts = root.sampleShape(root.tool, startX, startY, point.position.x, point.position.y);
|
||||||
|
if (pts.length > 0) {
|
||||||
|
committedCanvas.beginStroke(pts[0][0], pts[0][1], true);
|
||||||
|
for (let i = 1; i < pts.length; i++)
|
||||||
|
committedCanvas.appendPoint(pts[i][0], pts[i][1]);
|
||||||
|
committedCanvas.endStroke();
|
||||||
|
}
|
||||||
|
previewCanvas.clear();
|
||||||
|
}
|
||||||
|
started = false;
|
||||||
|
root.changed();
|
||||||
|
}
|
||||||
|
onPointChanged: {
|
||||||
|
if (!active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (point.pressedButtons & Qt.RightButton) {
|
||||||
|
root.clearAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pts = root.sampleShape(root.tool, startX, startY, x, y);
|
|
||||||
if (pts.length > 0) {
|
|
||||||
canvas.beginStroke(pts[0][0], pts[0][1], true);
|
|
||||||
for (let i = 1; i < pts.length; i++)
|
|
||||||
canvas.appendPoint(pts[i][0], pts[i][1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onPressed: e => {
|
|
||||||
if (e.button & Qt.LeftButton) {
|
|
||||||
startX = e.x;
|
|
||||||
startY = e.y;
|
|
||||||
canvas.beginStroke(e.x, e.y);
|
|
||||||
} else if (e.button & Qt.RightButton) {
|
|
||||||
root.clearAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onPressedChanged: if (!pressed)
|
|
||||||
canvas.endStroke()
|
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
cursorShape: {
|
|
||||||
if (root.tool === "none")
|
|
||||||
return undefined;
|
|
||||||
|
|
||||||
const x = point.position.x;
|
const x = point.position.x;
|
||||||
const y = point.position.y;
|
const y = point.position.y;
|
||||||
const withinXWidth = x > root.selection.x && x < root.selection.x + root.selection.implicitWidth;
|
|
||||||
const withinYHeight = y > root.selection.y && y < root.selection.y + root.selection.implicitHeight;
|
|
||||||
|
|
||||||
if (withinXWidth && withinYHeight) {
|
if (root.tool === "pen") {
|
||||||
if (!drawHandler.pressed)
|
if (!started) {
|
||||||
canvas.showHover(x, y);
|
started = true;
|
||||||
else
|
committedCanvas.beginStroke(x, y);
|
||||||
canvas.showHover(drawHandler.mouseX, drawHandler.mouseY);
|
return;
|
||||||
return Qt.BlankCursor;
|
}
|
||||||
} else {
|
committedCanvas.appendPoint(x, y);
|
||||||
canvas.hideHover();
|
return;
|
||||||
return undefined;
|
}
|
||||||
|
|
||||||
|
if (!started) {
|
||||||
|
started = true;
|
||||||
|
startX = point.pressPosition.x;
|
||||||
|
startY = point.pressPosition.y;
|
||||||
|
}
|
||||||
|
const pts = root.sampleShape(root.tool, startX, startY, x, y);
|
||||||
|
if (pts.length > 0) {
|
||||||
|
previewCanvas.beginStroke(pts[0][0], pts[0][1], true);
|
||||||
|
for (let i = 1; i < pts.length; i++)
|
||||||
|
previewCanvas.appendPoint(pts[i][0], pts[i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enabled: root.enabled
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,18 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Internal
|
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property int border
|
property color handleBorder: "#3584e4"
|
||||||
property color handleBorder: Colors.palette.m3primary
|
property color handleFill: "white"
|
||||||
property color handleFill: Colors.palette.m3onPrimary
|
|
||||||
property real hs: 12
|
property real hs: 12
|
||||||
property real minSize: 24
|
property real minSize: 24
|
||||||
required property real selH
|
required property real selH
|
||||||
required property real selW
|
required property real selW
|
||||||
required property real selX
|
required property real selX
|
||||||
required property real selY
|
required property real selY
|
||||||
required property Rectangle selection
|
|
||||||
required property string tool
|
|
||||||
|
|
||||||
signal boundsChanged(x: real, y: real, w: real, h: real)
|
signal boundsChanged(x: real, y: real, w: real, h: real)
|
||||||
signal dragFinished
|
signal dragFinished
|
||||||
@@ -28,16 +23,12 @@ Item {
|
|||||||
x: selX
|
x: selX
|
||||||
y: selY
|
y: selY
|
||||||
|
|
||||||
Component.onDestruction: Cursor.clearOverride()
|
|
||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: moveHandler
|
id: moveHandler
|
||||||
|
|
||||||
property real accumX: 0
|
property real accumX: 0
|
||||||
property real accumY: 0
|
property real accumY: 0
|
||||||
|
|
||||||
cursorShape: undefined
|
|
||||||
dragThreshold: 0
|
|
||||||
target: null
|
target: null
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
@@ -54,63 +45,51 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
cursorShape: {
|
|
||||||
if (root.tool !== "move")
|
|
||||||
return undefined;
|
|
||||||
|
|
||||||
if ((moveHandler.centroid.pressedButtons & Qt.LeftButton) && moveHandler.active)
|
|
||||||
return Qt.ClosedHandCursor;
|
|
||||||
else
|
|
||||||
return Qt.OpenHandCursor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "tl"
|
edge: "tl"
|
||||||
x: -(root.hs + root.border) / 2
|
x: -root.hs / 2
|
||||||
y: -(root.hs + root.border) / 2
|
y: -root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "t"
|
edge: "t"
|
||||||
x: root.width / 2 - root.hs / 2
|
x: root.width / 2 - root.hs / 2
|
||||||
y: -(root.hs + root.border) / 2
|
y: -root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "tr"
|
edge: "tr"
|
||||||
x: root.width - root.hs / 2 + root.border / 2
|
x: root.width - root.hs / 2
|
||||||
y: -(root.hs + root.border) / 2
|
y: -root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "r"
|
edge: "r"
|
||||||
x: root.width - root.hs / 2 + root.border / 2
|
x: root.width - root.hs / 2
|
||||||
y: root.height / 2 - root.hs / 2
|
y: root.height / 2 - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "br"
|
edge: "br"
|
||||||
x: root.width - root.hs / 2 + root.border / 2
|
x: root.width - root.hs / 2
|
||||||
y: root.height - root.hs / 2 + root.border / 2
|
y: root.height - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "b"
|
edge: "b"
|
||||||
x: root.width / 2 - root.hs / 2
|
x: root.width / 2 - root.hs / 2
|
||||||
y: root.height - root.hs / 2 + root.border / 2
|
y: root.height - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "bl"
|
edge: "bl"
|
||||||
x: -(root.hs + root.border) / 2
|
x: -root.hs / 2
|
||||||
y: root.height - root.hs / 2 + root.border / 2
|
y: root.height - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "l"
|
edge: "l"
|
||||||
x: -(root.hs + root.border) / 2
|
x: -root.hs / 2
|
||||||
y: root.height / 2 - root.hs / 2
|
y: root.height / 2 - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,8 +107,6 @@ Item {
|
|||||||
z: 10
|
z: 10
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: hover
|
|
||||||
|
|
||||||
cursorShape: {
|
cursorShape: {
|
||||||
switch (handle.edge) {
|
switch (handle.edge) {
|
||||||
case "tl":
|
case "tl":
|
||||||
@@ -155,7 +132,6 @@ Item {
|
|||||||
property real startX
|
property real startX
|
||||||
property real startY
|
property real startY
|
||||||
|
|
||||||
dragThreshold: 0
|
|
||||||
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
|
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
|
||||||
target: null
|
target: null
|
||||||
|
|
||||||
@@ -165,10 +141,8 @@ Item {
|
|||||||
startY = root.y;
|
startY = root.y;
|
||||||
startW = root.width;
|
startW = root.width;
|
||||||
startH = root.height;
|
startH = root.height;
|
||||||
Cursor.setOverride(hover.cursorShape);
|
|
||||||
} else {
|
} else {
|
||||||
root.dragFinished();
|
root.dragFinished();
|
||||||
Cursor.clearOverride();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTranslationChanged: {
|
onTranslationChanged: {
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import Quickshell
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Models
|
import ZShell.Models
|
||||||
import ZShell.Internal
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Components
|
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Paths
|
import qs.Paths
|
||||||
@@ -142,40 +140,4 @@ Searcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperService {
|
|
||||||
id: wallpaper
|
|
||||||
|
|
||||||
path: root.current
|
|
||||||
}
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
WallpaperObject {
|
|
||||||
readonly property var crops: root.getCrop(modelData.name)
|
|
||||||
required property var modelData
|
|
||||||
|
|
||||||
cropHeight: crops?.height ?? 1.0
|
|
||||||
cropWidth: crops?.width ?? 1.0
|
|
||||||
cropX: crops?.x ?? 0.0
|
|
||||||
cropY: crops?.y ?? 0.0
|
|
||||||
screen: modelData.name
|
|
||||||
service: wallpaper
|
|
||||||
zoom: crops?.zoom ?? 1.0
|
|
||||||
|
|
||||||
Behavior on cropHeight {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
Behavior on cropWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
Behavior on cropX {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
Behavior on cropY {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -17,12 +17,12 @@ GridLayout {
|
|||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ClipWrapper popoutsWrapper
|
required property ClipWrapper popoutsWrapper
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
required property ScreenState screenState
|
|
||||||
readonly property int vPadding: 6
|
readonly property int vPadding: 6
|
||||||
|
required property ScreenState screenState
|
||||||
|
|
||||||
function axisCenterOf(item: Item): real {
|
function axisCenterOf(item: Item): real {
|
||||||
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
||||||
return horizontal ? Math.floor(c.x) : Math.floor(c.y);
|
return horizontal ? c.x : c.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPopout(pos: real): void {
|
function checkPopout(pos: real): void {
|
||||||
@@ -206,6 +206,14 @@ GridLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DelegateChoice {
|
||||||
|
roleValue: "network"
|
||||||
|
|
||||||
|
delegate: EntryWrapper {
|
||||||
|
NetworkWidget {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: "media"
|
roleValue: "media"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
import ZShell.Config
|
||||||
|
import qs.Components
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Item bar
|
||||||
|
required property ScreenState screenState
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -1
|
||||||
|
color: Colors.palette.m3surface
|
||||||
|
layer.enabled: true
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
maskEnabled: true
|
||||||
|
maskInverted: true
|
||||||
|
maskSource: mask
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: mask
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Config.bar.border + 1
|
||||||
|
anchors.topMargin: root.bar.implicitHeight + 1
|
||||||
|
radius: Config.bar.border > 0 ? Config.bar.rounding : 0
|
||||||
|
topLeftRadius: Config.bar.rounding
|
||||||
|
topRightRadius: Config.bar.rounding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import QtQuick.Shapes
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
@@ -12,7 +12,6 @@ GridLayout {
|
|||||||
property real animatedPercentage: 0
|
property real animatedPercentage: 0
|
||||||
readonly property real arcStartAngle: 0.75 * Math.PI
|
readonly property real arcStartAngle: 0.75 * Math.PI
|
||||||
readonly property real arcSweep: 1.5 * Math.PI
|
readonly property real arcSweep: 1.5 * Math.PI
|
||||||
readonly property real dpr: (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1
|
|
||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
property string icon
|
property string icon
|
||||||
required property color iconColor
|
required property color iconColor
|
||||||
@@ -23,17 +22,12 @@ GridLayout {
|
|||||||
property bool warning: percentage * 100 >= warningThreshold
|
property bool warning: percentage * 100 >= warningThreshold
|
||||||
property int warningThreshold: 80
|
property int warningThreshold: 80
|
||||||
|
|
||||||
function snap(v) {
|
|
||||||
return Math.round(v * dpr) / dpr;
|
|
||||||
}
|
|
||||||
|
|
||||||
columnSpacing: Tokens.spacing.medium
|
columnSpacing: Tokens.spacing.medium
|
||||||
columns: horizontal ? -1 : 1
|
columns: horizontal ? -1 : 1
|
||||||
percentage: 0
|
percentage: 0
|
||||||
|
|
||||||
Behavior on animatedPercentage {
|
Behavior on animatedPercentage {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: animatedPercentage = percentage
|
Component.onCompleted: animatedPercentage = percentage
|
||||||
@@ -53,35 +47,27 @@ GridLayout {
|
|||||||
text: root.icon
|
text: root.icon
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: track
|
|
||||||
|
|
||||||
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.extraSmall : 4
|
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.extraSmall : 4
|
||||||
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
||||||
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||||
radius: Math.min(width, height) / 2
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
Item {
|
CustomRect {
|
||||||
id: clipper
|
id: fill
|
||||||
|
|
||||||
anchors.bottom: root.horizontal ? parent.bottom : undefined
|
anchors.bottom: parent.bottom
|
||||||
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
anchors.left: parent.left
|
||||||
anchors.left: root.horizontal ? undefined : parent.left
|
anchors.right: root.horizontal ? parent.right : undefined
|
||||||
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
anchors.top: root.horizontal ? undefined : parent.top
|
||||||
clip: true
|
color: root.mainColor
|
||||||
height: root.horizontal ? root.snap(root.percentage * track.height) : track.height * 2
|
implicitHeight: root.horizontal ? Math.ceil(root.percentage * parent.height) : 0
|
||||||
width: root.horizontal ? track.width * 2 : root.snap(root.percentage * track.width)
|
implicitWidth: root.horizontal ? 0 : Math.ceil(root.percentage * parent.width)
|
||||||
|
|
||||||
CustomRect {
|
// Behavior on implicitHeight {
|
||||||
anchors.bottom: root.horizontal ? parent.bottom : undefined
|
// Anim {
|
||||||
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
// }
|
||||||
anchors.left: root.horizontal ? undefined : parent.left
|
// }
|
||||||
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
|
||||||
color: root.mainColor
|
|
||||||
height: track.height
|
|
||||||
radius: track.radius
|
|
||||||
width: track.width
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,28 +105,6 @@ WidgetBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
roleValue: "bluetooth"
|
|
||||||
|
|
||||||
delegate: EntryWrapper {
|
|
||||||
name: "bluetooth"
|
|
||||||
|
|
||||||
BluetoothWidget {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
roleValue: "network"
|
|
||||||
|
|
||||||
delegate: EntryWrapper {
|
|
||||||
name: "network"
|
|
||||||
|
|
||||||
NetworkWidget {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: "power"
|
roleValue: "power"
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
animate: true
|
|
||||||
color: Colors.palette.m3onSurface // Network.connected ? root.textColor : Colors.palette.m3error
|
|
||||||
fill: 1
|
|
||||||
font.pointSize: Tokens.font.size.larger
|
|
||||||
text: "bluetooth"
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
animate: true
|
|
||||||
color: Colors.palette.m3onSurface // Network.connected ? root.textColor : Colors.palette.m3error
|
|
||||||
fill: 1
|
|
||||||
font.pointSize: Tokens.font.size.larger
|
|
||||||
text: "android_wifi_4_bar"
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,7 @@ Item {
|
|||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
|
|
||||||
function resolveIcon(app: string, icon: string): string {
|
function resolveIcon(app: string, icon: string): string {
|
||||||
if (app === "discord_status_icon_1" && Config.bar.tray.replaceIcons) {
|
if (app === "chrome_status_icon_1") {
|
||||||
return Quickshell.iconPath("discord-tray");
|
return Quickshell.iconPath("discord-tray");
|
||||||
} else if (app === "AyuGramDesktop") {
|
} else if (app === "AyuGramDesktop") {
|
||||||
if (icon === Quickshell.iconPath("com.ayugram.desktop-attention-symbolic"))
|
if (icon === Quickshell.iconPath("com.ayugram.desktop-attention-symbolic"))
|
||||||
@@ -50,8 +50,6 @@ Item {
|
|||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
id: layer
|
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: icon.layer.enabled && root.current ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: icon.layer.enabled && root.current ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ Item {
|
|||||||
y: parent.y
|
y: parent.y
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,8 @@ Item {
|
|||||||
value: Audio.volume
|
value: Audio.volume
|
||||||
|
|
||||||
Behavior on value {
|
Behavior on value {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onInteraction: value => Audio.setVolume(value)
|
onInteraction: value => Audio.setVolume(value)
|
||||||
@@ -121,7 +123,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 65 + Tokens.spacing.small * 2
|
Layout.preferredHeight: 65 + Tokens.spacing.small * 2
|
||||||
Layout.topMargin: root.topMargin
|
Layout.topMargin: root.topMargin
|
||||||
@@ -134,21 +136,17 @@ Item {
|
|||||||
node: Audio.source
|
node: Audio.source
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomRect {
|
||||||
anchors.fill: parent
|
id: sourcePeakFill
|
||||||
radius: parent.radius
|
|
||||||
|
|
||||||
CustomRect {
|
anchors.bottom: parent.bottom
|
||||||
id: sourcePeakFill
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
color: Qt.alpha(Colors.palette.m3primary, 0.15)
|
||||||
|
implicitWidth: parent.width * sourcePeak.peak
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
Behavior on implicitWidth {
|
||||||
anchors.left: parent.left
|
Anim {
|
||||||
anchors.top: parent.top
|
|
||||||
color: Qt.alpha(Colors.palette.m3primary, 0.15)
|
|
||||||
implicitWidth: parent.width * sourcePeak.peak
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +195,8 @@ Item {
|
|||||||
value: Audio.sourceVolume
|
value: Audio.sourceVolume
|
||||||
|
|
||||||
Behavior on value {
|
Behavior on value {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onInteraction: value => Audio.setSourceVolume(value)
|
onInteraction: value => Audio.setSourceVolume(value)
|
||||||
@@ -231,7 +230,7 @@ Item {
|
|||||||
|
|
||||||
model: Audio.streams.filter(s => s.isSink)
|
model: Audio.streams.filter(s => s.isSink)
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: appBox
|
id: appBox
|
||||||
|
|
||||||
required property int index
|
required property int index
|
||||||
@@ -249,21 +248,17 @@ Item {
|
|||||||
node: appBox.modelData
|
node: appBox.modelData
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomRect {
|
||||||
anchors.fill: parent
|
id: peakFill
|
||||||
radius: parent.radius
|
|
||||||
|
|
||||||
CustomRect {
|
anchors.bottom: parent.bottom
|
||||||
id: peakFill
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
color: Qt.alpha(Colors.palette.m3primary, 0.15)
|
||||||
|
implicitWidth: parent.width * peak.peak
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
Behavior on implicitWidth {
|
||||||
anchors.left: parent.left
|
Anim {
|
||||||
anchors.top: parent.top
|
|
||||||
color: Qt.alpha(Colors.palette.m3primary, 0.15)
|
|
||||||
implicitWidth: parent.width * peak.peak
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
Anim {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +316,8 @@ Item {
|
|||||||
value: appBox.modelData.audio.volume
|
value: appBox.modelData.audio.volume
|
||||||
|
|
||||||
Behavior on value {
|
Behavior on value {
|
||||||
Anim {}
|
Anim {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onInteraction: value => Audio.setStreamVolume(appBox.modelData, value)
|
onInteraction: value => Audio.setStreamVolume(appBox.modelData, value)
|
||||||
|
|||||||
@@ -1,385 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQml.Models
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Bluetooth
|
|
||||||
import ZShell.Components
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Components
|
|
||||||
import qs.Helpers
|
|
||||||
|
|
||||||
CustomClippingRect {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property list<var> btConnected: Bluetooth.devices.values.filter(d => d.connected)
|
|
||||||
|
|
||||||
implicitHeight: layout.implicitHeight + layout.anchors.margins * 2
|
|
||||||
implicitWidth: 500
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: layout
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Tokens.padding.larger
|
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.rightMargin: Tokens.padding.extraSmall
|
|
||||||
Layout.topMargin: Tokens.padding.normal
|
|
||||||
font.pointSize: Tokens.font.size.large
|
|
||||||
text: qsTr("Bluetooth")
|
|
||||||
}
|
|
||||||
|
|
||||||
Toggle {
|
|
||||||
checked: Bluetooth.defaultAdapter?.enabled ?? false // qmllint disable unresolved-type
|
|
||||||
first: true
|
|
||||||
subtext: qsTr("Toggle bluetooth device state")
|
|
||||||
text: checked ? qsTr("Enabled") : qsTr("Disabled")
|
|
||||||
|
|
||||||
onToggled: {
|
|
||||||
const adapter = Bluetooth.defaultAdapter; // qmllint disable unresolved-type
|
|
||||||
if (adapter)
|
|
||||||
adapter.enabled = checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Toggle {
|
|
||||||
checked: Bluetooth.defaultAdapter?.discovering ?? false // qmllint disable unresolved-type
|
|
||||||
last: root.btConnected.length === 0
|
|
||||||
subtext: qsTr("Enable scanning for new devices")
|
|
||||||
text: qsTr("Discover")
|
|
||||||
|
|
||||||
onToggled: {
|
|
||||||
const adapter = Bluetooth.defaultAdapter; // qmllint disable unresolved-type
|
|
||||||
if (adapter)
|
|
||||||
adapter.discovering = checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: rows
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: contentHeight
|
|
||||||
interactive: false
|
|
||||||
section.property: "connected"
|
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
|
||||||
|
|
||||||
add: Transition {
|
|
||||||
Anim {
|
|
||||||
from: 0
|
|
||||||
property: "opacity"
|
|
||||||
to: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delegate: DelegateChooser {
|
|
||||||
role: "isDivider"
|
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
roleValue: true
|
|
||||||
|
|
||||||
delegate: StatusDivider {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
delegate: BluetoothItem {
|
|
||||||
list: rows
|
|
||||||
width: rows.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
displaced: Transition {
|
|
||||||
Anim {
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
property: "y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model: ScriptModel {
|
|
||||||
objectProp: "address"
|
|
||||||
values: {
|
|
||||||
const byName = (a, b) => a.name.localeCompare(b.name);
|
|
||||||
return [...[...Bluetooth.devices.values].filter(d => d.connected).sort(byName).slice(0, 5),
|
|
||||||
{
|
|
||||||
isDivider: true
|
|
||||||
},
|
|
||||||
...[...Bluetooth.devices.values].filter(d => !d.connected).sort(byName).slice(0, 5)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
move: Transition {
|
|
||||||
Anim {
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
property: "y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remove: Transition {
|
|
||||||
Anim {
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.delegate: Rectangle {
|
|
||||||
required property string section
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
height: childrenRect.height
|
|
||||||
width: ListView.view.width
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: parent.section
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component BluetoothItem: ConnectedRect {
|
|
||||||
id: btItem
|
|
||||||
|
|
||||||
readonly property int connectedCount: root.btConnected.length
|
|
||||||
readonly property bool connecting: Network.connectingNetwork === modelData
|
|
||||||
property int horizontalPadding: Tokens.padding.largeIncreased
|
|
||||||
readonly property bool inConnectedGroup: index < connectedCount
|
|
||||||
required property int index
|
|
||||||
required property ListView list
|
|
||||||
readonly property bool loading: modelData.state === BluetoothDeviceState.Connecting || modelData.state === BluetoothDeviceState.Disconnecting // qmllint disable unresolved-type
|
|
||||||
|
|
||||||
required property BluetoothDevice modelData
|
|
||||||
property int verticalPadding: Tokens.padding.smaller
|
|
||||||
|
|
||||||
first: !inConnectedGroup && index === connectedCount + 1
|
|
||||||
implicitHeight: rowLayout.implicitHeight + verticalPadding * 2
|
|
||||||
last: inConnectedGroup ? index === connectedCount - 1 : index === list.count - 1
|
|
||||||
radius: Tokens.rounding.small
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 50
|
|
||||||
running: btItem.ListView.delayRemove
|
|
||||||
|
|
||||||
onTriggered: btItem.ListView.delayRemove = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onConnectedChanged(): void {
|
|
||||||
if (!btItem.modelData.connected)
|
|
||||||
btItem.ListView.delayRemove = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPairedChanged(): void {
|
|
||||||
if (btItem.modelData.paired)
|
|
||||||
btItem.modelData.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
target: btItem.modelData
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: rowLayout
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: btItem.horizontalPadding
|
|
||||||
anchors.rightMargin: btItem.horizontalPadding
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: column
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: Tokens.spacing.extraSmall
|
|
||||||
Layout.rightMargin: Tokens.spacing.extraSmall
|
|
||||||
elide: Text.ElideRight
|
|
||||||
text: btItem.modelData.name
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: subtext
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
color: Colors.palette.m3outline
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Tokens.font.size.small
|
|
||||||
text: btItem.modelData.connected ? (btItem.modelData.batteryAvailable ? qsTr("%1 battery left").arg(Math.round(btItem.modelData.battery * 100) + "%") : qsTr("Battery status unknown")) : btItem.modelData.address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
implicitHeight: icon.height
|
|
||||||
implicitWidth: icon.width
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
font.pointSize: Tokens.font.size.large
|
|
||||||
opacity: btItem.connecting ? 0 : 1
|
|
||||||
text: btItem.modelData.batteryAvailable ? Icons.getBatteryIcon(btItem.modelData.battery) : "battery_unknown"
|
|
||||||
visible: btItem.modelData.state === BluetoothDeviceState.Connected // qmllint disable unresolved-type
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: opacity > 0
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: btItem.connecting ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceComponent: CircularIndicator {
|
|
||||||
bgColor: "transparent"
|
|
||||||
running: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonRow {
|
|
||||||
spacing: Tokens.spacing.small
|
|
||||||
|
|
||||||
IconTextButton {
|
|
||||||
font.pointSize: Tokens.font.size.small
|
|
||||||
icon: btItem.modelData.connected ? "link_off" : btItem.modelData.paired ? "link" : "add_link"
|
|
||||||
text: btItem.modelData.connected ? qsTr("Disconnect") : btItem.modelData.paired ? qsTr("Connect") : qsTr("Pair")
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (btItem.modelData.connected)
|
|
||||||
btItem.modelData.disconnect();
|
|
||||||
else if (btItem.modelData.paired)
|
|
||||||
btItem.modelData.connect();
|
|
||||||
else if (!btItem.modelData.paired)
|
|
||||||
btItem.modelData.pair();
|
|
||||||
else if (btItem.modelData.pairing)
|
|
||||||
btItem.modelData.cancelPair();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
component ConnectedRect: CustomRect {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
property bool first
|
|
||||||
property bool last
|
|
||||||
|
|
||||||
bottomLeftRadius: last ? Tokens.rounding.large : Tokens.rounding.extraSmall
|
|
||||||
bottomRightRadius: last ? Tokens.rounding.large : Tokens.rounding.extraSmall
|
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
|
||||||
topLeftRadius: first ? Tokens.rounding.large : Tokens.rounding.extraSmall
|
|
||||||
topRightRadius: first ? Tokens.rounding.large : Tokens.rounding.extraSmall
|
|
||||||
|
|
||||||
Behavior on bottomLeftRadius {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on bottomRightRadius {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on topLeftRadius {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on topRightRadius {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
component StatusDivider: CustomText {
|
|
||||||
bottomPadding: Tokens.spacing.extraSmall
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Tokens.font.size.smaller
|
|
||||||
text: {
|
|
||||||
const devices = Bluetooth.devices.values; // qmllint disable unresolved-type
|
|
||||||
const connectedCount = devices.filter(d => d.connected).length;
|
|
||||||
let available = qsTr("%1 device%2 available").arg(devices.length - connectedCount).arg(devices.length === 1 ? "" : "s");
|
|
||||||
return available;
|
|
||||||
}
|
|
||||||
topPadding: Tokens.spacing.small
|
|
||||||
}
|
|
||||||
component Toggle: CustomSwitch {
|
|
||||||
id: toggleItem
|
|
||||||
|
|
||||||
readonly property alias bg: bg
|
|
||||||
property alias first: bg.first
|
|
||||||
property alias last: bg.last
|
|
||||||
property string subtext
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
cLayer: 2
|
|
||||||
horizontalPadding: Tokens.padding.largeIncreased
|
|
||||||
implicitHeight: Math.max(implicitContentHeight, implicitIndicatorHeight) + verticalPadding * 2
|
|
||||||
implicitWidth: implicitContentWidth + implicitIndicatorWidth + horizontalPadding * 2
|
|
||||||
indicator.anchors.right: right
|
|
||||||
indicator.anchors.rightMargin: toggleItem.horizontalPadding
|
|
||||||
indicator.anchors.verticalCenter: verticalCenter
|
|
||||||
verticalPadding: Tokens.padding.normal
|
|
||||||
|
|
||||||
background: ConnectedRect {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
id: stateLayer
|
|
||||||
|
|
||||||
manualPressOverride: toggleItem.pressed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentItem: Item {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: toggleItem.horizontalPadding
|
|
||||||
anchors.right: toggleItem.indicator.left
|
|
||||||
anchors.rightMargin: Tokens.spacing.normal
|
|
||||||
implicitHeight: column.implicitHeight
|
|
||||||
implicitWidth: column.implicitWidth
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: column
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: label
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font: {
|
|
||||||
const f = Qt.font(label.font);
|
|
||||||
f.pointSize = Tokens.font.size.smaller;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
text: toggleItem.text
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: subtext
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
color: Colors.palette.m3outline
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font: {
|
|
||||||
const f = Qt.font(subtext.font);
|
|
||||||
f.pointSize = Tokens.font.size.small;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
text: toggleItem.subtext
|
|
||||||
visible: toggleItem.subtext
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: stateLayer.press(stateLayer.mouseX, stateLayer.mouseY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -82,13 +82,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Popout {
|
|
||||||
name: "bluetooth"
|
|
||||||
|
|
||||||
sourceComponent: BluetoothPopout {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Popout {
|
Popout {
|
||||||
name: "updates"
|
name: "updates"
|
||||||
|
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Helpers.Network
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property bool closing: PopupManager.closed
|
|
||||||
readonly property url currentPopup: PopupManager.currentPopup
|
|
||||||
property bool shouldBeVisible: loader.status === Loader.Ready
|
|
||||||
|
|
||||||
color: Qt.alpha(Colors.palette.m3shadow, 0.3)
|
|
||||||
opacity: shouldBeVisible && !closing ? 1 : 0
|
|
||||||
visible: opacity > 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (!visible) {
|
|
||||||
PopupManager.requestClose();
|
|
||||||
PopupManager.currentPopup = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomMouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
preventStealing: true
|
|
||||||
propagateComposedEvents: false
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
const insideItemWidth = mouseX < loader.x + loader.item.width && mouseX > loader.x;
|
|
||||||
const insideItemHeight = mouseY < loader.y + loader.item.height && mouseY > loader.y;
|
|
||||||
if (insideItemHeight && insideItemWidth)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PopupManager.requestClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: loader
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onCurrentPopupChanged(): void {
|
|
||||||
if (PopupManager.currentPopup) {
|
|
||||||
loader.setSource(PopupManager.currentPopup, PopupManager.currentPopupProps);
|
|
||||||
} else {
|
|
||||||
loader.source = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target: PopupManager
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onNetworkConnected(): void {
|
|
||||||
PopupManager.requestClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
target: Network
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import ZShell.Components
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Components
|
|
||||||
import qs.Helpers.Network
|
|
||||||
|
|
||||||
CustomClippingRect {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property var network
|
|
||||||
|
|
||||||
color: Colors.palette.m3surfaceContainer
|
|
||||||
implicitHeight: layout.implicitHeight + layout.anchors.margins * 2
|
|
||||||
implicitWidth: layout.implicitWidth + layout.anchors.margins * 2
|
|
||||||
radius: Tokens.rounding.large
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: layout
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Tokens.padding.extraLarge
|
|
||||||
spacing: Tokens.spacing.medium
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
font.pointSize: Tokens.font.size.extraLarge * 2
|
|
||||||
text: "lock"
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
|
||||||
text: qsTr("Connect to %1").arg(root.network.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomTextField {
|
|
||||||
id: passwordField
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredWidth: 400
|
|
||||||
echoMode: CustomTextField.Password
|
|
||||||
errorText: qsTr("Failed to connect with given password")
|
|
||||||
isError: Network.failedNetwork
|
|
||||||
leadingIcon: "lock"
|
|
||||||
passwordMaskDelay: 5000
|
|
||||||
placeholderText: qsTr("Input password")
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonRow {
|
|
||||||
id: buttonRow
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: Tokens.spacing.extraSmall
|
|
||||||
|
|
||||||
IconTextButton {
|
|
||||||
fillWidth: true
|
|
||||||
font.pointSize: Tokens.font.size.normal
|
|
||||||
icon: "close"
|
|
||||||
inactiveColor: Colors.layer(Colors.palette.m3surfaceContainerHighest, 2)
|
|
||||||
inactiveOnColor: Colors.palette.m3onSurfaceVariant
|
|
||||||
isRound: true
|
|
||||||
isToggle: false
|
|
||||||
shapeMorph: true
|
|
||||||
text: "Cancel"
|
|
||||||
|
|
||||||
onClicked: PopupManager.requestClose()
|
|
||||||
}
|
|
||||||
|
|
||||||
IconTextButton {
|
|
||||||
fillWidth: true
|
|
||||||
font.pointSize: Tokens.font.size.normal
|
|
||||||
icon: Network.connectingNetwork ? "" : "check"
|
|
||||||
inactiveColor: Network.connectingNetwork ? Colors.palette.m3primaryContainer : Network.failedNetwork ? Colors.palette.m3error : Colors.palette.m3primary
|
|
||||||
inactiveOnColor: Network.connectingNetwork ? Colors.palette.m3onPrimaryContainer : Network.failedNetwork ? Colors.palette.m3onError : Colors.palette.m3onPrimary
|
|
||||||
isRound: true
|
|
||||||
isToggle: false
|
|
||||||
shapeMorph: true
|
|
||||||
text: Network.connectingNetwork ? "" : "Apply"
|
|
||||||
|
|
||||||
onClicked: Network.requestConnect(root.network, passwordField.text)
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: opacity > 0
|
|
||||||
anchors.centerIn: parent
|
|
||||||
opacity: Network.connectingNetwork ? 1 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceComponent: CircularIndicator {
|
|
||||||
bgColor: "transparent"
|
|
||||||
implicitSize: buttonRow.height - Tokens.padding.normal
|
|
||||||
running: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool closed: true
|
|
||||||
property url currentPopup: ""
|
|
||||||
property var currentPopupProps: ({})
|
|
||||||
|
|
||||||
function requestClose(): void {
|
|
||||||
closed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function requestOpen(source: url, properties = {}): void {
|
|
||||||
currentPopupProps = properties;
|
|
||||||
currentPopup = source;
|
|
||||||
closed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,142 +1,36 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Networking
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
|
||||||
import ZShell.Components
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
|
||||||
import qs.Modules.Settings.Common
|
|
||||||
import qs.Modules.Bar.Popouts.Network
|
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Helpers.Network
|
import ZShell.Config
|
||||||
|
import qs.Modules
|
||||||
|
import qs.Helpers as Helpers
|
||||||
|
|
||||||
CustomClippingRect {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var wrapper
|
required property var wrapper
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
implicitHeight: networkPopContent.height + networkPopContent.anchors.margins * 2
|
|
||||||
implicitWidth: 500 + 8 * 2
|
|
||||||
radius: (20 - Tokens.padding.small) * Tokens.rounding.scale
|
|
||||||
|
|
||||||
Component.onCompleted: Network.active = true
|
|
||||||
Component.onDestruction: Network.active = false
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: networkPopContent
|
id: layout
|
||||||
|
|
||||||
anchors.left: parent.left
|
spacing: 8
|
||||||
anchors.margins: Tokens.padding.large
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
|
||||||
|
|
||||||
CustomText {
|
Repeater {
|
||||||
Layout.preferredHeight: visible ? implicitHeight : 0
|
model: Helpers.Network.devices
|
||||||
Layout.rightMargin: Tokens.padding.extraSmall
|
|
||||||
font.pointSize: Tokens.font.size.large
|
|
||||||
text: qsTr("Wifi")
|
|
||||||
}
|
|
||||||
|
|
||||||
Toggle {
|
CustomRadioButton {
|
||||||
Layout.preferredHeight: visible ? implicitHeight : 0
|
id: network
|
||||||
checked: Network.wifiEnabled
|
|
||||||
first: true
|
|
||||||
last: Network.connectedNetworks.length === 0
|
|
||||||
subtext: qsTr("Toggle WiFi device state")
|
|
||||||
text: checked ? qsTr("Enabled") : qsTr("Disabled")
|
|
||||||
|
|
||||||
onToggled: Network.setWifi(checked)
|
required property NetworkDevice modelData
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
checked: Helpers.Network.activeDevice?.name === modelData.name
|
||||||
id: rows
|
text: modelData.description
|
||||||
|
visible: modelData.name !== "lo"
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: contentHeight
|
|
||||||
interactive: false
|
|
||||||
section.property: "connected"
|
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
|
||||||
|
|
||||||
add: Transition {
|
|
||||||
Anim {
|
|
||||||
from: 0
|
|
||||||
property: "opacity"
|
|
||||||
to: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delegate: DelegateChooser {
|
|
||||||
role: "isDivider"
|
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
roleValue: true
|
|
||||||
|
|
||||||
delegate: NetworkDivider {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DelegateChoice {
|
|
||||||
delegate: NetworkItem {
|
|
||||||
list: rows
|
|
||||||
width: rows.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
displaced: Transition {
|
|
||||||
Anim {
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
property: "y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model: ScriptModel {
|
|
||||||
values: {
|
|
||||||
const byStrengthName = (a, b) => b.signalStrength - a.signalStrength || a.name.localeCompare(b.name);
|
|
||||||
const cNetworks = [...Network.connectedNetworks];
|
|
||||||
const kNetworks = [...Network.knownNetworks];
|
|
||||||
const uNetworks = [...Network.unknownNetworks];
|
|
||||||
|
|
||||||
return [...cNetworks.sort(byStrengthName), ...(kNetworks.length > 0 ? [
|
|
||||||
{
|
|
||||||
isDivider: true,
|
|
||||||
type: "known"
|
|
||||||
},
|
|
||||||
...kNetworks.sort(byStrengthName)] : []), ...(uNetworks.length > 0 ? [
|
|
||||||
{
|
|
||||||
isDivider: true,
|
|
||||||
type: "unknown"
|
|
||||||
},
|
|
||||||
...uNetworks.sort(byStrengthName)] : [])];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
move: Transition {
|
|
||||||
Anim {
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
property: "y"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remove: Transition {
|
|
||||||
Anim {
|
|
||||||
property: "opacity"
|
|
||||||
to: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.delegate: Rectangle {
|
|
||||||
required property string section
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
height: childrenRect.height
|
|
||||||
width: ListView.view.width
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: parent.section
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkOverlay {
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import qs.Modules
|
|||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property bool hasUpdates: Object.keys(Updates.updates)?.length > 0
|
readonly property bool hasUpdates: Object.keys(Updates.updates)?.length > 0
|
||||||
@@ -36,8 +36,8 @@ CustomRect {
|
|||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: noUpdatesIcon
|
id: noUpdatesIcon
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenterOffset: -noUpdatesText.implicitHeight
|
anchors.top: parent.top
|
||||||
color: Colors.tPalette.m3onSurfaceVariant
|
color: Colors.tPalette.m3onSurfaceVariant
|
||||||
fontStyle: Tokens.font.icon.builders.large.size(48).weight(Font.DemiBold).build()
|
fontStyle: Tokens.font.icon.builders.large.size(48).weight(Font.DemiBold).build()
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@@ -45,8 +45,6 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: noUpdatesText
|
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: noUpdatesIcon.bottom
|
anchors.top: noUpdatesIcon.bottom
|
||||||
color: Colors.tPalette.m3onSurfaceVariant
|
color: Colors.tPalette.m3onSurfaceVariant
|
||||||
@@ -73,7 +71,6 @@ CustomRect {
|
|||||||
implicitHeight: Math.min(contentHeight, (root.itemHeight + spacing) * 5 - spacing)
|
implicitHeight: Math.min(contentHeight, (root.itemHeight + spacing) * 5 - spacing)
|
||||||
implicitWidth: contentWidth
|
implicitWidth: contentWidth
|
||||||
spacing: Tokens.spacing.medium
|
spacing: Tokens.spacing.medium
|
||||||
clip: true
|
|
||||||
|
|
||||||
delegate: CustomRect {
|
delegate: CustomRect {
|
||||||
id: update
|
id: update
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Hyprland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Item {
|
|||||||
searchField.forceActiveFocus();
|
searchField.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: search
|
id: search
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -54,7 +54,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: preview
|
id: preview
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
@@ -228,7 +228,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: textRect
|
id: textRect
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
@@ -10,6 +11,11 @@ import qs.Components
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
|
||||||
|
readonly property real nonAnimHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins + viewWrapper.anchors.topMargin
|
||||||
|
|
||||||
|
required property ScreenState screenState
|
||||||
|
|
||||||
readonly property var dashboardTabs: {
|
readonly property var dashboardTabs: {
|
||||||
const allTabs = [
|
const allTabs = [
|
||||||
{
|
{
|
||||||
@@ -39,12 +45,9 @@ Item {
|
|||||||
];
|
];
|
||||||
return allTabs.filter(tab => tab.enabled);
|
return allTabs.filter(tab => tab.enabled);
|
||||||
}
|
}
|
||||||
readonly property real nonAnimHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins + viewWrapper.anchors.topMargin
|
|
||||||
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
|
|
||||||
required property ScreenState screenState
|
|
||||||
|
|
||||||
implicitHeight: nonAnimHeight
|
|
||||||
implicitWidth: nonAnimWidth
|
implicitWidth: nonAnimWidth
|
||||||
|
implicitHeight: nonAnimHeight
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {
|
Anim {
|
||||||
@@ -60,14 +63,15 @@ Item {
|
|||||||
Tabs {
|
Tabs {
|
||||||
id: tabs
|
id: tabs
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.margins: Tokens.padding.small
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: ZUtils.clamp(anchors.margins - Config.bar.border, 0, anchors.margins)
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
nonAnimWidth: view.implicitWidth
|
nonAnimWidth: view.implicitWidth
|
||||||
screenState: root.screenState
|
screenState: root.screenState
|
||||||
tabs: root.dashboardTabs
|
tabs: root.dashboardTabs
|
||||||
|
anchors.topMargin: ZUtils.clamp(anchors.margins - Config.bar.border, 0, anchors.margins)
|
||||||
|
anchors.margins: Tokens.padding.small
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -75,15 +79,15 @@ Item {
|
|||||||
|
|
||||||
property int radius: Tokens.rounding.extraLarge - anchors.margins
|
property int radius: Tokens.rounding.extraLarge - anchors.margins
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.margins: Tokens.padding.small
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: tabs.bottom
|
anchors.top: tabs.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
anchors.topMargin: Tokens.spacing.small
|
anchors.topMargin: Tokens.spacing.small
|
||||||
clip: view.currentIndex !== 3 || (!view.currentItem?.settled ?? true)
|
anchors.margins: Tokens.padding.small
|
||||||
|
clip: true
|
||||||
|
|
||||||
Item {
|
Flickable {
|
||||||
id: view
|
id: view
|
||||||
|
|
||||||
readonly property int currentIndex: root.screenState.dashboardTab
|
readonly property int currentIndex: root.screenState.dashboardTab
|
||||||
@@ -93,50 +97,64 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
implicitHeight: currentItem?.implicitHeight ?? 0
|
|
||||||
implicitWidth: currentItem?.implicitWidth ?? 0
|
implicitWidth: currentItem?.implicitWidth ?? 0
|
||||||
|
implicitHeight: currentItem?.implicitHeight ?? 0
|
||||||
|
|
||||||
Repeater {
|
contentX: currentItem?.x ?? 0
|
||||||
id: repeater
|
contentWidth: row.implicitWidth
|
||||||
|
contentHeight: row.implicitHeight
|
||||||
|
|
||||||
delegate: Loader {
|
interactive: false
|
||||||
id: paneLoader
|
|
||||||
|
|
||||||
required property int index
|
onContentXChanged: {
|
||||||
required property var modelData
|
if (!moving || !currentItem)
|
||||||
|
return;
|
||||||
|
|
||||||
readonly property real targetX: index < view.currentIndex ? -view.implicitWidth : index > view.currentIndex ? view.implicitWidth : 0
|
const x = contentX - currentItem.x;
|
||||||
readonly property bool settled: x === targetX
|
if (x > currentItem.implicitWidth / 2)
|
||||||
|
root.screenState.dashboardTab = Math.min(root.screenState.dashboardTab + 1, tabs.count - 1);
|
||||||
|
else if (x < -currentItem.implicitWidth / 2)
|
||||||
|
root.screenState.dashboardTab = Math.max(root.screenState.dashboardTab - 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
active: index === view.currentIndex || opacity > 0
|
RowLayout {
|
||||||
opacity: index === view.currentIndex ? 1 : 0
|
id: row
|
||||||
sourceComponent: modelData.component
|
|
||||||
visible: opacity > 0
|
|
||||||
x: targetX
|
|
||||||
y: 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
Repeater {
|
||||||
Anim {
|
id: repeater
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
model: ScriptModel {
|
||||||
|
values: root.dashboardTabs
|
||||||
}
|
}
|
||||||
Behavior on x {
|
|
||||||
Anim {
|
delegate: Loader {
|
||||||
type: Anim.DefaultEffects
|
id: paneLoader
|
||||||
}
|
|
||||||
|
required property int index
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
sourceComponent: modelData.component
|
||||||
|
|
||||||
|
Component.onCompleted: active = Qt.binding(() => {
|
||||||
|
if (index === view.currentIndex)
|
||||||
|
return true;
|
||||||
|
const vx = Math.floor(view.visibleArea.xPosition * view.contentWidth);
|
||||||
|
const vex = Math.floor(vx + view.visibleArea.widthRatio * view.contentWidth);
|
||||||
|
return (vx >= x && vx <= x + implicitWidth) || (vex >= x && vex <= x + implicitWidth);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model: ScriptModel {
|
|
||||||
values: root.dashboardTabs
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: dashComponent
|
id: dashComponent
|
||||||
|
|
||||||
Dash {
|
Dash {
|
||||||
radius: viewWrapper.radius
|
|
||||||
screenState: root.screenState
|
screenState: root.screenState
|
||||||
|
radius: viewWrapper.radius
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +170,8 @@ Item {
|
|||||||
id: mediaComponent
|
id: mediaComponent
|
||||||
|
|
||||||
Media {
|
Media {
|
||||||
radius: viewWrapper.radius
|
|
||||||
screenState: root.screenState
|
screenState: root.screenState
|
||||||
|
radius: viewWrapper.radius
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +182,12 @@ Item {
|
|||||||
radius: viewWrapper.radius
|
radius: viewWrapper.radius
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on contentX {
|
||||||
|
Anim {
|
||||||
|
type: Anim.DefaultEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Row {
|
|||||||
padding: 20
|
padding: 20
|
||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||||
implicitHeight: info.implicitHeight
|
implicitHeight: info.implicitHeight
|
||||||
implicitWidth: info.implicitHeight
|
implicitWidth: info.implicitHeight
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Item {
|
|||||||
implicitWidth: 1000
|
implicitWidth: 1000
|
||||||
implicitHeight: 320
|
implicitHeight: 320
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: root.radius
|
radius: root.radius
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ CustomListView {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
spacing: Tokens.spacing.extraSmall / 2
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: iconClip
|
id: iconClip
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Item {
|
|||||||
onClicked: root.close()
|
onClicked: root.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: popupBackground
|
id: popupBackground
|
||||||
readonly property real padding: 4
|
readonly property real padding: 4
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ Item {
|
|||||||
visible: false
|
visible: false
|
||||||
z: 999
|
z: 999
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: popupBackground
|
id: popupBackground
|
||||||
|
|
||||||
readonly property real padding: Tokens.padding.extraSmall
|
readonly property real padding: Tokens.padding.extraSmall
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Item {
|
|||||||
implicitHeight: tileHeight + Tokens.padding.large * 2
|
implicitHeight: tileHeight + Tokens.padding.large * 2
|
||||||
implicitWidth: tileWidth
|
implicitWidth: tileWidth
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: image
|
id: image
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ColumnLayout {
|
|||||||
text: Time.format("dddd, d MMMM yyyy")
|
text: Time.format("dddd, d MMMM yyyy")
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import qs.Helpers
|
|||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var lock
|
required property var lock
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import ZShell.Components
|
import ZShell.Components
|
||||||
import ZShell.Config
|
|
||||||
import qs.Components
|
import qs.Components
|
||||||
|
import ZShell.Config
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var lock
|
required property var lock
|
||||||
|
|||||||
@@ -24,11 +24,12 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: Colors.palette.m3outline
|
color: Colors.palette.m3outline
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.mono.builders.small.weight(Font.Medium).build()
|
font.family: Config.appearance.font.family.mono
|
||||||
|
font.weight: 500
|
||||||
text: NotifServer.list.length > 0 ? qsTr("%1 notification%2").arg(NotifServer.list.length).arg(NotifServer.list.length === 1 ? "" : "s") : qsTr("Notifications")
|
text: NotifServer.list.length > 0 ? qsTr("%1 notification%2").arg(NotifServer.list.length).arg(NotifServer.list.length === 1 ? "" : "s") : qsTr("Notifications")
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
ClippingRectangle {
|
||||||
id: clipRect
|
id: clipRect
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipRect {
|
ClippingRectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: root.urgency === "critical" ? Colors.palette.m3error : root.urgency === "low" ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 3) : Colors.palette.m3secondaryContainer
|
color: root.urgency === "critical" ? Colors.palette.m3error : root.urgency === "low" ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 3) : Colors.palette.m3secondaryContainer
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Components
|
|
||||||
import qs.Paths
|
import qs.Paths
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
ClipRect {
|
ClippingRectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ pragma ComponentBehavior: Bound
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Config
|
|
||||||
import ZShell.Components
|
|
||||||
import qs.Components
|
import qs.Components
|
||||||
|
import ZShell.Config
|
||||||
import qs.Daemons
|
import qs.Daemons
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ Item {
|
|||||||
for (let i = 0; i < count; i++)
|
for (let i = 0; i < count; i++)
|
||||||
height += (list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0;
|
height += (list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0;
|
||||||
|
|
||||||
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x || screenState.dashboard)
|
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (screenState.osd) {
|
if (screenState.osd) {
|
||||||
@@ -37,20 +36,25 @@ Item {
|
|||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (screenState.session) {
|
||||||
|
const h = panels.session.y - Tokens.spacing.small * 2 - padding * 2;
|
||||||
|
if (height > h)
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
|
||||||
return Math.min(((QsWindow.window as QsWindow)?.screen?.height ?? 0) - 1 * 2, height + padding * 2);
|
return Math.min(((QsWindow.window as QsWindow)?.screen?.height ?? 0) - 1 * 2, height + padding * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: Config.notifs.sizes.width + padding * 2
|
implicitWidth: Config.notifs.sizes.width + padding * 2
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {}
|
Anim {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
ClippingWrapperRectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: root.padding
|
anchors.margins: root.padding
|
||||||
clip: true
|
color: "transparent"
|
||||||
// radius: Tokens.rounding.large - root.padding
|
radius: Tokens.rounding.large - root.padding
|
||||||
|
|
||||||
CustomListView {
|
CustomListView {
|
||||||
id: list
|
id: list
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ CustomRect {
|
|||||||
visible: root.hasImage || root.hasAppIcon
|
visible: root.hasImage || root.hasAppIcon
|
||||||
width: Config.notifs.sizes.image
|
width: Config.notifs.sizes.image
|
||||||
|
|
||||||
sourceComponent: ClipRect {
|
sourceComponent: CustomClippingRect {
|
||||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 2) : Colors.palette.m3secondaryContainer
|
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 2) : Colors.palette.m3secondaryContainer
|
||||||
implicitHeight: Config.notifs.sizes.image
|
implicitHeight: Config.notifs.sizes.image
|
||||||
implicitWidth: Config.notifs.sizes.image
|
implicitWidth: Config.notifs.sizes.image
|
||||||
|
|||||||
+6
-65
@@ -3,11 +3,10 @@ pragma ComponentBehavior: Bound
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import ZShell.Services
|
|
||||||
import ZShell.Components
|
import ZShell.Components
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import ZShell.Llm
|
import ZShell.Llm
|
||||||
import qs.Modules.Sidebar.Chat.Content
|
import qs.Modules.Notifications.Sidebar.Chat.Content
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -91,9 +90,7 @@ Item {
|
|||||||
signal requestClose
|
signal requestClose
|
||||||
|
|
||||||
readonly property bool atNewestEnd: !listLoader.item || listLoader.item.contentY < 4
|
readonly property bool atNewestEnd: !listLoader.item || listLoader.item.contentY < 4
|
||||||
readonly property bool importing: importIds.length > 0
|
|
||||||
|
|
||||||
property var importIds: []
|
|
||||||
property var pendingAttachments: []
|
property var pendingAttachments: []
|
||||||
|
|
||||||
function attachFiles(): void {
|
function attachFiles(): void {
|
||||||
@@ -174,7 +171,7 @@ Item {
|
|||||||
Layout.alignment: ChatState.isWindow ? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
|
Layout.alignment: ChatState.isWindow ? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Tokens.font.title.medium
|
font: Tokens.font.title.medium
|
||||||
text: qsTr(root.chatData?.title || ChatState.title)
|
text: qsTr(root.chatData.title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +436,7 @@ Item {
|
|||||||
width: attachments.cellWidth
|
width: attachments.cellWidth
|
||||||
height: width
|
height: width
|
||||||
opacity: modelData ? 1 : 0
|
opacity: modelData ? 1 : 0
|
||||||
ClipRect {
|
CustomClippingRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.spacing.extraSmall
|
anchors.margins: Tokens.spacing.extraSmall
|
||||||
|
|
||||||
@@ -543,17 +540,14 @@ Item {
|
|||||||
anchors.margins: Tokens.padding.medium
|
anchors.margins: Tokens.padding.medium
|
||||||
bg.border.color: Colors.palette.m3outlineVariant
|
bg.border.color: Colors.palette.m3outlineVariant
|
||||||
bg.color: Colors.tPalette.m3surfaceContainerLowest
|
bg.color: Colors.tPalette.m3surfaceContainerLowest
|
||||||
fastGlow: LlmClient.busy
|
fastGlow: Chat.busy
|
||||||
glow.opacity: !ChatState.narrowSidebarExpanded ? (input.activeFocus && (!LlmClient.busy || ChatState.isWindow) ? 1 : 0) : 0
|
|
||||||
font: Tokens.font.body.small
|
font: Tokens.font.body.small
|
||||||
implicitHeight: Math.min(root.height / 5, contentHeight + topPadding + bottomPadding)
|
implicitHeight: Math.min(root.height / 5, contentHeight + topPadding + bottomPadding)
|
||||||
focus: true
|
focus: true
|
||||||
placeholderText: qsTr("Send a message")
|
placeholderText: qsTr("Send a message")
|
||||||
sendIcon.font: Tokens.font.icon.medium
|
sendIcon.font: Tokens.font.icon.medium
|
||||||
sendIcon.icon: LlmClient.busy ? "stop" : "arrow_upward"
|
sendIcon.icon: "arrow_upward"
|
||||||
sendIcon.padding: Tokens.padding.extraSmall
|
sendIcon.padding: Tokens.padding.extraSmall
|
||||||
sendIcon.opacity: text || LlmClient.busy ? 1.0 : 0.5
|
|
||||||
sendIcon.enabled: text || LlmClient.busy
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
root.focusInput();
|
root.focusInput();
|
||||||
@@ -574,59 +568,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onButtonPressed: {
|
onSendPressed: root.send(text)
|
||||||
if (LlmClient.busy)
|
|
||||||
LlmClient.stop();
|
|
||||||
else
|
|
||||||
root.send(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: DropImporter
|
|
||||||
|
|
||||||
function onImportFinished(id: int, paths: var, errors: var): void {
|
|
||||||
if (!root.importIds.includes(id))
|
|
||||||
return;
|
|
||||||
root.importIds = root.importIds.filter(i => i !== id);
|
|
||||||
|
|
||||||
if (paths.length > 0) {
|
|
||||||
const added = root.chatData.addAttachments(paths);
|
|
||||||
root.pendingAttachments = root.pendingAttachments.concat(added);
|
|
||||||
}
|
|
||||||
for (const e of errors)
|
|
||||||
console.warn("Drop import:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DropArea {
|
|
||||||
id: dropArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
onEntered: drag => {
|
|
||||||
drag.accepted = drag.hasUrls || drag.hasText || drag.hasHtml || drag.formats.some(f => f.startsWith("image/"));
|
|
||||||
}
|
|
||||||
|
|
||||||
onDropped: drop => {
|
|
||||||
const formats = drop.formats;
|
|
||||||
const urls = drop.hasUrls ? drop.urls : [];
|
|
||||||
const text = drop.hasText ? drop.text : "";
|
|
||||||
const html = drop.hasHtml ? drop.html : "";
|
|
||||||
|
|
||||||
const imgFormat = formats.find(f => f.startsWith("image/"));
|
|
||||||
const raw = imgFormat ? drop.getDataAsArrayBuffer(imgFormat) : new ArrayBuffer(0);
|
|
||||||
|
|
||||||
switch (DropImporter.decide(urls, text, html, raw.byteLength > 0)) {
|
|
||||||
case DropImporter.Attach:
|
|
||||||
root.importIds = [...root.importIds, DropImporter.importAttachments(urls, html, raw)];
|
|
||||||
break;
|
|
||||||
case DropImporter.InsertText:
|
|
||||||
input.insert(input.cursorPosition, text || urls.map(u => u.toString()).join("\n"));
|
|
||||||
root.focusInput();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
drop.acceptProposedAction();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+33
-85
@@ -6,7 +6,7 @@ import qs.Effects
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool expanded: false
|
property bool expanded: false
|
||||||
@@ -91,50 +91,6 @@ CustomRect {
|
|||||||
|
|
||||||
opacity: root.slim ? 0 : 1
|
opacity: root.slim ? 0 : 1
|
||||||
|
|
||||||
state: titleText.readOnly ? "static" : "editing"
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "static"
|
|
||||||
PropertyChanges {
|
|
||||||
staticText.opacity: 1
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
titleText.opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "editing"
|
|
||||||
PropertyChanges {
|
|
||||||
staticText.opacity: 0
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
titleText.opacity: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
transitions: [
|
|
||||||
// Going static: titleText fades out (animated), staticText snaps in
|
|
||||||
Transition {
|
|
||||||
to: "static"
|
|
||||||
Anim {
|
|
||||||
target: titleText
|
|
||||||
property: "opacity"
|
|
||||||
type: Anim.SlowEffects
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Going editing: staticText fades out (animated), titleText snaps in
|
|
||||||
Transition {
|
|
||||||
to: "editing"
|
|
||||||
Anim {
|
|
||||||
target: staticText
|
|
||||||
property: "opacity"
|
|
||||||
type: Anim.SlowEffects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
type: Anim.DefaultEffects
|
type: Anim.DefaultEffects
|
||||||
@@ -150,7 +106,7 @@ CustomRect {
|
|||||||
color: Colors.layer(Colors.palette.m3surfaceContainerHighest, 1)
|
color: Colors.layer(Colors.palette.m3surfaceContainerHighest, 1)
|
||||||
implicitHeight: titleText.implicitHeight + Tokens.padding.extraSmall * 2
|
implicitHeight: titleText.implicitHeight + Tokens.padding.extraSmall * 2
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
implicitWidth: titleText.width + Tokens.padding.large * 2
|
implicitWidth: titleText.implicitWidth + Tokens.padding.large * 2
|
||||||
opacity: titleText.readOnly ? 0 : 1
|
opacity: titleText.readOnly ? 0 : 1
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
@@ -166,6 +122,11 @@ CustomRect {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
implicitHeight: titleText.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: titleText.implicitHeight + Tokens.padding.small * 2
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: OpacityMask {
|
||||||
|
maskSource: fadeMask
|
||||||
|
}
|
||||||
|
|
||||||
TextFieldBase {
|
TextFieldBase {
|
||||||
id: titleText
|
id: titleText
|
||||||
|
|
||||||
@@ -173,12 +134,10 @@ CustomRect {
|
|||||||
anchors.leftMargin: readOnly ? 0 : Tokens.padding.large
|
anchors.leftMargin: readOnly ? 0 : Tokens.padding.large
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: readOnly ? Tokens.padding.small : Tokens.padding.extraSmall * 2
|
anchors.topMargin: readOnly ? Tokens.padding.small : Tokens.padding.extraSmall * 2
|
||||||
width: Math.min(implicitWidth, parent.width - Tokens.padding.large * 2)
|
font: Tokens.font.title.medium
|
||||||
font: Tokens.font.body.medium
|
|
||||||
text: root.modelData.title || qsTr("New chat")
|
text: root.modelData.title || qsTr("New chat")
|
||||||
readOnly: true
|
readOnly: true
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
Behavior on anchors.leftMargin {
|
Behavior on anchors.leftMargin {
|
||||||
Anim {}
|
Anim {}
|
||||||
@@ -187,11 +146,6 @@ CustomRect {
|
|||||||
Anim {}
|
Anim {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelTitleEdit(): void {
|
|
||||||
text = root.modelData.title;
|
|
||||||
readOnly = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditingFinished: root.modelData.title = text
|
onEditingFinished: root.modelData.title = text
|
||||||
onReadOnlyChanged: {
|
onReadOnlyChanged: {
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
@@ -202,24 +156,31 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomRect {
|
||||||
id: staticText
|
id: fadeMask
|
||||||
|
|
||||||
anchors.left: parent.left
|
// anchors.top: titleText.top
|
||||||
anchors.leftMargin: titleText.readOnly ? 0 : Tokens.padding.large
|
// anchors.bottom: titleText.bottom
|
||||||
anchors.top: parent.top
|
// anchors.left: titleText.left
|
||||||
anchors.topMargin: titleText.readOnly ? Tokens.padding.small : Tokens.padding.extraSmall * 2
|
// anchors.right: parent.right
|
||||||
anchors.right: parent.right
|
anchors.fill: titleWrapper
|
||||||
font: titleText.font
|
|
||||||
text: titleText.text
|
|
||||||
elide: CustomText.ElideRight
|
|
||||||
|
|
||||||
Behavior on anchors.leftMargin {
|
layer.enabled: true
|
||||||
Anim {}
|
visible: false
|
||||||
|
|
||||||
|
gradient: Gradient {
|
||||||
|
orientation: Gradient.Horizontal
|
||||||
|
|
||||||
|
GradientStop {
|
||||||
|
color: Qt.rgba(1, 1, 1, 1.0)
|
||||||
|
position: 0.85
|
||||||
}
|
}
|
||||||
Behavior on anchors.topMargin {
|
|
||||||
Anim {}
|
GradientStop {
|
||||||
|
color: Qt.rgba(1, 1, 1, 0)
|
||||||
|
position: 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +192,6 @@ CustomRect {
|
|||||||
anchors.topMargin: Tokens.spacing.extraSmall
|
anchors.topMargin: Tokens.spacing.extraSmall
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
font: Tokens.font.label.small
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
text: qsTr("Created on: %1").arg(root.modelData.createdAt.toLocaleString(Qt.locale("en_US"), "MMM d, yyyy - h:mm AP"))
|
text: qsTr("Created on: %1").arg(root.modelData.createdAt.toLocaleString(Qt.locale("en_US"), "MMM d, yyyy - h:mm AP"))
|
||||||
opacity: root.expanded ? 1 : 0
|
opacity: root.expanded ? 1 : 0
|
||||||
@@ -247,7 +207,6 @@ CustomRect {
|
|||||||
anchors.top: created.bottom
|
anchors.top: created.bottom
|
||||||
anchors.topMargin: Tokens.spacing.small
|
anchors.topMargin: Tokens.spacing.small
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
font: Tokens.font.label.small
|
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
text: qsTr("Updated on: ")
|
text: qsTr("Updated on: ")
|
||||||
opacity: root.expanded ? 1 : 0
|
opacity: root.expanded ? 1 : 0
|
||||||
@@ -264,7 +223,6 @@ CustomRect {
|
|||||||
anchors.top: title.bottom
|
anchors.top: title.bottom
|
||||||
anchors.topMargin: Tokens.spacing.extraSmall
|
anchors.topMargin: Tokens.spacing.extraSmall
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
font: Tokens.font.label.small
|
|
||||||
text: root.modelData.updatedAt.toLocaleString(Qt.locale("en_US"), "MMM d, yyyy - h:mm AP")
|
text: root.modelData.updatedAt.toLocaleString(Qt.locale("en_US"), "MMM d, yyyy - h:mm AP")
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
@@ -295,10 +253,9 @@ CustomRect {
|
|||||||
y: infoContainer.implicitHeight + topMargin
|
y: infoContainer.implicitHeight + topMargin
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
font: Tokens.font.body.small
|
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
opacity: !root.expanded && !root.slim ? 1 : 0
|
opacity: !root.expanded && !root.slim ? 1 : 0
|
||||||
text: root.modelData.messagesModel.lastMessage?.content.replace(/\s+/g, " ").trim() ?? qsTr("No messages yet")
|
text: root.modelData.messagesModel.lastMessage?.activeGeneration.content.replace(/\s+/g, " ").trim() ?? qsTr("No messages yet")
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
Anim {}
|
Anim {}
|
||||||
@@ -323,7 +280,7 @@ CustomRect {
|
|||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
maximumLineCount: 5
|
maximumLineCount: 5
|
||||||
opacity: root.expanded ? 1 : 0
|
opacity: root.expanded ? 1 : 0
|
||||||
text: root.modelData.messagesModel.lastMessage?.content ?? qsTr("No messages yet")
|
text: root.modelData.messagesModel.lastMessage?.activeGeneration.content ?? qsTr("No messages yet")
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
@@ -366,13 +323,7 @@ CustomRect {
|
|||||||
inactiveColor: Colors.layer(Colors.palette.m3surfaceContainerHighest, 3)
|
inactiveColor: Colors.layer(Colors.palette.m3surfaceContainerHighest, 3)
|
||||||
inactiveOnColor: Colors.palette.m3onSurfaceVariant
|
inactiveOnColor: Colors.palette.m3onSurfaceVariant
|
||||||
|
|
||||||
onClicked: {
|
onClicked: root.remove(root.modelData)
|
||||||
if (!titleText.readOnly) {
|
|
||||||
titleText.cancelTitleEdit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.remove(root.modelData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
@@ -415,10 +366,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: root.expanded = !root.expanded
|
||||||
root.expanded = !root.expanded;
|
|
||||||
titleText.readOnly = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
+2
-4
@@ -8,11 +8,10 @@ TextAreaBase {
|
|||||||
|
|
||||||
readonly property alias bg: bg
|
readonly property alias bg: bg
|
||||||
readonly property alias sendIcon: sendIcon
|
readonly property alias sendIcon: sendIcon
|
||||||
readonly property alias glow: glow
|
|
||||||
|
|
||||||
property bool fastGlow: false
|
property bool fastGlow: false
|
||||||
|
|
||||||
signal buttonPressed
|
signal sendPressed
|
||||||
|
|
||||||
bottomPadding: Tokens.padding.large
|
bottomPadding: Tokens.padding.large
|
||||||
leftPadding: Tokens.padding.extraLarge
|
leftPadding: Tokens.padding.extraLarge
|
||||||
@@ -40,7 +39,6 @@ TextAreaBase {
|
|||||||
GeminiGlow {
|
GeminiGlow {
|
||||||
id: glow
|
id: glow
|
||||||
glowSize: 32
|
glowSize: 32
|
||||||
z: 5
|
|
||||||
|
|
||||||
opacity: root.activeFocus ? 1 : 0
|
opacity: root.activeFocus ? 1 : 0
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
@@ -133,7 +131,7 @@ TextAreaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: root.buttonPressed()
|
onClicked: root.sendPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
+158
-44
@@ -5,7 +5,6 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import ZShell.Llm
|
import ZShell.Llm
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Modules.Sidebar.Chat.Content
|
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Components
|
import qs.Components
|
||||||
|
|
||||||
@@ -22,22 +21,15 @@ Item {
|
|||||||
signal loadChatRequest(content: ChatSession, index: int)
|
signal loadChatRequest(content: ChatSession, index: int)
|
||||||
signal newChatRequest
|
signal newChatRequest
|
||||||
|
|
||||||
onSlimChanged: {
|
|
||||||
if (slim)
|
|
||||||
modelsContainer.open = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: chatHeader
|
id: header
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.margins: Tokens.padding.extraSmall
|
anchors.margins: Tokens.padding.extraSmall
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
color: Colors.palette.m3outline
|
color: Colors.palette.m3outline
|
||||||
font.family: "CaskaydiaCove NF"
|
font: Tokens.font.label.large
|
||||||
font.pointSize: 13
|
|
||||||
font.weight: 500
|
|
||||||
text: qsTr("%1 Chat%2").arg(list.count).arg(list.count > 1 ? "s" : "")
|
text: qsTr("%1 Chat%2").arg(list.count).arg(list.count > 1 ? "s" : "")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +39,7 @@ Item {
|
|||||||
anchors.bottom: modelsContainer.top
|
anchors.bottom: modelsContainer.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: chatHeader.bottom
|
anchors.top: header.bottom
|
||||||
anchors.topMargin: Tokens.spacing.medium
|
anchors.topMargin: Tokens.spacing.medium
|
||||||
clip: true
|
clip: true
|
||||||
spacing: Tokens.spacing.medium
|
spacing: Tokens.spacing.medium
|
||||||
@@ -104,24 +96,156 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelsContainer {
|
CustomClippingRect {
|
||||||
id: modelsContainer
|
id: modelsContainer
|
||||||
|
|
||||||
|
property bool expanded: false
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: fabRoot.left
|
anchors.right: fabRoot.left
|
||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.small
|
||||||
anchors.rightMargin: Tokens.spacing.small
|
anchors.rightMargin: Tokens.spacing.small
|
||||||
|
|
||||||
rootParent: root
|
implicitHeight: expanded ? 400 : fabRoot.implicitHeight
|
||||||
fabRoot: fabRoot
|
radius: modelLayer.pressed ? Tokens.rounding.small : modelName.implicitHeight / 2
|
||||||
|
|
||||||
opacity: root.slim ? 0 : 1
|
function prettyModelName(): string {
|
||||||
visible: opacity > 0
|
if (modelsList.count < 1)
|
||||||
|
return qsTr("No models found");
|
||||||
|
|
||||||
Behavior on opacity {
|
const pathList = Chat.model.split("\/");
|
||||||
Anim {
|
const name = pathList[pathList.length - 1];
|
||||||
type: Anim.DefaultEffects
|
|
||||||
|
if (!name)
|
||||||
|
return qsTr("No model selected");
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on radius {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: modelName
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
implicitHeight: fabRoot.implicitHeight
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
id: label
|
||||||
|
text: modelsContainer.prettyModelName()
|
||||||
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Tokens.padding.large
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Tokens.padding.large
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: modelsContainer.expanded ? "unfold_less" : "unfold_more"
|
||||||
|
animate: true
|
||||||
|
fontStyle: Tokens.font.icon.medium
|
||||||
|
visible: modelsList.count > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
id: modelLayer
|
||||||
|
enabled: modelsList.count > 0
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
ChatState.fabExpanded = false;
|
||||||
|
modelsContainer.expanded = !modelsContainer.expanded;
|
||||||
|
}
|
||||||
|
radius: modelsContainer.radius
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalFadeListView {
|
||||||
|
id: modelsList
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.top: modelName.bottom
|
||||||
|
anchors.margins: Tokens.padding.medium
|
||||||
|
anchors.topMargin: Tokens.spacing.medium
|
||||||
|
model: Chat.availableModels
|
||||||
|
opacity: modelsContainer.expanded ? 1 : 0
|
||||||
|
currentIndex: Chat.availableModels.indexOf(Chat.model)
|
||||||
|
visible: opacity > 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomScrollBar.vertical: CustomScrollBar {
|
||||||
|
flickable: modelsList
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: CustomRect {
|
||||||
|
id: model
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
required property int index
|
||||||
|
readonly property bool selected: model.ListView.view.currentIndex === model.index
|
||||||
|
|
||||||
|
implicitWidth: ListView.view.width
|
||||||
|
implicitHeight: layout.implicitHeight + Tokens.padding.small * 2
|
||||||
|
radius: stateLayer.pressed ? Tokens.rounding.extraSmall : selected ? Tokens.rounding.largeIncreased : Tokens.rounding.medium
|
||||||
|
color: Qt.alpha(Colors.palette.m3tertiaryContainer, selected ? 1 : 0)
|
||||||
|
|
||||||
|
Behavior on radius {
|
||||||
|
Anim {
|
||||||
|
type: Anim.SlowEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Tokens.padding.small
|
||||||
|
anchors.leftMargin: Tokens.padding.large
|
||||||
|
anchors.rightMargin: Tokens.padding.large
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
text: model.modelData
|
||||||
|
color: model.selected ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
visible: model.selected
|
||||||
|
color: Colors.palette.m3onTertiaryContainer
|
||||||
|
fontStyle: Tokens.font.icon.medium
|
||||||
|
opacity: model.selected ? 1 : 0
|
||||||
|
text: "check"
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
type: Anim.SlowEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
id: stateLayer
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
Chat.selectModel(model.modelData);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,14 +257,22 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.small
|
||||||
padding: 8
|
padding: 8
|
||||||
font.pointSize: Math.round(18 * 1.2)
|
font: Tokens.font.icon.large
|
||||||
icon: root.slim ? "left_panel_open" : "add"
|
icon: root.slim ? "left_panel_open" : "add"
|
||||||
isRound: ChatState.fabExpanded
|
isRound: ChatState.fabExpanded
|
||||||
|
// opacity: root.slim ? 0 : 1
|
||||||
|
// visible: opacity > 0
|
||||||
|
//
|
||||||
|
// Behavior on opacity {
|
||||||
|
// Anim {
|
||||||
|
// type: Anim.DefaultEffects
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
label.transform: Rotation {
|
label.transform: Rotation {
|
||||||
origin.y: fabRoot.label.height / 2
|
origin.y: fabRoot.label.height / 2
|
||||||
origin.x: fabRoot.label.width / 2
|
origin.x: fabRoot.label.width / 2
|
||||||
angle: ChatState.fabExpanded && (ChatState.narrowSidebarExpanded || !ChatState.isWide || !ChatState.isWindow) ? 135 : 0
|
angle: ChatState.fabExpanded ? 135 : 0
|
||||||
|
|
||||||
Behavior on angle {
|
Behavior on angle {
|
||||||
Anim {}
|
Anim {}
|
||||||
@@ -148,12 +280,12 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if ((root.slim && !ChatState.narrowSidebarExpanded) || ChatState.shrinkSidebarOverride) {
|
if (root.slim && !ChatState.narrowSidebarExpanded) {
|
||||||
root.requestExpand();
|
root.requestExpand();
|
||||||
ChatState.shrinkSidebarOverride = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modelsContainer.expanded = false;
|
||||||
ChatState.fabExpanded = !ChatState.fabExpanded;
|
ChatState.fabExpanded = !ChatState.fabExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,13 +316,9 @@ Item {
|
|||||||
name: "pop out in window"
|
name: "pop out in window"
|
||||||
icon: "open_in_new"
|
icon: "open_in_new"
|
||||||
}
|
}
|
||||||
ListElement {
|
|
||||||
name: "shrink sidebar"
|
|
||||||
icon: "left_panel_close"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: fabMenuItem
|
id: fabMenuItem
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
@@ -201,19 +329,7 @@ Item {
|
|||||||
|
|
||||||
radius: sLayer.pressed ? Tokens.rounding.small : implicitHeight / 2
|
radius: sLayer.pressed ? Tokens.rounding.small : implicitHeight / 2
|
||||||
color: Colors.palette.m3primaryContainer
|
color: Colors.palette.m3primaryContainer
|
||||||
visible: {
|
visible: !(modelData.name === "pop out in window" && ChatState.isWindow)
|
||||||
const n = modelData.name;
|
|
||||||
const w = ChatState.isWindow;
|
|
||||||
const wide = ChatState.isWide;
|
|
||||||
|
|
||||||
if (n === "pop out in window" && w)
|
|
||||||
return false;
|
|
||||||
if (n === "shrink sidebar" && (!w || !wide))
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Behavior on radius {
|
Behavior on radius {
|
||||||
Anim {
|
Anim {
|
||||||
@@ -287,7 +403,7 @@ Item {
|
|||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
text: fabMenuItem.modelData.icon
|
text: fabMenuItem.modelData.icon
|
||||||
color: Colors.palette.m3onPrimaryContainer
|
color: Colors.palette.m3onPrimaryContainer
|
||||||
fontStyle: Tokens.font.icon.large
|
fontStyle: Tokens.font.icon.medium
|
||||||
fill: 1
|
fill: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,8 +429,6 @@ Item {
|
|||||||
root.newChatRequest();
|
root.newChatRequest();
|
||||||
else if (name === "pop out in window")
|
else if (name === "pop out in window")
|
||||||
Detach.create();
|
Detach.create();
|
||||||
else if (name === "shrink sidebar")
|
|
||||||
ChatState.shrinkSidebarOverride = true;
|
|
||||||
|
|
||||||
ChatState.fabExpanded = false;
|
ChatState.fabExpanded = false;
|
||||||
}
|
}
|
||||||
+17
-27
@@ -6,7 +6,7 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Modules.Sidebar
|
import qs.Modules.Notifications.Sidebar
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -17,26 +17,15 @@ Item {
|
|||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.small
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (ChatState.firstOpen) {
|
|
||||||
ChatState.openDraft();
|
|
||||||
stack.push(chatList);
|
|
||||||
stack.push(chatContent);
|
|
||||||
ChatState.firstOpen = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ChatState.inChat) {
|
if (ChatState.inChat) {
|
||||||
stack.push(chatList);
|
stack.push(chatList);
|
||||||
stack.push(chatContent);
|
stack.push(chatContent, {
|
||||||
|
"chatData": ChatState.chatSession
|
||||||
|
});
|
||||||
} else
|
} else
|
||||||
stack.push(chatList);
|
stack.push(chatList);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openChat(): void {
|
|
||||||
if (stack.depth < 2)
|
|
||||||
stack.push(chatContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stack
|
id: stack
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -46,23 +35,27 @@ Item {
|
|||||||
id: chatList
|
id: chatList
|
||||||
|
|
||||||
ChatList {
|
ChatList {
|
||||||
model: LlmClient.chats
|
model: ScriptModel {
|
||||||
|
values: Chat.chats.values
|
||||||
|
}
|
||||||
|
|
||||||
onDeleteChatRequest: chat => {
|
onDeleteChatRequest: chat => {
|
||||||
const wasCurrent = chat === ChatState.chatSession;
|
Chat.chats.remove(chat);
|
||||||
LlmClient.chats.remove(chat);
|
|
||||||
if (wasCurrent)
|
|
||||||
ChatState.openDraft();
|
|
||||||
}
|
}
|
||||||
onLoadChatRequest: (chat, index) => {
|
onLoadChatRequest: (chat, index) => {
|
||||||
ChatState.chatSession = chat;
|
stack.push(chatContent, {
|
||||||
openChat();
|
"chatData": chat
|
||||||
|
});
|
||||||
ChatState.inChat = true;
|
ChatState.inChat = true;
|
||||||
|
ChatState.chatSession = chat;
|
||||||
}
|
}
|
||||||
onNewChatRequest: {
|
onNewChatRequest: {
|
||||||
ChatState.openDraft();
|
const data = Chat.chats.insert();
|
||||||
openChat();
|
stack.push(chatContent, {
|
||||||
|
"chatData": data
|
||||||
|
});
|
||||||
ChatState.inChat = true;
|
ChatState.inChat = true;
|
||||||
|
ChatState.chatSession = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,12 +64,9 @@ Item {
|
|||||||
id: chatContent
|
id: chatContent
|
||||||
|
|
||||||
ChatContent {
|
ChatContent {
|
||||||
chatData: ChatState.chatSession
|
|
||||||
|
|
||||||
onRequestClose: {
|
onRequestClose: {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
ChatState.inChat = false;
|
ChatState.inChat = false;
|
||||||
ChatState.openDraft();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-12
@@ -8,10 +8,9 @@ import qs.Services
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ChatSession chatSession: LlmClient.chats.draft()
|
property ChatSession chatSession
|
||||||
readonly property string title: chatSession?.title || "Chat"
|
readonly property string title: chatSession ? chatSession.title : "Chat"
|
||||||
property int currentIdx: -1
|
property int currentIdx: -1
|
||||||
property bool firstOpen: true
|
|
||||||
property bool inChat: false
|
property bool inChat: false
|
||||||
property bool fabExpanded: false
|
property bool fabExpanded: false
|
||||||
property bool isWindow: false
|
property bool isWindow: false
|
||||||
@@ -19,18 +18,10 @@ Singleton {
|
|||||||
property bool settledSlim: false
|
property bool settledSlim: false
|
||||||
property bool settledWide: false
|
property bool settledWide: false
|
||||||
property bool narrowSidebarExpanded: false
|
property bool narrowSidebarExpanded: false
|
||||||
property bool shrinkSidebarOverride: false
|
property bool windowIsWide: false
|
||||||
property ShellScreen screen
|
property ShellScreen screen
|
||||||
property bool sidebarVisible: ShellState.forActive().sidebar
|
property bool sidebarVisible: ShellState.forActive().sidebar
|
||||||
|
|
||||||
function openDraft(): void {
|
|
||||||
root.chatSession = LlmClient.chats.draft();
|
|
||||||
root.currentIdx = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
onIsWideChanged: if (isWide)
|
|
||||||
narrowSidebarExpanded = false
|
|
||||||
|
|
||||||
onSidebarVisibleChanged: if (!sidebarVisible)
|
onSidebarVisibleChanged: if (!sidebarVisible)
|
||||||
fabExpanded = false
|
fabExpanded = false
|
||||||
}
|
}
|
||||||
+5
-9
@@ -9,11 +9,12 @@ import qs.Services
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property ChatGeneration current
|
||||||
required property TextEdit edit
|
required property TextEdit edit
|
||||||
required property bool hovered
|
required property bool hovered
|
||||||
required property bool isUser
|
required property bool isUser
|
||||||
required property ChatMessage message
|
required property ChatMessage message
|
||||||
required property bool running
|
required property LlmSegment segment
|
||||||
|
|
||||||
implicitHeight: editButton.implicitHeight
|
implicitHeight: editButton.implicitHeight
|
||||||
implicitWidth: generationTools.implicitWidth + editTools.implicitWidth + Tokens.spacing.small
|
implicitWidth: generationTools.implicitWidth + editTools.implicitWidth + Tokens.spacing.small
|
||||||
@@ -28,7 +29,6 @@ Item {
|
|||||||
enabled: root.message.generationCount > 1 && root.message.activeGenerationIndex !== 0
|
enabled: root.message.generationCount > 1 && root.message.activeGenerationIndex !== 0
|
||||||
icon: "chevron_left"
|
icon: "chevron_left"
|
||||||
type: IconButton.Tonal
|
type: IconButton.Tonal
|
||||||
isRound: true
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!root.edit.readOnly)
|
if (!root.edit.readOnly)
|
||||||
@@ -40,7 +40,7 @@ Item {
|
|||||||
IconButton {
|
IconButton {
|
||||||
enabled: false
|
enabled: false
|
||||||
icon: `${root.message.activeGenerationIndex + 1}`
|
icon: `${root.message.activeGenerationIndex + 1}`
|
||||||
label.font: Tokens.font.body.small
|
label.font: Tokens.font.label.small
|
||||||
type: IconButton.Text
|
type: IconButton.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ Item {
|
|||||||
enabled: root.message.generationCount > 1 && root.message.activeGenerationIndex !== root.message.generationCount - 1
|
enabled: root.message.generationCount > 1 && root.message.activeGenerationIndex !== root.message.generationCount - 1
|
||||||
icon: "chevron_right"
|
icon: "chevron_right"
|
||||||
type: IconButton.Tonal
|
type: IconButton.Tonal
|
||||||
isRound: true
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!root.edit.readOnly)
|
if (!root.edit.readOnly)
|
||||||
@@ -62,7 +61,7 @@ Item {
|
|||||||
id: editTools
|
id: editTools
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
opacity: !root.running && root.hovered ? 1 : 0
|
opacity: !root.current.streaming && root.hovered ? 1 : 0
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
|
|
||||||
@@ -76,7 +75,6 @@ Item {
|
|||||||
inactiveOnColor: Colors.palette.m3onSecondary
|
inactiveOnColor: Colors.palette.m3onSecondary
|
||||||
scale: root.edit.readOnly ? 1 : 0
|
scale: root.edit.readOnly ? 1 : 0
|
||||||
visible: !root.isUser
|
visible: !root.isUser
|
||||||
isRound: true
|
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
Anim {}
|
Anim {}
|
||||||
@@ -92,13 +90,12 @@ Item {
|
|||||||
inactiveColor: Colors.palette.m3secondary
|
inactiveColor: Colors.palette.m3secondary
|
||||||
inactiveOnColor: Colors.palette.m3onSecondary
|
inactiveOnColor: Colors.palette.m3onSecondary
|
||||||
scale: root.edit.readOnly ? 1 : 0
|
scale: root.edit.readOnly ? 1 : 0
|
||||||
isRound: true
|
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
Anim {}
|
Anim {}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: Quickshell.clipboardText = root.message.content
|
onClicked: Quickshell.clipboardText = root.current.content
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
@@ -108,7 +105,6 @@ Item {
|
|||||||
inactiveColor: Colors.palette.m3tertiary
|
inactiveColor: Colors.palette.m3tertiary
|
||||||
inactiveOnColor: Colors.palette.m3onTertiary
|
inactiveOnColor: Colors.palette.m3onTertiary
|
||||||
visible: root.isUser
|
visible: root.isUser
|
||||||
isRound: true
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.edit.readOnly = !root.edit.readOnly;
|
root.edit.readOnly = !root.edit.readOnly;
|
||||||
+3
-7
@@ -3,7 +3,7 @@ import ZShell.Llm
|
|||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Modules.Sidebar.Chat
|
import qs.Modules.Notifications.Sidebar.Chat
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -34,12 +34,8 @@ Item {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const attach = () => {
|
const attach = () => {
|
||||||
incubator.object.anchors.top = container.top;
|
incubator.object.anchors.fill = container;
|
||||||
incubator.object.anchors.bottom = container.bottom;
|
|
||||||
incubator.object.anchors.margins = Tokens.padding.medium;
|
|
||||||
incubator.object.anchors.horizontalCenter = container.horizontalCenter;
|
|
||||||
incubator.object.requestClose.connect(root.requestClose);
|
incubator.object.requestClose.connect(root.requestClose);
|
||||||
incubator.object.implicitWidth = Qt.binding(() => Math.max(Math.min(container.width - Tokens.padding.medium * 2, 800), Config.sidebar.sizes.width));
|
|
||||||
currentItem = incubator.object;
|
currentItem = incubator.object;
|
||||||
root.loading = false;
|
root.loading = false;
|
||||||
if (!noAnim)
|
if (!noAnim)
|
||||||
@@ -70,7 +66,7 @@ Item {
|
|||||||
|
|
||||||
LoadingIndicator {
|
LoadingIndicator {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
implicitSize: Tokens.font.icon.extraLarge.pointSize * 4
|
implicitSize: Tokens.font.icon.large.pointSize * 4
|
||||||
opacity: root.loading ? 1 : 0
|
opacity: root.loading ? 1 : 0
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
|
|
||||||
+8
-8
@@ -220,8 +220,9 @@ CustomRect {
|
|||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: root.codeHeaderColor
|
color: root.codeHeaderColor
|
||||||
font: Tokens.font.label.builders.small.capitalization(Font.Capitalize).build()
|
font: Tokens.font.label.small
|
||||||
text: CodeIcons.name(root.language)
|
text: CodeIcons.name(root.language)
|
||||||
|
visible: root.language.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -251,7 +252,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: codeRect
|
id: codeRect
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -264,7 +265,6 @@ CustomRect {
|
|||||||
implicitWidth: codeText.implicitWidth + codeFlick.anchors.margins * 2
|
implicitWidth: codeText.implicitWidth + codeFlick.anchors.margins * 2
|
||||||
implicitHeight: codeText.implicitHeight + codeFlick.anchors.margins * 2
|
implicitHeight: codeText.implicitHeight + codeFlick.anchors.margins * 2
|
||||||
color: CodeColors.active.bg
|
color: CodeColors.active.bg
|
||||||
clip: true
|
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: codeFlick
|
id: codeFlick
|
||||||
@@ -272,9 +272,6 @@ CustomRect {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.small
|
||||||
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
contentWidth: codeText.implicitWidth
|
|
||||||
|
|
||||||
CustomScrollBar.horizontal: CustomScrollBar {
|
CustomScrollBar.horizontal: CustomScrollBar {
|
||||||
flickable: codeFlick
|
flickable: codeFlick
|
||||||
parent: codeFlick.parent
|
parent: codeFlick.parent
|
||||||
@@ -283,13 +280,16 @@ CustomRect {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
TextAreaBase.flickable: TextAreaBase {
|
||||||
id: codeText
|
id: codeText
|
||||||
|
|
||||||
color: CodeColors.active.normal
|
color: CodeColors.active.normal
|
||||||
|
layer.enabled: true
|
||||||
|
clip: false
|
||||||
font: Tokens.font.mono.small
|
font: Tokens.font.mono.small
|
||||||
textFormat: Text.RichText
|
textFormat: root.colored ? Text.RichText : Text.PlainText
|
||||||
text: root.colored ? root.html : root.plainForDisplay(root.code)
|
text: root.colored ? root.html : root.plainForDisplay(root.code)
|
||||||
|
readOnly: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
+15
-13
@@ -2,7 +2,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import ZShell.Llm
|
import ZShell.Llm
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Modules.Sidebar.Chat
|
import qs.Modules.Notifications.Sidebar.Chat
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -10,13 +10,12 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool isUser
|
required property bool isUser
|
||||||
required property string text
|
required property LlmSegment segment
|
||||||
required property var blocks
|
|
||||||
required property bool running
|
|
||||||
required property bool hovered
|
required property bool hovered
|
||||||
required property Repeater repeater
|
required property Repeater repeater
|
||||||
required property int index
|
required property int index
|
||||||
required property ChatMessage message
|
required property ChatMessage message
|
||||||
|
required property ChatGeneration current
|
||||||
|
|
||||||
readonly property real contentMaxWidth: width - Tokens.spacing.extraSmall - Tokens.spacing.extraLarge
|
readonly property real contentMaxWidth: width - Tokens.spacing.extraSmall - Tokens.spacing.extraLarge
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ Item {
|
|||||||
|
|
||||||
implicitHeight: bubble.implicitHeight + (actionsRow.shouldBeActive ? actionsRow.implicitHeight + actionsRow.anchors.topMargin : 0)
|
implicitHeight: bubble.implicitHeight + (actionsRow.shouldBeActive ? actionsRow.implicitHeight + actionsRow.anchors.topMargin : 0)
|
||||||
|
|
||||||
CustomRect {
|
CustomClippingRect {
|
||||||
id: bubble
|
id: bubble
|
||||||
|
|
||||||
property real liveTargetWidth: root.isUser ? Math.min(msgText.implicitWidth + Tokens.padding.medium * 2, root.contentMaxWidth) : root.contentMaxWidth
|
property real liveTargetWidth: root.isUser ? Math.min(msgText.implicitWidth + Tokens.padding.medium * 2, root.contentMaxWidth) : root.contentMaxWidth
|
||||||
@@ -35,9 +34,10 @@ Item {
|
|||||||
radius: Tokens.rounding.medium
|
radius: Tokens.rounding.medium
|
||||||
color: root.isUser ? Colors.palette.m3primary : Colors.palette.m3surfaceContainer
|
color: root.isUser ? Colors.palette.m3primary : Colors.palette.m3surfaceContainer
|
||||||
implicitWidth: layoutFrozen ? frozenWidth : layoutWidth
|
implicitWidth: layoutFrozen ? frozenWidth : layoutWidth
|
||||||
implicitHeight: root.isUser ? msgText.contentHeight + Tokens.padding.medium * 2 : markdown.implicitHeight + markdown.anchors.topMargin * 2
|
implicitHeight: root.isUser ? msgText.contentHeight + Tokens.padding.medium * 2 : blocks.implicitHeight + blocks.anchors.topMargin * 2
|
||||||
anchors.right: root.isUser ? parent.right : undefined
|
anchors.right: root.isUser ? parent.right : undefined
|
||||||
clip: true
|
layer.enabled: false
|
||||||
|
layer.smooth: true
|
||||||
|
|
||||||
transform: Scale {
|
transform: Scale {
|
||||||
id: stretchScale
|
id: stretchScale
|
||||||
@@ -74,7 +74,7 @@ Item {
|
|||||||
TextEditBase {
|
TextEditBase {
|
||||||
id: msgText
|
id: msgText
|
||||||
|
|
||||||
property string cachedText: root.text
|
property string cachedText: root.segment.text
|
||||||
property bool cancelled: false
|
property bool cancelled: false
|
||||||
|
|
||||||
visible: root.isUser
|
visible: root.isUser
|
||||||
@@ -88,7 +88,7 @@ Item {
|
|||||||
font: Tokens.font.body.small
|
font: Tokens.font.body.small
|
||||||
readOnly: true
|
readOnly: true
|
||||||
selectionColor: Qt.alpha((root.isUser ? Colors.palette.m3onPrimary : Colors.palette.m3primary), 0.4)
|
selectionColor: Qt.alpha((root.isUser ? Colors.palette.m3onPrimary : Colors.palette.m3primary), 0.4)
|
||||||
text: root.isUser ? root.text : ""
|
text: root.isUser ? root.segment.text : ""
|
||||||
textFormat: CustomText.MarkdownText
|
textFormat: CustomText.MarkdownText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
@@ -129,22 +129,23 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assistant content: parsed markdown blocks.
|
||||||
MarkdownBlocks {
|
MarkdownBlocks {
|
||||||
id: markdown
|
id: blocks
|
||||||
|
|
||||||
visible: !root.isUser
|
visible: !root.isUser
|
||||||
anchors.topMargin: Tokens.padding.medium
|
anchors.topMargin: Tokens.padding.medium
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
blocks: root.blocks
|
blocks: root.segment.markdown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Actions {
|
Actions {
|
||||||
id: actionsRow
|
id: actionsRow
|
||||||
|
|
||||||
readonly property bool shouldBeActive: !root.running && root.repeater.count === (root.index + 1)
|
readonly property bool shouldBeActive: (root.segment.type === LlmSegment.Type.Content) && !root.segment.running && root.repeater.count === (root.index + 1)
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: (implicitWidth > bubble.implicitWidth) ? undefined : bubble.right
|
anchors.right: (implicitWidth > bubble.implicitWidth) ? undefined : bubble.right
|
||||||
@@ -155,7 +156,8 @@ Item {
|
|||||||
edit: msgText
|
edit: msgText
|
||||||
hovered: root.hovered
|
hovered: root.hovered
|
||||||
isUser: root.isUser
|
isUser: root.isUser
|
||||||
running: root.running
|
segment: root.segment
|
||||||
|
current: root.current
|
||||||
message: root.message
|
message: root.message
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
+1
-1
@@ -16,7 +16,7 @@ ColumnLayout {
|
|||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.tPalette.m3outlineVariant
|
color: Colors.tPalette.m3outlineVariant
|
||||||
fontStyle: Tokens.font.icon.extraLarge
|
fontStyle: Tokens.font.icon.large
|
||||||
text: "chat"
|
text: "chat"
|
||||||
}
|
}
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user