gui: model ComboBox populated by ListModelsByBackend on backend change
This commit is contained in:
parent
726b3f29d7
commit
abd46c052e
19
gui/main.qml
19
gui/main.qml
|
|
@ -182,7 +182,7 @@ ApplicationWindow {
|
|||
newSessionDialog.backendModel = dbus.listBackends()
|
||||
newSessionDialog.cwdField.text = dbus.activeCwd || ""
|
||||
newSessionDialog.backendCombo.currentIndex = 0
|
||||
newSessionDialog.modelField.text = ""
|
||||
newSessionDialog.modelCombo.editText = ""
|
||||
newSessionDialog.open()
|
||||
}
|
||||
|
||||
|
|
@ -196,14 +196,14 @@ ApplicationWindow {
|
|||
|
||||
property alias cwdField: cwdInput
|
||||
property alias backendCombo: backendSelect
|
||||
property alias modelField: modelInput
|
||||
property alias modelCombo: modelSelect
|
||||
property var backendModel: []
|
||||
|
||||
onAccepted: {
|
||||
let cwd = cwdInput.text.trim()
|
||||
if (cwd === "") cwd = dbus.activeCwd || ""
|
||||
let backend = backendSelect.currentText
|
||||
let model = modelInput.text.trim()
|
||||
let model = modelSelect.editText.trim() || modelSelect.currentText
|
||||
dbus.createSession(cwd, backend, model)
|
||||
}
|
||||
|
||||
|
|
@ -236,13 +236,18 @@ ApplicationWindow {
|
|||
id: backendSelect
|
||||
Layout.fillWidth: true
|
||||
model: newSessionDialog.backendModel
|
||||
onCurrentTextChanged: {
|
||||
if (currentText)
|
||||
modelSelect.model = dbus.listModelsByBackend(currentText)
|
||||
}
|
||||
}
|
||||
|
||||
Label { text: "Model (optional):" }
|
||||
TextField {
|
||||
id: modelInput
|
||||
Label { text: "Model:" }
|
||||
ComboBox {
|
||||
id: modelSelect
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "default"
|
||||
editable: true
|
||||
editText: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,3 +595,11 @@ QStringList OllieDBusClient::listModels(const QString &sessionId)
|
|||
return reply.value();
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList OllieDBusClient::listModelsByBackend(const QString &backend)
|
||||
{
|
||||
QDBusReply<QStringList> reply = m_iface->call("ListModelsByBackend", backend);
|
||||
if (reply.isValid())
|
||||
return reply.value();
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public:
|
|||
Q_INVOKABLE bool interrupt(const QString &sessionId);
|
||||
Q_INVOKABLE QStringList listBackends();
|
||||
Q_INVOKABLE QStringList listModels(const QString &sessionId);
|
||||
Q_INVOKABLE QStringList listModelsByBackend(const QString &backend);
|
||||
|
||||
// Detached process management
|
||||
Q_INVOKABLE bool detachProcess(const QString &sessionId);
|
||||
|
|
|
|||
Reference in New Issue