Code style.

This commit is contained in:
Roman Telezhynskyi 2021-11-17 16:19:00 +02:00
parent 888dccc2f3
commit a915ef5a0d
2 changed files with 12 additions and 16 deletions

View File

@ -749,14 +749,14 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
*/ */
void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse) void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
{ {
QStringList tags = QStringList() << TagCalculation << TagModeling << TagDetails << TagGroups; QStringList tags{TagCalculation, TagModeling, TagDetails, TagGroups};
QDomNode domNode = node.firstChild(); QDomNode domNode = node.firstChild();
while (domNode.isNull() == false) while (not domNode.isNull())
{ {
if (domNode.isElement()) if (domNode.isElement())
{ {
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (not domElement.isNull())
{ {
switch (tags.indexOf(domElement.tagName())) switch (tags.indexOf(domElement.tagName()))
{ {
@ -778,8 +778,7 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
ParseGroups(domElement); ParseGroups(domElement);
break; break;
default: default:
VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName())); throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
throw e;
} }
} }
} }

View File

@ -416,12 +416,12 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
QMap<quint32, bool> itemVisibility; QMap<quint32, bool> itemVisibility;
QDomNode domNode = domElement.firstChild(); QDomNode domNode = domElement.firstChild();
while (domNode.isNull() == false) while (not domNode.isNull())
{ {
if (domNode.isElement()) if (domNode.isElement())
{ {
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (not domElement.isNull())
{ {
if (domElement.tagName() == TagGroup) if (domElement.tagName() == TagGroup)
{ {
@ -2257,8 +2257,8 @@ bool VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32
const QDomElement item = itemNode.toElement(); const QDomElement item = itemNode.toElement();
if (item.isNull() == false) if (item.isNull() == false)
{ {
quint32 toolIdIterate= GetParametrUInt(item, AttrTool, QChar('0')); quint32 toolIdIterate = GetParametrUInt(item, AttrTool, QChar('0'));
quint32 objectIdIterate= GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); quint32 objectIdIterate = GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));
if(toolIdIterate == toolId && objectIdIterate == objectId) if(toolIdIterate == toolId && objectIdIterate == objectId)
{ {
@ -2351,7 +2351,7 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q
{ {
QDomElement group = elementById(groupId, TagGroup); QDomElement group = elementById(groupId, TagGroup);
if (group.isNull() == false) if (not group.isNull())
{ {
if(objectId == 0) if(objectId == 0)
{ {
@ -2380,11 +2380,8 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q
return item; return item;
} }
else
{
qDebug() << "The group of id " << groupId << " doesn't exist";
}
qDebug() << "The group of id " << groupId << " doesn't exist";
return QDomElement(); return QDomElement();
} }
@ -2400,7 +2397,7 @@ QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 object
{ {
QDomElement group = elementById(groupId, TagGroup); QDomElement group = elementById(groupId, TagGroup);
if (group.isNull() == false) if (not group.isNull())
{ {
if(objectId == 0) if(objectId == 0)
{ {
@ -2413,7 +2410,7 @@ QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 object
if (itemNode.isElement()) if (itemNode.isElement())
{ {
const QDomElement item = itemNode.toElement(); const QDomElement item = itemNode.toElement();
if (item.isNull() == false) if (not item.isNull())
{ {
quint32 toolIdIterate= GetParametrUInt(item, AttrTool, QChar('0')); quint32 toolIdIterate= GetParametrUInt(item, AttrTool, QChar('0'));
quint32 objectIdIterate= GetParametrUInt(item, AttrObject, QString::number(toolIdIterate)); quint32 objectIdIterate= GetParametrUInt(item, AttrObject, QString::number(toolIdIterate));