some more work

pull/1/head
Michael Zanetti 2018-02-12 14:47:41 +01:00
parent 89d301d25a
commit 6dfd3ae736
12 changed files with 56 additions and 6 deletions

View File

@ -3,7 +3,7 @@ TARGET=guh-control
include(../guh-control.pri)
QT += qml quick quickcontrols2 websockets svg charts
QT += qml quick quickcontrols2 websockets svg
INCLUDEPATH += $$top_srcdir/libguh-common
LIBS += -L$$top_builddir/libguh-common/ -lguh-common

View File

@ -166,6 +166,7 @@ ActionType *JsonTypes::unpackActionType(const QVariantMap &actionTypeMap, QObjec
ActionType *actionType = new ActionType(parent);
actionType->setId(actionTypeMap.value("id").toUuid());
actionType->setName(actionTypeMap.value("name").toString());
actionType->setDisplayName(actionTypeMap.value("displayName").toString());
actionType->setIndex(actionTypeMap.value("index").toInt());
ParamTypes *paramTypes = new ParamTypes(actionType);
foreach (QVariant paramType, actionTypeMap.value("paramTypes").toList()) {

View File

@ -107,5 +107,6 @@
<file>ui/magic/DeviceRulesPage.qml</file>
<file>ui/magic/SelectEventPage.qml</file>
<file>ui/magic/NewThingMagicPage.qml</file>
<file>ui/magic/EditRulePage.qml</file>
</qresource>
</RCC>

View File

@ -33,7 +33,7 @@ Page {
TextField {
id: usernameTextField
Layout.fillWidth: true
inputMethodHints: Qt.ImhEmailCharactersOnly
}
Label {
Layout.fillWidth: true
@ -42,7 +42,7 @@ Page {
TextField {
id: passwordTextField
Layout.fillWidth: true
echoMode: TextInput.Password
}
Button {
Layout.fillWidth: true

View File

@ -24,6 +24,10 @@ Page {
Label {
text: model.name
}
onClicked: {
pageStack.push(Qt.resolvedUrl("magic/EditRulePage.qml"))
}
}
}
}

View File

@ -12,7 +12,7 @@ ActionDelegateBase {
Label {
Layout.fillWidth: true
text: actionType.name
text: actionType.displayName
}
Label {
Layout.fillWidth: true

View File

@ -10,7 +10,7 @@ ActionDelegateBase {
id: layout
anchors { left: parent.left; right: parent.right; top: parent.top; margins: app.margins }
Label {
text: root.actionType.name
text: root.actionType.displayName
Layout.fillWidth: true
}
Button {

View 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"
}
}
}

View File

@ -47,6 +47,16 @@ void ActionType::setName(const QString &name)
m_name = name;
}
QString ActionType::displayName() const
{
return m_displayName;
}
void ActionType::setDisplayName(const QString &displayName)
{
m_displayName = displayName;
}
int ActionType::index() const
{
return m_index;

View File

@ -33,6 +33,7 @@ class ActionType : public QObject
Q_OBJECT
Q_PROPERTY(QUuid id READ id CONSTANT)
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QString displayName READ displayName CONSTANT)
Q_PROPERTY(int index READ index CONSTANT)
Q_PROPERTY(ParamTypes *paramTypes READ paramTypes NOTIFY paramTypesChanged)
@ -45,6 +46,9 @@ public:
QString name() const;
void setName(const QString &name);
QString displayName() const;
void setDisplayName(const QString &displayName);
int index() const;
void setIndex(const int &index);
@ -54,6 +58,7 @@ public:
private:
QUuid m_id;
QString m_name;
QString m_displayName;
int m_index;
ParamTypes *m_paramTypes;

View File

@ -28,9 +28,18 @@ StateDescriptor *StateEvaluator::stateDescriptor() const
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
{
if (m_stateDescriptor->deviceId() == deviceId) {
if (m_stateDescriptor && m_stateDescriptor->deviceId() == deviceId) {
return true;
}
for (int i = 0; i < m_childEvaluators->rowCount(); i++) {

View File

@ -27,6 +27,7 @@ public:
StateEvaluators* childEvaluators() const;
StateDescriptor* stateDescriptor() const;
void setStateDescriptor(StateDescriptor *stateDescriptor);
bool containsDevice(const QUuid &deviceId) const;