first attempt to provide better feedback on executeAction results
This commit is contained in:
parent
3c3cb76bf8
commit
677536e463
@ -291,6 +291,12 @@ void DeviceManager::editDeviceResponse(const QVariantMap ¶ms)
|
|||||||
emit editDeviceReply(params);
|
emit editDeviceReply(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceManager::executeActionResponse(const QVariantMap ¶ms)
|
||||||
|
{
|
||||||
|
qDebug() << "Execute Action response" << params;
|
||||||
|
emit executeActionReply(params.value("params").toMap());
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceManager::savePluginConfig(const QUuid &pluginId)
|
void DeviceManager::savePluginConfig(const QUuid &pluginId)
|
||||||
{
|
{
|
||||||
Plugin *p = m_plugins->getPlugin(pluginId);
|
Plugin *p = m_plugins->getPlugin(pluginId);
|
||||||
@ -364,5 +370,5 @@ void DeviceManager::executeAction(const QUuid &deviceId, const QUuid &actionType
|
|||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Params:" << p;
|
qDebug() << "Params:" << p;
|
||||||
m_jsonClient->sendCommand("Actions.ExecuteAction", p);
|
m_jsonClient->sendCommand("Actions.ExecuteAction", p, this, "executeActionResponse");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,6 +76,7 @@ private:
|
|||||||
Q_INVOKABLE void confirmPairingResponse(const QVariantMap ¶ms);
|
Q_INVOKABLE void confirmPairingResponse(const QVariantMap ¶ms);
|
||||||
Q_INVOKABLE void setPluginConfigResponse(const QVariantMap ¶ms);
|
Q_INVOKABLE void setPluginConfigResponse(const QVariantMap ¶ms);
|
||||||
Q_INVOKABLE void editDeviceResponse(const QVariantMap ¶ms);
|
Q_INVOKABLE void editDeviceResponse(const QVariantMap ¶ms);
|
||||||
|
Q_INVOKABLE void executeActionResponse(const QVariantMap ¶ms);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void savePluginConfig(const QUuid &pluginId);
|
void savePluginConfig(const QUuid &pluginId);
|
||||||
@ -87,6 +88,7 @@ signals:
|
|||||||
void removeDeviceReply(const QVariantMap ¶ms);
|
void removeDeviceReply(const QVariantMap ¶ms);
|
||||||
void savePluginConfigReply(const QVariantMap ¶ms);
|
void savePluginConfigReply(const QVariantMap ¶ms);
|
||||||
void editDeviceReply(const QVariantMap ¶ms);
|
void editDeviceReply(const QVariantMap ¶ms);
|
||||||
|
void executeActionReply(const QVariantMap ¶ms);
|
||||||
void fetchingDataChanged();
|
void fetchingDataChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import QtQuick 2.5
|
import QtQuick 2.8
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Controls.Material 2.1
|
import QtQuick.Controls.Material 2.1
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
@ -23,6 +23,26 @@ Page {
|
|||||||
opacity: .2
|
opacity: .2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Currently we don't have any feedback for executeAction
|
||||||
|
// we don't want all the results, e.g. on looped calls like "all off"
|
||||||
|
// Connections {
|
||||||
|
// target: Engine.deviceManager
|
||||||
|
// onExecuteActionReply: {
|
||||||
|
// var text = params["deviceError"]
|
||||||
|
// switch(text) {
|
||||||
|
// case "DeviceErrorNoError":
|
||||||
|
// return;
|
||||||
|
// case "DeviceErrorHardwareNotAvailable":
|
||||||
|
// text = qsTr("Could not execute action. The thing is not available");
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var errorDialog = Qt.createComponent(Qt.resolvedUrl("components/ErrorDialog.qml"))
|
||||||
|
// var popup = errorDialog.createObject(root, {text: text})
|
||||||
|
// popup.open()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: mainMenu
|
id: mainMenu
|
||||||
width: implicitWidth + app.margins
|
width: implicitWidth + app.margins
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import QtQuick.Layouts 1.2
|
|||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: root
|
id: root
|
||||||
width: Math.min(parent.width * .6, 400)
|
width: Math.min(parent.width * .8, contentLabel.implicitWidth)
|
||||||
// height: content.height
|
|
||||||
x: (parent.width - width) / 2
|
x: (parent.width - width) / 2
|
||||||
y: (parent.height - height) / 2
|
y: (parent.height - height) / 2
|
||||||
|
modal: true
|
||||||
|
|
||||||
title: qsTr("Error")
|
title: qsTr("Error")
|
||||||
property alias text: contentLabel.text
|
property alias text: contentLabel.text
|
||||||
@ -31,7 +31,7 @@ Dialog {
|
|||||||
Label {
|
Label {
|
||||||
id: titleLabel
|
id: titleLabel
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
text: root.title
|
text: root.title
|
||||||
color: app.guhAccent
|
color: app.guhAccent
|
||||||
font.pixelSize: app.largeFont
|
font.pixelSize: app.largeFont
|
||||||
@ -42,12 +42,11 @@ Dialog {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: contentLabel
|
id: contentLabel
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,13 +44,7 @@ CustomViewBase {
|
|||||||
id: controlsRow
|
id: controlsRow
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
property int iconSize: Math.max(app.iconSize * 2, column.width / (controlsModel.count + 0))
|
property int iconSize: Math.max(app.iconSize * 2, column.width / controlsModel.count)
|
||||||
|
|
||||||
// Item {
|
|
||||||
// width: Math.max(app.iconSize * 2, column.width / (controlsModel.count + 2))
|
|
||||||
// height: 1
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
@ -71,9 +65,6 @@ CustomViewBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item { Layout.fillWidth: true; height: 1 }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user