Files
metabuilder/qml/widgets/SendPromptDialog.qml
johndoe6345789 c406b8df96 refactor: Reorganize FakeMUI by implementation type
Move FakeMUI content to appropriate root-level folders by implementation:

**React Components → components/fakemui/**
- 537 components (inputs, surfaces, layout, data-display, feedback,
  navigation, utils, atoms, lab, x, email, workflows)
- 416 SVG icons
- Full barrel exports in components/fakemui/index.ts

**QML Components → qml/**
- 104 Material Design 3 components (11 categories)
- 7 hybrid application views
- 8 desktop widgets
- qmldir module registration

**Python Bindings → python/fakemui/**
- 15 PyQt6 modules (120+ components)
- Full Python package structure with pyproject.toml

**SCSS/Styles → fakemui/** (renamed purpose)
- scss/ - Material Design 3 stylesheets
- styles/ - Component SCSS modules
- src/utils/ - Accessibility utilities
- index.ts now re-exports from components/fakemui/

This separation allows:
- React: import { Button } from '@metabuilder/components/fakemui'
- QML: import QmlComponents 1.0
- Python: from fakemui import Button, Card
- Backward compat: import { Button } from '@metabuilder/fakemui'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 12:59:24 +00:00

268 lines
8.0 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Dialog {
id: dialog
title: "Send Prompt to Codex"
width: 700
height: 500
modal: true
standardButtons: Dialog.Cancel
property var environments: []
property bool sending: false
property var themeColors: ({})
// Internal colors with fallbacks
readonly property var colors: ({
background: themeColors.window || themeColors.background || "#0d0d0d",
paper: themeColors.alternateBase || "#1a1a1a",
text: themeColors.windowText || themeColors.text || "#ffffff",
textSecondary: themeColors.textSecondary || "#a0a0a0",
accent: themeColors.accent || "#10a37f",
error: themeColors.error || "#ef4444",
border: themeColors.border || "#333333"
})
background: Rectangle {
color: colors.background
radius: 8
border.color: colors.border
border.width: 1
}
header: Label {
text: dialog.title
font.bold: true
font.pixelSize: 16
color: colors.text
padding: 16
background: Rectangle {
color: colors.paper
radius: 8
}
}
signal promptSubmitted(string prompt, string envId, string branch, int bestOf)
function open() {
promptField.text = ""
branchField.text = "main"
bestOfSpinner.value = 1
errorLabel.text = ""
sending = false
visible = true
}
function setEnvironments(envList) {
environments = envList
envCombo.model = envList.map(e => e.name || e.full_name || e.id)
if (envList.length > 0) {
envCombo.currentIndex = 0
}
}
function showError(msg) {
errorLabel.text = msg
sending = false
}
function showSuccess(taskId) {
sending = false
close()
}
ColumnLayout {
anchors.fill: parent
spacing: 16
// Environment selector
GridLayout {
Layout.fillWidth: true
columns: 2
columnSpacing: 12
rowSpacing: 8
Label {
text: "Environment:"
Layout.alignment: Qt.AlignRight
color: colors.text
}
ComboBox {
id: envCombo
Layout.fillWidth: true
model: []
enabled: !sending
background: Rectangle {
color: colors.paper
radius: 4
border.color: colors.border
}
contentItem: Text {
leftPadding: 8
text: envCombo.displayText
color: colors.text
verticalAlignment: Text.AlignVCenter
}
}
Label {
text: "Branch:"
Layout.alignment: Qt.AlignRight
color: colors.text
}
TextField {
id: branchField
Layout.fillWidth: true
text: "main"
placeholderText: "main"
enabled: !sending
color: colors.text
placeholderTextColor: colors.textSecondary
background: Rectangle {
color: colors.paper
radius: 4
border.color: branchField.activeFocus ? colors.accent : colors.border
}
}
Label {
text: "Best of N:"
Layout.alignment: Qt.AlignRight
color: colors.text
}
SpinBox {
id: bestOfSpinner
from: 1
to: 5
value: 1
enabled: !sending
background: Rectangle {
color: colors.paper
radius: 4
border.color: colors.border
}
contentItem: TextInput {
text: bestOfSpinner.textFromValue(bestOfSpinner.value, bestOfSpinner.locale)
color: colors.text
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
readOnly: !bestOfSpinner.editable
validator: bestOfSpinner.validator
}
}
}
// Prompt input
Label {
text: "Prompt:"
font.bold: true
color: colors.text
}
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
TextArea {
id: promptField
placeholderText: "Describe the task you want Codex to perform...\n\nExample:\nAdd a dark mode toggle to the settings page. It should persist the preference in localStorage."
wrapMode: Text.Wrap
font.pixelSize: 14
enabled: !sending
selectByMouse: true
color: colors.text
placeholderTextColor: colors.textSecondary
background: Rectangle {
color: colors.paper
radius: 4
border.color: promptField.activeFocus ? colors.accent : colors.border
}
}
}
// Error message
Label {
id: errorLabel
Layout.fillWidth: true
color: colors.error
wrapMode: Text.Wrap
visible: text.length > 0
}
// Submit button
RowLayout {
Layout.fillWidth: true
Item { Layout.fillWidth: true }
BusyIndicator {
running: sending
visible: sending
Layout.preferredWidth: 24
Layout.preferredHeight: 24
}
Button {
id: sendButton
text: sending ? "Sending..." : "🚀 Send Prompt"
enabled: !sending && promptField.text.trim().length > 0 && envCombo.currentIndex >= 0
highlighted: true
background: Rectangle {
color: sendButton.enabled ? colors.accent : Qt.darker(colors.accent, 1.5)
radius: 4
opacity: sendButton.hovered ? 0.9 : 1.0
}
contentItem: Text {
text: sendButton.text
color: "white"
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
if (promptField.text.trim().length === 0) {
errorLabel.text = "Please enter a prompt"
return
}
if (environments.length === 0 || envCombo.currentIndex < 0) {
errorLabel.text = "No environment selected"
return
}
sending = true
errorLabel.text = ""
var env = environments[envCombo.currentIndex]
var envId = env.id || env.environment_id
dialog.promptSubmitted(
promptField.text.trim(),
envId,
branchField.text || "main",
bestOfSpinner.value
)
}
}
}
}
// Keyboard shortcuts
Shortcut {
sequence: "Ctrl+Return"
enabled: sendButton.enabled
onActivated: sendButton.clicked()
}
}