Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
99e64a7713
433 files changed
+57792
No files matched your search
@@ -0,0 +1,111 @@
|
||||
import QtQuick
|
||||
import "../core"
|
||||
import "../theme"
|
||||
|
||||
// A popup that grows out of the bar (Caelestia-style drawer). Place it at
|
||||
// y = BarDrawers.bottom in a window whose top is the screen's top edge: the
|
||||
// layer box then starts above the bar, so the join is not a glass edge.
|
||||
// Content slides down with the body as it is revealed.
|
||||
Item {
|
||||
id: root
|
||||
default property alias content: inner.data
|
||||
property bool open: false
|
||||
property bool attached: true
|
||||
property real contentWidth: 300
|
||||
property real contentHeight: 200
|
||||
// Registered with the bar so it opens its border over this span.
|
||||
property string drawerId: ""
|
||||
property string screenName: ""
|
||||
property real screenX: 0
|
||||
readonly property real ear: attached ? BarDrawers.ear : 0
|
||||
// "slide" unrolls out of the bar; "drop" falls into place and away
|
||||
// downwards; "fade" fades in place; "shrink" grows from / shrinks to nothing.
|
||||
property string style: "slide"
|
||||
readonly property bool unrolls: style === "slide"
|
||||
property real progress: open ? 1 : 0
|
||||
readonly property real revealed: unrolls ? Math.max(0, contentHeight * progress) : contentHeight
|
||||
// Drop moves down on the way in and on the way out.
|
||||
property real dropFrom: -1
|
||||
onOpenChanged: dropFrom = open ? -1 : 1
|
||||
readonly property bool shown: progress > 0.001
|
||||
readonly property bool settled: !anim.running && open
|
||||
// Input/hover region: the full body as soon as it opens (the pointer may
|
||||
// reach the drawer before the reveal finishes), the visible part while closing.
|
||||
readonly property alias body: area
|
||||
readonly property bool hovered: hover.hovered
|
||||
// Content parent, for items reparented in at runtime.
|
||||
readonly property alias container: inner
|
||||
// Enter: emphasized decelerate; exit: emphasized accelerate (Material 3).
|
||||
Behavior on progress {
|
||||
NumberAnimation {
|
||||
id: anim
|
||||
duration: root.open ? Theme.duration * 1.8 : Theme.duration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.open ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1]
|
||||
}
|
||||
}
|
||||
implicitWidth: contentWidth + 2 * ear
|
||||
implicitHeight: contentHeight
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
// Input/hover region stays put; only the drawn drawer animates.
|
||||
Item {
|
||||
id: area
|
||||
x: root.ear
|
||||
width: root.contentWidth
|
||||
height: root.open ? root.contentHeight : root.revealed
|
||||
}
|
||||
// On the root so it wraps the content: a sibling under the content would
|
||||
// lose hover to the content's own hover areas.
|
||||
HoverHandler {
|
||||
id: hover
|
||||
}
|
||||
Item {
|
||||
id: motion
|
||||
width: root.width
|
||||
height: root.height
|
||||
opacity: root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
|
||||
scale: root.style === "shrink" ? Math.max(0.001, root.progress) : 1
|
||||
transformOrigin: Item.Center
|
||||
transform: Translate {
|
||||
y: root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
|
||||
}
|
||||
DrawerShape {
|
||||
id: shape
|
||||
bodyWidth: root.contentWidth
|
||||
bodyHeight: root.revealed
|
||||
ear: BarDrawers.ear
|
||||
attached: root.attached
|
||||
}
|
||||
Item {
|
||||
id: hit
|
||||
x: root.ear
|
||||
width: root.contentWidth
|
||||
height: root.revealed
|
||||
clip: true
|
||||
Item {
|
||||
id: inner
|
||||
width: root.contentWidth
|
||||
height: root.contentHeight
|
||||
y: root.revealed - root.contentHeight
|
||||
opacity: root.unrolls ? Math.min(1, root.progress * 1.6) : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property bool joined: attached && (unrolls ? shown : progress > 0.5)
|
||||
readonly property var gapKey: [joined, screenName, Math.round(screenX), Math.round(width)]
|
||||
onGapKeyChanged: syncGap()
|
||||
Component.onCompleted: syncGap()
|
||||
Component.onDestruction: if (drawerId)
|
||||
BarDrawers.clearGap(drawerId)
|
||||
function syncGap() {
|
||||
if (!drawerId)
|
||||
return;
|
||||
if (joined && screenName)
|
||||
BarDrawers.setGap(drawerId, screenName, screenX, screenX + width);
|
||||
else
|
||||
BarDrawers.clearGap(drawerId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import "../theme"
|
||||
|
||||
// Drawer body hanging from the bar: concave "ears" blend it into the bar's
|
||||
// bottom edge and its top side has no border, so bar and drawer read as one
|
||||
// shape. `bodyHeight` is the revealed height; detached drawers are plain cards.
|
||||
Item {
|
||||
id: root
|
||||
property real bodyWidth: 300
|
||||
property real bodyHeight: 200
|
||||
property real ear: 16
|
||||
property real radius: Theme.radius
|
||||
property bool attached: true
|
||||
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
|
||||
property color borderColor: Theme.border
|
||||
implicitWidth: bodyWidth + (attached ? 2 * ear : 0)
|
||||
implicitHeight: bodyHeight
|
||||
readonly property real w: implicitWidth
|
||||
readonly property real h: Math.max(0, bodyHeight)
|
||||
// Ears and corners shrink while the drawer is still short.
|
||||
readonly property real e: Math.min(ear, h)
|
||||
readonly property real r: Math.max(0, Math.min(radius, h - e, bodyWidth / 2))
|
||||
readonly property string body: {
|
||||
const W = w, E = ear, h = root.h, e = root.e, r = root.r;
|
||||
return `L ${W - E} ${h - r} A ${r} ${r} 0 0 1 ${W - E - r} ${h} L ${E + r} ${h} A ${r} ${r} 0 0 1 ${E} ${h - r} L ${E} ${e}`;
|
||||
}
|
||||
visible: h > 0.5
|
||||
|
||||
Shape {
|
||||
anchors.fill: parent
|
||||
visible: root.attached
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
ShapePath {
|
||||
fillColor: root.fillColor
|
||||
strokeColor: "transparent"
|
||||
strokeWidth: 0
|
||||
PathSvg {
|
||||
path: `M 0 0 L ${root.w} 0 A ${root.ear} ${root.e} 0 0 0 ${root.w - root.ear} ${root.e} ${root.body} A ${root.ear} ${root.e} 0 0 0 0 0 Z`
|
||||
}
|
||||
}
|
||||
// Outline everywhere except along the bar.
|
||||
ShapePath {
|
||||
fillColor: "transparent"
|
||||
strokeColor: root.borderColor
|
||||
strokeWidth: 1
|
||||
PathSvg {
|
||||
path: `M 0 0.5 A ${root.ear} ${root.e} 0 0 1 ${root.ear} ${root.e} L ${root.ear} ${root.h - root.r} A ${root.r} ${root.r} 0 0 0 ${root.ear + root.r} ${root.h - 0.5} L ${root.w - root.ear - root.r} ${root.h - 0.5} A ${root.r} ${root.r} 0 0 0 ${root.w - root.ear} ${root.h - root.r} L ${root.w - root.ear} ${root.e} A ${root.ear} ${root.e} 0 0 1 ${root.w} 0.5`
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: !root.attached
|
||||
radius: Math.min(root.radius, root.h / 2)
|
||||
color: root.fillColor
|
||||
border.width: 1
|
||||
border.color: root.borderColor
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
|
||||
// Thick pill slider with an icon inside the track (macOS Control Center style).
|
||||
Slider {
|
||||
id: root
|
||||
property string glyph
|
||||
property string fallback
|
||||
implicitWidth: 220
|
||||
implicitHeight: 28
|
||||
padding: 0
|
||||
background: Rectangle {
|
||||
x: root.leftPadding
|
||||
y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
width: root.availableWidth
|
||||
height: root.availableHeight
|
||||
radius: height / 2
|
||||
color: Theme.surfaceVariant
|
||||
border.width: root.activeFocus ? 1 : 0
|
||||
border.color: Theme.accent
|
||||
Rectangle {
|
||||
readonly property real knob: parent.height
|
||||
width: Math.max(knob, knob + root.visualPosition * (parent.width - knob))
|
||||
height: parent.height
|
||||
radius: height / 2
|
||||
color: root.enabled ? Qt.alpha(Theme.text, 0.92) : Qt.alpha(Theme.text, 0.35)
|
||||
Behavior on width {
|
||||
enabled: !root.pressed
|
||||
NumberAnimation {
|
||||
duration: Theme.duration / 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: (parent.height - width) / 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: Icons.available && root.glyph ? root.glyph : root.fallback
|
||||
font.family: Icons.available && root.glyph ? Icons.family : ""
|
||||
font.pixelSize: Math.round(parent.height * 0.5)
|
||||
color: Theme.surface
|
||||
}
|
||||
}
|
||||
handle: Rectangle {
|
||||
x: root.leftPadding + root.visualPosition * (root.availableWidth - width)
|
||||
y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
width: root.availableHeight
|
||||
height: root.availableHeight
|
||||
radius: width / 2
|
||||
color: root.enabled ? Theme.text : Qt.alpha(Theme.text, 0.5)
|
||||
border.width: 1
|
||||
border.color: Qt.alpha(Theme.surface, 0.5)
|
||||
scale: root.pressed ? 1.06 : 1
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
|
||||
Button {
|
||||
id: root
|
||||
property bool accented: false
|
||||
implicitWidth: Math.max(40, label.implicitWidth + 28)
|
||||
implicitHeight: 36
|
||||
hoverEnabled: true
|
||||
transform: Translate {
|
||||
y: root.hovered && !root.down ? -Theme.intensity : 0
|
||||
Behavior on y {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration / 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
scale: down ? 1 - 0.04 * Theme.intensity : 1
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration / 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
contentItem: Text {
|
||||
id: label
|
||||
text: root.text
|
||||
color: root.accented ? (root.down ? Theme.accentPressedText : root.hovered ? Theme.accentHoverText : Theme.accentText) : Theme.text
|
||||
font.pixelSize: 13
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
background: Rectangle {
|
||||
radius: height / 2
|
||||
color: root.accented ? (root.down ? Theme.accentPressed : root.hovered ? Theme.accentHover : Theme.accent) : root.hovered ? Theme.hover : Theme.surfaceVariant
|
||||
border.width: root.activeFocus ? 2 : 1
|
||||
border.color: root.activeFocus ? Theme.accent : Theme.border
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
opacity: enabled ? 1 : 0.45
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../theme"
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property color selectedColor: Theme.accent
|
||||
property real hue: 0
|
||||
property real saturation: 1
|
||||
property real brightness: 1
|
||||
signal chosen(color color)
|
||||
function sync() {
|
||||
if (selectedColor.hsvHue >= 0)
|
||||
hue = selectedColor.hsvHue;
|
||||
saturation = selectedColor.hsvSaturation;
|
||||
brightness = selectedColor.hsvValue;
|
||||
}
|
||||
function commit() {
|
||||
chosen(Qt.hsva(hue, saturation, brightness, 1));
|
||||
}
|
||||
onSelectedColorChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Rectangle {
|
||||
id: field
|
||||
objectName: "colorSaturationValue"
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 150
|
||||
color: Qt.hsva(root.hue, 1, 1, 1)
|
||||
radius: 8
|
||||
clip: true
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: Qt.rgba(1, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: Qt.rgba(1, 1, 1, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: Qt.rgba(0, 0, 0, 0)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: Qt.rgba(0, 0, 0, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
x: root.saturation * (parent.width - 12)
|
||||
y: (1 - root.brightness) * (parent.height - 12)
|
||||
width: 12
|
||||
height: 12
|
||||
radius: 6
|
||||
color: Theme.transparent
|
||||
border.width: 2
|
||||
border.color: Theme.text
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
function pick(x, y) {
|
||||
root.saturation = Math.max(0, Math.min(1, x / width));
|
||||
root.brightness = 1 - Math.max(0, Math.min(1, y / height));
|
||||
root.commit();
|
||||
}
|
||||
onPressed: event => pick(event.x, event.y)
|
||||
onPositionChanged: event => {
|
||||
if (pressed)
|
||||
pick(event.x, event.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
id: hueSlider
|
||||
objectName: "colorHue"
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 1
|
||||
value: root.hue
|
||||
onMoved: {
|
||||
root.hue = value;
|
||||
root.commit();
|
||||
}
|
||||
background: Rectangle {
|
||||
x: hueSlider.leftPadding
|
||||
y: hueSlider.topPadding + hueSlider.availableHeight / 2 - height / 2
|
||||
width: hueSlider.availableWidth
|
||||
height: 10
|
||||
radius: 5
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: Qt.hsva(0, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.1667
|
||||
color: Qt.hsva(0.1667, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.3333
|
||||
color: Qt.hsva(0.3333, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.5
|
||||
color: Qt.hsva(0.5, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.6667
|
||||
color: Qt.hsva(0.6667, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.8333
|
||||
color: Qt.hsva(0.8333, 1, 1, 1)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: Qt.hsva(1, 1, 1, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
|
||||
ComboBox {
|
||||
id: root
|
||||
implicitWidth: 180
|
||||
implicitHeight: 38
|
||||
leftPadding: 12
|
||||
rightPadding: 30
|
||||
background: Rectangle {
|
||||
radius: 10
|
||||
color: root.hovered ? Theme.hover : Theme.surfaceVariant
|
||||
border.color: root.activeFocus ? Theme.accent : Theme.border
|
||||
}
|
||||
contentItem: Text {
|
||||
text: root.displayText
|
||||
color: Theme.text
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
font: root.font
|
||||
}
|
||||
indicator: Text {
|
||||
text: "⌄"
|
||||
color: Theme.textSecondary
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
delegate: ItemDelegate {
|
||||
id: entry
|
||||
required property var modelData
|
||||
required property int index
|
||||
width: root.width - 16
|
||||
highlighted: root.highlightedIndex === index
|
||||
contentItem: Text {
|
||||
text: root.textRole ? entry.modelData[root.textRole] : entry.modelData
|
||||
color: Theme.text
|
||||
elide: Text.ElideRight
|
||||
font: root.font
|
||||
}
|
||||
background: Rectangle {
|
||||
radius: 8
|
||||
color: entry.highlighted ? Qt.alpha(Theme.accent, 0.2) : Theme.transparent
|
||||
}
|
||||
}
|
||||
popup: Popup {
|
||||
y: root.height + 6
|
||||
// Stay inside the window: panel-sized layer surfaces clip anything outside.
|
||||
margins: 6
|
||||
width: root.width
|
||||
padding: 8
|
||||
implicitHeight: Math.min(contentItem.implicitHeight + 16, 300)
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: root.popup.visible ? root.delegateModel : null
|
||||
currentIndex: root.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
}
|
||||
background: GlassPanel {
|
||||
surfaceOpacity: Math.max(Theme.panelOpacity, 0.85)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
// Icon tile: a Nerd Font glyph when one is installed, otherwise the fallback text.
|
||||
Rectangle {
|
||||
id: root
|
||||
property string glyph: ""
|
||||
property string fallback: ""
|
||||
// An image (e.g. the project crest) replaces the glyph when set.
|
||||
property url image: ""
|
||||
property bool active: false
|
||||
property int size: 30
|
||||
property int glyphSize: Math.round(size * 0.5)
|
||||
property color glyphColor: active ? Theme.accentText : Theme.text
|
||||
implicitWidth: size
|
||||
implicitHeight: size
|
||||
radius: Math.min(size / 2, Math.max(6, Theme.radius * 0.4))
|
||||
color: active ? Theme.accent : Theme.surfaceVariant
|
||||
border.width: active ? 0 : 1
|
||||
border.color: Theme.hairline
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Math.round(root.size * 0.12)
|
||||
visible: root.image.toString() !== ""
|
||||
source: root.image
|
||||
sourceSize: Qt.size(root.size * 2, root.size * 2)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
smooth: true
|
||||
mipmap: true
|
||||
asynchronous: true
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: root.image.toString() === ""
|
||||
text: Icons.available && root.glyph ? root.glyph : root.fallback
|
||||
font.family: Icons.available && root.glyph ? Icons.family : ""
|
||||
font.pixelSize: Icons.available && root.glyph ? root.glyphSize : Math.round(root.glyphSize * 0.9)
|
||||
font.weight: Font.DemiBold
|
||||
color: root.glyphColor
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import QtQuick
|
||||
GlassButton { implicitWidth: 36; implicitHeight: 36 }
|
||||
@@ -0,0 +1,7 @@
|
||||
import QtQuick
|
||||
GlassPopup {
|
||||
default property alias entries: content.data
|
||||
property alias contentItem: content
|
||||
implicitWidth: 280
|
||||
Item { id: content; anchors.fill: parent; anchors.margins: 8 }
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import "../theme"
|
||||
Item {
|
||||
id: root
|
||||
property string text: ""
|
||||
property string iconSource: ""
|
||||
property bool separator: false
|
||||
property bool actionEnabled: true
|
||||
property bool selected: false
|
||||
property bool submenu: false
|
||||
property int buttonType: QsMenuButtonType.None
|
||||
property int checkState: Qt.Unchecked
|
||||
signal invoked()
|
||||
signal entered()
|
||||
implicitWidth: 264
|
||||
implicitHeight: separator ? 9 : 34
|
||||
Accessible.role: separator ? Accessible.Separator : Accessible.MenuItem
|
||||
Accessible.name: text
|
||||
Accessible.checkable: buttonType !== QsMenuButtonType.None
|
||||
Accessible.checked: checkState === Qt.Checked
|
||||
Accessible.onPressAction: if (actionEnabled && !separator) invoked()
|
||||
Rectangle { anchors.verticalCenter: parent.verticalCenter; width: parent.width; height: 1; color: Theme.border; visible: root.separator }
|
||||
Rectangle {
|
||||
anchors.fill: parent; radius: 9; visible: !root.separator
|
||||
color: root.selected && root.actionEnabled ? Qt.alpha(Theme.accent, 0.22) : Theme.transparent
|
||||
Behavior on color { ColorAnimation { duration: Theme.duration / 2 } }
|
||||
}
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter; x: 8; spacing: 8; visible: !root.separator
|
||||
opacity: root.actionEnabled ? 1 : 0.4
|
||||
Item {
|
||||
width: 18; height: 18
|
||||
Rectangle {
|
||||
anchors.centerIn: parent; width: 14; height: 14
|
||||
radius: root.buttonType === QsMenuButtonType.RadioButton ? 7 : 3
|
||||
visible: root.buttonType !== QsMenuButtonType.None
|
||||
color: Theme.transparent; border.width: 1
|
||||
border.color: root.checkState === Qt.Unchecked ? Theme.textSecondary : Theme.accent
|
||||
Rectangle { anchors.centerIn: parent; width: 6; height: 6; radius: 3; color: Theme.accent; visible: root.buttonType === QsMenuButtonType.RadioButton && root.checkState === Qt.Checked }
|
||||
Text { anchors.centerIn: parent; text: root.checkState === Qt.PartiallyChecked ? "−" : "✓"; font.pixelSize: 12; color: Theme.accent; visible: root.buttonType !== QsMenuButtonType.RadioButton && root.checkState !== Qt.Unchecked }
|
||||
}
|
||||
Image { anchors.fill: parent; source: root.iconSource; sourceSize.width: 18; sourceSize.height: 18; visible: root.buttonType === QsMenuButtonType.None; fillMode: Image.PreserveAspectFit }
|
||||
}
|
||||
Text { width: root.width - 70; text: root.text; textFormat: Text.PlainText; elide: Text.ElideRight; color: Theme.text; font.pixelSize: 13; height: 18; verticalAlignment: Text.AlignVCenter }
|
||||
Text { text: root.submenu ? "›" : ""; color: Theme.textSecondary; font.pixelSize: 16 }
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent; hoverEnabled: true; enabled: !root.separator
|
||||
onEntered: root.entered()
|
||||
onClicked: if (root.actionEnabled) root.invoked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property real surfaceOpacity: Theme.glassOpacity
|
||||
radius: Theme.radius
|
||||
color: Qt.alpha(Theme.surface, surfaceOpacity)
|
||||
border.width: 1
|
||||
border.color: Theme.border
|
||||
Rectangle {
|
||||
z: -1
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
anchors.bottomMargin: -4
|
||||
radius: root.radius
|
||||
color: Theme.shadow
|
||||
visible: Theme.shadows
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: root.radius
|
||||
visible: Theme.highlights
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: Qt.alpha(Theme.text, 0.035)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.55
|
||||
color: Theme.transparent
|
||||
}
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: Qt.alpha(Theme.shadow, 0.03)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: Math.max(0, parent.width - root.radius * 2)
|
||||
height: 1
|
||||
color: Theme.border
|
||||
visible: Theme.highlights
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import QtQuick
|
||||
GlassPanel { radius: height / 2 }
|
||||
@@ -0,0 +1,31 @@
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
GlassPanel {
|
||||
id: root
|
||||
surfaceOpacity: Theme.panelOpacity
|
||||
property bool opened: false
|
||||
visible: opened || opacity > 0.01
|
||||
opacity: opened ? 1 : 0
|
||||
scale: opened ? 1 : 1 - 0.06 * Theme.intensity
|
||||
transform: Translate {
|
||||
y: root.opened ? 0 : -6 * Theme.intensity
|
||||
Behavior on y {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
// Pill-shaped single choice with a sliding accent indicator.
|
||||
Rectangle {
|
||||
id: root
|
||||
property var model: []
|
||||
property int currentIndex: -1
|
||||
signal activated(int index, string value)
|
||||
// Prettify config keywords ("top-left"); leave names such as "DP-4" untouched.
|
||||
function label(value) {
|
||||
const raw = String(value);
|
||||
if (!/^[a-z][a-z0-9_-]*$/.test(raw))
|
||||
return raw;
|
||||
const text = raw.replace(/[-_]/g, " ");
|
||||
return text.charAt(0).toUpperCase() + text.slice(1);
|
||||
}
|
||||
implicitWidth: row.implicitWidth + 8
|
||||
implicitHeight: 34
|
||||
radius: height / 2
|
||||
color: Theme.surfaceVariant
|
||||
border.width: 1
|
||||
border.color: Theme.border
|
||||
Rectangle {
|
||||
readonly property Item target: root.currentIndex >= 0 && root.currentIndex < segments.count ? segments.itemAt(root.currentIndex) : null
|
||||
visible: target !== null
|
||||
x: target ? row.x + target.x : 4
|
||||
y: 4
|
||||
width: target ? target.width : 0
|
||||
height: root.height - 8
|
||||
radius: height / 2
|
||||
color: Theme.accent
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: row
|
||||
anchors.centerIn: parent
|
||||
Repeater {
|
||||
id: segments
|
||||
model: root.model
|
||||
Item {
|
||||
id: segment
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool selected: root.currentIndex === index
|
||||
width: Math.max(52, caption.implicitWidth + 24)
|
||||
height: root.height - 8
|
||||
Text {
|
||||
id: caption
|
||||
anchors.centerIn: parent
|
||||
text: root.label(segment.modelData)
|
||||
font.pixelSize: 12
|
||||
font.weight: segment.selected ? Font.DemiBold : Font.Normal
|
||||
color: segment.selected ? Theme.accentText : area.containsMouse ? Theme.text : Theme.textSecondary
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.activated(segment.index, String(segment.modelData))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
Slider {
|
||||
id: root
|
||||
implicitWidth: 220; implicitHeight: 32
|
||||
background: Rectangle {
|
||||
x: root.leftPadding; y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
width: root.availableWidth; height: 6; radius: 3; color: Theme.surfaceVariant
|
||||
Rectangle { width: root.visualPosition * parent.width; height: parent.height; radius: 3; color: Theme.accent }
|
||||
}
|
||||
handle: Rectangle {
|
||||
x: root.leftPadding + root.visualPosition * (root.availableWidth - width)
|
||||
y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
width: 18; height: 18; radius: 9; color: Theme.text
|
||||
border.width: root.activeFocus ? 2 : 1; border.color: Theme.accent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
|
||||
TextArea {
|
||||
id: root
|
||||
color: Theme.text
|
||||
placeholderTextColor: Theme.textSecondary
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.accentText
|
||||
selectByMouse: true
|
||||
padding: 10
|
||||
background: Rectangle {
|
||||
radius: 10
|
||||
color: Theme.surfaceVariant
|
||||
border.color: root.activeFocus ? Theme.accent : Theme.border
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
|
||||
TextField {
|
||||
id: root
|
||||
color: Theme.text
|
||||
placeholderTextColor: Theme.textSecondary
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.accentText
|
||||
selectByMouse: true
|
||||
padding: 10
|
||||
background: Rectangle {
|
||||
radius: 10
|
||||
color: Theme.surfaceVariant
|
||||
border.color: root.activeFocus ? Theme.accent : Theme.border
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../theme"
|
||||
Switch {
|
||||
id: root
|
||||
implicitWidth: 52; implicitHeight: 32
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 52; implicitHeight: 30; radius: 15
|
||||
color: root.checked ? Theme.accent : Theme.surfaceVariant
|
||||
border.width: 1; border.color: root.activeFocus ? Theme.accent : Theme.border
|
||||
Rectangle {
|
||||
x: root.checked ? 25 : 4; y: 4; width: 22; height: 22; radius: 11
|
||||
color: root.checked ? Theme.accentText : Theme.text
|
||||
Behavior on x { NumberAnimation { duration: Theme.duration; easing.type: Easing.OutCubic } }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user