Files
logos-chat-ui/components/InputBar.qml
osmaczko 9d637f5e36 chore: port QML chat UI to drive the rust-bindings-exploration chat_module
Replaces the QML+C++-backend implementation (master) with a pure-QML port that
talks to the Rust chat_module exclusively via logos.callModule.

Note: pure QML is for the sake of simplicity for POC. It'll be reworked
back to QML+C++ properly as followup.
2026-05-07 15:32:54 +02:00

50 lines
1.2 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
// Composer bar: text field + Send button + /connect paste dialog.
Item {
id: root
property bool hasActiveConvo: false
signal sendMessage(string text)
signal connectWithBundle(string bundle)
height: 56
RowLayout {
anchors.fill: parent
anchors.margins: 8
spacing: 6
TextField {
id: field
Layout.fillWidth: true
placeholderText: root.hasActiveConvo
? "Type a message… or /connect <bundle>"
: "/connect <bundle> to start a chat"
Keys.onReturnPressed: root._submit()
Keys.onEnterPressed: root._submit()
}
Button {
text: "Send"
enabled: field.text.trim().length > 0
onClicked: root._submit()
}
}
function _submit() {
var text = field.text.trim()
if (text.length === 0) return
if (text.startsWith("/connect ")) {
var bundle = text.substring(9).trim()
if (bundle.length > 0) root.connectWithBundle(bundle)
} else {
root.sendMessage(text)
}
field.text = ""
}
}