67 |
67 |
68 int code = 0, alpha = 255; |
68 int code = 0, alpha = 255; |
69 QString name, facename, edgename, valuestr; |
69 QString name, facename, edgename, valuestr; |
70 |
70 |
71 // Check 0 !COLOUR, parse the name |
71 // Check 0 !COLOUR, parse the name |
72 if (not pars.tokenCompare (0, "0") || |
72 if (not pars.tokenCompare (0, "0") or |
73 not pars.tokenCompare (1, "!COLOUR") || |
73 not pars.tokenCompare (1, "!COLOUR") or |
74 not pars.getToken (name, 2)) |
74 not pars.getToken (name, 2)) |
75 { |
75 { |
76 continue; |
76 continue; |
77 } |
77 } |
78 |
78 |
85 |
85 |
86 // Ensure that the code is within [0 - 511] |
86 // Ensure that the code is within [0 - 511] |
87 bool ok; |
87 bool ok; |
88 code = valuestr.toShort (&ok); |
88 code = valuestr.toShort (&ok); |
89 |
89 |
90 if (not ok || code < 0 || code >= 512) |
90 if (not ok or code < 0 or code >= 512) |
91 continue; |
91 continue; |
92 |
92 |
93 // VALUE and EDGE tags |
93 // VALUE and EDGE tags |
94 if (not parseLDConfigTag (pars, "VALUE", facename) || not parseLDConfigTag (pars, "EDGE", edgename)) |
94 if (not parseLDConfigTag (pars, "VALUE", facename) or not parseLDConfigTag (pars, "EDGE", edgename)) |
95 continue; |
95 continue; |
96 |
96 |
97 // Ensure that our colors are correct |
97 // Ensure that our colors are correct |
98 QColor faceColor (facename), |
98 QColor faceColor (facename), |
99 edgeColor (edgename); |
99 edgeColor (edgename); |
100 |
100 |
101 if (not faceColor.isValid() || not edgeColor.isValid()) |
101 if (not faceColor.isValid() or not edgeColor.isValid()) |
102 continue; |
102 continue; |
103 |
103 |
104 // Parse alpha if given. |
104 // Parse alpha if given. |
105 if (parseLDConfigTag (pars, "ALPHA", valuestr)) |
105 if (parseLDConfigTag (pars, "ALPHA", valuestr)) |
106 alpha = clamp (valuestr.toInt(), 0, 255); |
106 alpha = clamp (valuestr.toInt(), 0, 255); |