Selettore lingua (System/EN/IT) nelle impostazioni con QTranslator in main.cpp (pattern quill); fix 'Close book' con pop fino alla prima pagina
This commit is contained in:
@@ -57,7 +57,10 @@ Page {
|
||||
text: qsTr("Close book")
|
||||
onClicked: {
|
||||
page.maybeSave(true)
|
||||
pageStack.popTo(null)
|
||||
// torna alla prima pagina dello stack (MainPage):
|
||||
// popTo(null) non è affidabile su questa Silica
|
||||
while (pageStack.depth > 1)
|
||||
pageStack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ Page {
|
||||
property string testResult: ""
|
||||
property bool testOk: false
|
||||
property bool testing: false
|
||||
property string languageNotice: ""
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
@@ -111,6 +112,43 @@ Page {
|
||||
visible: text.length > 0
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("Language") }
|
||||
|
||||
ComboBox {
|
||||
id: langBox
|
||||
width: parent.width
|
||||
label: qsTr("Language")
|
||||
currentIndex: appSettings.language === "it" ? 2 : (appSettings.language === "en" ? 1 : 0)
|
||||
menu: ContextMenu {
|
||||
MenuItem { text: qsTr("System (default)") }
|
||||
MenuItem { text: "English" }
|
||||
MenuItem { text: "Italiano" }
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
var v = currentIndex === 2 ? "it" : (currentIndex === 1 ? "en" : "system")
|
||||
if (v !== appSettings.language) {
|
||||
appSettings.language = v
|
||||
page.languageNotice = qsTr("Language will be applied after restarting the app")
|
||||
langNoticeTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
text: page.languageNotice
|
||||
color: Theme.highlightColor
|
||||
wrapMode: Text.Wrap
|
||||
visible: text.length > 0
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: langNoticeTimer
|
||||
interval: 4000
|
||||
onTriggered: page.languageNotice = ""
|
||||
}
|
||||
|
||||
Item { width: 1; height: Theme.paddingLarge }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user