Changeset View
Changeset View
Standalone View
Standalone View
client.cpp
Show First 20 Lines • Show All 1457 Lines • ▼ Show 20 Line(s) | 1453 | { | |||
---|---|---|---|---|---|
1458 | } | 1458 | } | ||
1459 | } | 1459 | } | ||
1460 | 1460 | | |||
1461 | // The list is taken from https://www.unicode.org/reports/tr9/ (#154840) | 1461 | // The list is taken from https://www.unicode.org/reports/tr9/ (#154840) | ||
1462 | static const QChar LRM(0x200E); | 1462 | static const QChar LRM(0x200E); | ||
1463 | 1463 | | |||
1464 | void Client::setCaption(const QString& _s, bool force) | 1464 | void Client::setCaption(const QString& _s, bool force) | ||
1465 | { | 1465 | { | ||
1466 | if (!force && _s == cap_normal) | | |||
1467 | return; | | |||
1468 | QString s(_s); | 1466 | QString s(_s); | ||
1469 | for (int i = 0; i < s.length(); ++i) | 1467 | for (int i = 0; i < s.length(); ) { | ||
1470 | if (!s[i].isPrint()) | 1468 | if (!s[i].isPrint()) { | ||
1471 | s[i] = QChar(u' '); | 1469 | if (QChar(s[i]).isHighSurrogate() && i + 1 < s.length() && QChar(s[i + 1]).isLowSurrogate()) { | ||
1470 | const uint uc = QChar::surrogateToUcs4(s[i], s[i + 1]); | ||||
1471 | if (!QChar::isPrint(uc)) { | ||||
1472 | s.remove(i, 2); | ||||
1473 | } else { | ||||
1474 | i += 2; | ||||
1475 | } | ||||
1476 | continue; | ||||
1477 | } | ||||
1478 | s.remove(i, 1); | ||||
1479 | continue; | ||||
1480 | } | ||||
1481 | ++i; | ||||
1482 | } | ||||
1472 | const bool changed = (s != cap_normal); | 1483 | const bool changed = (s != cap_normal); | ||
1484 | if (!force && !changed) | ||||
1485 | return; | ||||
zzag: Missing braces. | |||||
1473 | cap_normal = s; | 1486 | cap_normal = s; | ||
1474 | if (!force && !changed) { | 1487 | if (!force && !changed) { | ||
1475 | emit captionChanged(); | 1488 | emit captionChanged(); | ||
1476 | return; | 1489 | return; | ||
1477 | } | 1490 | } | ||
1478 | 1491 | | |||
1479 | bool reset_name = force; | 1492 | bool reset_name = force; | ||
1480 | bool was_suffix = (!cap_suffix.isEmpty()); | 1493 | bool was_suffix = (!cap_suffix.isEmpty()); | ||
▲ Show 20 Lines • Show All 630 Lines • Show Last 20 Lines |
Missing braces.