From 8ebb59408929c8aef8984a1649c0abd46b07705f Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Sun, 8 Jul 2018 10:19:08 -0700 Subject: [PATCH 1/3] Beginnings of settings page (#2) * Make Moonlight icon the window icon for all windows * Add dummy settings * Add slider * FIx comments --- app/gui/SettingsView.qml | 98 ++++++++++++++++++++++++++++++++++++++-- app/main.cpp | 4 ++ 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index 5f54ed42..d5c8f7dd 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -1,8 +1,100 @@ import QtQuick 2.9 -Rectangle { +import QtQuick.Controls 2.2 + +Page { id: settingsPage - color: "#333333" objectName: "Settings" - // TODO - add settings + Column { + id: column + x: 10 + y: 10 + width: settingsPage.width + height: 400 + + GroupBox { + // TODO save the settings + id: streamingSettingsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("Basic Settings") + + Column { + id: column1 + anchors.fill: parent + spacing: 5 + + Label { + width: parent.width + id: resFPStitle + text: qsTr("Resolution and FPS target") + font.pointSize: 12 + wrapMode: Text.Wrap + } + + Label { + width: parent.width + id: resFPSdesc + text: qsTr("Setting values too high for your device may cause lag or crashing") + font.pointSize: 9 + wrapMode: Text.Wrap + } + + ComboBox { + id: resolutionComboBox + currentIndex : 4 + model: ListModel { + id: resolutionListModel + // TODO have values associated with the text. + ListElement { text: "360p 30 FPS" } + ListElement { text: "360p 60 FPS" } + ListElement { text: "720p 30 FPS" } + ListElement { text: "720p 60 FPS" } + ListElement { text: "1080p 30 FPS" } + ListElement { text: "1080p 60 FPS" } + ListElement { text: "4K 30 FPS" } + ListElement { text: "4K 60 FPS" } + } + onCurrentIndexChanged: console.debug(resolutionListModel.get(currentIndex).text + " selected resolution") + } + + Label { + width: parent.width + id: bitrateTitle + text: qsTr("Video bitrate target") + font.pointSize: 12 + wrapMode: Text.Wrap + } + + Label { + width: parent.width + id: bitrateDesc + text: qsTr("Lower bitrate to reduce stuttering. Raise bitrate to increase image quality.") + font.pointSize: 9 + wrapMode: Text.Wrap + } + + Slider { + id: slider + wheelEnabled: true + + // TODO value should be loaded as the current value. + value: 500 + stepSize: 500 + from : 500 + to: 10000 + snapMode: "SnapOnRelease" + width: Math.min(bitrateDesc.implicitWidth, parent.width) + + // TODO store the value + // TODO display the current value to the user + onValueChanged: + { + console.debug(slider.value + " Slider moved") + } + } + } + } + } + // TODO add more settings } diff --git a/app/main.cpp b/app/main.cpp index 21f378df..c9ab990c 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1,5 +1,6 @@ #include #include +#include // Don't let SDL hook our main function, since Qt is already // doing the same thing. This needs to be before any headers @@ -29,6 +30,9 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + // FIXME this icon is low-resolution and appears a little fuzzy. + app.setWindowIcon(QIcon(":/res/icon128.png")); + // Register our C++ types for QML qmlRegisterType("ComputerModel", 1, 0, "ComputerModel"); qmlRegisterType("AppModel", 1, 0, "AppModel"); From 33a0188fea99bc776e2830be16dd00c679ab7584 Mon Sep 17 00:00:00 2001 From: "MINICOM\\mrb11" Date: Sun, 8 Jul 2018 11:12:22 -0700 Subject: [PATCH 2/3] Fill out remainder of dummy settings --- app/gui/SettingsView.qml | 126 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 4 deletions(-) diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index d5c8f7dd..16d6971a 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -6,7 +6,6 @@ Page { objectName: "Settings" Column { - id: column x: 10 y: 10 width: settingsPage.width @@ -14,13 +13,13 @@ Page { GroupBox { // TODO save the settings - id: streamingSettingsGroupBox + id: basicSettingsGroupBox width: (parent.width - 20) padding: 12 title: qsTr("Basic Settings") + font.pointSize: 12 Column { - id: column1 anchors.fill: parent spacing: 5 @@ -43,6 +42,8 @@ Page { ComboBox { id: resolutionComboBox currentIndex : 4 + width: Math.min(bitrateDesc.implicitWidth, parent.width) + font.pointSize: 9 model: ListModel { id: resolutionListModel // TODO have values associated with the text. @@ -93,8 +94,125 @@ Page { console.debug(slider.value + " Slider moved") } } + + CheckBox { + id: fullScreenCheck + text: qsTr("Stretch video to full-screen") + font.pointSize: 12 + } + + CheckBox { + id: pipObserverCheck + text: qsTr("Enable Picture-in-Picture observer mode") + font.pointSize: 12 + } + } + } + + GroupBox { + id: audioSettingsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("Audio Settings") + font.pointSize: 12 + + Column { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: surroundSoundCheck + text: qsTr("Enable 5.1 surround sound") + font.pointSize: 12 + } + } + } + + GroupBox { + id: gamepadSettingsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("Gamepad Settings") + font.pointSize: 12 + + Column { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: multiControllerCheck + text: qsTr("Multiple controller support") + font.pointSize: 12 + } + CheckBox { + id: mouseEmulationCheck + text: qsTr("Mouse emulation via gamepad") + font.pointSize: 12 + } + } + } + + GroupBox { + id: onScreenControlsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("On-screen Controls Settings") + font.pointSize: 12 + + Column { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: onScreenControlsCheck + text: qsTr("Show on-screen controls") + font.pointSize: 12 + } + } + } + + GroupBox { + id: hostSettingsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("Host Settings") + font.pointSize: 12 + + Column { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: optimizeGameSettingsCheck + text: qsTr("Optimize Game Settings") + font.pointSize: 12 + } + + CheckBox { + id: audioPcCheck + text: qsTr("Play audio on PC") + font.pointSize: 12 + } + } + } + + GroupBox { + id: advancedSettingsGroupBox + width: (parent.width - 20) + padding: 12 + title: qsTr("Advanced Settings") + font.pointSize: 12 + + Column { + anchors.fill: parent + spacing: 5 + + CheckBox { + id: neverDropFramesCheck + text: qsTr("Never Drop Frames") + font.pointSize: 12 + } } } } - // TODO add more settings } From 640f47300c7f9abe5f99e1c20899d6bce8506f23 Mon Sep 17 00:00:00 2001 From: "MINICOM\\mrb11" Date: Sun, 8 Jul 2018 11:20:56 -0700 Subject: [PATCH 3/3] Make settings page scrollable and match the app color scheme --- app/gui/SettingsView.qml | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index 16d6971a..8a3e3822 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -1,7 +1,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 -Page { +ScrollView { id: settingsPage objectName: "Settings" @@ -16,7 +16,7 @@ Page { id: basicSettingsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("Basic Settings") + title: "Basic Settings" font.pointSize: 12 Column { @@ -28,7 +28,8 @@ Page { id: resFPStitle text: qsTr("Resolution and FPS target") font.pointSize: 12 - wrapMode: Text.Wrap + wrapMode: Text.Wrap + color: "white" } Label { @@ -37,6 +38,7 @@ Page { text: qsTr("Setting values too high for your device may cause lag or crashing") font.pointSize: 9 wrapMode: Text.Wrap + color: "white" } ComboBox { @@ -65,6 +67,7 @@ Page { text: qsTr("Video bitrate target") font.pointSize: 12 wrapMode: Text.Wrap + color: "white" } Label { @@ -73,6 +76,7 @@ Page { text: qsTr("Lower bitrate to reduce stuttering. Raise bitrate to increase image quality.") font.pointSize: 9 wrapMode: Text.Wrap + color: "white" } Slider { @@ -97,13 +101,13 @@ Page { CheckBox { id: fullScreenCheck - text: qsTr("Stretch video to full-screen") + text: "Stretch video to full-screen" font.pointSize: 12 } CheckBox { id: pipObserverCheck - text: qsTr("Enable Picture-in-Picture observer mode") + text: "Enable Picture-in-Picture observer mode" font.pointSize: 12 } } @@ -113,7 +117,7 @@ Page { id: audioSettingsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("Audio Settings") + title: "Audio Settings" font.pointSize: 12 Column { @@ -122,7 +126,7 @@ Page { CheckBox { id: surroundSoundCheck - text: qsTr("Enable 5.1 surround sound") + text: "Enable 5.1 surround sound" font.pointSize: 12 } } @@ -132,7 +136,7 @@ Page { id: gamepadSettingsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("Gamepad Settings") + title: "Gamepad Settings" font.pointSize: 12 Column { @@ -141,12 +145,12 @@ Page { CheckBox { id: multiControllerCheck - text: qsTr("Multiple controller support") + text: "Multiple controller support" font.pointSize: 12 } CheckBox { id: mouseEmulationCheck - text: qsTr("Mouse emulation via gamepad") + text: "Mouse emulation via gamepad" font.pointSize: 12 } } @@ -156,7 +160,7 @@ Page { id: onScreenControlsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("On-screen Controls Settings") + title: "On-screen Controls Settings" font.pointSize: 12 Column { @@ -165,7 +169,7 @@ Page { CheckBox { id: onScreenControlsCheck - text: qsTr("Show on-screen controls") + text: "Show on-screen controls" font.pointSize: 12 } } @@ -175,7 +179,7 @@ Page { id: hostSettingsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("Host Settings") + title: "Host Settings" font.pointSize: 12 Column { @@ -184,13 +188,13 @@ Page { CheckBox { id: optimizeGameSettingsCheck - text: qsTr("Optimize Game Settings") + text: "Optimize game settings" font.pointSize: 12 } CheckBox { id: audioPcCheck - text: qsTr("Play audio on PC") + text: "Play audio on PC" font.pointSize: 12 } } @@ -200,7 +204,7 @@ Page { id: advancedSettingsGroupBox width: (parent.width - 20) padding: 12 - title: qsTr("Advanced Settings") + title: "Advanced Settings" font.pointSize: 12 Column { @@ -209,7 +213,7 @@ Page { CheckBox { id: neverDropFramesCheck - text: qsTr("Never Drop Frames") + text: "Never drop frames" font.pointSize: 12 } }