diff options
Diffstat (limited to 'desktop/assistant/Card.qml')
| -rw-r--r-- | desktop/assistant/Card.qml | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml index 228cfdb..f63ce59 100644 --- a/desktop/assistant/Card.qml +++ b/desktop/assistant/Card.qml @@ -12,6 +12,7 @@ import QtQuick import ".." import "Files.js" as Files +import "Presets.js" as Presets // The card in its three states (Assistant.qml, mode): entry is the input // line alone; file adds the staged chips and what can be done with them; @@ -31,6 +32,7 @@ Rectangle { // Bottom-up: the input, then the actions (file state), then the chips. height: card.tall ? card.fullHeight : footer.height + 28 + (chips.visible ? chips.height + 10 : 0) + + (asks.visible ? asks.height + 10 : 0) + (actions.visible ? actions.height + 10 : 0) Behavior on height { NumberAnimation { duration: 180; easing.type: Easing.OutCubic } } clip: true @@ -151,7 +153,8 @@ Rectangle { id: chips visible: card.canvas.staged.length > 0 anchors { - bottom: actions.visible ? actions.top : footer.top; bottomMargin: 10 + bottom: asks.visible ? asks.top : actions.visible ? actions.top : footer.top + bottomMargin: 10 left: parent.left; right: parent.right; leftMargin: 14; rightMargin: 14 } spacing: 6 @@ -194,8 +197,38 @@ Rectangle { } // --- what to do with them (file) --- - // Piece 1 offers Chat about it; the Ask and Do rows (model prompts and - // local operations) are their own specs and land here. + // Ask: canned questions matching the staged kinds (Presets.js). A click + // sends one; Shift+click puts it in the input to edit first. The Do row + // (local operations) is its own spec and lands here too. + + Flow { + id: asks + readonly property var offered: Presets.offered(Presets.list(Prefs.presets), card.canvas.staged) + visible: card.mode === "file" && offered.length > 0 + anchors { + bottom: actions.top; bottomMargin: 10 + left: parent.left; right: parent.right; leftMargin: 14; rightMargin: 14 + } + spacing: 8 + + Repeater { + model: asks.offered + Button { + required property var modelData + text: modelData.label + enabled: card.canvas.connected && !card.canvas.blocked + onClicked: mouse => { + if (mouse && (mouse.modifiers & Qt.ShiftModifier)) { + input.text = Presets.prompt(modelData); + input.cursorPosition = input.text.length; + input.forceActiveFocus(); + } else { + card.canvas.ask(Presets.prompt(modelData)); + } + } + } + } + } Row { id: actions |
