Files
harbour-hermes/qml/pages/SettingsPage.qml
T
kaneda 98139be96a fix(qml): correzioni Silica post-primo-test su device (v0.1.1)
Pagine non caricabili ("Impossibile caricare la pagina") per API
inesistenti nella Silica del kit Sailfish 5.1 / Qt 5.6 — verificate
sui docs ufficiali (pagine -members) e incrociate coi pattern
provati su device (tide/calibreweb/quill):

- TextField: rimosso onAccepted (segnale "accepted" inesistente)
  -> EnterKey.enabled/.onClicked (LoginPage, ChatPage)
- Button: rimosso "highlighted" (inesistente su Button) dal mic
- ComboBox: menu con MenuItem espliciti (via Repeater non provato)
- Theme.highlightDimmerColor -> Theme.rgba(highlightBackgroundColor)
- Azioni nei menu instradate via funzioni della Page (pattern tide)
- SessionsPage: titolo delegato piu' robusto (no "undefined")
2026-09-12 08:09:30 +02:00

130 lines
4.4 KiB
QML

import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
property var voiceNames: [
"it-IT-ElsaNeural",
"it-IT-DiegoNeural",
"it-IT-IsabellaNeural",
"it-IT-GiuseppeMultilingualNeural",
"en-US-AriaNeural"
]
property var engineNames: ["edge", "openai", "elevenlabs"]
SilicaFlickable {
anchors.fill: parent
contentHeight: col.height + Theme.paddingLarge
Column {
id: col
width: parent.width
spacing: Theme.paddingMedium
PageHeader { title: qsTr("Settings") }
SectionHeader { text: qsTr("Server") }
TextField {
id: urlField
width: parent.width
label: qsTr("Web UI address")
placeholderText: "https://hermes.example.com"
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
onTextChanged: {
if (text !== appSettings.baseUrl)
appSettings.baseUrl = text
}
}
SectionHeader { text: qsTr("Voice") }
ComboBox {
label: qsTr("Read-aloud voice")
currentIndex: Math.max(0, page.voiceNames.indexOf(appSettings.ttsVoice))
// MenuItems espliciti (no Repeater: pattern non provato sul kit 5.1)
menu: ContextMenu {
MenuItem {
text: "it-IT-ElsaNeural"
onClicked: appSettings.ttsVoice = "it-IT-ElsaNeural"
}
MenuItem {
text: "it-IT-DiegoNeural"
onClicked: appSettings.ttsVoice = "it-IT-DiegoNeural"
}
MenuItem {
text: "it-IT-IsabellaNeural"
onClicked: appSettings.ttsVoice = "it-IT-IsabellaNeural"
}
MenuItem {
text: "it-IT-GiuseppeMultilingualNeural"
onClicked: appSettings.ttsVoice = "it-IT-GiuseppeMultilingualNeural"
}
MenuItem {
text: "en-US-AriaNeural"
onClicked: appSettings.ttsVoice = "en-US-AriaNeural"
}
}
}
ComboBox {
label: qsTr("TTS engine")
currentIndex: Math.max(0, page.engineNames.indexOf(appSettings.ttsEngine))
menu: ContextMenu {
MenuItem {
text: "edge"
onClicked: appSettings.ttsEngine = "edge"
}
MenuItem {
text: "openai"
onClicked: appSettings.ttsEngine = "openai"
}
MenuItem {
text: "elevenlabs"
onClicked: appSettings.ttsEngine = "elevenlabs"
}
}
}
TextSwitch {
text: qsTr("Read replies aloud")
description: qsTr("Speak every completed reply automatically")
checked: appSettings.ttsAutoRead
onCheckedChanged: appSettings.ttsAutoRead = checked
}
SectionHeader { text: qsTr("Account") }
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Sign out")
onClicked: page.signOut()
}
SectionHeader { text: qsTr("About") }
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
text: "harbour-hermes " + appVersion + "\n\n" +
qsTr("Native client for the Hermes Web UI (hermes-webui): " +
"sessions, live streaming chat, server-side voice " +
"dictation and read-aloud.")
}
}
VerticalScrollDecorator {}
}
function signOut() {
api.logout()
pageStack.replace(Qt.resolvedUrl("LoginPage.qml"))
}
Component.onCompleted: urlField.text = appSettings.baseUrl
}