Split the bar panel into one QML file per stage

Panel.qml keeps the state, the CLI calls and the stage switch (889 lines,
was 2360); each stage is its own file taking the panel as a required
property. The omarchy installer copies every QML/JS file and clears stale
ones. tests/static.sh filters qmllint on [syntax], not the word error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
smoido
2026-09-15 02:12:49 +03:00
co-authored by Claude Opus 5
parent 4091746d4e
commit bb01418ce0
17 changed files with 1717 additions and 1510 deletions
@@ -0,0 +1,115 @@
import QtQuick
import qs.Commons
import qs.Ui
// NewPresetStage.qml - New preset: a name, and what to start from.
//
// One stage of the claude-mode panel. Panel.qml hands itself in as `panel`
// and owns all the state and actions; this file only draws them.
Column {
id: stage
required property var panel
width: parent.width
visible: stage.panel.stage === "presetNew"
spacing: Style.space(7)
Text {
width: parent.width
text: "New " + stage.panel.pTitle(stage.panel.newProvider) + " preset"
color: Color.popups.text
elide: Text.ElideRight
font.family: stage.panel.uiFont
font.pixelSize: Style.space(13)
font.bold: true
}
TextField {
id: newNameField
width: parent.width
text: stage.panel.newName
placeholderText: "name"
foreground: Color.popups.text
font.family: stage.panel.uiFont
font.pixelSize: Style.space(11)
onTextChanged: stage.panel.newName = text
onAccepted: stage.panel.createPreset()
}
Text {
width: parent.width
readonly property string problem: stage.panel.stage === "presetNew" ? stage.panel.nameProblem(stage.panel.newName, "") : ""
visible: problem !== ""
text: problem
color: stage.panel.urgentColor
wrapMode: Text.WordWrap
font.family: stage.panel.uiFont
font.pixelSize: Style.space(10)
}
Text {
text: "Start from"
color: Color.muted
font.family: stage.panel.uiFont
font.pixelSize: Style.space(10)
}
// Only this provider's presets: a copy keeps the provider, and a
// preset cannot change provider afterwards.
Flow {
width: parent.width
spacing: Style.space(6)
Repeater {
model: stage.panel.stage === "presetNew" ? stage.panel.presetsOf(stage.panel.newProvider) : []
PillButton { fontFamily: stage.panel.uiFont;
required property var modelData
label: "copy of " + String(modelData.name)
primary: stage.panel.newFrom === String(modelData.name)
onTriggered: stage.panel.newFrom = String(modelData.name)
}
}
PillButton { fontFamily: stage.panel.uiFont;
label: "blank"
primary: stage.panel.newFrom === ""
onTriggered: stage.panel.newFrom = ""
}
}
Text {
id: newFromHint
width: parent.width
text: stage.panel.newFrom === ""
? "Every tier starts empty; the editor opens next to fill them in."
: "Same server, key and models as '" + stage.panel.newFrom + "'. The editor opens next to change them."
color: Color.muted
wrapMode: Text.WordWrap
font.family: stage.panel.uiFont
font.pixelSize: Style.space(10)
}
Flow {
width: parent.width
spacing: Style.space(7)
PillButton { fontFamily: stage.panel.uiFont; label: "Create"; primary: true; onTriggered: stage.panel.createPreset() }
PillButton { fontFamily: stage.panel.uiFont;
label: "Cancel"
onTriggered: {
stage.panel.lastError = ""
if (stage.panel.editPreset !== "") stage.panel.stage = "preset"
else stage.panel.resetFlow()
}
}
}
Connections {
target: stage.panel
function onNewPresetOpened() {
newNameField.text = stage.panel.newName
Qt.callLater(function () { newNameField.forceActiveFocus(); newNameField.selectAll() })
}
}
}