gui: replace backend/model ComboBoxes with TextField + picker dialogs
- Backend: TextField with '...' button opens ListView of available backends - Model: TextField with '...' button opens ListView filtered by selected backend - Auto-populate model placeholder when backend text changes - Model picker also works on manual click for re-selection - Update onAccepted to use field.text instead of combo.currentText
This commit is contained in:
parent
e86b09447b
commit
7f083c0d7a
109
gui/main.qml
109
gui/main.qml
|
|
@ -303,7 +303,11 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
text: "Browse..."
|
text: "Browse..."
|
||||||
onClicked: folderDialog.open()
|
onClicked: {
|
||||||
|
var folder = theme.chooseFolder("Select Project Directory", dirField.text || "")
|
||||||
|
if (folder !== "")
|
||||||
|
dirField.text = folder
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -322,12 +326,14 @@ ApplicationWindow {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Label { text: "Backend:"; Layout.preferredWidth: 80 }
|
Label { text: "Backend:"; Layout.preferredWidth: 80 }
|
||||||
ComboBox {
|
TextField {
|
||||||
id: backendCombo
|
id: backendField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: ollie.rootBackendsLoaded
|
placeholderText: "ollama"
|
||||||
model: ollie.availableBackends
|
}
|
||||||
currentIndex: 0
|
Button {
|
||||||
|
text: "..."
|
||||||
|
onClicked: backendPicker.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -335,12 +341,16 @@ ApplicationWindow {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Label { text: "Model:"; Layout.preferredWidth: 80 }
|
Label { text: "Model:"; Layout.preferredWidth: 80 }
|
||||||
ComboBox {
|
TextField {
|
||||||
id: modelCombo
|
id: modelField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: ollie.rootModelsLoaded && backendCombo.count > 0
|
placeholderText: "(auto-populated)"
|
||||||
model: ollie.getAvailableModels(backendCombo.currentText)
|
enabled: backendField.text.trim() !== ""
|
||||||
currentIndex: 0
|
}
|
||||||
|
Button {
|
||||||
|
text: "..."
|
||||||
|
enabled: backendField.text.trim() !== "" && ollie.rootModelsLoaded
|
||||||
|
onClicked: modelPicker.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -368,10 +378,73 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Backend picker dialog
|
||||||
|
Dialog {
|
||||||
|
id: backendPicker
|
||||||
|
title: "Select Backend"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
modal: true
|
||||||
|
standardButtons: Dialog.Cancel
|
||||||
|
|
||||||
|
contentItem: ListView {
|
||||||
|
width: 300
|
||||||
|
height: 200
|
||||||
|
model: ollie.availableBackends
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
width: parent.width
|
||||||
|
text: modelData
|
||||||
|
onClicked: {
|
||||||
|
backendField.text = modelData
|
||||||
|
backendPicker.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model picker dialog
|
||||||
|
Dialog {
|
||||||
|
id: modelPicker
|
||||||
|
title: "Select Model"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
modal: true
|
||||||
|
standardButtons: Dialog.Cancel
|
||||||
|
|
||||||
|
contentItem: ListView {
|
||||||
|
width: 400
|
||||||
|
height: 300
|
||||||
|
model: ollie.getAvailableModels(backendField.text.trim())
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
width: parent.width
|
||||||
|
text: modelData
|
||||||
|
onClicked: {
|
||||||
|
modelField.text = modelData
|
||||||
|
modelPicker.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!ollie.rootBackendsLoaded) ollie.loadRootBackends()
|
if (!ollie.rootBackendsLoaded) ollie.loadRootBackends()
|
||||||
if (!ollie.rootAgentsLoaded) ollie.loadRootAgents()
|
if (!ollie.rootAgentsLoaded) ollie.loadRootAgents()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: backendField
|
||||||
|
function onTextChanged() {
|
||||||
|
var be = backendField.text.trim()
|
||||||
|
if (be !== "" && ollie.rootModelsLoaded) {
|
||||||
|
var models = ollie.getAvailableModels(be)
|
||||||
|
if (models.length > 0) {
|
||||||
|
modelField.placeholderText = models[0]
|
||||||
|
} else {
|
||||||
|
modelField.placeholderText = "(no models)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
modelField.placeholderText = "(auto-populated)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
|
|
@ -381,8 +454,8 @@ ApplicationWindow {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var name = nameField.text.trim()
|
var name = nameField.text.trim()
|
||||||
var backend = backendCombo.currentText
|
var backend = backendField.text.trim()
|
||||||
var model = modelCombo.currentText
|
var model = modelField.text.trim()
|
||||||
var agent = agentCombo.currentText
|
var agent = agentCombo.currentText
|
||||||
var remote = remoteField.text.trim()
|
var remote = remoteField.text.trim()
|
||||||
|
|
||||||
|
|
@ -395,16 +468,6 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog {
|
|
||||||
id: folderDialog
|
|
||||||
title: "Select Project Directory"
|
|
||||||
currentFolder: StandardPaths.homePath
|
|
||||||
selectFolder: true
|
|
||||||
onAccepted: {
|
|
||||||
dirField.text = selectedFolder
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue