more work
parent
6dfd3ae736
commit
27b8946ff5
|
|
@ -193,11 +193,11 @@ void UpnpDiscovery::networkReplyFinished(QNetworkReply *reply)
|
|||
{
|
||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
switch (status) {
|
||||
case(200):{
|
||||
QByteArray data = reply->readAll();
|
||||
DiscoveryDevice discoveryDevice = m_runningReplies.take(reply);
|
||||
|
||||
switch (status) {
|
||||
case(200):{
|
||||
// parse XML data
|
||||
QXmlStreamReader xml(data);
|
||||
while (!xml.atEnd() && !xml.hasError()) {
|
||||
|
|
@ -252,9 +252,9 @@ void UpnpDiscovery::networkReplyFinished(QNetworkReply *reply)
|
|||
}
|
||||
}
|
||||
|
||||
qDebug() << "discovered device" << discoveryDevice.friendlyName() << discoveryDevice.hostAddress();
|
||||
|
||||
if (discoveryDevice.friendlyName().contains("guh")) {
|
||||
qDebug() << discoveryDevice;
|
||||
if (discoveryDevice.manufacturer().contains("guh")) {
|
||||
if (!m_discoveryModel->contains(discoveryDevice.uuid())) {
|
||||
m_discoveryModel->addDevice(discoveryDevice);
|
||||
}
|
||||
|
|
@ -264,7 +264,6 @@ void UpnpDiscovery::networkReplyFinished(QNetworkReply *reply)
|
|||
}
|
||||
default:
|
||||
qWarning() << "HTTP request error " << status;
|
||||
m_runningReplies.remove(reply);
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ EventType *JsonTypes::unpackEventType(const QVariantMap &eventTypeMap, QObject *
|
|||
EventType *eventType = new EventType(parent);
|
||||
eventType->setId(eventTypeMap.value("id").toUuid());
|
||||
eventType->setName(eventTypeMap.value("name").toString());
|
||||
eventType->setDisplayName(eventTypeMap.value("displayName").toString());
|
||||
eventType->setIndex(eventTypeMap.value("index").toInt());
|
||||
ParamTypes *paramTypes = new ParamTypes(eventType);
|
||||
foreach (QVariant paramType, eventTypeMap.value("paramTypes").toList()) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QtQml/QQmlContext>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
|
@ -39,6 +39,8 @@
|
|||
#include "types/ruleaction.h"
|
||||
#include "types/ruleactionparams.h"
|
||||
#include "types/ruleactionparam.h"
|
||||
#include "types/eventdescriptors.h"
|
||||
#include "types/eventdescriptor.h"
|
||||
#include "types/rule.h"
|
||||
#include "models/logsmodel.h"
|
||||
#include "models/valuelogsproxymodel.h"
|
||||
|
|
@ -46,13 +48,14 @@
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication application(argc, argv);
|
||||
QCoreApplication application(argc, argv);
|
||||
application.setApplicationName("guh-control");
|
||||
application.setOrganizationName("guh");
|
||||
|
||||
QQuickStyle::setStyle("Material");
|
||||
|
||||
const char uri[] = "Guh";
|
||||
|
||||
qmlRegisterSingletonType<Engine>(uri, 1, 0, "Engine", Engine::qmlInstance);
|
||||
|
||||
qmlRegisterUncreatableType<DeviceManager>(uri, 1, 0, "DeviceManager", "Can't create this in QML. Get it from the Core.");
|
||||
|
|
@ -98,6 +101,12 @@ int main(int argc, char *argv[])
|
|||
qmlRegisterUncreatableType<RuleActionParams>(uri, 1, 0, "RuleActionParams", "Get it from RuleActions");
|
||||
qmlRegisterUncreatableType<RuleActionParam>(uri, 1, 0, "RuleActionParam", "Get it from RuleActionParams");
|
||||
qmlRegisterType<RulesFilterModel>(uri, 1, 0, "RulesFilterModel");
|
||||
qmlRegisterUncreatableType<EventDescriptors>(uri, 1, 0, "EventDescriptors", "Get them from rules");
|
||||
qmlRegisterUncreatableType<EventDescriptor>(uri, 1, 0, "EventDescriptor", "Get them from rules");
|
||||
qmlRegisterUncreatableType<ParamTypes>(uri, 1, 0, "ParamTypes", "Uncreatable");
|
||||
qmlRegisterUncreatableType<ParamType>(uri, 1, 0, "ParamType", "Uncreatable");
|
||||
qmlRegisterUncreatableType<ParamDescriptor>(uri, 1, 0, "ParamDescriptor", "Uncreatable");
|
||||
qmlRegisterUncreatableType<ParamDescriptors>(uri, 1, 0, "ParamDescriptors", "Uncreatable");
|
||||
|
||||
qmlRegisterUncreatableType<Plugin>(uri, 1, 0, "Plugin", "Can't create this in QML. Get it from the Plugins.");
|
||||
qmlRegisterUncreatableType<Plugins>(uri, 1, 0, "Plugins", "Can't create this in QML. Get it from the DeviceManager.");
|
||||
|
|
|
|||
|
|
@ -108,5 +108,9 @@
|
|||
<file>ui/magic/SelectEventPage.qml</file>
|
||||
<file>ui/magic/NewThingMagicPage.qml</file>
|
||||
<file>ui/magic/EditRulePage.qml</file>
|
||||
<file>ui/magic/SelectThingPage.qml</file>
|
||||
<file>ui/magic/ComposeEventDescriptorPage.qml</file>
|
||||
<file>ui/images/view-expand.svg</file>
|
||||
<file>ui/images/view-collapse.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ Rules *RuleManager::rules() const
|
|||
return m_rules;
|
||||
}
|
||||
|
||||
Rule *RuleManager::createNewRule()
|
||||
{
|
||||
return new Rule();
|
||||
}
|
||||
|
||||
void RuleManager::addRule(const QVariantMap params)
|
||||
{
|
||||
m_jsonClient->sendCommand("Rules.AddRule", params, this, "addRuleReply");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public:
|
|||
|
||||
Rules* rules() const;
|
||||
|
||||
Q_INVOKABLE Rule* createNewRule();
|
||||
|
||||
Q_INVOKABLE void addRule(const QVariantMap params);
|
||||
Q_INVOKABLE void removeRule(const QUuid &ruleId);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Page {
|
|||
|
||||
HeaderButton {
|
||||
imageSource: Qt.resolvedUrl("images/add.svg")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("magic/NewRulePage.qml"))
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("magic/NewRulePage.qml"), {rule: Engine.ruleManager.createNewRule() })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ Page {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("magic/EditRulePage.qml"))
|
||||
pageStack.push(Qt.resolvedUrl("magic/EditRulePage.qml"), {rule: Engine.ruleManager.rules.get(index) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@ CustomViewBase {
|
|||
text: "Send a notification now:"
|
||||
}
|
||||
TextArea {
|
||||
id: textArea
|
||||
id: titleTextArea
|
||||
placeholderText: "Title"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
TextArea {
|
||||
id: bodyTextArea
|
||||
placeholderText: "Text"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
|
|
@ -29,8 +35,13 @@ CustomViewBase {
|
|||
print("bla:", root.deviceClass.actionTypes.findByName("notify").paramTypes)
|
||||
var paramTypeId = root.deviceClass.actionTypes.findByName("notify").paramTypes.findByName("title").id
|
||||
param1.paramTypeId = paramTypeId
|
||||
param1.value = textArea.text
|
||||
param1.value = titleTextArea.text
|
||||
params.push(param1)
|
||||
var param2 = {}
|
||||
paramTypeId = root.deviceClass.actionTypes.findByName("notify").paramTypes.findByName("body").id
|
||||
param2.paramTypeId = paramTypeId
|
||||
param2.value = bodyTextArea.text
|
||||
params.push(param2)
|
||||
Engine.deviceManager.executeAction(root.device.id, root.deviceClass.actionTypes.findByName("notify").id, params)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg id="svg4874" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="96" viewBox="0 0 96 96.000001" width="96" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<metadata id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g id="layer1" transform="translate(67.857 -78.505)">
|
||||
<rect id="rect4782" style="color:#000000;fill:none" transform="rotate(90)" height="96" width="96" y="-28.143" x="78.505"/>
|
||||
<path id="path4643" style="color-rendering:auto;text-decoration-color:#000000;color:#000000;font-variant-numeric:normal;shape-rendering:auto;solid-color:#000000;text-decoration-line:none;fill:#808080;font-variant-position:normal;mix-blend-mode:normal;block-progression:tb;font-feature-settings:normal;shape-padding:0;font-variant-alternates:normal;text-indent:0;font-variant-caps:normal;image-rendering:auto;white-space:normal;text-decoration-style:solid;font-variant-ligatures:none;isolation:auto;text-transform:none" d="m-38.828 94.504c-3.971 0.04591-6.9155-0.12972-9.4551 1.2715-1.2698 0.7006-2.2916 1.9086-2.8398 3.3691-0.54825 1.4605-0.73438 3.1517-0.73438 5.2559v44.211c0 2.1041 0.18612 3.7934 0.73438 5.2539 0.54825 1.4605 1.57 2.6686 2.8398 3.3692 2.5396 1.4012 5.4841 1.2256 9.4551 1.2715h0.01172 37.918 0.011719c3.971-0.0459 6.9155 0.12972 9.4551-1.2715 1.2698-0.70061 2.2916-1.9086 2.8398-3.3692 0.54825-1.4605 0.73438-3.1498 0.73438-5.2539v-44.211c0-2.1041-0.18612-3.7953-0.73438-5.2559-0.549-1.46-1.5708-2.668-2.8406-3.369-2.5396-1.401-5.4841-1.225-9.4551-1.271h-0.011719-37.918-0.01172zm0.02344 4h37.895c3.9762 0.04667 6.5534 0.22528 7.5469 0.77344 0.49794 0.27474 0.7475 0.52794 1.0273 1.2734 0.27984 0.7455 0.47852 2.0064 0.47852 3.8496v44.211c0 1.8433-0.19867 3.1022-0.47852 3.8476-0.27984 0.7455-0.5294 0.99871-1.0273 1.2734-0.99351 0.54817-3.5707 0.72678-7.5469 0.77344h-37.871-0.02344c-3.9762-0.0467-6.5534-0.22528-7.5469-0.77344-0.49794-0.27473-0.74555-0.52795-1.0254-1.2734-0.27984-0.74548-0.48047-2.0044-0.48047-3.8476v-44.211c0-1.8433 0.20062-3.1041 0.48047-3.8496 0.27984-0.74549 0.52745-0.9987 1.0254-1.2734 0.99351-0.54816 3.5707-0.72677 7.5469-0.77344z"/>
|
||||
<rect id="rect4174" style="color:#000000;fill:#808080" height="4" width="32" y="124.51" x="-35.857"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg id="svg4874" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="96" viewBox="0 0 96 96.000001" width="96" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<metadata id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g id="layer1" transform="translate(67.857 -78.505)">
|
||||
<rect id="rect4782" style="color:#000000;fill:none" transform="rotate(90)" height="96" width="96" y="-28.143" x="78.505"/>
|
||||
<path id="path4643" style="color-rendering:auto;text-decoration-color:#000000;color:#000000;font-variant-numeric:normal;shape-rendering:auto;solid-color:#000000;text-decoration-line:none;fill:#808080;font-variant-position:normal;mix-blend-mode:normal;block-progression:tb;font-feature-settings:normal;shape-padding:0;font-variant-alternates:normal;text-indent:0;font-variant-caps:normal;image-rendering:auto;white-space:normal;text-decoration-style:solid;font-variant-ligatures:none;isolation:auto;text-transform:none" d="m-38.828 94.504c-3.971 0.04591-6.9155-0.12972-9.4551 1.2715-1.2698 0.7006-2.2916 1.9086-2.8398 3.3691-0.54825 1.4605-0.73438 3.1517-0.73438 5.2559v44.211c0 2.1041 0.18612 3.7934 0.73438 5.2539 0.54825 1.4605 1.57 2.6686 2.8398 3.3692 2.5396 1.4012 5.4841 1.2256 9.4551 1.2715h0.01172 37.918 0.011719c3.971-0.0459 6.9155 0.12972 9.4551-1.2715 1.2698-0.70061 2.2916-1.9086 2.8398-3.3692 0.54825-1.4605 0.73438-3.1498 0.73438-5.2539v-44.211c0-2.1041-0.18612-3.7953-0.73438-5.2559-0.549-1.46-1.5708-2.668-2.8406-3.369-2.5396-1.401-5.4841-1.225-9.4551-1.271h-0.011719-37.918-0.01172zm0.02344 4h37.895c3.9762 0.04667 6.5534 0.22528 7.5469 0.77344 0.49794 0.27474 0.7475 0.52794 1.0273 1.2734 0.27984 0.7455 0.47852 2.0064 0.47852 3.8496v44.211c0 1.8433-0.19867 3.1022-0.47852 3.8476-0.27984 0.7455-0.5294 0.99871-1.0273 1.2734-0.99351 0.54817-3.5707 0.72678-7.5469 0.77344h-37.871-0.02344c-3.9762-0.0467-6.5534-0.22528-7.5469-0.77344-0.49794-0.27473-0.74555-0.52795-1.0254-1.2734-0.27984-0.74548-0.48047-2.0044-0.48047-3.8476v-44.211c0-1.8433 0.20062-3.1041 0.48047-3.8496 0.27984-0.74549 0.52745-0.9987 1.0254-1.2734 0.99351-0.54816 3.5707-0.72677 7.5469-0.77344z"/>
|
||||
<rect id="rect4174" style="color:#000000;fill:#808080" height="4" width="32" y="124.51" x="-35.857"/>
|
||||
<path id="rect4195" style="color:#000000;fill:#808080" d="m109.51 17.857h33v4h-32z" transform="rotate(90)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
|
@ -0,0 +1,40 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls 2.1
|
||||
import "../components"
|
||||
import Guh 1.0
|
||||
|
||||
Page {
|
||||
id: root
|
||||
property var device: null
|
||||
|
||||
header: GuhHeader {
|
||||
text: "Select event"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
ColumnLayout {
|
||||
visible: root.device == null
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
RadioButton {
|
||||
text: "A specific thing"
|
||||
checked: true
|
||||
}
|
||||
RadioButton {
|
||||
text: "A group of things"
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
// Layout.fi
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,8 +2,11 @@ import QtQuick 2.7
|
|||
import QtQuick.Controls 2.2
|
||||
import "../components"
|
||||
import QtQuick.Layouts 1.2
|
||||
import Guh 1.0
|
||||
|
||||
Page {
|
||||
property var rule: null
|
||||
|
||||
header: GuhHeader {
|
||||
text: "Add some magic"
|
||||
onBackPressed: pageStack.pop()
|
||||
|
|
@ -14,6 +17,23 @@ Page {
|
|||
Label {
|
||||
text: "When"
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: rule.eventDescriptors
|
||||
ItemDelegate {
|
||||
property var device: Engine.deviceManager.devices.getDevice(model.deviceId)
|
||||
property var deviceClass: device ? Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId) : null
|
||||
property var eventType: deviceClass ? deviceClass.eventTypes.getEventType(model.eventTypeId) : null
|
||||
contentItem: ColumnLayout {
|
||||
Label {
|
||||
text: device ? device.name : "Unknown device"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label {
|
||||
text: eventType ? eventType.name : "Unknown event"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,132 @@
|
|||
import QtQuick 2.8
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.1
|
||||
import "../components"
|
||||
import Guh 1.0
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
property var device: null
|
||||
property var rule: null
|
||||
|
||||
StackView {
|
||||
id: internalPageStack
|
||||
anchors.fill: parent
|
||||
initialItem: newRulePage1
|
||||
}
|
||||
|
||||
function addEventDescriptor() {
|
||||
var eventDescriptor = root.rule.eventDescriptors.createNewEventDescriptor();
|
||||
var page = internalPageStack.push(Qt.resolvedUrl("SelectThingPage.qml"));
|
||||
page.onBackPressed.connect(function() { internalPageStack.pop(); });
|
||||
page.onThingSelected.connect(function(device) {
|
||||
eventDescriptor.deviceId = device.id;
|
||||
selectEventDescriptorData(eventDescriptor)
|
||||
})
|
||||
page.onInterfaceSelected.connect(function(interfaceName) {
|
||||
eventDescriptor.interfaceName = interfaceName;
|
||||
selectEventDescriptorData(eventDescriptor)
|
||||
})
|
||||
}
|
||||
|
||||
function selectEventDescriptorData(eventDescriptor) {
|
||||
var eventPage = internalPageStack.push(Qt.resolvedUrl("SelectEventPage.qml"), {text: "Select event", eventDescriptor: eventDescriptor});
|
||||
eventPage.onBackPressed.connect(function() {internalPageStack.pop()})
|
||||
eventPage.onDone.connect(function() {
|
||||
root.rule.eventDescriptors.addEventDescriptor(eventPage.eventDescriptor);
|
||||
internalPageStack.pop(newRulePage1)
|
||||
})
|
||||
}
|
||||
|
||||
function addAction() {
|
||||
|
||||
}
|
||||
|
||||
Page {
|
||||
id: newRulePage1
|
||||
|
||||
header: GuhHeader {
|
||||
text: "New rule"
|
||||
onBackPressed: pageStack.pop()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
RadioButton {
|
||||
id: whenButton
|
||||
text: "When"
|
||||
checked: true
|
||||
}
|
||||
RadioButton {
|
||||
id: whileButton
|
||||
text: "While"
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: eventsRepeater.count == 0
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: "Add an event which should trigger the execution of the rule"
|
||||
}
|
||||
Button {
|
||||
text: "+"
|
||||
onClicked: root.addEventDescriptor();
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: eventsRepeater
|
||||
model: root.rule.eventDescriptors
|
||||
delegate: ItemDelegate {
|
||||
id: eventDelegate
|
||||
property var device: Engine.deviceManager.devices.getDevice(root.rule.eventDescriptors.get(index).deviceId)
|
||||
property var deviceClass: device ? Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId) : null
|
||||
property var eventType: deviceClass ? deviceClass.eventTypes.getEventType(root.rule.eventDescriptors.get(index).eventTypeId) : null
|
||||
contentItem: ColumnLayout {
|
||||
Label {
|
||||
text: eventDelegate.device ? eventDelegate.device.name : "Unknown device" + root.rule.eventDescriptors.get(index).deviceId
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label {
|
||||
text: eventDelegate.eventType ? eventDelegate.eventType.displayName : "Unknown event" + root.rule.eventDescriptors.get(index).eventTypeId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "do the following:"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: actionsRepeater.count == 0
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: "Add action which should be executed when the rule is triggered"
|
||||
}
|
||||
Button {
|
||||
text: "+"
|
||||
onClicked: root.addAction();
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: actionsRepeater
|
||||
model: root.rule.actions
|
||||
delegate: ItemDelegate {
|
||||
id: actionDelegate
|
||||
contentItem: ColumnLayout {
|
||||
Label {
|
||||
text: "bla"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,41 +6,100 @@ import Guh 1.0
|
|||
Page {
|
||||
id: root
|
||||
property alias text: header.text
|
||||
property var device: null
|
||||
readonly property var deviceClass: Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId)
|
||||
|
||||
// an eventDescriptor object needs to be set and prefilled with either deviceId or interfaceName
|
||||
property var eventDescriptor: null
|
||||
|
||||
readonly property var device: eventDescriptor && eventDescriptor.deviceId ? Engine.deviceManager.devices.getDevice(eventDescriptor.deviceId) : null
|
||||
readonly property var deviceClass: device ? Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId) : null
|
||||
|
||||
signal backPressed();
|
||||
signal done();
|
||||
|
||||
onEventDescriptorChanged: buildInterface()
|
||||
Component.onCompleted: buildInterface()
|
||||
|
||||
header: GuhHeader {
|
||||
id: header
|
||||
onBackPressed: pageStack.pop()
|
||||
onBackPressed: root.backPressed();
|
||||
|
||||
property bool interfacesMode: true
|
||||
onInterfacesModeChanged: root.buildInterface()
|
||||
|
||||
HeaderButton {
|
||||
imageSource: header.interfacesMode ? "../images/view-expand.svg" : "../images/view-collapse.svg"
|
||||
onClicked: header.interfacesMode = !header.interfacesMode
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: eventModel
|
||||
id: eventTemplateModel
|
||||
ListElement { interfaceName: "temperaturesensor"; text: "When it's freezing..."; event: "freeze"}
|
||||
ListElement { interfaceName: "battery"; text: "When the device runs out of battery..."; event: "lowBattery"}
|
||||
ListElement { interfaceName: "weather"; text: "When it starts raining..."; event: "rain" }
|
||||
}
|
||||
|
||||
onDeviceClassChanged: {
|
||||
function buildInterface() {
|
||||
actualModel.clear()
|
||||
|
||||
if (header.interfacesMode) {
|
||||
if (root.device) {
|
||||
print("device supports interfaces", deviceClass.interfaces)
|
||||
for (var i = 0; i < eventModel.count; i++) {
|
||||
print("event is for interface", eventModel.get(i).interfaceName)
|
||||
if (deviceClass.interfaces.indexOf(eventModel.get(i).interfaceName) >= 0) {
|
||||
actualModel.append(eventModel.get(i))
|
||||
for (var i = 0; i < eventTemplateModel.count; i++) {
|
||||
print("event is for interface", eventTemplateModel.get(i).interfaceName)
|
||||
if (deviceClass.interfaces.indexOf(eventTemplateModel.get(i).interfaceName) >= 0) {
|
||||
actualModel.append(eventTemplateModel.get(i))
|
||||
}
|
||||
}
|
||||
} else if (root.eventDescriptor.interfaceName !== "") {
|
||||
for (var i = 0; i < eventTemplateModel.count; i++) {
|
||||
if (eventTemplateModel.get(i).interfaceName === root.eventDescriptor.interfaceName) {
|
||||
actualModel.append(eventTemplateModel.get(i))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.warn("You need to set device or interfaceName");
|
||||
}
|
||||
} else {
|
||||
if (root.device) {
|
||||
print("fdsfasdfdsafdas", deviceClass.eventTypes.count)
|
||||
for (var i = 0; i < deviceClass.eventTypes.count; i++) {
|
||||
print("bla", deviceClass.eventTypes.get(i).name, deviceClass.eventTypes.get(i).displayName)
|
||||
actualModel.append({text: deviceClass.eventTypes.get(i).displayName})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: actualModel
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: ListModel {
|
||||
id: actualModel
|
||||
}
|
||||
model: actualModel
|
||||
|
||||
delegate: ItemDelegate {
|
||||
text: model.text
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (header.interfacesMode) {
|
||||
if (root.device) {
|
||||
print("selected:", model.event)
|
||||
switch (model.event) {
|
||||
case "lowBattery":
|
||||
var eventType = root.deviceClass.eventTypes.findByName("batteryCritical")
|
||||
root.eventDescriptor.eventTypeId = eventType.id;
|
||||
// root.eventDescriptor.paramDescriptors.setParamDescriptor(eventType.paramTypes.get(0).paramTypeId, 0, ParamDescriptors.ValueOperatorLessOrEqual)
|
||||
root.done();
|
||||
break;
|
||||
default:
|
||||
console.warn("FIXME: Unhandled interface event");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.warn("FIXME: not implemented yet")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls 2.1
|
||||
import "../components"
|
||||
import Guh 1.0
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
signal backPressed();
|
||||
signal thingSelected(var device);
|
||||
signal interfaceSelected(string interfaceName);
|
||||
|
||||
header: GuhHeader {
|
||||
text: "Select a thing"
|
||||
onBackPressed: root.backPressed()
|
||||
}
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
RadioButton {
|
||||
id: thingButton
|
||||
text: "A specific thing"
|
||||
checked: true
|
||||
}
|
||||
RadioButton {
|
||||
id: interfacesButton
|
||||
text: "A group of things"
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: supportedInterfacesModel
|
||||
ListElement { interfaceName: "battery"; name: "Battery powered devices" }
|
||||
ListElement { interfaceName: "temperatureSensor"; name: "Temperature sensors" }
|
||||
}
|
||||
|
||||
ListView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: thingButton.checked ? Engine.deviceManager.devices : supportedInterfacesModel
|
||||
delegate: ItemDelegate {
|
||||
text: model.name
|
||||
onClicked: {
|
||||
if (thingButton.checked) {
|
||||
root.thingSelected(Engine.deviceManager.devices.get(index))
|
||||
} else {
|
||||
root.interfaceSelected(supportedInterfacesModel.get(index).interfaceName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,9 @@ HEADERS += types/types.h \
|
|||
types/logentry.h \
|
||||
types/stateevaluators.h \
|
||||
types/stateevaluator.h \
|
||||
types/statedescriptor.h
|
||||
types/statedescriptor.h \
|
||||
types/paramdescriptor.h \
|
||||
types/paramdescriptors.h
|
||||
|
||||
SOURCES += types/vendor.cpp \
|
||||
types/vendors.cpp \
|
||||
|
|
@ -72,7 +74,9 @@ SOURCES += types/vendor.cpp \
|
|||
types/logentry.cpp \
|
||||
types/stateevaluators.cpp \
|
||||
types/stateevaluator.cpp \
|
||||
types/statedescriptor.cpp
|
||||
types/statedescriptor.cpp \
|
||||
types/paramdescriptor.cpp \
|
||||
types/paramdescriptors.cpp
|
||||
|
||||
# install header file with relative subdirectory
|
||||
for(header, HEADERS) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
EventDescriptor::EventDescriptor(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
m_paramDescriptors = new ParamDescriptors(this);
|
||||
}
|
||||
|
||||
QUuid EventDescriptor::deviceId() const
|
||||
|
|
@ -12,7 +12,10 @@ QUuid EventDescriptor::deviceId() const
|
|||
|
||||
void EventDescriptor::setDeviceId(const QUuid &deviceId)
|
||||
{
|
||||
if (m_deviceId != deviceId) {
|
||||
m_deviceId = deviceId;
|
||||
emit deviceIdChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QUuid EventDescriptor::eventTypeId() const
|
||||
|
|
@ -22,5 +25,36 @@ QUuid EventDescriptor::eventTypeId() const
|
|||
|
||||
void EventDescriptor::setEventTypeId(const QUuid &eventTypeId)
|
||||
{
|
||||
if (m_eventTypeId != eventTypeId) {
|
||||
m_eventTypeId = eventTypeId;
|
||||
emit eventTypeIdChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString EventDescriptor::interfaceName() const
|
||||
{
|
||||
return m_interfaceName;
|
||||
}
|
||||
|
||||
void EventDescriptor::setInterfaceName(const QString &interfaceName)
|
||||
{
|
||||
if (m_interfaceName != interfaceName) {
|
||||
m_interfaceName = interfaceName;
|
||||
emit interfaceNameChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString EventDescriptor::interfaceEvent() const
|
||||
{
|
||||
return m_interfaceEvent;
|
||||
}
|
||||
|
||||
void EventDescriptor::setInterfaceEvent(const QString &interfaceEvent)
|
||||
{
|
||||
m_interfaceEvent = interfaceEvent;
|
||||
}
|
||||
|
||||
ParamDescriptors *EventDescriptor::paramDescriptors() const
|
||||
{
|
||||
return m_paramDescriptors;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,18 @@
|
|||
#include <QObject>
|
||||
#include <QUuid>
|
||||
|
||||
#include "paramdescriptors.h"
|
||||
|
||||
class EventDescriptor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QUuid deviceId READ deviceId CONSTANT)
|
||||
Q_PROPERTY(QUuid eventTypeId READ eventTypeId CONSTANT)
|
||||
Q_PROPERTY(QUuid deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged)
|
||||
Q_PROPERTY(QUuid eventTypeId READ eventTypeId WRITE setEventTypeId NOTIFY eventTypeIdChanged)
|
||||
|
||||
Q_PROPERTY(QString interfaceName READ interfaceName WRITE setInterfaceName NOTIFY interfaceNameChanged)
|
||||
Q_PROPERTY(QString interfaceEvent READ interfaceEvent CONSTANT)
|
||||
|
||||
Q_PROPERTY(ParamDescriptors* paramDescriptors READ paramDescriptors CONSTANT)
|
||||
|
||||
public:
|
||||
explicit EventDescriptor(QObject *parent = nullptr);
|
||||
|
|
@ -19,11 +26,27 @@ public:
|
|||
QUuid eventTypeId() const;
|
||||
void setEventTypeId(const QUuid &eventTypeId);
|
||||
|
||||
QString interfaceName() const;
|
||||
void setInterfaceName(const QString &interfaceName);
|
||||
|
||||
QString interfaceEvent() const;
|
||||
void setInterfaceEvent(const QString &interfaceEvent);
|
||||
|
||||
ParamDescriptors* paramDescriptors() const;
|
||||
|
||||
signals:
|
||||
void deviceIdChanged();
|
||||
void eventTypeIdChanged();
|
||||
void interfaceNameChanged();
|
||||
|
||||
private:
|
||||
QUuid m_deviceId;
|
||||
QUuid m_eventTypeId;
|
||||
|
||||
QString m_interfaceName;
|
||||
QString m_interfaceEvent;
|
||||
|
||||
ParamDescriptors *m_paramDescriptors;
|
||||
};
|
||||
|
||||
#endif // EVENTDESCRIPTOR_H
|
||||
|
|
|
|||
|
|
@ -15,13 +15,20 @@ int EventDescriptors::rowCount(const QModelIndex &parent) const
|
|||
|
||||
QVariant EventDescriptors::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
switch (role) {
|
||||
case RoleDeviceId:
|
||||
return m_list.at(index.row())->deviceId();
|
||||
case RoleEventTypeId:
|
||||
return m_list.at(index.row())->eventTypeId();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> EventDescriptors::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles;
|
||||
roles.insert(RoleName, "name");
|
||||
roles.insert(RoleDeviceId, "deviceId");
|
||||
roles.insert(RoleEventTypeId, "eventId");
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +37,11 @@ EventDescriptor *EventDescriptors::get(int index) const
|
|||
return m_list.at(index);
|
||||
}
|
||||
|
||||
EventDescriptor *EventDescriptors::createNewEventDescriptor()
|
||||
{
|
||||
return new EventDescriptor();
|
||||
}
|
||||
|
||||
void EventDescriptors::addEventDescriptor(EventDescriptor *eventDescriptor)
|
||||
{
|
||||
eventDescriptor->setParent(this);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ class EventDescriptors : public QAbstractListModel
|
|||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
public:
|
||||
enum Roles {
|
||||
RoleName
|
||||
RoleDeviceId,
|
||||
RoleEventTypeId
|
||||
};
|
||||
explicit EventDescriptors(QObject *parent = nullptr);
|
||||
|
||||
|
|
@ -19,9 +20,10 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
EventDescriptor* get(int index) const;
|
||||
Q_INVOKABLE EventDescriptor* get(int index) const;
|
||||
|
||||
void addEventDescriptor(EventDescriptor *eventDescriptor);
|
||||
Q_INVOKABLE EventDescriptor* createNewEventDescriptor();
|
||||
Q_INVOKABLE void addEventDescriptor(EventDescriptor *eventDescriptor);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
|
|
|||
|
|
@ -47,6 +47,16 @@ void EventType::setName(const QString &name)
|
|||
m_name = name;
|
||||
}
|
||||
|
||||
QString EventType::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
void EventType::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
int EventType::index() const
|
||||
{
|
||||
return m_index;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,9 @@ class EventType : 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 CONSTANT)
|
||||
Q_PROPERTY(ParamTypes* paramTypes READ paramTypes CONSTANT)
|
||||
|
||||
public:
|
||||
explicit EventType(QObject *parent = 0);
|
||||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@ QList<EventType *> EventTypes::eventTypes()
|
|||
return m_eventTypes;
|
||||
}
|
||||
|
||||
int EventTypes::count() const
|
||||
{
|
||||
return m_eventTypes.count();
|
||||
}
|
||||
|
||||
EventType *EventTypes::get(int index) const
|
||||
{
|
||||
return m_eventTypes.at(index);
|
||||
|
|
@ -80,6 +75,7 @@ void EventTypes::addEventType(EventType *eventType)
|
|||
//qDebug() << "EventTypes: loaded eventType" << eventType->name();
|
||||
m_eventTypes.append(eventType);
|
||||
endInsertRows();
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void EventTypes::clearModel()
|
||||
|
|
@ -87,12 +83,12 @@ void EventTypes::clearModel()
|
|||
beginResetModel();
|
||||
m_eventTypes.clear();
|
||||
endResetModel();
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
EventType *EventTypes::findByName(const QString &name) const
|
||||
{
|
||||
foreach (EventType *eventType, m_eventTypes) {
|
||||
qDebug() << "have eventtypoe" << eventType->name();
|
||||
if (eventType->name() == name) {
|
||||
return eventType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
class EventTypes : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
|
||||
public:
|
||||
enum EventTypeRole {
|
||||
|
|
@ -42,7 +43,6 @@ public:
|
|||
|
||||
QList<EventType *> eventTypes();
|
||||
|
||||
Q_INVOKABLE int count() const;
|
||||
Q_INVOKABLE EventType *get(int index) const;
|
||||
Q_INVOKABLE EventType *getEventType(const QUuid &eventTypeId) const;
|
||||
|
||||
|
|
@ -55,6 +55,9 @@ public:
|
|||
|
||||
Q_INVOKABLE EventType *findByName(const QString &name) const;
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#include "paramdescriptor.h"
|
||||
|
||||
ParamDescriptor::ParamDescriptor(const QString &id, const QVariant &value, QObject *parent) : Param(id, value, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ParamDescriptor::ValueOperator ParamDescriptor::operatorType() const
|
||||
{
|
||||
return m_operator;
|
||||
}
|
||||
|
||||
void ParamDescriptor::setOperatorType(ParamDescriptor::ValueOperator operatorType)
|
||||
{
|
||||
if (m_operator != operatorType) {
|
||||
m_operator = operatorType;
|
||||
emit operatorTypeChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef PARAMDESCRIPTOR_H
|
||||
#define PARAMDESCRIPTOR_H
|
||||
|
||||
#include "param.h"
|
||||
|
||||
class ParamDescriptor : public Param
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(ValueOperator operatorType READ operatorType WRITE setOperatorType NOTIFY operatorTypeChanged)
|
||||
public:
|
||||
enum ValueOperator {
|
||||
ValueOperatorEquals,
|
||||
ValueOperatorNotEquals,
|
||||
ValueOperatorLess,
|
||||
ValueOperatorGreater,
|
||||
ValueOperatorLessOrEqual,
|
||||
ValueOperatorGreaterOrEqual
|
||||
};
|
||||
Q_ENUM(ValueOperator)
|
||||
|
||||
explicit ParamDescriptor(const QString &id = QString(), const QVariant &value = QVariant(), QObject *parent = nullptr);
|
||||
|
||||
ValueOperator operatorType() const;
|
||||
void setOperatorType(ValueOperator operatorType);
|
||||
|
||||
signals:
|
||||
void operatorTypeChanged();
|
||||
|
||||
private:
|
||||
ValueOperator m_operator;
|
||||
};
|
||||
|
||||
#endif // PARAMDESCRIPTOR_H
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#include "paramdescriptors.h"
|
||||
#include "paramdescriptor.h"
|
||||
|
||||
ParamDescriptors::ParamDescriptors(QObject *parent) : QAbstractListModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ParamDescriptors::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
QVariant ParamDescriptors::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
ParamDescriptor *ParamDescriptors::createNewParamDescriptor() const
|
||||
{
|
||||
return new ParamDescriptor();
|
||||
}
|
||||
|
||||
void ParamDescriptors::addParamDescriptor(ParamDescriptor *paramDescriptor)
|
||||
{
|
||||
paramDescriptor->setParent(this);
|
||||
beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
|
||||
m_list.append(paramDescriptor);
|
||||
endInsertRows();
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void ParamDescriptors::setParamDescriptor(const QString ¶mTypeId, const QVariant &value, ValueOperator operatorType)
|
||||
{
|
||||
foreach (ParamDescriptor* paramDescriptor, m_list) {
|
||||
if (paramDescriptor->id() == paramTypeId) {
|
||||
paramDescriptor->setValue(value);
|
||||
paramDescriptor->setOperatorType((ParamDescriptor::ValueOperator)operatorType);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Still here? need to add a new one
|
||||
ParamDescriptor* paramDescriptor = createNewParamDescriptor();
|
||||
paramDescriptor->setId(paramTypeId);
|
||||
paramDescriptor->setValue(value);
|
||||
paramDescriptor->setOperatorType((ParamDescriptor::ValueOperator)operatorType);
|
||||
addParamDescriptor(paramDescriptor);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef PARAMDESCRIPTORS_H
|
||||
#define PARAMDESCRIPTORS_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include "paramdescriptor.h"
|
||||
|
||||
class ParamDescriptors : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
public:
|
||||
enum ValueOperator {
|
||||
ValueOperatorEquals,
|
||||
ValueOperatorNotEquals,
|
||||
ValueOperatorLess,
|
||||
ValueOperatorGreater,
|
||||
ValueOperatorLessOrEqual,
|
||||
ValueOperatorGreaterOrEqual
|
||||
};
|
||||
Q_ENUM(ValueOperator)
|
||||
|
||||
explicit ParamDescriptors(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
ParamDescriptor* createNewParamDescriptor() const;
|
||||
void addParamDescriptor(ParamDescriptor* paramDescriptor);
|
||||
|
||||
Q_INVOKABLE void setParamDescriptor(const QString ¶mTypeId, const QVariant &value, ValueOperator operatorType);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
private:
|
||||
QList<ParamDescriptor*> m_list;
|
||||
};
|
||||
|
||||
#endif // PARAMDESCRIPTORS_H
|
||||
|
|
@ -18,7 +18,7 @@ class Rule : public QObject
|
|||
Q_PROPERTY(StateEvaluator* stateEvaluator READ stateEvaluator CONSTANT)
|
||||
Q_PROPERTY(RuleActions* ruleActions READ ruleActions CONSTANT)
|
||||
public:
|
||||
explicit Rule(const QUuid &id, QObject *parent = nullptr);
|
||||
explicit Rule(const QUuid &id = QUuid(), QObject *parent = nullptr);
|
||||
|
||||
QUuid id() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ RuleActionParams::RuleActionParams(QObject *parent) : QAbstractListModel(parent)
|
|||
|
||||
int RuleActionParams::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue