diff --git a/guh-control/jsonrpc/devicehandler.cpp b/guh-control/jsonrpc/devicehandler.cpp index 6ce79b1b..05a27d1f 100644 --- a/guh-control/jsonrpc/devicehandler.cpp +++ b/guh-control/jsonrpc/devicehandler.cpp @@ -73,7 +73,7 @@ void DeviceHandler::processGetSupportedDevices(const QVariantMap ¶ms) QVariantList deviceClassList = params.value("params").toMap().value("deviceClasses").toList(); foreach (QVariant deviceClassVariant, deviceClassList) { DeviceClass *deviceClass = JsonTypes::unpackDeviceClass(deviceClassVariant.toMap(), Engine::instance()->deviceManager()->deviceClasses()); - qDebug() << "Server has device class:" << deviceClass->name(); + qDebug() << "Server has device class:" << deviceClass->name() << deviceClass->id(); Engine::instance()->deviceManager()->deviceClasses()->addDeviceClass(deviceClass); } } diff --git a/guh-control/resources.qrc b/guh-control/resources.qrc index 4b9ef6e1..c23c5641 100644 --- a/guh-control/resources.qrc +++ b/guh-control/resources.qrc @@ -1,7 +1,6 @@ ui/ConnectPage.qml - ui/DevicePage.qml ui/DevicesPage.qml ui/main.qml ui/NewDeviceWizard.qml @@ -43,5 +42,13 @@ ui/customviews/MediaControllerView.qml ui/LoginPage.qml ui/customviews/SensorView.qml + ui/devicepages/GenericDevicePage.qml + ui/devicepages/MediaDevicePage.qml + ui/devicelistpages/GenericDeviceListPage.qml + ui/devicelistpages/LightsDeviceListPage.qml + ui/customviews/ExtendedVolumeController.qml + ui/components/ColorIcon.qml + ui/images/torch-on.svg + ui/images/media-preview-start.svg diff --git a/guh-control/ui/DevicesPage.qml b/guh-control/ui/DevicesPage.qml index 9bbf781d..16a8fdd7 100644 --- a/guh-control/ui/DevicesPage.qml +++ b/guh-control/ui/DevicesPage.qml @@ -18,19 +18,6 @@ Page { } } - function interfaceToString(name) { - switch(name) { - case "light": - return "Lighting" - case "weather": - return "Weather" - case "sensor": - return "Sensor" - case "media": - return "Media" - } - } - SwipeView { anchors.fill: parent clip: true @@ -61,25 +48,38 @@ Page { anchors.fill: parent anchors.margins: app.margins // color: "#22000000" - Material.elevation: 2 - Label { + Material.elevation: 1 + Column { anchors.centerIn: parent - text: root.interfaceToString(model.name) + spacing: app.margins + ColorIcon { + height: app.iconSize * 2 + width: height + color: app.guhAccent + anchors.horizontalCenter: parent.horizontalCenter + name: interfaceToIcon(model.name) + } + + Label { + text: interfaceToString(model.name).toUpperCase() + anchors.horizontalCenter: parent.horizontalCenter + } + } + MouseArea { anchors.fill: parent onClicked: { - print("kkkkklick", model.name) var page; switch (model.name) { case "light": - page = lightsPageComponent; + page = "LightsDeviceListPage.qml" break; default: - page = subPageComponent + page = "GenericDeviceListPage.qml" } - pageStack.push(page, {filterInterface: model.name}) + pageStack.push(Qt.resolvedUrl("devicelistpages/" + page), {filterInterface: model.name}) } } } @@ -122,7 +122,7 @@ Page { MouseArea { anchors.fill: parent onClicked: { - pageStack.push(subPageComponent, {filterTag: model.tag}) + pageStack.push(Qt.resolvedUrl("devicelistpages/GenericDeviceListPage.qml"), {filterTag: model.tag}) } } } @@ -141,155 +141,4 @@ Page { } } } - - Component { - id: lightsPageComponent - - - Page { - property alias filterInterface: devicesProxy.filterInterface - header: GuhHeader { - text: "Lights" - onBackPressed: pageStack.pop() - } - ColumnLayout { - anchors.fill: parent - RowLayout { - Layout.fillWidth: true - Layout.margins: 10 - Label { - text: "All" - Layout.fillWidth: true - } - Button { - text: "off" - onClicked: { - for (var i = 0; i < devicesProxy.count; i++) { - var device = devicesProxy.get(i); - var deviceClass = Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId); - var actionType = deviceClass.actionTypes.findByName("power"); - - var params = []; - var param1 = {}; - param1["paramTypeId"] = actionType.paramTypes.get(0).id; - param1["value"] = checked; - params.push(param1) - Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) - - - } - } - } - } - - ListView { - Layout.fillHeight: true - Layout.fillWidth: true - model: DevicesProxy { - id: devicesProxy - devices: Engine.deviceManager.devices - } - - delegate: ItemDelegate { - width: parent.width - height: childrenRect.height - property var device: devicesProxy.get(index); - property var deviceClass: Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId); - - ColumnLayout { - anchors { left: parent.left; right: parent.right; top: parent.top } - RowLayout { - Layout.fillWidth: true - Layout.margins: 10 - Label { - Layout.fillWidth: true - text: model.name - verticalAlignment: Text.AlignVCenter - } - Slider { - visible: model.interfaces.indexOf("dimmablelight") >= 0 - property var stateType: deviceClass.stateTypes.findByName("brightnes"); - property var actionType: deviceClass.actionTypes.findByName("brightness"); - from: 0; to: 100 - value: device.stateValue(stateType.id) - onValueChanged: { - if (pressed) { - var params = []; - var param1 = {}; - param1["paramTypeId"] = actionType.paramTypes.get(0).id; - param1["value"] = value; - params.push(param1) - Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) - } - } - } - Switch { - property var stateType: deviceClass.stateTypes.findByName("power"); - property var actionType: deviceClass.actionTypes.findByName("power"); - checked: device.stateValue(stateType.id) === true - onClicked: { - var params = []; - var param1 = {}; - param1["paramTypeId"] = actionType.paramTypes.get(0).id; - param1["value"] = checked; - params.push(param1) - Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) - } - - } - } - } - - - onClicked: { - pageStack.push(Qt.resolvedUrl("DevicePage.qml"), {device: devicesProxy.get(index)}) - } - } - - } - } - } - } - - Component { - id: subPageComponent - Page { - id: subPage - property alias filterTag: devicesProxy.filterTag - property alias filterInterface: devicesProxy.filterInterface - - header: GuhHeader { - text: { - if (subPage.filterTag != DeviceClass.BasicTagNone) { - return qsTr("My %1 things").arg(devicesBasicTagsModel.basicTagToString(subPage.filterTag)) - } else if (subPage.filterInterface.length > 0) { - return qsTr("My %1 things").arg(root.interfaceToString(subPage.filterInterface)) - } - return qsTr("All my things") - } - - onBackPressed: pageStack.pop() - } - - ListView { - anchors.fill: parent - model: DevicesProxy { - id: devicesProxy - devices: Engine.deviceManager.devices - } - delegate: ItemDelegate { - width: parent.width - Label { - anchors { fill: parent; leftMargin: app.margins; rightMargin: app.margins } - text: model.name - verticalAlignment: Text.AlignVCenter - } - - onClicked: { - pageStack.push(Qt.resolvedUrl("DevicePage.qml"), {device: devicesProxy.get(index)}) - } - } - } - } - } } diff --git a/guh-control/ui/MainPage.qml b/guh-control/ui/MainPage.qml index c1b1ad47..600ec789 100644 --- a/guh-control/ui/MainPage.qml +++ b/guh-control/ui/MainPage.qml @@ -1,9 +1,11 @@ import QtQuick 2.5 import QtQuick.Controls 2.1 +import QtQuick.Controls.Material 2.2 Page { id: root footer: TabBar { + Material.elevation: 2 TabButton { text: "Things" onClicked: mainSwipeView.currentIndex = 0 diff --git a/guh-control/ui/components/ColorIcon.qml b/guh-control/ui/components/ColorIcon.qml new file mode 100644 index 00000000..0624a1e3 --- /dev/null +++ b/guh-control/ui/components/ColorIcon.qml @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2013 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 3. + * + * This program 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 program. If not, see . + */ + +import QtQuick 2.4 + +/*! + \qmltype Icon + \inqmlmodule Ubuntu.Components 0.1 + \ingroup ubuntu + \brief The Icon component displays an icon from the icon theme. + + The icon theme contains a set of standard icons referred to by their name. + Using icons whenever possible enhances consistency accross applications. + Each icon has a name and can have different visual representations depending + on the size requested. + + Icons can also be colorized. Setting the \l color property will make all pixels + with the \l keyColor (by default #808080) colored. + + Example: + \qml + Icon { + width: 64 + height: 64 + name: "search" + } + \endqml + + Example of colorization: + \qml + Icon { + width: 64 + height: 64 + name: "search" + color: UbuntuColors.warmGrey + } + \endqml + + Icon themes are created following the + \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html}{Freedesktop Icon Theme Specification}. +*/ +Item { + id: icon + + /*! + The name of the icon to display. + \qmlproperty string name + */ + property string name + + /*! + The color that all pixels that originally are of color \l keyColor should take. + \qmlproperty color color + */ + property alias color: colorizedImage.keyColorOut + + /*! + The color of the pixels that should be colorized. + By default it is set to #808080. + \qmlproperty color keyColor + */ + property alias keyColor: colorizedImage.keyColorIn + + property int margins: 0 + + Image { + id: image + + /* Necessary so that icons are not loaded before a size is set. */ + property bool ready: false + Component.onCompleted: ready = true + + anchors.fill: parent + anchors.margins: parent.margins + source: ready && width > 0 && height > 0 && icon.name ? icon.name : "" + sourceSize { + width: width + height: height + } + cache: true + visible: !colorizedImage.active + } + + ShaderEffect { + id: colorizedImage + + anchors.fill: parent + anchors.margins: parent.margins + visible: active && image.status == Image.Ready + + // Whether or not a color has been set. + property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0) + + property Image source: image + property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0) + property color keyColorIn: "#808080" + property real threshold: 0.1 + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + uniform highp vec4 keyColorOut; + uniform highp vec4 keyColorIn; + uniform lowp float threshold; + uniform lowp float qt_Opacity; + void main() { + lowp vec4 sourceColor = texture2D(source, qt_TexCoord0); + gl_FragColor = mix(vec4(keyColorOut.rgb, 1.0) * sourceColor.a, sourceColor, step(threshold, distance(sourceColor.rgb / sourceColor.a, keyColorIn.rgb))) * qt_Opacity; + }" + } +} diff --git a/guh-control/ui/components/GuhHeader.qml b/guh-control/ui/components/GuhHeader.qml index 241ac9dd..107c3d7b 100644 --- a/guh-control/ui/components/GuhHeader.qml +++ b/guh-control/ui/components/GuhHeader.qml @@ -1,16 +1,23 @@ import QtQuick 2.5 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 +import QtQuick.Controls.Material 2.2 ToolBar { id: root + Material.elevation: 1 - property alias text: label.text + property string text property alias backButtonVisible: backButton.visible default property alias data: layout.data signal backPressed(); + Rectangle { + anchors.fill: parent + color: "#fefefe" + } + RowLayout { id: layout anchors { fill: parent; leftMargin: app.margins; rightMargin: app.margins } @@ -26,6 +33,8 @@ ToolBar { Layout.fillHeight: true verticalAlignment: Text.AlignVCenter font.pixelSize: app.largeFont + color: "#333" + text: root.text.toUpperCase() } } } diff --git a/guh-control/ui/customviews/ExtendedVolumeController.qml b/guh-control/ui/customviews/ExtendedVolumeController.qml new file mode 100644 index 00000000..75df6a95 --- /dev/null +++ b/guh-control/ui/customviews/ExtendedVolumeController.qml @@ -0,0 +1,44 @@ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 +import Guh 1.0 + +CustomViewBase { + id: root + height: row.implicitHeight + app.margins * 2 + + RowLayout { + id: row + anchors { left: parent.left; top: parent.top; right: parent.right; margins: app.margins } + Button { + property var muteState: root.device.states.getState(deviceClass.stateTypes.findByName("mute").id) + property bool isMuted: muteState.value + text: isMuted ? "unmute" : "mute" + onClicked: { + var paramList = [] + var muteParam = {} + muteParam["paramTypeId"] = deviceClass.stateTypes.findByName("mute").id + muteParam["value"] = !isMuted + paramList.push(muteParam) + Engine.jsonRpcClient.executeAction(root.device.id, deviceClass.actionTypes.findByName("mute").id, paramList) + } + } + + Slider { + Layout.fillWidth: true + value: root.device.stateValue(deviceClass.stateTypes.findByName("volume").id) + from: 0 + to: 100 + onValueChanged: { + if (pressed) { + var paramList = [] + var muteParam = {} + muteParam["paramTypeId"] = deviceClass.stateTypes.findByName("volume").id + muteParam["value"] = value + paramList.push(muteParam) + Engine.jsonRpcClient.executeAction(root.device.id, deviceClass.actionTypes.findByName("volume").id, paramList) + } + } + } + } +} diff --git a/guh-control/ui/customviews/MediaControllerView.qml b/guh-control/ui/customviews/MediaControllerView.qml index 25f2164f..c83c96f4 100644 --- a/guh-control/ui/customviews/MediaControllerView.qml +++ b/guh-control/ui/customviews/MediaControllerView.qml @@ -13,6 +13,8 @@ CustomViewBase { Engine.jsonRpcClient.executeAction(device.id, actionTypeId) } + property var playbackState: device.states.getState(deviceClass.stateTypes.findByName("playbackStatus").id) + ColumnLayout { id: column anchors { left: parent.left; right: parent.right } @@ -32,19 +34,21 @@ CustomViewBase { } } Button { - text: "X" + text: "X"+ playbackState.value onClicked: { executeAction("stop") } } Button { text: ">" + visible: playbackState.value == "PAUSED" onClicked: { executeAction("play") } } Button { text: "||" + visible: playbackState.value == "PLAYING" onClicked: { executeAction("pause") } diff --git a/guh-control/ui/devicelistpages/GenericDeviceListPage.qml b/guh-control/ui/devicelistpages/GenericDeviceListPage.qml new file mode 100644 index 00000000..9e1518c4 --- /dev/null +++ b/guh-control/ui/devicelistpages/GenericDeviceListPage.qml @@ -0,0 +1,51 @@ +import QtQuick 2.5 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.1 +import Guh 1.0 +import "../components" + +Page { + id: subPage + property alias filterTag: devicesProxy.filterTag + property alias filterInterface: devicesProxy.filterInterface + + header: GuhHeader { + text: { + if (subPage.filterTag != DeviceClass.BasicTagNone) { + return qsTr("My %1 things").arg(devicesBasicTagsModel.basicTagToString(subPage.filterTag)) + } else if (subPage.filterInterface.length > 0) { + return qsTr("My %1 things").arg(interfaceToString(subPage.filterInterface)) + } + return qsTr("All my things") + } + + onBackPressed: pageStack.pop() + } + + ListView { + anchors.fill: parent + model: DevicesProxy { + id: devicesProxy + devices: Engine.deviceManager.devices + } + delegate: ItemDelegate { + width: parent.width + Label { + anchors { fill: parent; leftMargin: app.margins; rightMargin: app.margins } + text: model.name + verticalAlignment: Text.AlignVCenter + } + + onClicked: { + var device = devicesProxy.get(index); + var deviceClass = Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId); + print("clicked", deviceClass.interfaces) + if (deviceClass.interfaces.indexOf("media") >= 0) { + pageStack.push(Qt.resolvedUrl("../devicepages/MediaDevicePage.qml"), {device: devicesProxy.get(index)}) + } else { + pageStack.push(Qt.resolvedUrl("../devicepages/GenericDevicePage.qml"), {device: devicesProxy.get(index)}) + } + } + } + } +} diff --git a/guh-control/ui/devicelistpages/LightsDeviceListPage.qml b/guh-control/ui/devicelistpages/LightsDeviceListPage.qml new file mode 100644 index 00000000..9c2c754a --- /dev/null +++ b/guh-control/ui/devicelistpages/LightsDeviceListPage.qml @@ -0,0 +1,107 @@ +import QtQuick 2.5 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.1 +import Guh 1.0 +import "../components" + +Page { + property alias filterInterface: devicesProxy.filterInterface + header: GuhHeader { + text: "Lights" + onBackPressed: pageStack.pop() + } + ColumnLayout { + anchors.fill: parent + RowLayout { + Layout.fillWidth: true + Layout.margins: 10 + Label { + text: "All" + Layout.fillWidth: true + } + Button { + text: "off" + onClicked: { + for (var i = 0; i < devicesProxy.count; i++) { + var device = devicesProxy.get(i); + var deviceClass = Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId); + var actionType = deviceClass.actionTypes.findByName("power"); + + var params = []; + var param1 = {}; + param1["paramTypeId"] = actionType.paramTypes.get(0).id; + param1["value"] = checked; + params.push(param1) + Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) + } + } + } + } + + ListView { + Layout.fillHeight: true + Layout.fillWidth: true + model: DevicesProxy { + id: devicesProxy + devices: Engine.deviceManager.devices + } + + delegate: ItemDelegate { + width: parent.width + height: childrenRect.height + property var device: devicesProxy.get(index); + property var deviceClass: Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId); + + ColumnLayout { + anchors { left: parent.left; right: parent.right; top: parent.top } + RowLayout { + Layout.fillWidth: true + Layout.margins: 10 + Label { + Layout.fillWidth: true + text: model.name + verticalAlignment: Text.AlignVCenter + } + Slider { + visible: model.interfaces.indexOf("dimmablelight") >= 0 + property var stateType: deviceClass.stateTypes.findByName("brightness"); + property var actionType: deviceClass.actionTypes.findByName("brightness"); + from: 0; to: 100 + value: device.stateValue(stateType.id) + onValueChanged: { + if (pressed) { + var params = []; + var param1 = {}; + param1["paramTypeId"] = actionType.paramTypes.get(0).id; + param1["value"] = value; + params.push(param1) + Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) + } + } + } + Switch { + property var stateType: deviceClass.stateTypes.findByName("power"); + property var actionType: deviceClass.actionTypes.findByName("power"); + checked: device.stateValue(stateType.id) === true + onClicked: { + var params = []; + var param1 = {}; + param1["paramTypeId"] = actionType.paramTypes.get(0).id; + param1["value"] = checked; + params.push(param1) + Engine.jsonRpcClient.executeAction(device.id, actionType.id, params) + } + + } + } + } + + + onClicked: { + pageStack.push(Qt.resolvedUrl("../devicepages/GenericDevicePage.qml"), {device: devicesProxy.get(index)}) + } + } + + } + } +} diff --git a/guh-control/ui/DevicePage.qml b/guh-control/ui/devicepages/GenericDevicePage.qml similarity index 94% rename from guh-control/ui/DevicePage.qml rename to guh-control/ui/devicepages/GenericDevicePage.qml index 8ba98d2d..696198cf 100644 --- a/guh-control/ui/DevicePage.qml +++ b/guh-control/ui/devicepages/GenericDevicePage.qml @@ -2,7 +2,7 @@ import QtQuick 2.5 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 import Guh 1.0 -import "components" +import "../components" Page { id: root @@ -15,7 +15,7 @@ Page { onBackPressed: pageStack.pop() HeaderButton { - imageSource: "images/info.svg" + imageSource: "../images/info.svg" onClicked: pageStack.push(deviceStateDetailsPage) } } @@ -43,16 +43,16 @@ Page { var src = ""; print("**** devicetags", deviceClass.basicTags) if (deviceClass.interfaces.indexOf("weather") >= 0) { - src = "customviews/WeatherView.qml"; + src = "WeatherView.qml"; } if (deviceClass.interfaces.indexOf("mediacontroller") >= 0) { - src = "customviews/MediaControllerView.qml" + src = "MediaControllerView.qml" } if (deviceClass.interfaces.indexOf("sensor") >= 0) { - src = "customviews/SensorView.qml" + src = "SensorView.qml" } - return Qt.resolvedUrl(src); + return Qt.resolvedUrl("../customviews/" + src); } Binding { target: stateViewLoader.item ? stateViewLoader.item : null @@ -99,7 +99,7 @@ Page { delegate = "ActionDelegateStringFromStringList.qml"; } } - return Qt.resolvedUrl("actiondelegates/" + delegate); + return Qt.resolvedUrl("../actiondelegates/" + delegate); } Binding { diff --git a/guh-control/ui/devicepages/MediaDevicePage.qml b/guh-control/ui/devicepages/MediaDevicePage.qml new file mode 100644 index 00000000..d265301f --- /dev/null +++ b/guh-control/ui/devicepages/MediaDevicePage.qml @@ -0,0 +1,44 @@ +import QtQuick 2.5 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.1 +import Guh 1.0 +import "../components" +import "../customviews" + +Page { + id: root + property var device: null + readonly property var deviceClass: Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId) + + + header: GuhHeader { + text: device.name + onBackPressed: pageStack.pop() + + HeaderButton { + imageSource: "../images/info.svg" + onClicked: pageStack.push(deviceStateDetailsPage) + } + } + + + ColumnLayout { + id: contentColumn + anchors.fill: parent + spacing: app.margins + + ExtendedVolumeController { + Layout.fillWidth: true + device: root.device + deviceClass: root.deviceClass +// visible: deviceClass.interfaces.indexOf("extendedvolumecontroller") >= 0 + } + + MediaControllerView { + Layout.fillWidth: true + device: root.device + deviceClass: root.deviceClass + visible: root.deviceClass.interfaces.indexOf("mediacontroller") >= 0 + } + } +} diff --git a/guh-control/ui/images/media-preview-start.svg b/guh-control/ui/images/media-preview-start.svg new file mode 100644 index 00000000..34b33a3a --- /dev/null +++ b/guh-control/ui/images/media-preview-start.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/guh-control/ui/images/torch-on.svg b/guh-control/ui/images/torch-on.svg new file mode 100644 index 00000000..489611d3 --- /dev/null +++ b/guh-control/ui/images/torch-on.svg @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guh-control/ui/main.qml b/guh-control/ui/main.qml index 2cddf9a8..296239d9 100644 --- a/guh-control/ui/main.qml +++ b/guh-control/ui/main.qml @@ -10,14 +10,16 @@ ApplicationWindow { width: 270 * 1.5 height: 480 * 1.5 + property color guhAccent: "#ff57baae" // Material.primary: "#ff57baae" Material.primary: "white" - Material.accent: "#ff57baae" + Material.accent: guhAccent property int margins: 10 property int bigMargins: 20 property int smallFont: 10 property int largeFont: 20 + property int iconSize: 30 property int delegateHeight: 60 Settings { @@ -74,6 +76,28 @@ ApplicationWindow { id: discovery } + function interfaceToString(name) { + switch(name) { + case "light": + return "Lighting" + case "weather": + return "Weather" + case "sensor": + return "Sensor" + case "media": + return "Media" + } + } + + function interfaceToIcon(name) { + switch (name) { + case "light": + return Qt.resolvedUrl("images/torch-on.svg") + case "media": + return Qt.resolvedUrl("images/media-preview-start.svg") + } + } + // ZeroconfDiscovery { // id: discovery // }