From 30f673efe1a46e8986a33e52da25e2b48a656a28 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 16 Aug 2018 23:29:46 -0700 Subject: [PATCH] Create Qt components with all parameters specified otherwise it will be instantiated with default properties --- app/backend/nvhttp.cpp | 2 ++ app/gui/AppView.qml | 17 +++++++---------- app/gui/PcView.qml | 4 +--- app/gui/QuitSegue.qml | 4 +--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/backend/nvhttp.cpp b/app/backend/nvhttp.cpp index f994d3a6..a7140aff 100644 --- a/app/backend/nvhttp.cpp +++ b/app/backend/nvhttp.cpp @@ -16,6 +16,8 @@ NvHTTP::NvHTTP(QString address) : m_Address(address) { + Q_ASSERT(!address.isEmpty()); + m_BaseUrlHttp.setScheme("http"); m_BaseUrlHttps.setScheme("https"); m_BaseUrlHttp.setHost(address); diff --git a/app/gui/AppView.qml b/app/gui/AppView.qml index 6202261e..bb329f01 100644 --- a/app/gui/AppView.qml +++ b/app/gui/AppView.qml @@ -100,9 +100,7 @@ GridView { } var component = Qt.createComponent("StreamSegue.qml") - var segue = component.createObject(stackView) - segue.appName = model.name - segue.session = appModel.createSessionForApp(index) + var segue = component.createObject(stackView, {"appName": model.name, "session": appModel.createSessionForApp(index)}) stackView.push(segue) } @@ -115,20 +113,19 @@ GridView { standardButtons: StandardButton.Yes | StandardButton.No onYes: { var component = Qt.createComponent("QuitSegue.qml") - var segue = component.createObject(stackView) - segue.appName = appName + var params = {"appName": appName} if (segueToStream) { // Store the session and app name if we're going to stream after // successfully quitting the old app. - segue.nextAppName = model.name - segue.nextSession = appModel.createSessionForApp(index) + params.nextAppName = model.name + params.nextSession = appModel.createSessionForApp(index) } else { - segue.nextAppName = null - segue.nextSession = null + params.nextAppName = null + params.nextSession = null } - stackView.push(segue) + stackView.push(component.createObject(stackView, params)) // Trigger the quit after pushing the quit segue on screen appModel.quitRunningApp() diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 4766e307..118ba3b6 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -154,9 +154,7 @@ GridView { if (model.paired) { // go to game view var component = Qt.createComponent("AppView.qml") - var appView = component.createObject(stackView) - appView.computerIndex = index - appView.objectName = model.name + var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name}) stackView.push(appView) } else { diff --git a/app/gui/QuitSegue.qml b/app/gui/QuitSegue.qml index 455bf993..0f63d9d1 100644 --- a/app/gui/QuitSegue.qml +++ b/app/gui/QuitSegue.qml @@ -33,9 +33,7 @@ Item { // If we're supposed to launch another game after this, do so now if (error === undefined && nextSession !== null) { var component = Qt.createComponent("StreamSegue.qml") - var segue = component.createObject(stackView) - segue.appName = nextAppName - segue.session = nextSession + var segue = component.createObject(stackView, {"appName": nextAppName, "session": nextSession}) stackView.push(segue) } }