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,256 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "../../components"
|
||||
import "../../core"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
import "../../services/SettingsLogic.js" as Logic
|
||||
Item {
|
||||
id: root
|
||||
objectName:"barEditor"
|
||||
implicitHeight: lanes.implicitHeight
|
||||
property var laneItems: []
|
||||
property string dragging: ""
|
||||
property string targetLane: ""
|
||||
property string beforeId: ""
|
||||
// Screen whose layout is edited; "" or a screen without its own layout edits the shared one.
|
||||
property string screenName: ""
|
||||
// Card whose options panel (cog) is open.
|
||||
property string expandedId: ""
|
||||
// Option fields for a module: built-in choice lists, or a plugin's
|
||||
// manifest schema (boolean / integer / number / string / choices).
|
||||
function fieldsFor(id) {
|
||||
if (!ModuleRegistry.isPlugin(id))
|
||||
return (ModuleRegistry.optionSchemas[id] || []).map(f => Object.assign({type:"choice"}, f));
|
||||
return PluginService.schema(String(id).slice(7)).filter(f => f && f.key).map(f => {
|
||||
const choices = Array.isArray(f.choices) ? f.choices : Array.isArray(f.options) ? f.options.map(o => typeof o === "object" ? o.value : o) : null;
|
||||
return Object.assign({}, f, {label: f.label || f.key, type: choices ? "choice" : (f.type || "string"), choices: choices || []});
|
||||
});
|
||||
}
|
||||
function valueOf(entry, field) {
|
||||
if (!ModuleRegistry.isPlugin(entry.id))
|
||||
return ModuleRegistry.option(entry, field.key);
|
||||
return PluginService.widgetSettings(String(entry.id).slice(7), entry.options)[field.key];
|
||||
}
|
||||
function setOption(entry, key, value) {
|
||||
root.save(Logic.editModule(root.modules, entry.id, "options", Object.assign({}, entry.options || {}, {[key]: value})));
|
||||
}
|
||||
readonly property var modules: BarLayout.modulesFor(screenName)
|
||||
function save(list) {
|
||||
BarLayout.save(screenName, list);
|
||||
}
|
||||
function updateDrag(source,x,y) {
|
||||
const p=source.mapToItem(root,x,y);
|
||||
ghost.x=p.x-70;ghost.y=p.y-22;
|
||||
targetLane="";beforeId="";
|
||||
for(let i=0;i<laneItems.length;i++) {
|
||||
const lane=laneItems[i],local=root.mapToItem(lane,p.x,p.y);
|
||||
if(local.x<0 || local.x>lane.width || local.y<0 || local.y>lane.height)continue;
|
||||
targetLane=lane.modelData;
|
||||
for(let j=0;j<lane.cards.count;j++) {
|
||||
const card=lane.cards.itemAt(j),q=root.mapToItem(card,p.x,p.y);
|
||||
if(q.y<card.height/2) {beforeId=card.modelData.id;break;}
|
||||
}
|
||||
}
|
||||
}
|
||||
function finish() {
|
||||
const id=dragging,lane=targetLane,before=beforeId;
|
||||
dragging="";targetLane="";beforeId="";
|
||||
if(id && lane)Qt.callLater(()=>root.save(Logic.dropModule(root.modules,id,lane,before)));
|
||||
}
|
||||
RowLayout {
|
||||
id: lanes
|
||||
anchors.left:parent.left;anchors.right:parent.right
|
||||
spacing:12
|
||||
Repeater {
|
||||
id: laneRepeater
|
||||
model:["left","center","right"]
|
||||
GlassPanel {
|
||||
id: lane
|
||||
Component.onCompleted: root.laneItems=root.laneItems.concat([lane])
|
||||
Component.onDestruction: root.laneItems=root.laneItems.filter(l=>l!==lane)
|
||||
required property string modelData
|
||||
property alias cards: cards
|
||||
objectName:"bar-lane-"+modelData
|
||||
Layout.fillWidth:true
|
||||
Layout.minimumWidth:130
|
||||
Layout.fillHeight:true
|
||||
implicitHeight:column.implicitHeight+32
|
||||
border.color:root.targetLane===modelData ? Theme.accent : Theme.border
|
||||
ColumnLayout {
|
||||
id:column
|
||||
anchors {left:parent.left;right:parent.right;top:parent.top;margins:10}
|
||||
spacing:8
|
||||
Text {text:lane.modelData.toUpperCase();color:Theme.textSecondary;font.pixelSize:11}
|
||||
Repeater {
|
||||
id:cards
|
||||
model:root.modules.filter(m=>m.position===lane.modelData)
|
||||
GlassPanel {
|
||||
id:card
|
||||
required property var modelData
|
||||
readonly property var schema:root.fieldsFor(modelData.id)
|
||||
readonly property var link:ModuleRegistry.settingsLinks[modelData.id] || null
|
||||
readonly property bool expanded:root.expandedId===modelData.id && schema.length>0
|
||||
Layout.fillWidth:true
|
||||
implicitHeight:52+(expanded ? optionsColumn.implicitHeight+4 : 0)
|
||||
Behavior on implicitHeight {NumberAnimation {duration:Theme.duration;easing.type:Easing.OutCubic}}
|
||||
clip:true
|
||||
radius:12
|
||||
HoverHandler {id:cardHover}
|
||||
opacity:root.dragging===modelData.id ? 0.35 : 1
|
||||
Rectangle {anchors.top:parent.top;width:parent.width;height:3;radius:2;color:Theme.accent;visible:root.targetLane===lane.modelData && root.beforeId===card.modelData.id}
|
||||
RowLayout {
|
||||
anchors {left:parent.left;right:parent.right;top:parent.top;margins:7}
|
||||
height:38;spacing:5
|
||||
Item {
|
||||
Layout.preferredWidth:24;Layout.fillHeight:true
|
||||
activeFocusOnTab:true
|
||||
Accessible.name:"Move "+card.modelData.id
|
||||
Accessible.role:Accessible.Button
|
||||
Text {anchors.centerIn:parent;text:"⠿";color:parent.activeFocus ? Theme.accent : Theme.textSecondary;font.pixelSize:24}
|
||||
MouseArea {
|
||||
id:grip
|
||||
objectName:"bar-drag-"+card.modelData.id
|
||||
anchors.fill:parent
|
||||
preventStealing:true
|
||||
cursorShape:pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
property point start
|
||||
onPressed:event=>{start=Qt.point(event.x,event.y);parent.forceActiveFocus();}
|
||||
onPositionChanged:event=>{
|
||||
if(!pressed)return;
|
||||
if(!root.dragging && Math.hypot(event.x-start.x,event.y-start.y)<8)return;
|
||||
root.dragging=card.modelData.id;root.updateDrag(grip,event.x,event.y);
|
||||
}
|
||||
onReleased:root.finish()
|
||||
onCanceled:{root.dragging="";root.targetLane="";}
|
||||
}
|
||||
Keys.onPressed:event=>{
|
||||
if(event.key===Qt.Key_Escape) {root.dragging="";root.targetLane="";event.accepted=true;}
|
||||
else if(event.modifiers & Qt.ControlModifier && [Qt.Key_Up,Qt.Key_Down].includes(event.key)) {
|
||||
root.save(Logic.moveModule(root.modules,card.modelData.id,event.key===Qt.Key_Up?-1:1));event.accepted=true;
|
||||
} else if(event.modifiers & Qt.AltModifier && [Qt.Key_Left,Qt.Key_Right].includes(event.key)) {
|
||||
const index=["left","center","right"].indexOf(lane.modelData)+(event.key===Qt.Key_Left?-1:1);
|
||||
if(index>=0 && index<3)root.save(Logic.dropModule(root.modules,card.modelData.id,["left","center","right"][index],""));event.accepted=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {text:ModuleRegistry.title(card.modelData.id);color:Theme.text;Layout.fillWidth:true;elide:Text.ElideRight;font.pixelSize:12}
|
||||
// Cog: module options inline, or the page that holds them.
|
||||
Rectangle {
|
||||
objectName:"bar-options-"+card.modelData.id
|
||||
visible:card.schema.length>0 || !!card.link
|
||||
implicitWidth:26;implicitHeight:26;radius:13
|
||||
color:card.expanded ? Qt.alpha(Theme.accent,0.3) : cogArea.containsMouse ? Theme.hover : Qt.alpha(Theme.text,0.06)
|
||||
Accessible.name:"Options for "+card.modelData.id
|
||||
Accessible.role:Accessible.Button
|
||||
Text {anchors.centerIn:parent;text:Icons.available ? "" : "⚙";font.family:Icons.available ? Icons.family : "";color:card.expanded || cogArea.containsMouse ? Theme.text : Theme.textSecondary;font.pixelSize:13}
|
||||
MouseArea {
|
||||
id:cogArea
|
||||
anchors.fill:parent
|
||||
hoverEnabled:true
|
||||
cursorShape:Qt.PointingHandCursor
|
||||
onClicked:{
|
||||
if(card.schema.length>0)root.expandedId=card.expanded ? "" : card.modelData.id;
|
||||
else if(card.link)ShellState.revealSetting(card.link.page,card.link.setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
GlassToggle {objectName:"bar-enable-"+card.modelData.id;checked:card.modelData.enabled;onToggled:root.save(Logic.editModule(root.modules,card.modelData.id,"enabled",checked))}
|
||||
// Removed modules return to the "+" list below the lanes.
|
||||
Rectangle {
|
||||
objectName:"bar-remove-"+card.modelData.id
|
||||
// Shown on hover so narrow lanes keep room for the name.
|
||||
visible:cardHover.hovered || card.activeFocus
|
||||
implicitWidth:26;implicitHeight:26;radius:13
|
||||
color:removeArea.containsMouse ? Qt.alpha(Theme.urgent,0.25) : Qt.alpha(Theme.text,0.06)
|
||||
Accessible.name:"Remove "+card.modelData.id
|
||||
Accessible.role:Accessible.Button
|
||||
Text {anchors.centerIn:parent;text:"×";color:removeArea.containsMouse ? Theme.text : Theme.textSecondary;font.pixelSize:16}
|
||||
MouseArea {
|
||||
id:removeArea
|
||||
anchors.fill:parent
|
||||
hoverEnabled:true
|
||||
cursorShape:Qt.PointingHandCursor
|
||||
onClicked:root.save(Logic.removeModule(root.modules,card.modelData.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
id:optionsColumn
|
||||
visible:card.expanded
|
||||
anchors {left:parent.left;right:parent.right;top:parent.top;topMargin:50;leftMargin:12;rightMargin:10}
|
||||
spacing:6
|
||||
Repeater {
|
||||
model:card.schema
|
||||
RowLayout {
|
||||
id:optionRow
|
||||
required property var modelData
|
||||
readonly property var value:root.valueOf(card.modelData,modelData)
|
||||
Layout.fillWidth:true
|
||||
spacing:8
|
||||
Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;elide:Text.ElideRight
|
||||
HoverHandler {id:labelHover}
|
||||
ToolTip.visible:labelHover.hovered && !!optionRow.modelData.description
|
||||
ToolTip.text:optionRow.modelData.description || ""
|
||||
ToolTip.delay:600}
|
||||
GlassComboBox {
|
||||
objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key
|
||||
visible:optionRow.modelData.type==="choice"
|
||||
Layout.preferredWidth:110
|
||||
implicitHeight:30
|
||||
model:optionRow.modelData.choices.map(c=>({text:String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c}))
|
||||
textRole:"text"
|
||||
valueRole:"value"
|
||||
currentIndex:optionRow.modelData.choices.indexOf(optionRow.value)
|
||||
onActivated:root.setOption(card.modelData,optionRow.modelData.key,currentValue)
|
||||
}
|
||||
GlassToggle {
|
||||
visible:optionRow.modelData.type==="boolean"
|
||||
checked:optionRow.value===true
|
||||
onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked)
|
||||
}
|
||||
Text {
|
||||
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
|
||||
text:optionRow.value===undefined ? "" : String(optionRow.value)
|
||||
color:Theme.text;font.pixelSize:11
|
||||
Layout.preferredWidth:26;horizontalAlignment:Text.AlignRight
|
||||
}
|
||||
GlassSlider {
|
||||
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
|
||||
Layout.preferredWidth:90
|
||||
implicitHeight:26
|
||||
from:Number(optionRow.modelData.min !== undefined ? optionRow.modelData.min : 0)
|
||||
to:Number(optionRow.modelData.max !== undefined ? optionRow.modelData.max : 100)
|
||||
stepSize:Number(optionRow.modelData.step || (optionRow.modelData.type==="integer" ? 1 : 0.1))
|
||||
value:Number(optionRow.value || 0)
|
||||
onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.modelData.type==="integer" ? Math.round(value) : value)
|
||||
}
|
||||
GlassTextField {
|
||||
visible:optionRow.modelData.type==="string"
|
||||
Layout.preferredWidth:110
|
||||
implicitHeight:30
|
||||
text:optionRow.value===undefined ? "" : String(optionRow.value)
|
||||
onEditingFinished:root.setOption(card.modelData,optionRow.modelData.key,text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {Layout.fillWidth:true;implicitHeight:3;radius:2;color:root.targetLane===lane.modelData && !root.beforeId ? Theme.accent : Theme.transparent}
|
||||
Text {text:cards.count ? "Drop to append" : "Drop a module here";color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;wrapMode:Text.Wrap}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GlassPill {
|
||||
id:ghost
|
||||
z:100
|
||||
visible:!!root.dragging
|
||||
width:140;height:44
|
||||
color:Theme.surfaceVariant;border.color:Theme.accent
|
||||
Text {anchors.centerIn:parent;text:root.dragging;color:Theme.text}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property string label
|
||||
property string setting
|
||||
property string error: ""
|
||||
Layout.fillWidth: true
|
||||
Text {
|
||||
text: root.label
|
||||
color: Theme.textSecondary
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
GlassTextField {
|
||||
Layout.fillWidth: true
|
||||
text: JSON.stringify(ConfigService.value(root.setting))
|
||||
onEditingFinished: {
|
||||
try {
|
||||
if (ConfigService.setValue(root.setting, JSON.parse(text))) {
|
||||
root.error = "";
|
||||
SystemService.refresh();
|
||||
} else
|
||||
root.error = ConfigService.error;
|
||||
} catch (e) {
|
||||
root.error = "Enter a JSON array of command arguments";
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
visible: !!root.error
|
||||
text: root.error
|
||||
color: Theme.urgent
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
ColumnLayout {
|
||||
id:root
|
||||
spacing:2
|
||||
SettingNote {text:GlassService.state.available ? "Global glass controls apply to the shell and other translucent applications. Explicit app/preset rules keep priority. Changes apply when you press Apply at the top of this page." : "HyprGlass is not available. Install a version matching your compositor to use these controls."}
|
||||
SettingRow {
|
||||
title:"Liquid glass preset"
|
||||
description:"Ghostty-like refraction with lighter shell surfaces"
|
||||
icon:""
|
||||
GlassButton {
|
||||
objectName:"glassMatchGhostty"
|
||||
text:"Match Ghostty’s liquid glass"
|
||||
onClicked:{
|
||||
const values={blur_strength:0.45,blur_iterations:2,refraction_strength:3,chromatic_aberration:0.45,fresnel_strength:0.5,specular_strength:0.8,edge_thickness:0.065,lens_distortion:0.25,brightness:0.95,contrast:1,saturation:1,vibrancy:0.15,adaptive_dim:0.2};
|
||||
ConfigService.setValue("hyprglass.values",values);
|
||||
ConfigService.setValue("appearance.glassOpacity",0.3);ConfigService.setValue("appearance.panelOpacity",0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
PreferenceToggle {label:"Enable global glass";setting:"hyprglass.effectEnabled"}
|
||||
PreferenceToggle {label:"Glass on shell/layers";setting:"hyprglass.layers"}
|
||||
Repeater {
|
||||
model:[{key:"blur_strength",label:"Blur",max:5},{key:"blur_iterations",label:"Blur passes",min:1,max:5,step:1},{key:"refraction_strength",label:"Refraction",max:8},{key:"chromatic_aberration",label:"Spectral highlights",max:1},{key:"fresnel_strength",label:"Edge glow",max:1},{key:"specular_strength",label:"Specular highlights",max:1},{key:"edge_thickness",label:"Rim thickness",max:0.15,step:0.005},{key:"lens_distortion",label:"Lens distortion",max:1},{key:"brightness",label:"Brightness",min:0.2,max:2},{key:"contrast",label:"Contrast",min:0.2,max:2},{key:"saturation",label:"Saturation",max:2},{key:"vibrancy",label:"Vibrancy",max:1},{key:"adaptive_dim",label:"Adaptive dimming",max:1}]
|
||||
PreferenceSlider {required property var modelData;label:modelData.label;setting:"hyprglass.values."+modelData.key;from:modelData.min || 0;to:modelData.max;step:modelData.step || 0.01}
|
||||
}
|
||||
SettingNote {visible:!!GlassService.state.namespaces || !!GlassService.state.exclusions || !!GlassService.state.overrides;text:"Existing layer allow/exclude lists or preset overrides are active. Those compositor rules remain authoritative."}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
|
||||
// Few short choices render as a segmented control, longer lists as a menu.
|
||||
SettingRow {
|
||||
id: root
|
||||
property string label
|
||||
property var choices: []
|
||||
readonly property bool segmented: choices.length > 1 && choices.length <= 4 && choices.join("").length <= 34
|
||||
title: label
|
||||
GlassSegmented {
|
||||
visible: root.segmented
|
||||
model: root.choices
|
||||
currentIndex: root.choices.indexOf(ConfigService.value(root.setting))
|
||||
onActivated: (index, value) => ConfigService.setValue(root.setting, value)
|
||||
}
|
||||
GlassComboBox {
|
||||
visible: !root.segmented
|
||||
Layout.preferredWidth: 240
|
||||
model: root.choices
|
||||
currentIndex: Math.max(0, root.choices.indexOf(ConfigService.value(root.setting)))
|
||||
onActivated: ConfigService.setValue(root.setting, currentText)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
import "../../components"
|
||||
|
||||
SettingRow {
|
||||
id: root
|
||||
property string label
|
||||
property real from: 0
|
||||
property real to: 1
|
||||
property real step: 0.01
|
||||
property string unit
|
||||
title: label
|
||||
GlassSlider {
|
||||
Layout.preferredWidth: 240
|
||||
from: root.from
|
||||
to: root.to
|
||||
stepSize: root.step
|
||||
value: Number(ConfigService.value(root.setting))
|
||||
onMoved: ConfigService.setValue(root.setting, Number((Math.round(value / root.step) * root.step).toFixed(6)))
|
||||
}
|
||||
Text {
|
||||
text: Number(ConfigService.value(root.setting)).toFixed(root.step < 0.01 ? 3 : root.step < 1 ? 2 : 0) + root.unit
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 12
|
||||
font.features: {
|
||||
"tnum": 1
|
||||
}
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.preferredWidth: 52
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import QtQuick
|
||||
import "../../services"
|
||||
import "../../components"
|
||||
|
||||
SettingRow {
|
||||
id: root
|
||||
property string label
|
||||
title: label
|
||||
clickable: enabled
|
||||
onClicked: ConfigService.setValue(setting, !ConfigService.value(setting))
|
||||
GlassToggle {
|
||||
checked: !!ConfigService.value(root.setting)
|
||||
onToggled: ConfigService.setValue(root.setting, checked)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../theme"
|
||||
|
||||
// Secondary explanatory text inside a settings section.
|
||||
Text {
|
||||
property bool warning: false
|
||||
color: warning ? Theme.urgent : Theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
wrapMode: Text.Wrap
|
||||
visible: text !== ""
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 12
|
||||
Layout.rightMargin: 12
|
||||
Layout.topMargin: 2
|
||||
Layout.bottomMargin: 4
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../components"
|
||||
import "../../core"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
// One setting: optional icon, title and description on the left, control on the right.
|
||||
// Wide controls go in `below`. A bound `setting` gains a reset-to-default button once changed.
|
||||
Item {
|
||||
id: root
|
||||
property string title
|
||||
property string description
|
||||
property string icon
|
||||
property string setting
|
||||
property bool clickable: false
|
||||
default property alias control: controls.data
|
||||
property alias below: belowColumn.data
|
||||
signal clicked
|
||||
readonly property var defaultValue: setting ? setting.split(".").reduce((object, key) => object ? object[key] : undefined, ConfigService.defaults) : undefined
|
||||
readonly property bool modified: defaultValue !== undefined && JSON.stringify(ConfigService.value(setting)) !== JSON.stringify(defaultValue)
|
||||
property real flash: 0
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: Math.max(52, content.implicitHeight + 20)
|
||||
opacity: enabled ? 1 : 0.5
|
||||
|
||||
function matches(text) {
|
||||
const a = title.toLowerCase(), b = String(text).toLowerCase();
|
||||
return !!a && !!b && (a === b || a.startsWith(b) || b.startsWith(a));
|
||||
}
|
||||
function reveal() {
|
||||
// Untyped walk: the nearest Flickable ancestor scrolls the row into view.
|
||||
let parent = Object(root.parent);
|
||||
while (parent) {
|
||||
if (parent.contentY !== undefined && parent.contentItem && parent.contentHeight > parent.height) {
|
||||
const position = root.mapToItem(parent.contentItem, 0, 0);
|
||||
parent.contentY = Math.max(0, Math.min(parent.contentHeight - parent.height, position.y - parent.height / 3));
|
||||
break;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
highlight.restart();
|
||||
}
|
||||
function checkHighlight() {
|
||||
if (ShellState.settingsHighlight && root.matches(ShellState.settingsHighlight))
|
||||
Qt.callLater(root.reveal);
|
||||
}
|
||||
Component.onCompleted: checkHighlight()
|
||||
Connections {
|
||||
target: ShellState
|
||||
function onSettingsHighlightSerialChanged() {
|
||||
root.checkHighlight();
|
||||
}
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: highlight
|
||||
PauseAnimation {
|
||||
duration: 160
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "flash"
|
||||
to: 1
|
||||
duration: 320
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
PauseAnimation {
|
||||
duration: 1200
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "flash"
|
||||
to: 0
|
||||
duration: 800
|
||||
easing.type: Easing.InOutSine
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Math.max(8, Theme.radius * 0.5)
|
||||
color: area.containsMouse && root.clickable ? Qt.alpha(Theme.text, 0.07) : area.containsMouse ? Qt.alpha(Theme.text, 0.035) : Theme.transparent
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: parent.radius
|
||||
color: Theme.accent
|
||||
opacity: root.flash * 0.22
|
||||
border.width: root.flash > 0 ? 1 : 0
|
||||
border.color: Qt.alpha(Theme.accent, root.flash)
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: root.clickable ? Qt.LeftButton : Qt.NoButton
|
||||
cursorShape: root.clickable ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
ColumnLayout {
|
||||
id: content
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 10
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 12
|
||||
GlassIcon {
|
||||
visible: root.icon !== ""
|
||||
glyph: root.icon
|
||||
fallback: root.title.charAt(0)
|
||||
size: 32
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 120
|
||||
spacing: 2
|
||||
Text {
|
||||
text: root.title
|
||||
visible: text !== ""
|
||||
color: Theme.text
|
||||
font.pixelSize: 13
|
||||
font.weight: Font.Medium
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: root.description
|
||||
visible: text !== ""
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
objectName: "reset-" + root.setting
|
||||
ToolTip.visible: resetArea.containsMouse
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: "Reset to default"
|
||||
visible: root.modified
|
||||
implicitWidth: 26
|
||||
implicitHeight: 26
|
||||
radius: 13
|
||||
color: resetArea.containsMouse ? Qt.alpha(Theme.accent, 0.25) : Qt.alpha(Theme.text, 0.06)
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "↺"
|
||||
color: resetArea.containsMouse ? Theme.text : Theme.textSecondary
|
||||
font.pixelSize: 14
|
||||
}
|
||||
MouseArea {
|
||||
id: resetArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: ConfigService.setValue(root.setting, JSON.parse(JSON.stringify(root.defaultValue)))
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: controls
|
||||
spacing: 8
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
id: belowColumn
|
||||
visible: children.length > 0
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../theme"
|
||||
|
||||
ScrollView {
|
||||
id: root
|
||||
default property alias content: column.data
|
||||
clip: true
|
||||
contentWidth: availableWidth
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 4
|
||||
radius: 2
|
||||
color: Qt.alpha(Theme.text, 0.25)
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
id: column
|
||||
width: root.availableWidth - 14
|
||||
spacing: 22
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../theme"
|
||||
|
||||
// Titled card grouping related settings. `padded` suits free-form content
|
||||
// (buttons, notes, previews); rows carry their own padding.
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property string title
|
||||
property string description
|
||||
property bool padded: false
|
||||
default property alias content: body.data
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
ColumnLayout {
|
||||
visible: root.title !== "" || root.description !== ""
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 4
|
||||
spacing: 2
|
||||
Text {
|
||||
text: root.title
|
||||
visible: text !== ""
|
||||
color: Theme.text
|
||||
font.pixelSize: 14
|
||||
font.weight: Font.DemiBold
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: root.description
|
||||
visible: text !== ""
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: body.implicitHeight + (root.padded ? 28 : 8)
|
||||
radius: Math.max(10, Theme.radius * 0.7)
|
||||
color: Theme.fill
|
||||
border.width: 1
|
||||
border.color: Theme.hairline
|
||||
ColumnLayout {
|
||||
id: body
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.margins: root.padded ? 14 : 4
|
||||
spacing: root.padded ? 10 : 2
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user