Simplify ZigBee settings a bit
This commit is contained in:
parent
bac150106b
commit
44d14b33fb
@ -254,5 +254,7 @@
|
||||
<file>ui/images/thermostat/cooling.svg</file>
|
||||
<file>ui/images/thermostat/heating.svg</file>
|
||||
<file>ui/images/sensors/water.svg</file>
|
||||
<file>ui/images/zigbee/deCONZ.svg</file>
|
||||
<file>ui/images/zigbee/NXP.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -220,7 +220,6 @@
|
||||
<file>ui/system/ZigbeeSettingsPage.qml</file>
|
||||
<file>ui/system/ZigbeeAddNetworkPage.qml</file>
|
||||
<file>ui/system/ZigbeeNetworkPage.qml</file>
|
||||
<file>ui/system/ZigbeeNetworkInfoPage.qml</file>
|
||||
<file>ui/MainMenu.qml</file>
|
||||
<file>ui/components/NymeaItemDelegate.qml</file>
|
||||
<file>ui/components/NymeaSwipeDelegate.qml</file>
|
||||
|
||||
@ -18,6 +18,8 @@ Item {
|
||||
property alias topPadding: content.topPadding
|
||||
property alias bottomPadding: content.bottomPadding
|
||||
|
||||
property bool interactive: true
|
||||
|
||||
signal clicked();
|
||||
signal pressAndHold();
|
||||
|
||||
@ -98,7 +100,12 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
height: contentItem.implicitHeight
|
||||
onClicked: root.clicked()
|
||||
onPressAndHold: root.pressAndHold()
|
||||
hoverEnabled: root.interactive
|
||||
onPressAndHold: {
|
||||
if (root.interactive) {
|
||||
root.pressAndHold()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
93
nymea-app/ui/images/zigbee/NXP.svg
Normal file
93
nymea-app/ui/images/zigbee/NXP.svg
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="30mm"
|
||||
height="30mm"
|
||||
viewBox="0 0 30 30"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="1.0.1 (1.0.1+r74)"
|
||||
sodipodi:docname="NXP.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.6119437"
|
||||
inkscape:cx="-111.00421"
|
||||
inkscape:cy="21.748714"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1380"
|
||||
inkscape:window-height="873"
|
||||
inkscape:window-x="60"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid880" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-167.48075,-87.642611)">
|
||||
<g
|
||||
id="g878"
|
||||
transform="matrix(1.3620975,0,0,1.3620975,-60.208519,-22.004161)">
|
||||
<path
|
||||
id="path860"
|
||||
style="fill:#c7d100;fill-opacity:1;stroke:none;stroke-width:0.399999"
|
||||
d="m 681.2793,331.24805 v 29.24023 h 9.16992 l -0.0937,-6.26562 c 0,0 11.85428,0.087 15.61328,-0.0742 3.75904,-0.16129 7.63631,-2.98382 7.78711,-8.16992 0.1508,-5.18611 0,-6.13086 0,-6.13086 -0.0928,-5.03042 -4.13337,-8.6427 -8.05859,-8.59961 z m 21.78515,7.35351 c 0,0 0.58286,0.029 1.15821,0.5625 0.28767,0.26674 0.57289,0.65967 0.7832,1.23828 0.21031,0.57862 0.3446,1.34402 0.33008,2.35352 -0.0146,1.00949 -0.16294,1.76347 -0.37891,2.32617 -0.21597,0.5627 -0.49861,0.93417 -0.7793,1.17969 -0.56137,0.49104 -1.11523,0.47656 -1.11523,0.47656 l -12.69727,0.18555 v -8.28906 z"
|
||||
transform="scale(0.26458333)" />
|
||||
<path
|
||||
id="rect847"
|
||||
style="fill:#ffb401;fill-opacity:1;stroke:none;stroke-width:0.105833"
|
||||
d="m 167.48091,87.651566 h 2.45553 l 3.97612,4.656886 -0.005,-4.656886 h 2.36961 v 7.724916 h -2.35915 l -4.01088,-4.648754 0.0168,4.648754 h -2.44319 z"
|
||||
sodipodi:nodetypes="ccccccccccc" />
|
||||
<path
|
||||
id="rect850"
|
||||
style="fill:#7bb0da;fill-opacity:1;stroke:none;stroke-width:0.105833"
|
||||
d="m 173.90755,87.651558 h 2.71165 l 1.66103,2.652889 1.64491,-2.652889 h 2.73233 l -2.39605,3.902068 2.39605,3.820978 h -2.75179 l -1.61313,-2.584706 -1.62734,2.584706 h -2.75766 l 2.37678,-3.82124 z"
|
||||
sodipodi:nodetypes="ccccccccccccc" />
|
||||
<path
|
||||
id="path863"
|
||||
style="fill:#729632;fill-opacity:1;stroke:none;stroke-width:0.399999"
|
||||
d="m 681.2793,331.28125 v 29.18945 h 9.08008 l -9.05665,-14.4414 9.05665,-14.74805 z"
|
||||
transform="scale(0.26458333)" />
|
||||
<path
|
||||
id="path865"
|
||||
style="fill:#938135;fill-opacity:1;stroke:none;stroke-width:0.399999"
|
||||
d="m 657.28906,331.28125 8.95508,14.70313 v -14.70313 z m 8.95508,14.79297 -8.94141,14.375 0.0195,0.0215 h 8.92187 z"
|
||||
transform="scale(0.26458333)" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
56
nymea-app/ui/images/zigbee/deCONZ.svg
Normal file
56
nymea-app/ui/images/zigbee/deCONZ.svg
Normal file
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xml:space="preserve"
|
||||
enable-background="new 0 0 189.121 189.121"
|
||||
viewBox="0 0 126.16122 137.53172"
|
||||
height="137.53172"
|
||||
width="126.16122"
|
||||
y="0px"
|
||||
x="0px"
|
||||
id="svg5046"
|
||||
version="1.1"
|
||||
sodipodi:docname="deConz.svg"
|
||||
inkscape:version="1.0.1 (1.0.1+r74)"><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1380"
|
||||
inkscape:window-height="873"
|
||||
id="namedview4490"
|
||||
showgrid="true"
|
||||
showborder="true"
|
||||
inkscape:zoom="3.7217315"
|
||||
inkscape:cx="33.669964"
|
||||
inkscape:cy="77.380008"
|
||||
inkscape:window-x="60"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg5046"
|
||||
inkscape:document-rotation="0"><inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid831" /></sodipodi:namedview><metadata
|
||||
id="metadata10"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs8" /><g
|
||||
transform="matrix(0.83934056,0,0,0.83934056,-197.93394,-15.980236)"
|
||||
id="g5070"
|
||||
inkscape:export-xdpi="608.73999"
|
||||
inkscape:export-ydpi="608.73999"
|
||||
style="stroke:#808080;stroke-opacity:1"><path
|
||||
d="m 259.613,88.164 0.036,69.67 M 274.824,58.4 c 17.807,-17.296 45.756,-19.375 66.128,-4.917 20.373,14.458 27.218,41.227 16.197,63.339 -11.021,22.111 -36.69,33.107 -60.734,26.016 -24.043,-7.092 -39.439,-30.199 -36.427,-54.674"
|
||||
style="fill:none;stroke:#808080;stroke-width:23.433;stroke-linecap:round;stroke-opacity:1"
|
||||
id="path5062"
|
||||
inkscape:connector-curvature="0" /></g></svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@ -1,126 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2020, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
* This project including source code and documentation is protected by
|
||||
* copyright law, and remains the property of nymea GmbH. All rights, including
|
||||
* reproduction, publication, editing and translation, are reserved. The use of
|
||||
* this project is subject to the terms of a license agreement to be concluded
|
||||
* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
|
||||
* under https://nymea.io/license
|
||||
*
|
||||
* GNU General Public License Usage
|
||||
* Alternatively, this project may be redistributed and/or modified under the
|
||||
* terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, GNU version 3. This project is distributed in the hope that it
|
||||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this project. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For any further details and any questions please contact us under
|
||||
* contact@nymea.io or see our FAQ/Licensing Information on
|
||||
* https://nymea.io/license/faq
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
import QtQuick 2.8
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import QtQuick.Layouts 1.3
|
||||
import "../components"
|
||||
import Nymea 1.0
|
||||
|
||||
SettingsPageBase {
|
||||
id: root
|
||||
|
||||
property ZigbeeManager zigbeeManager: null
|
||||
|
||||
property ZigbeeNetwork network: null
|
||||
|
||||
header: NymeaHeader {
|
||||
text: qsTr("Network settings")
|
||||
backButtonVisible: true
|
||||
onBackPressed: pageStack.pop()
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Hardware information")
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("MAC address:")
|
||||
subText: root.network.macAddress
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Serial port")
|
||||
subText: root.network.serialPort
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Baud rate")
|
||||
subText: root.network.baudRate
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Controller backend")
|
||||
subText: root.network.backend
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Controller firmware version")
|
||||
subText: root.network.firmwareVersion
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Manage network")
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
text: qsTr("Remove network")
|
||||
onClicked: {
|
||||
root.zigbeeManager.removeNetwork(root.network.networkUuid)
|
||||
pageStack.pop()
|
||||
pageStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
text: qsTr("Factory reset controller")
|
||||
onClicked: {
|
||||
root.zigbeeManager.factoryResetNetwork(root.network.networkUuid)
|
||||
pageStack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -42,15 +42,10 @@ SettingsPageBase {
|
||||
property ZigbeeNetwork network: null
|
||||
|
||||
header: NymeaHeader {
|
||||
text: qsTr("Network") + " " + root.network.macAddress
|
||||
text: qsTr("ZigBee network settings")
|
||||
backButtonVisible: true
|
||||
onBackPressed: pageStack.pop()
|
||||
|
||||
HeaderButton {
|
||||
text: qsTr("Settings")
|
||||
imageSource: "../images/settings.svg"
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("ZigbeeNetworkInfoPage.qml"), { network: root.network, zigbeeManager: root.zigbeeManager })
|
||||
}
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
@ -93,46 +88,74 @@ SettingsPageBase {
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Network control")
|
||||
text: qsTr("Hardware information")
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: root.network.permitJoiningEnabled ? qsTr("The network is open") : qsTr("The network is closed")
|
||||
subText: root.network.permitJoiningEnabled ? qsTr("Devices can join this network") : qsTr("Devices are not allowed to join this network")
|
||||
text: qsTr("MAC address:")
|
||||
subText: root.network.macAddress
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
ProgressBar {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
visible: root.network.permitJoiningEnabled
|
||||
from: root.network.permitJoiningDuration
|
||||
to: 0
|
||||
value: root.network.permitJoiningRemaining
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
enabled: network.networkState === ZigbeeNetwork.ZigbeeNetworkStateOnline
|
||||
text: root.network.permitJoiningEnabled ? qsTr("Extend network open duration") : qsTr("Open network for new ZigBee devices")
|
||||
onClicked: root.zigbeeManager.setPermitJoin(root.network.networkUuid)
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
visible: network.networkState === ZigbeeNetwork.ZigbeeNetworkStateOnline && root.network.permitJoiningEnabled
|
||||
text: qsTr("Close network")
|
||||
onClicked: root.zigbeeManager.setPermitJoin(root.network.networkUuid, 0)
|
||||
}
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Serial port")
|
||||
subText: root.network.serialPort
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Baud rate")
|
||||
subText: root.network.baudRate
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Controller backend")
|
||||
subText: root.network.backend
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Controller firmware version")
|
||||
subText: root.network.firmwareVersion
|
||||
progressive: false
|
||||
prominentSubText: false
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Manage network")
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
text: qsTr("Remove network")
|
||||
onClicked: {
|
||||
root.zigbeeManager.removeNetwork(root.network.networkUuid)
|
||||
pageStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
text: qsTr("Factory reset controller")
|
||||
onClicked: {
|
||||
root.zigbeeManager.factoryResetNetwork(root.network.networkUuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,51 +54,164 @@ SettingsPageBase {
|
||||
engine: _engine
|
||||
}
|
||||
|
||||
// Disabled for now, the Resources API won't make it in time
|
||||
// SettingsPageSectionHeader {
|
||||
// text: qsTr("General")
|
||||
// }
|
||||
|
||||
// NymeaSwipeDelegate {
|
||||
// Layout.fillWidth: true
|
||||
// text: qsTr("Zigbee enabled")
|
||||
// subText: qsTr("Enable or disable Zigbee altogether")
|
||||
// prominentSubText: false
|
||||
// progressive: false
|
||||
// additionalItem: Switch {
|
||||
// anchors.centerIn: parent
|
||||
// }
|
||||
// }
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("ZigBee networks")
|
||||
}
|
||||
|
||||
Label {
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("There are no ZigBee networks set up yet. In order to use ZigBee, create a ZigBee network.")
|
||||
Layout.preferredHeight: root.height
|
||||
visible: zigbeeManager.networks.count == 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: zigbeeManager.networks
|
||||
delegate: NymeaSwipeDelegate {
|
||||
Layout.fillWidth: true
|
||||
property var network: zigbeeManager.networks.get(index)
|
||||
iconName: "../images/zigbee.svg"
|
||||
text: model.backend + " - " + model.macAddress
|
||||
subText: model.serialPort + " - " + model.firmwareVersion
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("ZigbeeNetworkPage.qml"), { zigbeeManager: zigbeeManager, network: network })
|
||||
EmptyViewPlaceholder {
|
||||
width: parent.width - app.margins * 2
|
||||
anchors.centerIn: parent
|
||||
title: qsTr("ZigBee")
|
||||
text: qsTr("There are no ZigBee networks set up yet. In order to use ZigBee, create a ZigBee network.")
|
||||
imageSource: "/ui/images/zigbee.svg"
|
||||
buttonText: qsTr("Add network")
|
||||
onButtonClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("ZigbeeAddNetworkPage.qml"), {zigbeeManager: zigbeeManager})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
text: qsTr("Add a ZigBee network")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("ZigbeeAddNetworkPage.qml"), {zigbeeManager: zigbeeManager})
|
||||
|
||||
ColumnLayout {
|
||||
Layout.margins: app.margins / 2
|
||||
Repeater {
|
||||
model: zigbeeManager.networks
|
||||
delegate: BigTile {
|
||||
Layout.fillWidth: true
|
||||
interactive: false
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
spacing: app.margins
|
||||
RowLayout {
|
||||
ColorIcon {
|
||||
name: "/ui/images/zigbee/" + model.backend + ".svg"
|
||||
Layout.preferredWidth: app.iconSize
|
||||
Layout.preferredHeight: app.iconSize
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: model.backend
|
||||
font.pixelSize: app.largeFont
|
||||
}
|
||||
|
||||
ProgressButton {
|
||||
Layout.preferredWidth: app.iconSize
|
||||
Layout.preferredHeight: app.iconSize
|
||||
imageSource: "/ui/images/configure.svg"
|
||||
longpressEnabled: false
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("ZigbeeNetworkPage.qml"), { zigbeeManager: zigbeeManager, network: zigbeeManager.networks.get(index) })
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Network state:")
|
||||
}
|
||||
Label {
|
||||
text: {
|
||||
switch (model.networkState) {
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateOnline:
|
||||
return qsTr("Online")
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateOffline:
|
||||
return qsTr("Offline")
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateStarting:
|
||||
return qsTr("Starting")
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateUpdating:
|
||||
return qsTr("Updating")
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateError:
|
||||
return qsTr("Error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Led {
|
||||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: app.iconSize
|
||||
state: {
|
||||
switch (model.networkState) {
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateOnline:
|
||||
return "on"
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateOffline:
|
||||
return "off"
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateStarting:
|
||||
return "orange"
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateUpdating:
|
||||
return "orange"
|
||||
case ZigbeeNetwork.ZigbeeNetworkStateError:
|
||||
return "red"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Network joining:")
|
||||
}
|
||||
Label {
|
||||
text: model.permitJoiningEnabled ? qsTr("Open for %0 s").arg(model.permitJoiningRemaining) : qsTr("Closed")
|
||||
}
|
||||
ColorIcon {
|
||||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: app.iconSize
|
||||
name: model.permitJoiningEnabled ? "/ui/images/lock-open.svg" : "/ui/images/lock-closed.svg"
|
||||
visible: !model.permitJoiningEnabled
|
||||
}
|
||||
Canvas {
|
||||
id: canvas
|
||||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: app.iconSize
|
||||
rotation: -90
|
||||
visible: model.permitJoiningEnabled
|
||||
|
||||
property real progress: model.permitJoiningRemaining / model.permitJoiningDuration
|
||||
onProgressChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
|
||||
onPaint: {
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.save();
|
||||
ctx.reset();
|
||||
var data = [1 - progress, progress];
|
||||
var myTotal = 0;
|
||||
|
||||
for(var e = 0; e < data.length; e++) {
|
||||
myTotal += data[e];
|
||||
}
|
||||
|
||||
ctx.fillStyle = Style.accentColor
|
||||
ctx.strokeStyle = Style.accentColor
|
||||
ctx.lineWidth = 1;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(canvas.width/2,canvas.height/2);
|
||||
ctx.arc(canvas.width/2,canvas.height/2,canvas.height/2,0,(Math.PI*2*((1-progress)/myTotal)),false);
|
||||
ctx.lineTo(canvas.width/2,canvas.height/2);
|
||||
ctx.fill();
|
||||
ctx.closePath();
|
||||
ctx.beginPath();
|
||||
ctx.arc(canvas.width/2,canvas.height/2,canvas.height/2 - 1,0,Math.PI*2,false);
|
||||
ctx.closePath();
|
||||
ctx.stroke();
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: model.permitJoiningEnabled ? qsTr("Extend open duration") : qsTr("Open for new devices")
|
||||
enabled: model.networkState === ZigbeeNetwork.ZigbeeNetworkStateOnline
|
||||
onClicked: zigbeeManager.setPermitJoin(model.networkUuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user