intermediate commit

pull/183/head
Michael Zanetti 2019-07-09 21:56:53 +02:00
parent f0e8e5a609
commit 968f1fe2fa
6 changed files with 63 additions and 6 deletions

View File

@ -97,6 +97,16 @@ void BrowserItem::setThumbnail(const QString &thumbnail)
m_thumbnail = thumbnail; m_thumbnail = thumbnail;
} }
QList<ActionTypeId> BrowserItem::actionTypeIds() const
{
return m_actionTypeIds;
}
void BrowserItem::setActionTypeIs(const QList<ActionTypeId> &actionTypeIds)
{
m_actionTypeIds = actionTypeIds;
}
BrowserItem::ExtendedPropertiesFlags BrowserItem::extendedPropertiesFlags() const BrowserItem::ExtendedPropertiesFlags BrowserItem::extendedPropertiesFlags() const
{ {
return m_extendedPropertiesFlags; return m_extendedPropertiesFlags;

View File

@ -79,6 +79,9 @@ public:
QString thumbnail() const; QString thumbnail() const;
void setThumbnail(const QString &thumbnail); void setThumbnail(const QString &thumbnail);
QList<ActionTypeId> actionTypeIds() const;
void setActionTypeIs(const QList<ActionTypeId> &actionTypeIds);
ExtendedPropertiesFlags extendedPropertiesFlags() const; ExtendedPropertiesFlags extendedPropertiesFlags() const;
QVariant extendedProperty(const QString &propertyName) const; QVariant extendedProperty(const QString &propertyName) const;
@ -94,6 +97,7 @@ private:
protected: protected:
ExtendedPropertiesFlags m_extendedPropertiesFlags = ExtendedPropertiesNone; ExtendedPropertiesFlags m_extendedPropertiesFlags = ExtendedPropertiesNone;
QHash<QString, QVariant> m_extendedProperties; QHash<QString, QVariant> m_extendedProperties;
QList<ActionTypeId> m_actionTypeIds;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(BrowserItem::ExtendedPropertiesFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(BrowserItem::ExtendedPropertiesFlags)

View File

@ -147,7 +147,7 @@ StateType DeviceClass::getStateType(const StateTypeId &stateTypeId)
/*! Set the \a stateTypes of this DeviceClass. \{Device}{Devices} created /*! Set the \a stateTypes of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} must have their states matching to this template. */ from this \l{DeviceClass} must have their states matching to this template. */
void DeviceClass::setStateTypes(const QList<StateType> &stateTypes) void DeviceClass::setStateTypes(const StateTypes &stateTypes)
{ {
m_stateTypes = stateTypes; m_stateTypes = stateTypes;
} }
@ -172,7 +172,7 @@ EventTypes DeviceClass::eventTypes() const
/*! Set the \a eventTypes of this DeviceClass. \{Device}{Devices} created /*! Set the \a eventTypes of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} must have their events matching to this template. */ from this \l{DeviceClass} must have their events matching to this template. */
void DeviceClass::setEventTypes(const QList<EventType> &eventTypes) void DeviceClass::setEventTypes(const EventTypes &eventTypes)
{ {
m_eventTypes = eventTypes; m_eventTypes = eventTypes;
} }
@ -197,7 +197,7 @@ ActionTypes DeviceClass::actionTypes() const
/*! Set the \a actionTypes of this DeviceClass. \{Device}{Devices} created /*! Set the \a actionTypes of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} must have their actions matching to this template. */ from this \l{DeviceClass} must have their actions matching to this template. */
void DeviceClass::setActionTypes(const QList<ActionType> &actionTypes) void DeviceClass::setActionTypes(const ActionTypes &actionTypes)
{ {
m_actionTypes = actionTypes; m_actionTypes = actionTypes;
} }
@ -213,6 +213,31 @@ bool DeviceClass::hasActionType(const ActionTypeId &actionTypeId)
return false; return false;
} }
/*! Returns the browserActionTypes of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} may set those actions to their browser items. */
ActionTypes DeviceClass::browserActionTypes() const
{
return m_browserActionTypes;
}
/*! Set the \a browserActionTypes of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} may set those actions to their browser items. */
void DeviceClass::setBrowserActionTypes(const ActionTypes &browserActionTypes)
{
m_browserActionTypes = browserActionTypes;
}
/*! Returns true if this DeviceClass has a \l{ActionType} with the given \a actionTypeId. */
bool DeviceClass::hasBrowserActionType(const ActionTypeId &actionTypeId)
{
foreach (const ActionType &actionType, m_actionTypes) {
if (actionType.id() == actionTypeId) {
return true;
}
}
return false;
}
/*! Returns the params description of this DeviceClass. \{Device}{Devices} created /*! Returns the params description of this DeviceClass. \{Device}{Devices} created
from this \l{DeviceClass} must have their params matching to this template. */ from this \l{DeviceClass} must have their params matching to this template. */
ParamTypes DeviceClass::paramTypes() const ParamTypes DeviceClass::paramTypes() const

View File

@ -71,17 +71,21 @@ public:
StateTypes stateTypes() const; StateTypes stateTypes() const;
StateType getStateType(const StateTypeId &stateTypeId); StateType getStateType(const StateTypeId &stateTypeId);
void setStateTypes(const QList<StateType> &stateTypes); void setStateTypes(const StateTypes &stateTypes);
bool hasStateType(const StateTypeId &stateTypeId); bool hasStateType(const StateTypeId &stateTypeId);
EventTypes eventTypes() const; EventTypes eventTypes() const;
void setEventTypes(const QList<EventType> &eventTypes); void setEventTypes(const EventTypes &eventTypes);
bool hasEventType(const EventTypeId &eventTypeId); bool hasEventType(const EventTypeId &eventTypeId);
ActionTypes actionTypes() const; ActionTypes actionTypes() const;
void setActionTypes(const QList<ActionType> &actionTypes); void setActionTypes(const ActionTypes &actionTypes);
bool hasActionType(const ActionTypeId &actionTypeId); bool hasActionType(const ActionTypeId &actionTypeId);
ActionTypes browserActionTypes() const;
void setBrowserActionTypes(const ActionTypes &browserActionTypes);
bool hasBrowserActionType(const ActionTypeId &actionTypeId);
ParamTypes paramTypes() const; ParamTypes paramTypes() const;
void setParamTypes(const ParamTypes &paramTypes); void setParamTypes(const ParamTypes &paramTypes);
@ -118,6 +122,7 @@ private:
StateTypes m_stateTypes; StateTypes m_stateTypes;
EventTypes m_eventTypes; EventTypes m_eventTypes;
ActionTypes m_actionTypes; ActionTypes m_actionTypes;
ActionTypes m_browserActionTypes;
ParamTypes m_paramTypes; ParamTypes m_paramTypes;
ParamTypes m_settingsTypes; ParamTypes m_settingsTypes;
ParamTypes m_discoveryParamTypes; ParamTypes m_discoveryParamTypes;

View File

@ -169,6 +169,12 @@ ActionTypeId RuleAction::actionTypeId() const
return m_actionTypeId; return m_actionTypeId;
} }
/*! Returns the browserItemId of this RuleAction. */
QString RuleAction::browserItemId() const
{
return m_browserItemId;
}
/*! Returns the deviceId of this RuleAction. */ /*! Returns the deviceId of this RuleAction. */
DeviceId RuleAction::deviceId() const DeviceId RuleAction::deviceId() const
{ {

View File

@ -194,6 +194,13 @@
"name": "asyncFailing", "name": "asyncFailing",
"displayName": "Mock Action 5 (async, broken)" "displayName": "Mock Action 5 (async, broken)"
} }
],
"brwserItemActionTypes": [
{
"id": "00b8f0a8-99ca-4aa4-833d-59eb8d4d6de3",
"name": "addToFolder",
"displayName": "Add to Favorites"
}
] ]
}, },
{ {