first attempt to provide better feedback on executeAction results
parent
3c3cb76bf8
commit
677536e463
|
|
@ -291,6 +291,12 @@ void DeviceManager::editDeviceResponse(const QVariantMap ¶ms)
|
|||
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)
|
||||
{
|
||||
Plugin *p = m_plugins->getPlugin(pluginId);
|
||||
|
|
@ -364,5 +370,5 @@ void DeviceManager::executeAction(const QUuid &deviceId, const QUuid &actionType
|
|||
}
|
||||
|
||||
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 setPluginConfigResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void editDeviceResponse(const QVariantMap ¶ms);
|
||||
Q_INVOKABLE void executeActionResponse(const QVariantMap ¶ms);
|
||||
|
||||
public slots:
|
||||
void savePluginConfig(const QUuid &pluginId);
|
||||
|
|
@ -87,6 +88,7 @@ signals:
|
|||
void removeDeviceReply(const QVariantMap ¶ms);
|
||||
void savePluginConfigReply(const QVariantMap ¶ms);
|
||||
void editDeviceReply(const QVariantMap ¶ms);
|
||||
void executeActionReply(const QVariantMap ¶ms);
|
||||
void fetchingDataChanged();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import QtQuick 2.5
|
||||
import QtQuick 2.8
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import QtQuick.Layouts 1.2
|
||||
|
|
@ -23,6 +23,26 @@ Page {
|
|||
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 {
|
||||
id: mainMenu
|
||||
width: implicitWidth + app.margins
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import QtQuick.Layouts 1.2
|
|||
|
||||
Dialog {
|
||||
id: root
|
||||
width: Math.min(parent.width * .6, 400)
|
||||
// height: content.height
|
||||
width: Math.min(parent.width * .8, contentLabel.implicitWidth)
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
modal: true
|
||||
|
||||
title: qsTr("Error")
|
||||
property alias text: contentLabel.text
|
||||
|
|
@ -31,7 +31,7 @@ Dialog {
|
|||
Label {
|
||||
id: titleLabel
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: root.title
|
||||
color: app.guhAccent
|
||||
font.pixelSize: app.largeFont
|
||||
|
|
@ -42,12 +42,11 @@ Dialog {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||
height: childrenRect.height
|
||||
|
||||
Label {
|
||||
id: contentLabel
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,13 +44,7 @@ CustomViewBase {
|
|||
id: controlsRow
|
||||
Layout.fillWidth: true
|
||||
|
||||
property int iconSize: Math.max(app.iconSize * 2, column.width / (controlsModel.count + 0))
|
||||
|
||||
// Item {
|
||||
// width: Math.max(app.iconSize * 2, column.width / (controlsModel.count + 2))
|
||||
// height: 1
|
||||
// }
|
||||
|
||||
property int iconSize: Math.max(app.iconSize * 2, column.width / controlsModel.count)
|
||||
|
||||
Repeater {
|
||||
model: ListModel {
|
||||
|
|
@ -71,9 +65,6 @@ CustomViewBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Item { Layout.fillWidth: true; height: 1 }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue