summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraavit <eirik.aavitsland@digia.com>2014-09-10 15:12:06 +0200
committerEirik Aavitsland <eirik.aavitsland@digia.com>2014-10-08 11:38:11 +0300
commitdc12a6624b5f5a397e590d378bcf1f2a2f192e51 (patch)
tree21d39224c329c2cb8c3ae76d37aeda0f573457aa
parent09ae8a5401ae5ff97b8b7b75437077651988b5a2 (diff)
Update launchersettings for renamed DroidUtils->B2QtUtils
Also much simplification as the refactored API is better suited for QML usage. Depends on http://qt-gerrit.it.local/6317 Task-number: QTEE-704 Change-Id: I7491ada390d973a26cf8a2c2b668114eb87357c0 Reviewed-by: Samuli Piippo <samuli.piippo@digia.com>
-rw-r--r--basicsuite/launchersettings/BrightnessController.qml49
-rw-r--r--basicsuite/launchersettings/NetworkController.qml61
-rw-r--r--basicsuite/launchersettings/PoweroffAction.qml47
-rw-r--r--basicsuite/launchersettings/RebootAction.qml47
-rw-r--r--basicsuite/launchersettings/main.qml44
5 files changed, 23 insertions, 225 deletions
diff --git a/basicsuite/launchersettings/BrightnessController.qml b/basicsuite/launchersettings/BrightnessController.qml
deleted file mode 100644
index 777fa30..0000000
--- a/basicsuite/launchersettings/BrightnessController.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
-**
-** This file is part of the examples of the Qt Enterprise Embedded.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtDroid.Utils 1.0
-import QtQuick 2.0
-
-QtObject {
- function setBrightness(value)
- {
- DroidUtils.setDisplayBrightness(value)
- }
-}
diff --git a/basicsuite/launchersettings/NetworkController.qml b/basicsuite/launchersettings/NetworkController.qml
deleted file mode 100644
index 85a8de6..0000000
--- a/basicsuite/launchersettings/NetworkController.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
-**
-** This file is part of the examples of the Qt Enterprise Embedded.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtDroid.Utils 1.0
-import QtQuick 2.0
-
-QtObject {
-
- function getIPAddress()
- {
- return DroidUtils.getIPAddress()
- }
-
- function getHostname()
- {
- return DroidUtils.getHostname()
- }
-
- function setHostname(value)
- {
- return DroidUtils.setHostname(value)
- }
-
-}
diff --git a/basicsuite/launchersettings/PoweroffAction.qml b/basicsuite/launchersettings/PoweroffAction.qml
deleted file mode 100644
index d0bcd39..0000000
--- a/basicsuite/launchersettings/PoweroffAction.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
-**
-** This file is part of the examples of the Qt Enterprise Embedded.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick.Controls 1.0
-import QtDroid.Utils 1.0
-
-Action
-{
- onTriggered: DroidUtils.powerOffSystem()();
-}
diff --git a/basicsuite/launchersettings/RebootAction.qml b/basicsuite/launchersettings/RebootAction.qml
deleted file mode 100644
index 995fb61..0000000
--- a/basicsuite/launchersettings/RebootAction.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
-**
-** This file is part of the examples of the Qt Enterprise Embedded.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick.Controls 1.0
-import QtDroid.Utils 1.0
-
-Action
-{
- onTriggered: DroidUtils.rebootSystem();
-}
diff --git a/basicsuite/launchersettings/main.qml b/basicsuite/launchersettings/main.qml
index 8933598..085ec4d 100644
--- a/basicsuite/launchersettings/main.qml
+++ b/basicsuite/launchersettings/main.qml
@@ -45,6 +45,7 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Controls.Private 1.0
import QtQuick.Window 2.1
+import B2Qt.Utils 1.0
Rectangle {
id: root
@@ -122,10 +123,6 @@ Rectangle {
}
// ******************************** UI ****************************************
- Loader { id: rebootActionLoader; source: "RebootAction.qml" }
- Loader { id: poweroffActionLoader; source: "PoweroffAction.qml" }
- Loader { id: brightnessControllerLoader; source: "BrightnessController.qml" }
- Loader { id: networkControllerLoader; source: "NetworkController.qml" }
Loader { id: wifiControllerLoader; source: "WifiController.qml" }
Flickable {
@@ -163,20 +160,16 @@ Rectangle {
style: buttonStyle
text: "Shut Down"
Layout.fillWidth: true
- action: poweroffActionLoader.item;
- enabled: action != undefined
-
+ onClicked: B2QtDevice.powerOff();
}
Button {
style: buttonStyle
text: "Reboot"
Layout.fillWidth: true
- action: rebootActionLoader.item;
- enabled: action != undefined
+ onClicked: B2QtDevice.reboot();
}
}
-
}
GroupBox {
@@ -197,21 +190,24 @@ Rectangle {
Label { text: "Display FPS: "; font.pixelSize: 18; color: "white" }
Slider {
+ id: brightnessSlider
maximumValue: 255
minimumValue: 1
- value: 255
Layout.fillWidth: true
- onValueChanged: {
- if (brightnessControllerLoader.item != undefined) {
- brightnessControllerLoader.item.setBrightness(value);
- }
- }
+ value: B2QtDevice.displayBrightness
}
+
CheckBox {
checked: engine.fpsEnabled
onCheckedChanged: engine.fpsEnabled = checked;
}
}
+
+ Binding {
+ target: B2QtDevice
+ property: "displayBrightness"
+ value: brightnessSlider.value
+ }
}
GroupBox {
@@ -235,13 +231,21 @@ Rectangle {
TextField {
id: hostname
implicitHeight: hostnameButton.height - 8
- text: if (networkControllerLoader.item != undefined) { networkControllerLoader.item.getHostname(); }
+ text: B2QtDevice.hostname
+ placeholderText: "Enter hostname"
+ inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase | Qt.ImhNoPredictiveText
font.pixelSize: 18
Layout.fillWidth: true
+ onAccepted: {
+ Qt.inputMethod.commit()
+ Qt.inputMethod.hide()
+ B2QtDevice.setHostname(hostname.text)
+ hostname.focus = false
+ }
}
Label {
- text: if (networkControllerLoader.item != undefined) { networkControllerLoader.item.getIPAddress(); }
+ text: B2QtDevice.ipAddress
font.pixelSize: 18
color: "white"
Layout.columnSpan: 2
@@ -252,10 +256,8 @@ Rectangle {
style: buttonStyle
text: "Change hostname"
implicitWidth: 260
- onClicked: networkControllerLoader.item.setHostname(hostname.text);
- enabled: networkControllerLoader.item != undefined
+ onClicked: hostname.accepted()
}
-
}
}