some more work
This commit is contained in:
parent
89d301d25a
commit
6dfd3ae736
@ -3,7 +3,7 @@ TARGET=guh-control
|
|||||||
include(../guh-control.pri)
|
include(../guh-control.pri)
|
||||||
|
|
||||||
|
|
||||||
QT += qml quick quickcontrols2 websockets svg charts
|
QT += qml quick quickcontrols2 websockets svg
|
||||||
|
|
||||||
INCLUDEPATH += $$top_srcdir/libguh-common
|
INCLUDEPATH += $$top_srcdir/libguh-common
|
||||||
LIBS += -L$$top_builddir/libguh-common/ -lguh-common
|
LIBS += -L$$top_builddir/libguh-common/ -lguh-common
|
||||||
|
|||||||
@ -166,6 +166,7 @@ ActionType *JsonTypes::unpackActionType(const QVariantMap &actionTypeMap, QObjec
|
|||||||
ActionType *actionType = new ActionType(parent);
|
ActionType *actionType = new ActionType(parent);
|
||||||
actionType->setId(actionTypeMap.value("id").toUuid());
|
actionType->setId(actionTypeMap.value("id").toUuid());
|
||||||
actionType->setName(actionTypeMap.value("name").toString());
|
actionType->setName(actionTypeMap.value("name").toString());
|
||||||
|
actionType->setDisplayName(actionTypeMap.value("displayName").toString());
|
||||||
actionType->setIndex(actionTypeMap.value("index").toInt());
|
actionType->setIndex(actionTypeMap.value("index").toInt());
|
||||||
ParamTypes *paramTypes = new ParamTypes(actionType);
|
ParamTypes *paramTypes = new ParamTypes(actionType);
|
||||||
foreach (QVariant paramType, actionTypeMap.value("paramTypes").toList()) {
|
foreach (QVariant paramType, actionTypeMap.value("paramTypes").toList()) {
|
||||||
|
|||||||
@ -107,5 +107,6 @@
|
|||||||
<file>ui/magic/DeviceRulesPage.qml</file>
|
<file>ui/magic/DeviceRulesPage.qml</file>
|
||||||
<file>ui/magic/SelectEventPage.qml</file>
|
<file>ui/magic/SelectEventPage.qml</file>
|
||||||
<file>ui/magic/NewThingMagicPage.qml</file>
|
<file>ui/magic/NewThingMagicPage.qml</file>
|
||||||
|
<file>ui/magic/EditRulePage.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Page {
|
|||||||
TextField {
|
TextField {
|
||||||
id: usernameTextField
|
id: usernameTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
inputMethodHints: Qt.ImhEmailCharactersOnly
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -42,7 +42,7 @@ Page {
|
|||||||
TextField {
|
TextField {
|
||||||
id: passwordTextField
|
id: passwordTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
echoMode: TextInput.Password
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
@ -24,6 +24,10 @@ Page {
|
|||||||
Label {
|
Label {
|
||||||
text: model.name
|
text: model.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
pageStack.push(Qt.resolvedUrl("magic/EditRulePage.qml"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ ActionDelegateBase {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: actionType.name
|
text: actionType.displayName
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
@ -10,7 +10,7 @@ ActionDelegateBase {
|
|||||||
id: layout
|
id: layout
|
||||||
anchors { left: parent.left; right: parent.right; top: parent.top; margins: app.margins }
|
anchors { left: parent.left; right: parent.right; top: parent.top; margins: app.margins }
|
||||||
Label {
|
Label {
|
||||||
text: root.actionType.name
|
text: root.actionType.displayName
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
|
|||||||
19
guh-control/ui/magic/EditRulePage.qml
Normal file
19
guh-control/ui/magic/EditRulePage.qml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
import "../components"
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
|
Page {
|
||||||
|
header: GuhHeader {
|
||||||
|
text: "Add some magic"
|
||||||
|
onBackPressed: pageStack.pop()
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
Label {
|
||||||
|
text: "When"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -47,6 +47,16 @@ void ActionType::setName(const QString &name)
|
|||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ActionType::displayName() const
|
||||||
|
{
|
||||||
|
return m_displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionType::setDisplayName(const QString &displayName)
|
||||||
|
{
|
||||||
|
m_displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
int ActionType::index() const
|
int ActionType::index() const
|
||||||
{
|
{
|
||||||
return m_index;
|
return m_index;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ class ActionType : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QUuid id READ id CONSTANT)
|
Q_PROPERTY(QUuid id READ id CONSTANT)
|
||||||
Q_PROPERTY(QString name READ name CONSTANT)
|
Q_PROPERTY(QString name READ name CONSTANT)
|
||||||
|
Q_PROPERTY(QString displayName READ displayName CONSTANT)
|
||||||
Q_PROPERTY(int index READ index CONSTANT)
|
Q_PROPERTY(int index READ index CONSTANT)
|
||||||
Q_PROPERTY(ParamTypes *paramTypes READ paramTypes NOTIFY paramTypesChanged)
|
Q_PROPERTY(ParamTypes *paramTypes READ paramTypes NOTIFY paramTypesChanged)
|
||||||
|
|
||||||
@ -45,6 +46,9 @@ public:
|
|||||||
QString name() const;
|
QString name() const;
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
|
|
||||||
|
QString displayName() const;
|
||||||
|
void setDisplayName(const QString &displayName);
|
||||||
|
|
||||||
int index() const;
|
int index() const;
|
||||||
void setIndex(const int &index);
|
void setIndex(const int &index);
|
||||||
|
|
||||||
@ -54,6 +58,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QUuid m_id;
|
QUuid m_id;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
QString m_displayName;
|
||||||
int m_index;
|
int m_index;
|
||||||
ParamTypes *m_paramTypes;
|
ParamTypes *m_paramTypes;
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,18 @@ StateDescriptor *StateEvaluator::stateDescriptor() const
|
|||||||
return m_stateDescriptor;
|
return m_stateDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StateEvaluator::setStateDescriptor(StateDescriptor *stateDescriptor)
|
||||||
|
{
|
||||||
|
if (m_stateDescriptor) {
|
||||||
|
m_stateDescriptor->deleteLater();
|
||||||
|
}
|
||||||
|
stateDescriptor->setParent(this);
|
||||||
|
m_stateDescriptor = stateDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
bool StateEvaluator::containsDevice(const QUuid &deviceId) const
|
bool StateEvaluator::containsDevice(const QUuid &deviceId) const
|
||||||
{
|
{
|
||||||
if (m_stateDescriptor->deviceId() == deviceId) {
|
if (m_stateDescriptor && m_stateDescriptor->deviceId() == deviceId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < m_childEvaluators->rowCount(); i++) {
|
for (int i = 0; i < m_childEvaluators->rowCount(); i++) {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ public:
|
|||||||
StateEvaluators* childEvaluators() const;
|
StateEvaluators* childEvaluators() const;
|
||||||
|
|
||||||
StateDescriptor* stateDescriptor() const;
|
StateDescriptor* stateDescriptor() const;
|
||||||
|
void setStateDescriptor(StateDescriptor *stateDescriptor);
|
||||||
|
|
||||||
bool containsDevice(const QUuid &deviceId) const;
|
bool containsDevice(const QUuid &deviceId) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user