From 1a5a6773ce872d15d0a48a4dee660ab671e98642 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 4 Nov 2018 13:57:33 -0800 Subject: [PATCH] Add option to determine if Moonlight launches in full-screen. Fixes #103 --- app/gui/SettingsView.qml | 23 +++++++++++++++++++++++ app/gui/main.qml | 6 +----- app/settings/streamingpreferences.cpp | 3 +++ app/settings/streamingpreferences.h | 3 +++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index 8af80c4b..413871ea 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -466,6 +466,29 @@ ScrollView { } } + GroupBox { + id: uiSettingsGroupBox + width: (parent.width - parent.padding) + padding: 12 + title: "UI Settings" + font.pointSize: 12 + + Row { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: startWindowedCheck + text: "Start Moonlight in windowed mode" + font.pointSize: 12 + checked: prefs.startWindowed + onCheckedChanged: { + prefs.startWindowed = checked + } + } + } + } + GroupBox { id: hostSettingsGroupBox width: (parent.width - parent.padding) diff --git a/app/gui/main.qml b/app/gui/main.qml index b806d8d1..c1330708 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -18,11 +18,7 @@ ApplicationWindow { width: 1280 height: 600 - // Maximize the window by default when the stream is configured - // for full-screen or borderless windowed. This is ideal for TV - // setups where the user doesn't want a tiny window in the middle - // of their screen when starting Moonlight. - visibility: prefs.windowMode != StreamingPreferences.WM_WINDOWED ? "Maximized" : "Windowed" + visibility: prefs.startWindowed ? "Windowed" : "Maximized" Material.theme: Material.Dark Material.accent: Material.Purple diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index 92c94afd..9afb1e60 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -21,6 +21,7 @@ #define SER_UNSUPPORTEDFPS "unsupportedfps" #define SER_MDNS "mdns" #define SER_MOUSEACCELERATION "mouseacceleration" +#define SER_STARTWINDOWED "startwindowed" StreamingPreferences::StreamingPreferences(QObject *parent) : QObject(parent) @@ -43,6 +44,7 @@ void StreamingPreferences::reload() unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool(); enableMdns = settings.value(SER_MDNS, true).toBool(); mouseAcceleration = settings.value(SER_MOUSEACCELERATION, false).toBool(); + startWindowed = settings.value(SER_STARTWINDOWED, false).toBool(); audioConfig = static_cast(settings.value(SER_AUDIOCFG, static_cast(AudioConfig::AC_STEREO)).toInt()); videoCodecConfig = static_cast(settings.value(SER_VIDEOCFG, @@ -70,6 +72,7 @@ void StreamingPreferences::save() settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps); settings.setValue(SER_MDNS, enableMdns); settings.setValue(SER_MOUSEACCELERATION, mouseAcceleration); + settings.setValue(SER_STARTWINDOWED, startWindowed); settings.setValue(SER_AUDIOCFG, static_cast(audioConfig)); settings.setValue(SER_VIDEOCFG, static_cast(videoCodecConfig)); settings.setValue(SER_VIDEODEC, static_cast(videoDecoderSelection)); diff --git a/app/settings/streamingpreferences.h b/app/settings/streamingpreferences.h index 6b4ce2a2..c151435d 100644 --- a/app/settings/streamingpreferences.h +++ b/app/settings/streamingpreferences.h @@ -74,6 +74,7 @@ public: Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged) Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged) Q_PROPERTY(bool mouseAcceleration MEMBER mouseAcceleration NOTIFY mouseAccelerationChanged) + Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged) Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged) Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged) Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged) @@ -91,6 +92,7 @@ public: bool unsupportedFps; bool enableMdns; bool mouseAcceleration; + bool startWindowed; AudioConfig audioConfig; VideoCodecConfig videoCodecConfig; VideoDecoderSelection videoDecoderSelection; @@ -110,5 +112,6 @@ signals: void videoCodecConfigChanged(); void videoDecoderSelectionChanged(); void windowModeChanged(); + void startWindowedChanged(); };