diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-25 12:09:28 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-25 12:09:28 +0200 |
commit | 45049903a304a6762d5656890213c8ad5a1db3c3 (patch) | |
tree | 11335323e83e268120d69434d14298f6dadf7a2d /src/ui | |
parent | d8b789caf6f5c2ab6ce435f51075a4a4cc83db4b (diff) |
Consolidating media handling
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6b023349..87b8d7ad 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1058,7 +1058,7 @@ static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *r | |||
1058 | else if (d->certFlags & trusted_GmCertFlag) { | 1058 | else if (d->certFlags & trusted_GmCertFlag) { |
1059 | updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_CStr); | 1059 | updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_CStr); |
1060 | } | 1060 | } |
1061 | else { | 1061 | else { |
1062 | updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape "\u26a0" | 1062 | updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape "\u26a0" |
1063 | : black_ColorEscape "\u26a0"); | 1063 | : black_ColorEscape "\u26a0"); |
1064 | } | 1064 | } |
@@ -1755,7 +1755,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1755 | const iRangecc host = urlHost_String(d->mod.url); | 1755 | const iRangecc host = urlHost_String(d->mod.url); |
1756 | if (!isEmpty_Block(d->certFingerprint) && !isEmpty_Range(&host)) { | 1756 | if (!isEmpty_Block(d->certFingerprint) && !isEmpty_Range(&host)) { |
1757 | setTrusted_GmCerts(certs_App(), host, d->certFingerprint, &d->certExpiry); | 1757 | setTrusted_GmCerts(certs_App(), host, d->certFingerprint, &d->certExpiry); |
1758 | d->certFlags |= trusted_GmCertFlag; | 1758 | d->certFlags |= trusted_GmCertFlag; |
1759 | postCommand_App("document.info"); | 1759 | postCommand_App("document.info"); |
1760 | updateTrust_DocumentWidget_(d, NULL); | 1760 | updateTrust_DocumentWidget_(d, NULL); |
1761 | redoLayout_GmDocument(d->doc); | 1761 | redoLayout_GmDocument(d->doc); |
@@ -2667,7 +2667,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2667 | const int linkFlags = linkFlags_GmDocument(d->doc, linkId); | 2667 | const int linkFlags = linkFlags_GmDocument(d->doc, linkId); |
2668 | iAssert(linkId); | 2668 | iAssert(linkId); |
2669 | /* Media links are opened inline by default. */ | 2669 | /* Media links are opened inline by default. */ |
2670 | if (isMediaLink_GmDocument(d->doc, linkId)) { | 2670 | if (isMediaLink_GmDocument(d->doc, linkId)) { |
2671 | if (linkFlags & content_GmLinkFlag && linkFlags & permanent_GmLinkFlag) { | 2671 | if (linkFlags & content_GmLinkFlag && linkFlags & permanent_GmLinkFlag) { |
2672 | /* We have the content and it cannot be dismissed, so nothing | 2672 | /* We have the content and it cannot be dismissed, so nothing |
2673 | further to do. */ | 2673 | further to do. */ |
@@ -3005,15 +3005,16 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3005 | iAssert(imageId || audioId); | 3005 | iAssert(imageId || audioId); |
3006 | if (imageId) { | 3006 | if (imageId) { |
3007 | iAssert(!isEmpty_Rect(run->bounds)); | 3007 | iAssert(!isEmpty_Rect(run->bounds)); |
3008 | iGmImageInfo info; | 3008 | iGmMediaInfo info; |
3009 | imageInfo_Media(constMedia_GmDocument(doc), imageId, &info); | 3009 | imageInfo_Media(constMedia_GmDocument(doc), imageId, &info); |
3010 | const iInt2 imgSize = imageSize_Media(constMedia_GmDocument(doc), imageId); | ||
3010 | format_String(&text, "%s \u2014 %d x %d \u2014 %.1fMB", | 3011 | format_String(&text, "%s \u2014 %d x %d \u2014 %.1fMB", |
3011 | info.mime, info.size.x, info.size.y, info.numBytes / 1.0e6f); | 3012 | info.type, imgSize.x, imgSize.y, info.numBytes / 1.0e6f); |
3012 | } | 3013 | } |
3013 | else if (audioId) { | 3014 | else if (audioId) { |
3014 | iGmAudioInfo info; | 3015 | iGmMediaInfo info; |
3015 | audioInfo_Media(constMedia_GmDocument(doc), audioId, &info); | 3016 | audioInfo_Media(constMedia_GmDocument(doc), audioId, &info); |
3016 | format_String(&text, "%s", info.mime); | 3017 | format_String(&text, "%s", info.type); |
3017 | } | 3018 | } |
3018 | if (findMediaRequest_DocumentWidget_(d->widget, run->linkId)) { | 3019 | if (findMediaRequest_DocumentWidget_(d->widget, run->linkId)) { |
3019 | appendFormat_String( | 3020 | appendFormat_String( |