mirror of https://github.com/nymea/nymea.git
repurpose "name" property, add displayName* props instead
parent
359bf96b45
commit
880b6e1418
|
|
@ -204,18 +204,30 @@ bool DeviceClass::isValid() const
|
|||
return !m_id.isNull() && !m_vendorId.isNull() && !m_pluginId.isNull();
|
||||
}
|
||||
|
||||
/*! Returns the name of this \l{DeviceClass}. This is visible to the user. */
|
||||
/*! Returns the name of this \l{DeviceClass}. This is used internally. */
|
||||
QString DeviceClass::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/*! Set the \a name of this \l{DeviceClass}. This is visible to the user. */
|
||||
/*! Set the \a name of this \l{DeviceClass}. This is used internally. */
|
||||
void DeviceClass::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*! Returns the displayed name of this \l{DeviceClass}. This is visible to the user. */
|
||||
QString DeviceClass::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
/*! Set the \a displayName of this \l{DeviceClass}. This is visible to the user. */
|
||||
void DeviceClass::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
/*! Returns the critical \l{StateTypeId} of this \l{DeviceClass}.
|
||||
* A critical \l{State} describes the state which disables the whole device (i.e. connected, available or reachable). */
|
||||
StateTypeId DeviceClass::criticalStateTypeId() const
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ public:
|
|||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
StateTypeId criticalStateTypeId() const;
|
||||
void setCriticalStateTypeId(const StateTypeId &criticalStateTypeId);
|
||||
|
||||
|
|
@ -182,6 +185,7 @@ private:
|
|||
VendorId m_vendorId;
|
||||
PluginId m_pluginId;
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
StateTypeId m_criticalStateTypeId;
|
||||
StateTypeId m_primaryStateTypeId;
|
||||
ActionTypeId m_primaryActionTypeId;
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ void DevicePlugin::loadMetaData()
|
|||
|
||||
}
|
||||
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "idName" << "name" << "vendors", m_metaData);
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name" << "displayName" << "vendors", m_metaData);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping plugin because of missing" << missingFields.join(", ") << m_metaData;
|
||||
return;
|
||||
|
|
@ -508,7 +508,7 @@ void DevicePlugin::loadMetaData()
|
|||
foreach (const QJsonValue &vendorJson, m_metaData.value("vendors").toArray()) {
|
||||
bool broken = false;
|
||||
QJsonObject vendorObject = vendorJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "idName" << "name", vendorObject);
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name" << "displayName", vendorObject);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping vendor because of missing" << missingFields.join(", ") << vendorObject;
|
||||
broken = true;
|
||||
|
|
@ -518,7 +518,7 @@ void DevicePlugin::loadMetaData()
|
|||
VendorId vendorId = vendorObject.value("id").toString();
|
||||
foreach (const QJsonValue &deviceClassJson, vendorJson.toObject().value("deviceClasses").toArray()) {
|
||||
QJsonObject deviceClassObject = deviceClassJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "idName" << "name" << "createMethods" << "paramTypes", deviceClassObject);
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name" << "displyName" << "createMethods" << "paramTypes", deviceClassObject);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping DeviceClass because of missing" << missingFields.join(", ") << deviceClassObject;
|
||||
broken = true;
|
||||
|
|
@ -526,7 +526,8 @@ void DevicePlugin::loadMetaData()
|
|||
}
|
||||
|
||||
DeviceClass deviceClass(pluginId(), vendorId, deviceClassObject.value("id").toString());
|
||||
deviceClass.setName(translateValue(m_metaData.value("idName").toString(), deviceClassObject.value("name").toString()));
|
||||
deviceClass.setName(m_metaData.value("name").toString());
|
||||
deviceClass.setDisplayName(translateValue(m_metaData.value("name").toString(), deviceClassObject.value("displayName").toString()));
|
||||
DeviceClass::CreateMethods createMethods;
|
||||
foreach (const QJsonValue &createMethodValue, deviceClassObject.value("createMethods").toArray()) {
|
||||
if (createMethodValue.toString() == "discovery") {
|
||||
|
|
@ -596,7 +597,14 @@ void DevicePlugin::loadMetaData()
|
|||
int index = 0;
|
||||
foreach (const QJsonValue &stateTypesJson, deviceClassObject.value("stateTypes").toArray()) {
|
||||
QJsonObject st = stateTypesJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "type" << "id" << "idName" << "name" << "defaultValue" << "eventTypeName", st);
|
||||
bool writableState = false;
|
||||
QStringList requiredFields;
|
||||
requiredFields << "type" << "id" << "name" << "displayName" << "defaultValue" << "displayNameEvent";
|
||||
if (st.contains("writable") && st.value("writable").toBool()) {
|
||||
writableState = true;
|
||||
requiredFields << "displayNameAction";
|
||||
}
|
||||
QStringList missingFields = verifyFields(requiredFields, st);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping device class" << deviceClass.name() << "because of missing" << missingFields.join(", ") << "in stateType" << st;
|
||||
broken = true;
|
||||
|
|
@ -605,7 +613,8 @@ void DevicePlugin::loadMetaData()
|
|||
|
||||
QVariant::Type t = QVariant::nameToType(st.value("type").toString().toLatin1().data());
|
||||
StateType stateType(st.value("id").toString());
|
||||
stateType.setName(translateValue(m_metaData.value("idName").toString(), st.value("name").toString()));
|
||||
stateType.setName(m_metaData.value("name").toString());
|
||||
stateType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayName").toString()));
|
||||
stateType.setIndex(index++);
|
||||
stateType.setType(t);
|
||||
QPair<bool, Types::Unit> unitVerification = loadAndVerifyUnit(st.value("unit").toString());
|
||||
|
|
@ -653,7 +662,8 @@ void DevicePlugin::loadMetaData()
|
|||
if (st.contains("eventRuleRelevant"))
|
||||
eventType.setRuleRelevant(st.value("eventRuleRelevant").toBool());
|
||||
|
||||
eventType.setName(translateValue(m_metaData.value("idName").toString(), st.value("eventTypeName").toString()));
|
||||
eventType.setName(m_metaData.value("name").toString());
|
||||
eventType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayNameEvent").toString()));
|
||||
ParamType paramType(ParamTypeId(stateType.id().toString()), translateValue(m_metaData.value("idName").toString(), st.value("name").toString()), stateType.type());
|
||||
paramType.setAllowedValues(stateType.possibleValues());
|
||||
paramType.setDefaultValue(stateType.defaultValue());
|
||||
|
|
@ -665,16 +675,10 @@ void DevicePlugin::loadMetaData()
|
|||
eventTypes.append(eventType);
|
||||
|
||||
// ActionTypes for writeable StateTypes
|
||||
if (st.contains("writable") && st.value("writable").toBool()) {
|
||||
// Note: fields already checked in StateType
|
||||
if (!st.contains("actionTypeName")) {
|
||||
qCWarning(dcDeviceManager()) << "Missing field \"actionTypeName\" for writable StateType" << st;
|
||||
broken = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (writableState) {
|
||||
ActionType actionType(ActionTypeId(stateType.id().toString()));
|
||||
actionType.setName(translateValue(m_metaData.value("idName").toString(), st.value("actionTypeName").toString()));
|
||||
actionType.setName(m_metaData.value("name").toString());
|
||||
actionType.setDisplayName(translateValue(m_metaData.value("name").toString(), st.value("displayNameAction").toString()));
|
||||
actionType.setIndex(stateType.index());
|
||||
actionType.setParamTypes(QList<ParamType>() << paramType);
|
||||
actionTypes.append(actionType);
|
||||
|
|
@ -686,7 +690,7 @@ void DevicePlugin::loadMetaData()
|
|||
index = 0;
|
||||
foreach (const QJsonValue &actionTypesJson, deviceClassObject.value("actionTypes").toArray()) {
|
||||
QJsonObject at = actionTypesJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name", at);
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name" << "displayName", at);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping device class" << deviceClass.name() << "because of missing" << missingFields.join(", ") << "in actionTypes";
|
||||
broken = true;
|
||||
|
|
@ -694,7 +698,8 @@ void DevicePlugin::loadMetaData()
|
|||
}
|
||||
|
||||
ActionType actionType(at.value("id").toString());
|
||||
actionType.setName(translateValue(m_metaData.value("idName").toString(), at.value("name").toString()));
|
||||
actionType.setName(m_metaData.value("name").toString());
|
||||
actionType.setDisplayName(translateValue(m_metaData.value("name").toString(), at.value("displayName").toString()));
|
||||
actionType.setIndex(index++);
|
||||
QPair<bool, QList<ParamType> > paramVerification = parseParamTypes(at.value("paramTypes").toArray());
|
||||
if (!paramVerification.first) {
|
||||
|
|
@ -712,7 +717,7 @@ void DevicePlugin::loadMetaData()
|
|||
index = 0;
|
||||
foreach (const QJsonValue &eventTypesJson, deviceClassObject.value("eventTypes").toArray()) {
|
||||
QJsonObject et = eventTypesJson.toObject();
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name", et);
|
||||
QStringList missingFields = verifyFields(QStringList() << "id" << "name" << "displayName", et);
|
||||
if (!missingFields.isEmpty()) {
|
||||
qCWarning(dcDeviceManager) << "Skipping device class" << deviceClass.name() << "because of missing" << missingFields.join(", ") << "in eventTypes";
|
||||
broken = true;
|
||||
|
|
@ -720,7 +725,8 @@ void DevicePlugin::loadMetaData()
|
|||
}
|
||||
|
||||
EventType eventType(et.value("id").toString());
|
||||
eventType.setName(translateValue(m_metaData.value("idName").toString(), translateValue(m_metaData.value("idName").toString(), et.value("name").toString())));
|
||||
eventType.setName(m_metaData.value("name").toString());
|
||||
eventType.setDisplayName(translateValue(m_metaData.value("name").toString(), translateValue(m_metaData.value("displayName").toString(), et.value("name").toString())));
|
||||
eventType.setIndex(index++);
|
||||
if (et.contains("ruleRelevant"))
|
||||
eventType.setRuleRelevant(et.value("ruleRelevant").toBool());
|
||||
|
|
|
|||
|
|
@ -59,12 +59,24 @@ QString ActionType::name() const
|
|||
return m_name;
|
||||
}
|
||||
|
||||
/*! Set the \a name for this \l{ActionType}. This will be visible to the user. */
|
||||
/*! Set the \a name for this \l{ActionType}. */
|
||||
void ActionType::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*! Returns the display name of this \l{ActionType}. */
|
||||
QString ActionType::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
/*! Set the \a displayName for this \l{ActionType}. This will be visible to the user. */
|
||||
void ActionType::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
/*! Returns the index of this \l{ActionType}. The index of an \l{ActionType} indicates the order in the \l{DeviceClass}.
|
||||
* This guarantees that a \l{Device} will look always the same (\l{Action} order). */
|
||||
int ActionType::index() const
|
||||
|
|
|
|||
|
|
@ -40,6 +40,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);
|
||||
|
||||
|
|
@ -49,6 +52,7 @@ public:
|
|||
private:
|
||||
ActionTypeId m_id;
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
int m_index;
|
||||
ParamTypes m_paramTypes;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,18 +49,30 @@ EventTypeId EventType::id() const
|
|||
return m_id;
|
||||
}
|
||||
|
||||
/*! Returns the name of this EventType, e.g. "Temperature changed". */
|
||||
/*! Returns the name of this EventType. */
|
||||
QString EventType::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/*! Set the name for this EventType to \a name, e.g. "Temperature changed". */
|
||||
/*! Set the name for this EventType to \a name. */
|
||||
void EventType::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*! Returns the displayName of this EventType, e.g. "Temperature changed". */
|
||||
QString EventType::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
/*! Set the displayName for this EventType to \a name, e.g. "Temperature changed". */
|
||||
void EventType::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
/*! Returns the index of this \l{EventType}. The index of an \l{EventType} indicates the order in the \l{DeviceClass}.
|
||||
* This guarantees that a \l{Device} will look always the same (\l{Event} order). */
|
||||
int EventType::index() const
|
||||
|
|
|
|||
|
|
@ -40,6 +40,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);
|
||||
|
||||
|
|
@ -56,6 +59,7 @@ public:
|
|||
private:
|
||||
EventTypeId m_id;
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
int m_index;
|
||||
QList<ParamType> m_paramTypes;
|
||||
bool m_ruleRelevant;
|
||||
|
|
|
|||
|
|
@ -49,18 +49,30 @@ StateTypeId StateType::id() const
|
|||
return m_id;
|
||||
}
|
||||
|
||||
/*! Returns the name of the StateType. This is visible to the user (e.g. "Temperature"). */
|
||||
/*! Returns the name of the StateType. This is used internally, e.g. to match interfaces. */
|
||||
QString StateType::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/*! Set the name of the StateType to \a name. This is visible to the user (e.g. "Temperature"). */
|
||||
/*! Set the name of the StateType to \a name. This is used internally, e.g. to match interfaces. */
|
||||
void StateType::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
/*! Returns the displayName of the StateType. This is visible to the user (e.g. "Color temperature"). */
|
||||
QString StateType::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
/*! Set the displayName of the StateType to \a name. This is visible to the user (e.g. "Color temperature"). */
|
||||
void StateType::setDisplayName(const QString &displayName)
|
||||
{
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
/*! Returns the index of this \l{StateType}. The index of an \l{StateType} indicates the order in the \l{DeviceClass}.
|
||||
* This guarantees that a \l{Device} will look always the same (\l{State} order). */
|
||||
int StateType::index() const
|
||||
|
|
|
|||
|
|
@ -40,6 +40,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);
|
||||
|
||||
|
|
@ -73,6 +76,7 @@ public:
|
|||
private:
|
||||
StateTypeId m_id;
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
int m_index = 0;
|
||||
QVariant::Type m_type;
|
||||
QVariant m_defaultValue;
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ def extractPlugin(pluginMap):
|
|||
def extractParamTypes(paramTypes, contextName):
|
||||
for paramType in paramTypes:
|
||||
try:
|
||||
variableName = '%sParamTypeId' % (paramType['idName'])
|
||||
variableName = '%sParamTypeId' % (paramType['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
printInfo('Define ParamTypeId %s = %s' % (variableName, paramType['id']))
|
||||
if args.filetype is 'i':
|
||||
writeToFile('ParamTypeId %s = ParamTypeId(\"%s\");' % (variableName, paramType['id']))
|
||||
addTranslationString(paramType['name'], 'The name of the paramType (%s) of %s' % (paramType['id'], contextName))
|
||||
addTranslationString(paramType['displayName'], 'The name of the paramType (%s) of %s' % (paramType['id'], contextName))
|
||||
createExternDefinition('ParamTypeId', variableName)
|
||||
else:
|
||||
printWarning('Duplicated variable name \"%s\" for ParamTypeId %s -> skipping' % (variableName, paramType['id']))
|
||||
|
|
@ -95,13 +95,13 @@ def extractParamTypes(paramTypes, contextName):
|
|||
def extractVendors(vendors):
|
||||
for vendor in vendors:
|
||||
try:
|
||||
variableName = '%sVendorId' % (vendor['idName'])
|
||||
variableName = '%sVendorId' % (vendor['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
printInfo('Define VendorId %s = %s' % (variableName, vendor['id']))
|
||||
if args.filetype is 'i':
|
||||
writeToFile('VendorId %s = VendorId(\"%s\");' % (variableName, vendor['id']))
|
||||
addTranslationString(vendor['name'], 'The name of the vendor (%s)' % vendor['id'])
|
||||
addTranslationString(vendor['displayName'], 'The name of the vendor (%s)' % vendor['id'])
|
||||
createExternDefinition('VendorId', variableName)
|
||||
else:
|
||||
printWarning('Duplicated variable name \"%s\" for VendorId %s -> skipping' % (variableName, param['id']))
|
||||
|
|
@ -116,7 +116,7 @@ def extractVendors(vendors):
|
|||
def extractDeviceClasses(deviceClasses):
|
||||
for deviceClass in deviceClasses:
|
||||
try:
|
||||
variableName = '%sDeviceClassId' % (deviceClass['idName'])
|
||||
variableName = '%sDeviceClassId' % (deviceClass['name'])
|
||||
|
||||
if 'pairingInfo' in deviceClass:
|
||||
addTranslationString(deviceClass['pairingInfo'], 'The pairing info of deviceClass %s' % deviceClass['name'])
|
||||
|
|
@ -126,7 +126,7 @@ def extractDeviceClasses(deviceClasses):
|
|||
printInfo('Define DeviceClassId %s = %s' % (variableName, deviceClass['id']))
|
||||
if args.filetype is 'i':
|
||||
writeToFile('DeviceClassId %s = DeviceClassId(\"%s\");' % (variableName, deviceClass['id']))
|
||||
addTranslationString(deviceClass['name'], 'The name of the DeviceClass (%s)' %(deviceClass['id']))
|
||||
addTranslationString(deviceClass['displayName'], 'The name of the DeviceClass (%s)' %(deviceClass['id']))
|
||||
createExternDefinition('DeviceClassId', variableName)
|
||||
else:
|
||||
printWarning('Duplicated variable name \"%s\" for DeviceClassId %s -> skipping' % (variableName, deviceClass['deviceClassId']))
|
||||
|
|
@ -155,7 +155,7 @@ def extractStateTypes(stateTypes, deviceClassName):
|
|||
for stateType in stateTypes:
|
||||
try:
|
||||
# Define StateType
|
||||
variableName = '%sStateTypeId' % (stateType['idName'])
|
||||
variableName = '%sStateTypeId' % (stateType['name'])
|
||||
#addTranslationString(stateType['name'], 'The name of the stateType (%s) of DeviceClass %s' % (stateType['id'], deviceClassName))
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
|
|
@ -167,9 +167,9 @@ def extractStateTypes(stateTypes, deviceClassName):
|
|||
printWarning('Duplicated variable name \"%s\" for StateTypeId %s -> skipping' % (variableName, stateType['id']))
|
||||
|
||||
# Create EventTypeId for this state
|
||||
variableName = '%sEventTypeId' % (stateType['idName'])
|
||||
variableName = '%sEventTypeId' % (stateType['name'])
|
||||
if not variableName in variableNames:
|
||||
addTranslationString(stateType['eventTypeName'], 'The name of the autocreated EventType (%s)' % stateType['id'])
|
||||
addTranslationString(stateType['displayNameEvent'], 'The name of the autocreated EventType (%s)' % stateType['id'])
|
||||
variableNames.append(variableName)
|
||||
printInfo('Define EventTypeId %s = %s' % (variableName, stateType['id']))
|
||||
if args.filetype is 'i':
|
||||
|
|
@ -179,7 +179,7 @@ def extractStateTypes(stateTypes, deviceClassName):
|
|||
printWarning('Duplicated variable name \"%s\" for autocreated EventTypeId %s -> skipping' % (variableName, stateType['id']))
|
||||
|
||||
#ParamType for EventType/ActionType
|
||||
variableName = '%sStateParamTypeId' % (stateType['idName'])
|
||||
variableName = '%sStateParamTypeId' % (stateType['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
printInfo('Define ParamTypeId %s for StateType %s = %s' % (variableName, variableName, stateType['id']))
|
||||
|
|
@ -192,11 +192,11 @@ def extractStateTypes(stateTypes, deviceClassName):
|
|||
|
||||
# Create ActionTypeId if the state is writable
|
||||
if 'writable' in stateType and stateType['writable']:
|
||||
variableName = '%sActionTypeId' % (stateType['idName'])
|
||||
variableName = '%sActionTypeId' % (stateType['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
printInfo('Define ActionTypeId for writable StateType %s = %s' % (variableName, stateType['id']))
|
||||
addTranslationString(stateType['actionTypeName'], 'The name of the autocreated ActionType (%s)' % stateType['id'])
|
||||
addTranslationString(stateType['displayNameAction'], 'The name of the autocreated ActionType (%s)' % stateType['id'])
|
||||
if args.filetype is 'i':
|
||||
writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, stateType['id']))
|
||||
createExternDefinition('ActionTypeId', variableName)
|
||||
|
|
@ -212,10 +212,10 @@ def extractActionTypes(actionTypes, deviceClassName):
|
|||
for actionType in actionTypes:
|
||||
try:
|
||||
# Define ActionTypeId
|
||||
variableName = '%sActionTypeId' % (actionType['idName'])
|
||||
variableName = '%sActionTypeId' % (actionType['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
addTranslationString(actionType['name'], 'The name of the ActionType %s of deviceClass %s' % (actionType['id'], deviceClassName))
|
||||
addTranslationString(actionType['displayName'], 'The name of the ActionType %s of deviceClass %s' % (actionType['id'], deviceClassName))
|
||||
if args.filetype is 'i':
|
||||
writeToFile('ActionTypeId %s = ActionTypeId(\"%s\");' % (variableName, actionType['id']))
|
||||
createExternDefinition('ActionTypeId', variableName)
|
||||
|
|
@ -235,10 +235,10 @@ def extractEventTypes(eventTypes, deviceClassName):
|
|||
for eventType in eventTypes:
|
||||
try:
|
||||
# Define EventTypeId
|
||||
variableName = '%sEventTypeId' % (eventType['idName'])
|
||||
variableName = '%sEventTypeId' % (eventType['name'])
|
||||
if not variableName in variableNames:
|
||||
variableNames.append(variableName)
|
||||
addTranslationString(eventType['name'], 'The name of the EventType %s of deviceClass %s' % (eventType['id'], deviceClassName))
|
||||
addTranslationString(eventType['displayName'], 'The name of the EventType %s of deviceClass %s' % (eventType['id'], deviceClassName))
|
||||
if args.filetype is 'i':
|
||||
writeToFile('EventTypeId %s = EventTypeId(\"%s\");' % (variableName, eventType['id']))
|
||||
createExternDefinition('EventTypeId', variableName)
|
||||
|
|
@ -274,9 +274,9 @@ def writeTranslationStrings():
|
|||
for index, value in enumerate(translationStrings):
|
||||
writeToFile(' //: %s' % value[1])
|
||||
if index != len(translationStrings) - 1:
|
||||
writeToFile(' QT_TRANSLATE_NOOP(\"%s\", \"%s\"), \n' % (pluginMap['idName'], value[0]))
|
||||
writeToFile(' QT_TRANSLATE_NOOP(\"%s\", \"%s\"), \n' % (pluginMap['name'], value[0]))
|
||||
else:
|
||||
writeToFile(' QT_TRANSLATE_NOOP(\"%s\", \"%s\")' % (pluginMap['idName'], value[0]))
|
||||
writeToFile(' QT_TRANSLATE_NOOP(\"%s\", \"%s\")' % (pluginMap['name'], value[0]))
|
||||
|
||||
writeToFile('};')
|
||||
|
||||
|
|
@ -319,10 +319,10 @@ def writePluginInfoFile():
|
|||
writeToFile('')
|
||||
writeToFile('// Logging category')
|
||||
|
||||
if 'idName' in pluginMap:
|
||||
writeToFile('Q_DECLARE_LOGGING_CATEGORY(dc%s)' % pluginMap['idName'])
|
||||
writeToFile('Q_LOGGING_CATEGORY(dc%s, \"%s\")' % (pluginMap['idName'], pluginMap['idName']))
|
||||
printInfo('Define logging category: \'dc%s\'' % pluginMap['idName'])
|
||||
if 'name' in pluginMap:
|
||||
writeToFile('Q_DECLARE_LOGGING_CATEGORY(dc%s)' % pluginMap['name'])
|
||||
writeToFile('Q_LOGGING_CATEGORY(dc%s, \"%s\")' % (pluginMap['name'], pluginMap['name']))
|
||||
printInfo('Define logging category: \'dc%s\'' % pluginMap['name'])
|
||||
|
||||
writeToFile('')
|
||||
|
||||
|
|
@ -342,8 +342,7 @@ def writeExternPluginInfoFile():
|
|||
writeToFile('/* This file is generated by the guh build system. Any changes to this file will')
|
||||
writeToFile(' * be lost.')
|
||||
writeToFile(' *')
|
||||
writeToFile(' * If you want to change this file, edit the plugin\'s json file and add')
|
||||
writeToFile(' * idName tags where appropriate.')
|
||||
writeToFile(' * If you want to change this file, edit the plugin\'s json file.')
|
||||
writeToFile(' */')
|
||||
writeToFile('')
|
||||
writeToFile('#ifndef EXTERNPLUGININFO_H')
|
||||
|
|
@ -359,8 +358,8 @@ def writeExternPluginInfoFile():
|
|||
writeToFile('')
|
||||
writeToFile('// Logging category definition')
|
||||
|
||||
if 'idName' in pluginMap:
|
||||
writeToFile('Q_DECLARE_LOGGING_CATEGORY(dc%s)' % pluginMap['idName'])
|
||||
if 'name' in pluginMap:
|
||||
writeToFile('Q_DECLARE_LOGGING_CATEGORY(dc%s)' % pluginMap['name'])
|
||||
|
||||
writeToFile('')
|
||||
writeToFile('#endif // EXTERNPLUGININFO_H')
|
||||
|
|
|
|||
Loading…
Reference in New Issue