Skip to content

Commit

Permalink
feat(composer): focus picker (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr authored Sep 8, 2024
1 parent 76a65d3 commit ed3f9f9
Show file tree
Hide file tree
Showing 10 changed files with 581 additions and 140 deletions.
1 change: 1 addition & 0 deletions data/gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<file preprocess="xml-stripblanks">icons/scalable/actions/tuba-radio-checked-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tuba-mail-unread-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tuba-starred-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tuba-camera-focus-symbolic.svg</file>
<!-- <file preprocess="xml-stripblanks">icons/scalable/actions/tuba-language-symbolic.svg</file> -->

<file>gtk/help-overlay.ui</file>
Expand Down
2 changes: 2 additions & 0 deletions data/icons/scalable/actions/tuba-camera-focus-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -724,3 +724,13 @@ popover.mini-profile > contents {
.report-status:hover .attachment-picture {
filter: none;
}

.focuspickerdialog .last-row {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}

.focuspickerdialog .focus-picker {
border-radius: 9999px;
padding: 4px;
}
9 changes: 9 additions & 0 deletions src/API/Attachment.vala
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
public class Tuba.API.Attachment : Entity, Widgetizable {
public class Meta : Entity {
public class Focus : Entity {
public float x { get; set; }
public float y { get; set; }
}

public Focus? focus { get; set; }
}

public string id { get; set; }
public string kind { get; set; default = "unknown"; }
public string url { get; set; }
public string? description { get; set; }
public Meta? meta { get; set; }
public string? blurhash { get; set; default=null; }
private string? t_preview_url { get; set; }
public string? preview_url {
Expand Down
11 changes: 9 additions & 2 deletions src/Dialogs/Composer/AttachmentsPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,17 @@ public class Tuba.AttachmentsPage : ComposerPage {

for (var i = 0; i < attachments.get_n_items (); i++) {
var attachment = attachments.get_item (i) as API.Attachment;
var attachment_page_attachment_alt = ((AttachmentsPageAttachment) list.get_row_at_index (i).child).alt_text;
var page_attachment = ((AttachmentsPageAttachment) list.get_row_at_index (i).child);
var attachment_page_attachment_alt = page_attachment.alt_text;

attachment.description = attachment_page_attachment_alt;
status.add_media (attachment.id, attachment.description);

string? focus = null;
if (attachment.meta != null && attachment.meta.focus != null) {
focus = "%.2f,%.2f".printf (page_attachment.pos_x, page_attachment.pos_y);
}

status.add_media (attachment.id, attachment.description, focus);
status.media_attachments.add (attachment);
}
status.sensitive = media_sensitive;
Expand Down
Loading

0 comments on commit ed3f9f9

Please sign in to comment.