Add support for Fullscreen UI in Moonlight (#492)

* initial UI and window decoration removal toggle

* revert default height change

* add fullscreen support to kiosk mode

* add tool tip for kiosk mode

* change to fullscreen rather than kiosk

* update to Fullscreen instead of Full-screen or Full Screen

* update UI text

* convert to display mode picker

* add UI label for picker

* clean up references to startMaximized and fullScreenUIMode

* remove flags property, as fullscreen visiblity handles this already

* use Maximized in selection text

* account for running moonlight without a window manager

* lock display mode from being changed if there is no window manager running

Co-authored-by: jmt-gh <jmt-gh@users.noreply.github.com>
This commit is contained in:
jmt-gh
2021-01-10 07:50:12 -08:00
committed by GitHub
parent e9a98a3402
commit 19dac306d1
4 changed files with 69 additions and 16 deletions

View File

@@ -551,7 +551,7 @@ Flickable {
model: ListModel {
id: windowModeListModel
ListElement {
text: qsTr("Full-screen")
text: qsTr("Fullscreen")
val: StreamingPreferences.WM_FULLSCREEN
}
ListElement {
@@ -570,7 +570,7 @@ Flickable {
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Full-screen generally provides the best performance, but borderless windowed may work better with features like macOS Spaces, Alt+Tab, screenshot tools, on-screen overlays, etc.")
ToolTip.text: qsTr("Fullscreen generally provides the best performance, but borderless windowed may work better with features like macOS Spaces, Alt+Tab, screenshot tools, on-screen overlays, etc.")
}
CheckBox {
@@ -713,15 +713,50 @@ Flickable {
anchors.fill: parent
spacing: 5
CheckBox {
id: startMaximizedCheck
Label {
width: parent.width
text: qsTr("Maximize Moonlight window on startup")
id: uiDisplayModeTitle
text: qsTr("Display Mode")
font.pointSize: 12
wrapMode: Text.Wrap
}
AutoResizingComboBox {
// ignore setting the index at first, and actually set it when the component is loaded
Component.onCompleted: {
var saved_uidisplaymode = StreamingPreferences.uiDisplayMode
currentIndex = 0
for (var i = 0; i < uiDisplayModeListModel.count; i++) {
var el_uidisplaymode = uiDisplayModeListModel.get(i).val;
if (saved_uidisplaymode === el_uidisplaymode) {
currentIndex = i
break
}
}
activated(currentIndex)
}
id: uiDisplayModeComboBox
enabled: SystemProperties.hasWindowManager
checked: !StreamingPreferences.startWindowed || !SystemProperties.hasWindowManager
onCheckedChanged: {
StreamingPreferences.startWindowed = !checked
textRole: "text"
model: ListModel {
id: uiDisplayModeListModel
ListElement {
text: qsTr("Windowed")
val: StreamingPreferences.UI_WINDOWED
}
ListElement {
text: qsTr("Maximized")
val: StreamingPreferences.UI_FULLSCREEN_WINDOWED
}
ListElement {
text: qsTr("Fullscreen")
val: StreamingPreferences.UI_FULLSCREEN
}
}
// ::onActivated must be used, as it only listens for when the index is changed by a human
onActivated : {
StreamingPreferences.uiDisplayMode = uiDisplayModeListModel.get(currentIndex).val
}
}

View File

@@ -17,8 +17,16 @@ ApplicationWindow {
width: 1280
height: 600
visibility: (SystemProperties.hasWindowManager && StreamingPreferences.startWindowed) ? "Windowed" : "Maximized"
visibility: {
if (SystemProperties.hasWindowManager) {
if (StreamingPreferences.uiDisplayMode == StreamingPreferences.UI_WINDOWED) return "Windowed"
else if (StreamingPreferences.uiDisplayMode == StreamingPreferences.UI_FULLSCREEN_WINDOWED) return "Maximized"
else if (StreamingPreferences.uiDisplayMode == StreamingPreferences.UI_FULLSCREEN) return "FullScreen"
} else {
return "Maximized"
}
}
// This configures the maximum width of the singleton attached QML ToolTip. If left unconstrained,
// it will never insert a line break and just extend on forever.
ToolTip.toolTip.contentWidth: ToolTip.toolTip.implicitContentWidth < 400 ? ToolTip.toolTip.implicitContentWidth : 400