use ThrottledSlider everywhere
This commit is contained in:
parent
e0545ad01e
commit
a53a182364
@ -31,7 +31,7 @@ bool ZeroconfDiscovery::discovering() const
|
||||
#ifdef WITH_AVAHI
|
||||
void ZeroconfDiscovery::serviceEntryAdded(const AvahiServiceEntry &entry)
|
||||
{
|
||||
if (!entry.name().startsWith("nymea") || entry.serviceType() != "_jsonrpc._tcp") {
|
||||
if (!entry.name().startsWith("nymea") || entry.serviceType() != "_jsonrpc._tcp" || entry.hostAddress().protocol() == QAbstractSocket::IPv6Protocol) {
|
||||
return;
|
||||
}
|
||||
// qDebug() << "avahi service entry added" << entry.name() << entry.hostAddress() << entry.port() << entry.txt() << entry.serviceType();
|
||||
@ -57,7 +57,14 @@ void ZeroconfDiscovery::serviceEntryAdded(const AvahiServiceEntry &entry)
|
||||
dev.setHostAddress(entry.hostAddress());
|
||||
dev.setPort(entry.port());
|
||||
dev.setFriendlyName(entry.hostName());
|
||||
dev.setNymeaRpcUrl(QString("%1://%2:%3").arg(sslEnabled ? "nymeas" : "nymea").arg(entry.hostAddress().toString()).arg(entry.port()));
|
||||
QHostAddress address = entry.hostAddress();
|
||||
QString addressString;
|
||||
if (address.protocol() == QAbstractSocket::IPv6Protocol) {
|
||||
addressString = "[" + address.toString() + "]";
|
||||
} else {
|
||||
addressString = address.toString();
|
||||
}
|
||||
dev.setNymeaRpcUrl(QString("%1://%2:%3").arg(sslEnabled ? "nymeas" : "nymea").arg(addressString).arg(entry.port()));
|
||||
m_discoveryModel->addDevice(dev);
|
||||
|
||||
// DiscoveryDevice *dev = new DiscoveryDevice();
|
||||
|
||||
@ -137,7 +137,7 @@ ItemDelegate {
|
||||
Label {
|
||||
text: sliderRow.paramType.minValue
|
||||
}
|
||||
Slider {
|
||||
ThrottledSlider {
|
||||
Layout.fillWidth: true
|
||||
from: sliderRow.paramType.minValue
|
||||
to: sliderRow.paramType.maxValue
|
||||
@ -151,15 +151,13 @@ ItemDelegate {
|
||||
|
||||
}
|
||||
|
||||
onValueChanged: {
|
||||
if (pressed) {
|
||||
var params = [];
|
||||
var param1 = new Object();
|
||||
param1["paramTypeId"] = sliderRow.paramType.id;
|
||||
param1["value"] = value;
|
||||
params.push(param1)
|
||||
root.executeAction(params)
|
||||
}
|
||||
onMoved: {
|
||||
var params = [];
|
||||
var param1 = new Object();
|
||||
param1["paramTypeId"] = sliderRow.paramType.id;
|
||||
param1["value"] = value;
|
||||
params.push(param1)
|
||||
root.executeAction(params)
|
||||
}
|
||||
}
|
||||
Label {
|
||||
|
||||
@ -4,10 +4,12 @@ import QtQuick.Controls 2.1
|
||||
Item {
|
||||
id: root
|
||||
implicitHeight: slider.implicitHeight
|
||||
implicitWidth: slider.implicitWidth
|
||||
|
||||
property real value: 0
|
||||
property alias from: slider.from
|
||||
property alias to: slider.to
|
||||
property alias stepSize: slider.stepSize
|
||||
signal moved(real value);
|
||||
|
||||
Slider {
|
||||
|
||||
@ -35,20 +35,18 @@ CustomViewBase {
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
ThrottledSlider {
|
||||
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.deviceManager.executeAction(root.device.id, deviceClass.actionTypes.findByName("volume").id, paramList)
|
||||
}
|
||||
onMoved: {
|
||||
var paramList = []
|
||||
var muteParam = {}
|
||||
muteParam["paramTypeId"] = deviceClass.stateTypes.findByName("volume").id
|
||||
muteParam["value"] = value
|
||||
paramList.push(muteParam)
|
||||
Engine.deviceManager.executeAction(root.device.id, deviceClass.actionTypes.findByName("volume").id, paramList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,22 +64,20 @@ Page {
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Slider {
|
||||
ThrottledSlider {
|
||||
visible: model.interfaces.indexOf("dimmablelight") >= 0
|
||||
property var stateType: deviceClass.stateTypes.findByName("brightness");
|
||||
property var actionType: deviceClass.actionTypes.findByName("brightness");
|
||||
property var actionState: device.states.getState(stateType.id)
|
||||
from: 0; to: 100
|
||||
value: actionState.value
|
||||
onValueChanged: {
|
||||
if (pressed) {
|
||||
var params = [];
|
||||
var param1 = {};
|
||||
param1["paramTypeId"] = actionType.paramTypes.get(0).id;
|
||||
param1["value"] = value;
|
||||
params.push(param1)
|
||||
Engine.deviceManager.executeAction(device.id, actionType.id, params)
|
||||
}
|
||||
onMoved: {
|
||||
var params = [];
|
||||
var param1 = {};
|
||||
param1["paramTypeId"] = actionType.paramTypes.get(0).id;
|
||||
param1["value"] = value;
|
||||
params.push(param1)
|
||||
Engine.deviceManager.executeAction(device.id, actionType.id, params)
|
||||
}
|
||||
}
|
||||
Switch {
|
||||
|
||||
Reference in New Issue
Block a user