Skip to content

Commit c6e2e2b

Browse files
committed
Show style warning if allowed (paceholder#119)
1 parent 0d808ac commit c6e2e2b

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

src/ConnectionStyle.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ setConnectionStyle(QString jsonText)
4545
StyleCollection::setConnectionStyle(style);
4646
}
4747

48+
#ifdef STYLE_DEBUG
49+
#define CONNECTION_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
50+
if (v.type() == QJsonValue::Undefined || \
51+
v.type() == QJsonValue::Null) \
52+
qWarning() << "Undefined value for parameter:" << #variable; \
53+
}
54+
#else
55+
#define CONNECTION_STYLE_CHECK_UNDEFINED_VALUE(v, variable)
56+
#endif
4857

49-
#define CONNECTION_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
50-
if (v.type() == QJsonValue::Undefined || \
51-
v.type() == QJsonValue::Null) \
52-
qWarning() << "Undefined value for parameter:" << #variable; \
53-
}
5458

5559
#define CONNECTION_VALUE_EXISTS(v) \
5660
(v.type() != QJsonValue::Undefined && \

src/FlowViewStyle.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ setStyle(QString jsonText)
4343
}
4444

4545

46-
#define FLOW_VIEW_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
47-
if (v.type() == QJsonValue::Undefined || \
48-
v.type() == QJsonValue::Null) \
49-
qWarning() << "Undefined value for parameter:" << #variable; \
50-
}
46+
#ifdef STYLE_DEBUG
47+
#define FLOW_VIEW_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
48+
if (v.type() == QJsonValue::Undefined || \
49+
v.type() == QJsonValue::Null) \
50+
qWarning() << "Undefined value for parameter:" << #variable; \
51+
}
52+
#else
53+
#define FLOW_VIEW_STYLE_CHECK_UNDEFINED_VALUE(v, variable)
54+
#endif
5155

5256
#define FLOW_VIEW_STYLE_READ_COLOR(values, variable) { \
5357
auto valueRef = values[#variable]; \

src/NodeStyle.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ setNodeStyle(QString jsonText)
4646
}
4747

4848

49-
#define NODE_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
50-
if (v.type() == QJsonValue::Undefined || \
51-
v.type() == QJsonValue::Null) \
52-
qWarning() << "Undefined value for parameter:" << #variable; \
53-
}
49+
#ifdef STYLE_DEBUG
50+
#define NODE_STYLE_CHECK_UNDEFINED_VALUE(v, variable) { \
51+
if (v.type() == QJsonValue::Undefined || \
52+
v.type() == QJsonValue::Null) \
53+
qWarning() << "Undefined value for parameter:" << #variable; \
54+
}
55+
#else
56+
#define NODE_STYLE_CHECK_UNDEFINED_VALUE(v, variable)
57+
#endif
5458

5559
#define NODE_STYLE_READ_COLOR(values, variable) { \
5660
auto valueRef = values[#variable]; \

0 commit comments

Comments
 (0)