Rework loading images from files (#7088)
This PR is a follow-up to #7084, where I noted that I wasn't satisfied with using `SharedUri` to represent both URIs and paths on the local filesystem: > I'm still not entirely happy with this naming, as the file paths that we can store in here are not _really_ URIs, as they are lacking a protocol. > > I want to explore changing `SharedUri` / `SharedUrl` back to alway storing a URL and treat local filepaths differently, as it seems we're conflating two different concerns under the same umbrella, at the moment. `SharedUri` has now been reverted to just containing a `SharedString` with a URI. `ImageSource` now has a new `File` variant that is used to load an image from a `PathBuf`. Release Notes: - N/A
This commit is contained in:
parent
6d4fe8098b
commit
2980f0508c
12 changed files with 163 additions and 166 deletions
|
@ -1,4 +1,4 @@
|
|||
use gpui::{div, img, px, IntoElement, ParentElement, Render, SharedUri, Styled, ViewContext};
|
||||
use gpui::{div, img, px, IntoElement, ParentElement, Render, Styled, ViewContext};
|
||||
use story::Story;
|
||||
|
||||
use crate::{ActiveTheme, PlayerColors};
|
||||
|
@ -53,12 +53,10 @@ impl Render for PlayerStory {
|
|||
.border_2()
|
||||
.border_color(player.cursor)
|
||||
.child(
|
||||
img(SharedUri::network(
|
||||
"https://avatars.githubusercontent.com/u/1714999?v=4",
|
||||
))
|
||||
.rounded_full()
|
||||
.size_6()
|
||||
.bg(gpui::red()),
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size_6()
|
||||
.bg(gpui::red()),
|
||||
)
|
||||
}),
|
||||
))
|
||||
|
@ -84,12 +82,10 @@ impl Render for PlayerStory {
|
|||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img(SharedUri::network(
|
||||
"https://avatars.githubusercontent.com/u/1714999?v=4",
|
||||
))
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
@ -102,12 +98,10 @@ impl Render for PlayerStory {
|
|||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img(SharedUri::network(
|
||||
"https://avatars.githubusercontent.com/u/1714999?v=4",
|
||||
))
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
@ -120,12 +114,10 @@ impl Render for PlayerStory {
|
|||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img(SharedUri::network(
|
||||
"https://avatars.githubusercontent.com/u/1714999?v=4",
|
||||
))
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue