presentation/ConflictPhotoProvider.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "ConflictPhotoProvider.h" | ||
| 2 | |||
| 3 | #include "ContactPhotoProvider.h" | ||
| 4 | #include "QuickConflictResolver.h" | ||
| 5 | |||
| 6 | #include <QLoggingCategory> | ||
| 7 | #include <QUrl> | ||
| 8 | |||
| 9 | Q_DECLARE_LOGGING_CATEGORY(lcConflict) | ||
| 10 | |||
| 11 | 766 | ConflictPhotoProvider::ConflictPhotoProvider(QuickConflictResolver *resolver) | |
| 12 |
2/2✓ Branch 3 → 4 taken 766 times.
✓ Branch 4 → 5 taken 766 times.
|
766 | : QQuickImageProvider(QQuickImageProvider::Image), m_resolver(resolver) {} |
| 13 | |||
| 14 | 4 | QImage ConflictPhotoProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { | |
| 15 |
1/1✓ Branch 5 → 6 taken 4 times.
|
4 | const QStringList parts = id.split(QLatin1Char('/')); |
| 16 |
5/6✓ Branch 7 → 8 taken 3 times.
✓ Branch 7 → 10 taken 1 time.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 3 times.
✓ Branch 12 → 13 taken 1 time.
✓ Branch 12 → 24 taken 3 times.
|
4 | if (parts.size() != 3 || !m_resolver) { |
| 17 |
5/5✓ Branch 13 → 14 taken 1 time.
✓ Branch 17 → 18 taken 1 time.
✓ Branch 18 → 19 taken 1 time.
✓ Branch 22 → 15 taken 1 time.
✓ Branch 22 → 23 taken 1 time.
|
2 | qCWarning(lcConflict) << "conflict photo: malformed request"; |
| 18 | 1 | return {}; | |
| 19 | } | ||
| 20 |
2/2✓ Branch 25 → 26 taken 3 times.
✓ Branch 26 → 27 taken 3 times.
|
3 | const QString rowId = QUrl::fromPercentEncoding(parts.at(0).toUtf8()); |
| 21 |
1/1✓ Branch 31 → 32 taken 3 times.
|
3 | const int side = qBound(16, qMax(requestedSize.width(), requestedSize.height()), 256); |
| 22 |
2/2✓ Branch 34 → 35 taken 3 times.
✓ Branch 35 → 36 taken 3 times.
|
3 | const QImage image = ContactPhotoProvider::decode(m_resolver->photoBytes(rowId, parts.at(1)), side); |
| 23 |
1/2✓ Branch 37 → 38 taken 3 times.
✗ Branch 37 → 39 not taken.
|
3 | if (size) |
| 24 |
1/1✓ Branch 38 → 39 taken 3 times.
|
3 | *size = image.size(); |
| 25 |
1/1✓ Branch 39 → 40 taken 3 times.
|
3 | return image; |
| 26 | 4 | } | |
| 27 |