mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-20 23:04:02 +00:00
Add workaround for AppView breaking after changing language at runtime
This commit is contained in:
parent
94952cf0a4
commit
c330898aeb
2 changed files with 24 additions and 3 deletions
|
@ -787,6 +787,11 @@ Flickable {
|
||||||
if (!StreamingPreferences.retranslate()) {
|
if (!StreamingPreferences.retranslate()) {
|
||||||
ToolTip.show(qsTr("You must restart Moonlight for this change to take effect"), 5000)
|
ToolTip.show(qsTr("You must restart Moonlight for this change to take effect"), 5000)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Force the back operation to pop any AppView pages that exist.
|
||||||
|
// The AppView stops working after retranslate() for some reason.
|
||||||
|
window.clearOnBack = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ import SdlGamepadKeyNavigation 1.0
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
property bool pollingActive: false
|
property bool pollingActive: false
|
||||||
|
|
||||||
|
// Set by SettingsView to force the back operation to pop all
|
||||||
|
// pages except the initial view. This is required when doing
|
||||||
|
// a retranslate() because AppView breaks for some reason.
|
||||||
|
property bool clearOnBack: false
|
||||||
|
|
||||||
id: window
|
id: window
|
||||||
visible: true
|
visible: true
|
||||||
width: 1280
|
width: 1280
|
||||||
|
@ -31,6 +36,17 @@ ApplicationWindow {
|
||||||
// it will never insert a line break and just extend on forever.
|
// it will never insert a line break and just extend on forever.
|
||||||
ToolTip.toolTip.contentWidth: ToolTip.toolTip.implicitContentWidth < 400 ? ToolTip.toolTip.implicitContentWidth : 400
|
ToolTip.toolTip.contentWidth: ToolTip.toolTip.implicitContentWidth < 400 ? ToolTip.toolTip.implicitContentWidth : 400
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
if (clearOnBack) {
|
||||||
|
// Pop all items except the first one
|
||||||
|
stackView.pop(null)
|
||||||
|
clearOnBack = false
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stackView.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stackView
|
id: stackView
|
||||||
initialItem: initialView
|
initialItem: initialView
|
||||||
|
@ -46,7 +62,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
Keys.onEscapePressed: {
|
Keys.onEscapePressed: {
|
||||||
if (depth > 1) {
|
if (depth > 1) {
|
||||||
stackView.pop()
|
goBack()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
quitConfirmationDialog.open()
|
quitConfirmationDialog.open()
|
||||||
|
@ -55,7 +71,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
Keys.onBackPressed: {
|
Keys.onBackPressed: {
|
||||||
if (depth > 1) {
|
if (depth > 1) {
|
||||||
stackView.pop()
|
goBack()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
quitConfirmationDialog.open()
|
quitConfirmationDialog.open()
|
||||||
|
@ -210,7 +226,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
iconSource: "qrc:/res/arrow_left.svg"
|
iconSource: "qrc:/res/arrow_left.svg"
|
||||||
|
|
||||||
onClicked: stackView.pop()
|
onClicked: goBack()
|
||||||
|
|
||||||
Keys.onDownPressed: {
|
Keys.onDownPressed: {
|
||||||
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
||||||
|
|
Loading…
Reference in a new issue