button press feedback
This commit is contained in:
parent
c122113195
commit
b71f65e023
@ -74,6 +74,10 @@ ParamTypes *ActionType::paramTypes() const
|
||||
|
||||
void ActionType::setParamTypes(ParamTypes *paramTypes)
|
||||
{
|
||||
if (m_paramTypes && m_paramTypes->parent() == this) {
|
||||
m_paramTypes->deleteLater();
|
||||
}
|
||||
m_paramTypes = paramTypes;
|
||||
m_paramTypes->setParent(this);
|
||||
emit paramTypesChanged();
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ private:
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
int m_index;
|
||||
ParamTypes *m_paramTypes;
|
||||
ParamTypes *m_paramTypes = nullptr;
|
||||
|
||||
signals:
|
||||
void paramTypesChanged();
|
||||
|
||||
@ -38,6 +38,9 @@ Interfaces::Interfaces(QObject *parent) : QAbstractListModel(parent)
|
||||
addStateType("temperaturesensor", "temperature", QVariant::Double, false,
|
||||
tr("Temperature"),
|
||||
tr("Temperature has changed"));
|
||||
|
||||
addInterface("simpleclosable", tr("Closable things"));
|
||||
addActionType("simpleclosable", "close", "Close", new ParamTypes());
|
||||
}
|
||||
|
||||
int Interfaces::rowCount(const QModelIndex &parent) const
|
||||
|
||||
@ -227,5 +227,7 @@
|
||||
<file>ui/images/awning/awning-080.svg</file>
|
||||
<file>ui/images/awning/awning-090.svg</file>
|
||||
<file>ui/magic/NewThingMagicPage.qml</file>
|
||||
<file>ui/images/DeviceIconBlind.svg</file>
|
||||
<file>ui/images/DeviceIconRollerShutter.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -97,6 +97,7 @@ Page {
|
||||
deviceClasses: Engine.deviceManager.deviceClasses
|
||||
}
|
||||
delegate: MeaListItemDelegate {
|
||||
id: deviceClassDelegate
|
||||
width: parent.width
|
||||
text: model.displayName
|
||||
iconName: app.interfacesToIcon(deviceClass.interfaces)
|
||||
@ -118,6 +119,27 @@ Page {
|
||||
|
||||
print("should setup", deviceClass.name, deviceClass.setupMethod, deviceClass.createMethods, deviceClass["discoveryParamTypes"].count)
|
||||
}
|
||||
|
||||
swipe.enabled: deviceClass.createMethods.indexOf("CreateMethodUser") !== -1
|
||||
swipe.right: MouseArea {
|
||||
height: deviceClassDelegate.height
|
||||
width: height
|
||||
anchors.right: parent.right
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins
|
||||
name: "../images/add.svg"
|
||||
}
|
||||
onClicked: {
|
||||
d.deviceClass = deviceClass
|
||||
internalPageStack.push(paramsPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,10 +223,11 @@ ApplicationWindow {
|
||||
case "outputtrigger":
|
||||
return Qt.resolvedUrl("images/send.svg")
|
||||
case "shutter":
|
||||
case "blind":
|
||||
case "extendedshutter":
|
||||
return Qt.resolvedUrl("images/DeviceIconRollerShutter.svg")
|
||||
case "blind":
|
||||
case "extendedblind":
|
||||
return Qt.resolvedUrl("images/sort-listitem.svg")
|
||||
return Qt.resolvedUrl("images/DeviceIconBlind.svg")
|
||||
case "garagegate":
|
||||
return Qt.resolvedUrl("images/shutter/shutter-100.svg")
|
||||
case "extendedawning":
|
||||
@ -235,6 +236,10 @@ ApplicationWindow {
|
||||
return Qt.resolvedUrl("images/battery/battery-050.svg")
|
||||
case "uncategorized":
|
||||
return Qt.resolvedUrl("images/select-none.svg")
|
||||
case "simpleclosable":
|
||||
return Qt.resolvedUrl("images/sort-listitem.svg")
|
||||
default:
|
||||
console.warn("InterfaceToIcon: Unhandled interface", name)
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -16,54 +16,44 @@ RowLayout {
|
||||
|
||||
property bool invert: false
|
||||
|
||||
Rectangle {
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: app.iconSize * 2
|
||||
Layout.preferredHeight: width
|
||||
color: root.openState && root.openState.value === "opening" ? Material.accent : Material.foreground
|
||||
radius: height / 2
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins
|
||||
name: root.invert ? "../images/down.svg" : "../images/up.svg"
|
||||
color: root.openState && root.openState.value === "opening" ? Material.accent : keyColor
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("open").id)
|
||||
}
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("open").id)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: app.iconSize * 2
|
||||
Layout.preferredHeight: width
|
||||
color: Material.foreground
|
||||
radius: height / 2
|
||||
// color: Material.foreground
|
||||
// radius: height / 2
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins
|
||||
name: "../images/remove.svg"
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("stop").id)
|
||||
name: "../images/media-playback-stop.svg"
|
||||
}
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("stop").id)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: app.iconSize * 2
|
||||
Layout.preferredHeight: width
|
||||
color: root.openState && root.openState.value === "closing" ? Material.accent : Material.foreground
|
||||
radius: height / 2
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins
|
||||
name: root.invert ? "../images/up.svg" : "../images/down.svg"
|
||||
color: root.openState && root.openState.value === "closing" ? Material.accent : keyColor
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("close").id)
|
||||
}
|
||||
onClicked: Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("close").id)
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,29 +85,25 @@ DevicePageBase {
|
||||
device: root.device
|
||||
anchors.centerIn: parent
|
||||
|
||||
Rectangle {
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: app.iconSize * 2
|
||||
Layout.preferredHeight: width
|
||||
color: root.lightState && root.lightState.value === true ? Material.accent : Material.foreground
|
||||
radius: height / 2
|
||||
visible: root.lightStateType !== null
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins
|
||||
name: "../images/torch-" + (root.lightState && root.lightState.value === true ? "on" : "off") + ".svg"
|
||||
name: "../images/light-" + (root.lightState && root.lightState.value === true ? "on" : "off") + ".svg"
|
||||
color: root.lightState && root.lightState.value === true ? Material.accent : keyColor
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
print("blabla", root.lightState, root.lightState.value, root.lightStateType.name, root.lightState.stateTypeId, root.lightStateType.id)
|
||||
var params = [];
|
||||
var param = {};
|
||||
param["paramTypeId"] = root.lightStateType.id;
|
||||
param["value"] = !root.lightState.value;
|
||||
params.push(param)
|
||||
Engine.deviceManager.executeAction(root.device.id, root.lightStateType.id, params)
|
||||
}
|
||||
onClicked: {
|
||||
print("blabla", root.lightState, root.lightState.value, root.lightStateType.name, root.lightState.stateTypeId, root.lightStateType.id)
|
||||
var params = [];
|
||||
var param = {};
|
||||
param["paramTypeId"] = root.lightStateType.id;
|
||||
param["value"] = !root.lightState.value;
|
||||
params.push(param)
|
||||
Engine.deviceManager.executeAction(root.device.id, root.lightStateType.id, params)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
59
nymea-app/ui/images/DeviceIconBlind.svg
Normal file
59
nymea-app/ui/images/DeviceIconBlind.svg
Normal file
@ -0,0 +1,59 @@
|
||||
<?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="128"
|
||||
height="128"
|
||||
viewBox="0 0 128 128"
|
||||
version="1.1"
|
||||
id="svg6"
|
||||
sodipodi:docname="DeviceIconBlind.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata12">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs10" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2880"
|
||||
inkscape:window-height="1698"
|
||||
id="namedview8"
|
||||
showgrid="false"
|
||||
inkscape:zoom="7.375"
|
||||
inkscape:cx="42.855773"
|
||||
inkscape:cy="47.171326"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="44"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg6" />
|
||||
<path
|
||||
d="M118.432 11.977l-8.098 8.198-100.78-.18 7.918-8.02 100.96.002m9.572-4H15.8l-15.8 16 112.003.2 16-16.2zM118.432 35.778l-8.098 8.198-100.78-.18 7.918-8.018h100.96m9.572-4H15.8l-15.8 16 112.003.2 16-16.2zM118.432 59.98l-8.097 8.196-100.78-.18 7.917-8.018h100.96m9.572-4H15.8L0 71.98l112.003.202 16-16.2zM118.432 83.98l-8.098 8.198-100.78-.18 7.918-8.02h100.96m9.572-4H15.8L0 95.98l112.003.2 16-16.2zM118.432 107.98l-8.097 8.197-100.78-.18 7.917-8.02h100.96m9.572-3.997H15.8l-15.8 16 112.003.2 16-16.2z"
|
||||
id="path2"
|
||||
style="fill-opacity:1;fill:#808080" />
|
||||
<path
|
||||
d="m 95.02,24.044 h 2 v 16 h -2 z m 0,-23.951 h 2 v 16 h -2 z m 0,47.927 h 2 v 16 h -2 z m 0,24.01 h 2 v 16 h -2 z m 0,23.926 h 2 v 16.002 h -2 z m 0,24.009 h 2 V 128 h -2 z m -64,-95.921 h 2 v 16 h -2 z m 0,-23.951 h 2 v 16 h -2 z m 0,47.927 h 2 v 16 h -2 z m 0,24.01 h 2 v 16 h -2 z m 0,23.926 h 2 v 16.002 h -2 z m 0,24.009 h 2 V 128 h -2 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#808080;fill-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
67
nymea-app/ui/images/DeviceIconRollerShutter.svg
Normal file
67
nymea-app/ui/images/DeviceIconRollerShutter.svg
Normal file
@ -0,0 +1,67 @@
|
||||
<?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="128"
|
||||
height="128"
|
||||
viewBox="0 0 128 128"
|
||||
version="1.1"
|
||||
id="svg10"
|
||||
sodipodi:docname="DeviceIconRollerShutter.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
||||
<metadata
|
||||
id="metadata16">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs14" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2880"
|
||||
inkscape:window-height="1698"
|
||||
id="namedview12"
|
||||
showgrid="false"
|
||||
inkscape:zoom="5.2149125"
|
||||
inkscape:cx="139.1504"
|
||||
inkscape:cy="-3.0965549"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="44"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg10" />
|
||||
<g
|
||||
fill="#1D1D1B"
|
||||
id="g8"
|
||||
style="fill:#808080;fill-opacity:1">
|
||||
<path
|
||||
d="M111 20H17V0h94v20zm-90-4h86V4H21v12zM111 128H17v-12h94v12zm-90-4h86v-4H21v4z"
|
||||
id="path2"
|
||||
style="fill:#808080;fill-opacity:1" />
|
||||
<path
|
||||
d="M22 18h4v100h-4zM102 18h4v100h-4z"
|
||||
id="path4"
|
||||
style="fill:#808080;fill-opacity:1" />
|
||||
<path
|
||||
d="M24 31h80v2H24zM24 23h80v2H24zM24 39h80v2H24zM24 47h80v2H24zM24 55h80v2H24zM24.5 63h79v2h-79zM24 71h80v2H24z"
|
||||
id="path6"
|
||||
style="fill:#808080;fill-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -44,45 +44,43 @@ Item {
|
||||
anchors.fill: parent
|
||||
anchors.margins: app.margins / 2
|
||||
Material.elevation: 1
|
||||
|
||||
MouseArea {
|
||||
padding: 0
|
||||
ItemDelegate {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
Engine.ruleManager.executeActions(model.id)
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
spacing: app.margins
|
||||
|
||||
ColorIcon {
|
||||
Layout.preferredHeight: app.iconSize * 2
|
||||
Layout.preferredWidth: height
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
name: scenesDelegate.iconTag ? "../images/" + scenesDelegate.iconTag.value + ".svg" : "../images/slideshow.svg";
|
||||
color: scenesDelegate.colorTag ? scenesDelegate.colorTag.value : app.guhAccent;
|
||||
contentItem: ColumnLayout {
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
spacing: app.margins
|
||||
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
name: "../images/slideshow.svg"
|
||||
color: app.guhAccent
|
||||
visible: parent.status === Image.Error
|
||||
}
|
||||
}
|
||||
Layout.preferredHeight: app.iconSize * 2
|
||||
Layout.preferredWidth: height
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
name: scenesDelegate.iconTag ? "../images/" + scenesDelegate.iconTag.value + ".svg" : "../images/slideshow.svg";
|
||||
color: scenesDelegate.colorTag ? scenesDelegate.colorTag.value : app.guhAccent;
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: model.name
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
ColorIcon {
|
||||
anchors.fill: parent
|
||||
name: "../images/slideshow.svg"
|
||||
color: app.guhAccent
|
||||
visible: parent.status === Image.Error
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: model.name
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user