Prima di pubblicare: eliminati dai sorgenti tutti i valori "cablati". - settings: default neutri (URL, voce, engine vuoti = "decide il server"); nuove chiavi ttsVoices/ttsEngines (preset dei selettori) e vadMaxMs (durata massima registrazione, prima fissa a 60 s nel codice) - ApiClient: guard su baseUrl vuoto (checkAuth/login si comportano senza rete), voce/engine omessi nella richiesta TTS se vuoti, Content-Type audio coerente col formato reale del file (ogg/wav/mp3/m4a/opus) - SettingsPage: selettori voce/engine costruiti dai preset configurabili (Repeater dentro ContextMenu = pattern provato su tide) + campi per modificare i preset; LoginPage richiede indirizzo server non vuoto - VoiceRecorder: tetto di registrazione da configurazione - README: sezione "Configuration" completa; docs neutralizzate (niente URL/valori personali: repo public-friendly)
80 lines
2.4 KiB
QML
80 lines
2.4 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
|
|
// Login alla Web UI di Hermes: URL del server + password.
|
|
// La password non viene salvata: dopo il login resta il cookie di sessione.
|
|
Page {
|
|
id: page
|
|
|
|
Column {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
spacing: Theme.paddingLarge
|
|
|
|
PageHeader { title: qsTr("Sign in") }
|
|
|
|
Label {
|
|
x: Theme.horizontalPageMargin
|
|
width: parent.width - 2 * Theme.horizontalPageMargin
|
|
wrapMode: Text.WordWrap
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
color: Theme.secondaryColor
|
|
text: qsTr("Use the same password you use in the Hermes Web UI in your browser.")
|
|
}
|
|
|
|
TextField {
|
|
id: urlField
|
|
width: parent.width
|
|
label: qsTr("Server")
|
|
placeholderText: "https://hermes.example.com"
|
|
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
|
|
}
|
|
|
|
TextField {
|
|
id: passField
|
|
width: parent.width
|
|
label: qsTr("Password")
|
|
echoMode: TextInput.Password
|
|
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
|
|
// Silica TextField NON ha il segnale "accepted": l'invio si gestisce
|
|
// con la proprietà allegata EnterKey (pattern provato sul device).
|
|
EnterKey.enabled: text.length > 0
|
|
EnterKey.onClicked: page.doLogin()
|
|
}
|
|
|
|
Button {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
text: api.busy ? qsTr("Signing in…") : qsTr("Sign in")
|
|
enabled: !api.busy && passField.text.length > 0 && urlField.text.trim().length > 0
|
|
onClicked: page.doLogin()
|
|
}
|
|
|
|
Label {
|
|
x: Theme.horizontalPageMargin
|
|
width: parent.width - 2 * Theme.horizontalPageMargin
|
|
wrapMode: Text.WordWrap
|
|
visible: api.lastError.length > 0
|
|
color: Theme.errorColor
|
|
text: api.lastError
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: api
|
|
onLoggedInChanged: {
|
|
if (api.loggedIn)
|
|
pageStack.replace(Qt.resolvedUrl("SessionsPage.qml"))
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: urlField.text = appSettings.baseUrl
|
|
|
|
function doLogin() {
|
|
if (passField.text.length === 0)
|
|
return
|
|
api.clearError()
|
|
appSettings.baseUrl = urlField.text
|
|
api.login(passField.text)
|
|
}
|
|
}
|