2018-07-04 21:16:25 +00:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
2018-07-08 05:15:02 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2018-08-14 02:47:42 +00:00
|
|
|
import QtQuick.Window 2.2
|
2018-07-04 21:16:25 +00:00
|
|
|
|
2018-08-14 02:47:42 +00:00
|
|
|
import ComputerManager 1.0
|
2018-08-10 05:51:27 +00:00
|
|
|
import AutoUpdateChecker 1.0
|
2018-10-01 05:39:51 +00:00
|
|
|
import StreamingPreferences 1.0
|
2019-03-23 19:05:08 +00:00
|
|
|
import SystemProperties 1.0
|
2019-03-23 21:15:55 +00:00
|
|
|
import SdlGamepadKeyNavigation 1.0
|
2018-08-10 05:51:27 +00:00
|
|
|
|
2018-07-04 21:16:25 +00:00
|
|
|
ApplicationWindow {
|
2018-08-14 02:47:42 +00:00
|
|
|
property bool pollingActive: false
|
|
|
|
|
2018-07-04 21:16:25 +00:00
|
|
|
id: window
|
|
|
|
visible: true
|
2018-07-06 05:08:55 +00:00
|
|
|
width: 1280
|
2018-09-09 20:21:11 +00:00
|
|
|
height: 600
|
2018-07-09 06:24:26 +00:00
|
|
|
|
2019-03-28 01:13:20 +00:00
|
|
|
visibility: StreamingPreferences.startWindowed ? "Windowed" : "Maximized"
|
2019-03-23 21:15:55 +00:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
SdlGamepadKeyNavigation.enable()
|
|
|
|
}
|
|
|
|
|
2018-07-06 03:37:51 +00:00
|
|
|
StackView {
|
|
|
|
id: stackView
|
2018-09-29 21:06:55 +00:00
|
|
|
initialItem: initialView
|
2018-07-06 03:37:51 +00:00
|
|
|
anchors.fill: parent
|
2018-09-23 22:16:27 +00:00
|
|
|
focus: true
|
|
|
|
|
|
|
|
onCurrentItemChanged: {
|
2018-09-24 02:06:26 +00:00
|
|
|
// Ensure focus travels to the next view when going back
|
2018-09-23 22:16:27 +00:00
|
|
|
if (currentItem) {
|
|
|
|
currentItem.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Keys.onEscapePressed: {
|
|
|
|
if (depth > 1) {
|
|
|
|
stackView.pop()
|
|
|
|
}
|
2018-10-13 07:41:22 +00:00
|
|
|
else {
|
|
|
|
quitConfirmationDialog.open()
|
|
|
|
}
|
2018-09-23 22:16:27 +00:00
|
|
|
}
|
2018-09-24 02:06:26 +00:00
|
|
|
|
|
|
|
Keys.onBackPressed: {
|
|
|
|
if (depth > 1) {
|
|
|
|
stackView.pop()
|
|
|
|
}
|
2018-10-13 07:41:22 +00:00
|
|
|
else {
|
|
|
|
quitConfirmationDialog.open()
|
|
|
|
}
|
2018-09-24 02:06:26 +00:00
|
|
|
}
|
2018-09-30 20:41:32 +00:00
|
|
|
|
|
|
|
Keys.onMenuPressed: {
|
|
|
|
settingsButton.clicked()
|
|
|
|
}
|
2018-09-30 20:52:38 +00:00
|
|
|
|
|
|
|
// This is a keypress we've reserved for letting the
|
|
|
|
// SdlGamepadKeyNavigation object tell us to show settings
|
|
|
|
// when Menu is consumed by a focused control.
|
|
|
|
Keys.onHangupPressed: {
|
|
|
|
settingsButton.clicked()
|
|
|
|
}
|
2018-07-04 21:16:25 +00:00
|
|
|
}
|
2018-07-08 05:15:02 +00:00
|
|
|
|
2018-10-13 02:58:29 +00:00
|
|
|
// This timer keeps us polling for 5 minutes of inactivity
|
|
|
|
// to allow the user to work with Moonlight on a second display
|
|
|
|
// while dealing with configuration issues. This will ensure
|
|
|
|
// machines come online even if the input focus isn't on Moonlight.
|
|
|
|
Timer {
|
|
|
|
id: inactivityTimer
|
|
|
|
interval: 5 * 60000
|
|
|
|
onTriggered: {
|
|
|
|
if (!active && pollingActive) {
|
|
|
|
ComputerManager.stopPollingAsync()
|
|
|
|
pollingActive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-29 00:53:49 +00:00
|
|
|
onVisibleChanged: {
|
|
|
|
// When we become invisible while streaming is going on,
|
|
|
|
// stop polling immediately.
|
|
|
|
if (!visible) {
|
|
|
|
inactivityTimer.stop()
|
|
|
|
|
|
|
|
if (pollingActive) {
|
|
|
|
ComputerManager.stopPollingAsync()
|
|
|
|
pollingActive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (active) {
|
|
|
|
// When we become visible and active again, start polling
|
|
|
|
inactivityTimer.stop()
|
|
|
|
|
|
|
|
// Restart polling if it was stopped
|
|
|
|
if (!pollingActive) {
|
|
|
|
ComputerManager.startPolling()
|
|
|
|
pollingActive = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-13 02:58:29 +00:00
|
|
|
onActiveChanged: {
|
|
|
|
if (active) {
|
|
|
|
// Stop the inactivity timer
|
|
|
|
inactivityTimer.stop()
|
|
|
|
|
|
|
|
// Restart polling if it was stopped
|
|
|
|
if (!pollingActive) {
|
|
|
|
ComputerManager.startPolling()
|
|
|
|
pollingActive = true
|
|
|
|
}
|
2018-08-14 02:47:42 +00:00
|
|
|
}
|
2018-10-13 02:58:29 +00:00
|
|
|
else {
|
|
|
|
// Start the inactivity timer to stop polling
|
|
|
|
// if focus does not return within a few minutes.
|
|
|
|
inactivityTimer.restart()
|
2018-08-14 02:47:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-01 05:39:51 +00:00
|
|
|
property bool initialized: false
|
|
|
|
|
2018-10-06 02:54:13 +00:00
|
|
|
// BUG: Using onAfterSynchronizing: here causes very strange
|
|
|
|
// failures on Linux. Many shaders fail to compile and we
|
|
|
|
// eventually segfault deep inside the Qt OpenGL code.
|
|
|
|
onAfterRendering: {
|
2018-10-01 05:39:51 +00:00
|
|
|
// We use this callback to trigger dialog display because
|
|
|
|
// it only happens once the window is fully constructed.
|
|
|
|
// Doing it earlier can lead to the dialog appearing behind
|
|
|
|
// the window or otherwise without input focus.
|
|
|
|
if (!initialized) {
|
2018-11-19 06:04:44 +00:00
|
|
|
// Set initialized before calling anything else, because
|
|
|
|
// pumping the event loop can cause us to get another
|
|
|
|
// onAfterRendering call and potentially reenter this code.
|
|
|
|
initialized = true;
|
|
|
|
|
2019-04-22 01:31:11 +00:00
|
|
|
if (SystemProperties.isWow64) {
|
2018-10-01 05:39:51 +00:00
|
|
|
wow64Dialog.open()
|
|
|
|
}
|
2019-03-23 19:05:08 +00:00
|
|
|
else if (!SystemProperties.hasHardwareAcceleration) {
|
2019-04-22 01:31:11 +00:00
|
|
|
if (SystemProperties.isRunningXWayland) {
|
|
|
|
xWaylandDialog.open()
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
noHwDecoderDialog.open()
|
|
|
|
}
|
2018-10-01 05:39:51 +00:00
|
|
|
}
|
|
|
|
|
2019-03-23 19:05:08 +00:00
|
|
|
if (SystemProperties.unmappedGamepads) {
|
|
|
|
unmappedGamepadDialog.unmappedGamepads = SystemProperties.unmappedGamepads
|
2018-10-01 05:39:51 +00:00
|
|
|
unmappedGamepadDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 05:37:29 +00:00
|
|
|
function navigateTo(url, objectName)
|
|
|
|
{
|
|
|
|
var existingItem = stackView.find(function(item, index) {
|
|
|
|
return item.objectName === objectName
|
|
|
|
})
|
|
|
|
|
|
|
|
if (existingItem !== null) {
|
|
|
|
// Pop to the existing item
|
|
|
|
stackView.pop(existingItem)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Create a new item
|
|
|
|
stackView.push(url)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 05:15:02 +00:00
|
|
|
header: ToolBar {
|
2018-07-09 07:12:27 +00:00
|
|
|
id: toolBar
|
2018-08-31 06:28:26 +00:00
|
|
|
anchors.topMargin: 5
|
|
|
|
anchors.bottomMargin: 5
|
2018-07-08 05:15:02 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
spacing: 20
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
NavigableToolButton {
|
2018-07-08 05:15:02 +00:00
|
|
|
// Only make the button visible if the user has navigated somewhere.
|
|
|
|
visible: stackView.depth > 1
|
|
|
|
|
2018-08-31 06:28:26 +00:00
|
|
|
// FIXME: We're using an Image here rather than icon.source because
|
|
|
|
// icons don't work on Qt 5.9 LTS.
|
|
|
|
Image {
|
|
|
|
source: "qrc:/res/arrow_left.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
// The icon should be square so use the height as the width too
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 05:15:02 +00:00
|
|
|
onClicked: stackView.pop()
|
2018-09-23 22:16:27 +00:00
|
|
|
|
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
2018-07-08 05:15:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: titleLabel
|
|
|
|
text: stackView.currentItem.objectName
|
|
|
|
font.pointSize: 15
|
|
|
|
elide: Label.ElideRight
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2019-03-27 04:31:51 +00:00
|
|
|
NavigableToolButton {
|
|
|
|
id: addPcButton
|
|
|
|
visible: stackView.currentItem.objectName === "Computers"
|
|
|
|
|
|
|
|
Image {
|
|
|
|
source: "qrc:/res/ic_add_to_queue_white_48px.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolTip.delay: 1000
|
|
|
|
ToolTip.timeout: 3000
|
|
|
|
ToolTip.visible: hovered
|
2019-03-31 20:57:57 +00:00
|
|
|
ToolTip.text: "Add PC manually" + (newPcShortcut.nativeText ? (" ("+newPcShortcut.nativeText+")") : "")
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
id: newPcShortcut
|
|
|
|
sequence: StandardKey.New
|
|
|
|
onActivated: addPcButton.clicked()
|
|
|
|
}
|
2019-03-27 04:31:51 +00:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
addPcDialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
NavigableToolButton {
|
2018-08-10 05:51:27 +00:00
|
|
|
property string browserUrl: ""
|
|
|
|
|
|
|
|
id: updateButton
|
2018-08-31 06:28:26 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
source: "qrc:/res/update.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
2018-08-10 05:51:27 +00:00
|
|
|
|
2018-08-10 06:20:20 +00:00
|
|
|
ToolTip.delay: 1000
|
|
|
|
ToolTip.timeout: 3000
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
|
2018-08-10 05:51:27 +00:00
|
|
|
// Invisible until we get a callback notifying us that
|
|
|
|
// an update is available
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
onClicked: Qt.openUrlExternally(browserUrl);
|
|
|
|
|
2019-01-04 02:00:54 +00:00
|
|
|
function updateAvailable(version, url)
|
2018-08-10 05:51:27 +00:00
|
|
|
{
|
2019-01-04 02:00:54 +00:00
|
|
|
ToolTip.text = "Update available for Moonlight: Version " + version
|
2018-08-10 05:51:27 +00:00
|
|
|
updateButton.browserUrl = url
|
|
|
|
updateButton.visible = true
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
AutoUpdateChecker.onUpdateAvailable.connect(updateAvailable)
|
|
|
|
AutoUpdateChecker.start()
|
|
|
|
}
|
2018-09-23 22:16:27 +00:00
|
|
|
|
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
2018-08-10 05:51:27 +00:00
|
|
|
}
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
NavigableToolButton {
|
2018-09-24 02:24:47 +00:00
|
|
|
id: helpButton
|
2019-03-23 20:51:34 +00:00
|
|
|
visible: SystemProperties.hasBrowser
|
2018-09-24 02:24:47 +00:00
|
|
|
|
2018-08-31 06:28:26 +00:00
|
|
|
Image {
|
|
|
|
source: "qrc:/res/question_mark.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
2018-07-09 05:37:29 +00:00
|
|
|
|
2018-08-10 06:20:20 +00:00
|
|
|
ToolTip.delay: 1000
|
|
|
|
ToolTip.timeout: 3000
|
|
|
|
ToolTip.visible: hovered
|
2018-09-24 02:24:47 +00:00
|
|
|
ToolTip.text: "Help" + (helpShortcut.nativeText ? (" ("+helpShortcut.nativeText+")") : "")
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
id: helpShortcut
|
|
|
|
sequence: StandardKey.HelpContents
|
|
|
|
onActivated: helpButton.clicked()
|
|
|
|
}
|
2018-08-10 06:20:20 +00:00
|
|
|
|
2018-07-09 05:37:29 +00:00
|
|
|
// TODO need to make sure browser is brought to foreground.
|
|
|
|
onClicked: Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide");
|
2018-09-23 22:16:27 +00:00
|
|
|
|
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
2018-07-08 05:15:02 +00:00
|
|
|
}
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
NavigableToolButton {
|
2018-07-28 08:27:42 +00:00
|
|
|
// TODO: Implement gamepad mapping then unhide this button
|
|
|
|
visible: false
|
|
|
|
|
2018-08-10 06:20:20 +00:00
|
|
|
ToolTip.delay: 1000
|
|
|
|
ToolTip.timeout: 3000
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: "Gamepad Mapper"
|
|
|
|
|
2018-08-31 06:28:26 +00:00
|
|
|
Image {
|
|
|
|
source: "qrc:/res/ic_videogame_asset_white_48px.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 05:37:29 +00:00
|
|
|
onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", "Gamepad Mapping")
|
2018-09-23 22:16:27 +00:00
|
|
|
|
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
2018-07-09 05:37:29 +00:00
|
|
|
}
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
NavigableToolButton {
|
2018-09-24 02:24:47 +00:00
|
|
|
id: settingsButton
|
|
|
|
|
2018-08-31 06:28:26 +00:00
|
|
|
Image {
|
|
|
|
source: "qrc:/res/settings.svg"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
sourceSize {
|
|
|
|
width: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
height: toolBar.height - toolBar.anchors.bottomMargin - toolBar.anchors.topMargin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 05:37:29 +00:00
|
|
|
onClicked: navigateTo("qrc:/gui/SettingsView.qml", "Settings")
|
2018-07-08 05:15:02 +00:00
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
Keys.onDownPressed: {
|
|
|
|
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
|
|
|
|
2018-09-24 02:24:47 +00:00
|
|
|
Shortcut {
|
|
|
|
id: settingsShortcut
|
|
|
|
sequence: StandardKey.Preferences
|
|
|
|
onActivated: settingsButton.clicked()
|
|
|
|
}
|
|
|
|
|
2018-08-10 06:20:20 +00:00
|
|
|
ToolTip.delay: 1000
|
|
|
|
ToolTip.timeout: 3000
|
|
|
|
ToolTip.visible: hovered
|
2018-09-24 02:24:47 +00:00
|
|
|
ToolTip.text: "Settings" + (settingsShortcut.nativeText ? (" ("+settingsShortcut.nativeText+")") : "")
|
2018-07-08 05:15:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-01 05:39:51 +00:00
|
|
|
|
2019-03-23 20:51:34 +00:00
|
|
|
ErrorMessageDialog {
|
2018-10-01 05:39:51 +00:00
|
|
|
id: noHwDecoderDialog
|
|
|
|
text: "No functioning hardware accelerated H.264 video decoder was detected by Moonlight. " +
|
2019-03-23 20:51:34 +00:00
|
|
|
"Your streaming performance may be severely degraded in this configuration."
|
|
|
|
helpText: "Click the Help button for more information on solving this problem."
|
2019-03-31 22:16:48 +00:00
|
|
|
helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"
|
2018-10-01 05:39:51 +00:00
|
|
|
}
|
|
|
|
|
2019-03-23 20:51:34 +00:00
|
|
|
ErrorMessageDialog {
|
2019-04-22 01:31:11 +00:00
|
|
|
id: xWaylandDialog
|
|
|
|
text: "Hardware acceleration doesn't work on XWayland. Continuing on XWayland may result in poor streaming performance. " +
|
|
|
|
"Try running with QT_QPA_PLATFORM=wayland or switch to X11."
|
2019-03-23 20:51:34 +00:00
|
|
|
helpText: "Click the Help button for more information."
|
2019-03-31 22:16:48 +00:00
|
|
|
helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"
|
2018-10-01 05:39:51 +00:00
|
|
|
}
|
|
|
|
|
2019-03-31 20:57:57 +00:00
|
|
|
NavigableMessageDialog {
|
2018-10-01 05:39:51 +00:00
|
|
|
id: wow64Dialog
|
2019-04-01 00:24:25 +00:00
|
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
2018-10-01 05:39:51 +00:00
|
|
|
text: "This PC is running a 64-bit version of Windows. Please download the x64 version of Moonlight for the best streaming performance."
|
|
|
|
onAccepted: {
|
|
|
|
Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-qt/releases");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-23 20:51:34 +00:00
|
|
|
ErrorMessageDialog {
|
2018-10-01 05:39:51 +00:00
|
|
|
id: unmappedGamepadDialog
|
|
|
|
property string unmappedGamepads : ""
|
2019-03-23 20:51:34 +00:00
|
|
|
text: "Moonlight detected gamepads without a mapping:\n" + unmappedGamepads
|
2019-04-01 03:10:56 +00:00
|
|
|
helpTextSeparator: "\n\n"
|
2019-03-23 20:51:34 +00:00
|
|
|
helpText: "Click the Help button for information on how to map your gamepads."
|
2019-03-31 22:16:48 +00:00
|
|
|
helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Gamepad-Mapping"
|
2018-10-01 05:39:51 +00:00
|
|
|
}
|
2018-10-13 07:41:22 +00:00
|
|
|
|
|
|
|
// This dialog appears when quitting via keyboard or gamepad button
|
2019-03-31 20:57:57 +00:00
|
|
|
NavigableMessageDialog {
|
2018-10-13 07:41:22 +00:00
|
|
|
id: quitConfirmationDialog
|
2019-04-01 00:24:25 +00:00
|
|
|
standardButtons: Dialog.Yes | Dialog.No
|
2018-10-13 07:41:22 +00:00
|
|
|
text: "Are you sure you want to quit?"
|
|
|
|
// For keyboard/gamepad navigation
|
|
|
|
onAccepted: Qt.quit()
|
|
|
|
}
|
2019-03-27 04:31:51 +00:00
|
|
|
|
2019-04-24 02:40:21 +00:00
|
|
|
// HACK: This belongs in StreamSegue but keeping a dialog around after the parent
|
|
|
|
// dies can trigger bugs in Qt 5.12 that cause the app to crash. For now, we will
|
|
|
|
// host this dialog in a QML component that is never destroyed.
|
|
|
|
//
|
|
|
|
// To repro: Start a stream, cut the network connection to trigger the "Connection
|
|
|
|
// terminated" dialog, wait until the app grid times out back to the PC grid, then
|
|
|
|
// try to dismiss the dialog.
|
|
|
|
ErrorMessageDialog {
|
|
|
|
id: streamSegueErrorDialog
|
|
|
|
|
|
|
|
property bool quitAfter: false
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
if (quitAfter) {
|
|
|
|
Qt.quit()
|
|
|
|
}
|
|
|
|
|
|
|
|
// StreamSegue assumes its dialog will be re-created each time we
|
|
|
|
// start streaming, so fake it by wiping out the text each time.
|
|
|
|
text = ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-01 00:24:25 +00:00
|
|
|
NavigableDialog {
|
2019-03-27 04:31:51 +00:00
|
|
|
id: addPcDialog
|
2019-03-27 07:39:25 +00:00
|
|
|
property string label: "Enter the IP address of your GameStream PC:"
|
2019-03-27 04:31:51 +00:00
|
|
|
|
2019-04-01 00:24:25 +00:00
|
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
2019-03-27 04:31:51 +00:00
|
|
|
|
2019-04-01 02:32:17 +00:00
|
|
|
onOpened: {
|
|
|
|
// Force keyboard focus on the textbox so keyboard navigation works
|
|
|
|
editText.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
2019-03-27 04:31:51 +00:00
|
|
|
onAccepted: {
|
|
|
|
if (editText.text) {
|
|
|
|
ComputerManager.addNewHost(editText.text, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2019-04-01 00:24:25 +00:00
|
|
|
Label {
|
2019-03-27 04:31:51 +00:00
|
|
|
text: addPcDialog.label
|
2019-03-27 07:39:25 +00:00
|
|
|
font.bold: true
|
2019-03-27 04:31:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: editText
|
|
|
|
Layout.fillWidth: true
|
2019-04-01 00:24:25 +00:00
|
|
|
focus: true
|
|
|
|
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
addPcDialog.accept()
|
|
|
|
}
|
2019-03-27 04:31:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-04 21:16:25 +00:00
|
|
|
}
|