Skip to content

Commit

Permalink
chore: update to iced latest
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Jul 3, 2023
1 parent b7185f2 commit 82b3cf9
Show file tree
Hide file tree
Showing 20 changed files with 2,198 additions and 1,518 deletions.
3,174 changes: 1,934 additions & 1,240 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,37 @@ cli = ["structopt"]
debug = ["iced/debug"]

[dependencies]
iced = { version = "0.4.2", features = ["wgpu", "default_system_font", "palette", "svg", "image", "tokio"] }
iced_native = "0.5.0"
iced_style = "0.4.0"
palette = { version = "0.5.0", features = ["serializing"] }
iced = { version = "0.8.0", features = ["wgpu", "default_system_font", "palette", "svg", "image", "tokio"] }
iced_core = "0.8.1"
iced_native = "0.9.1"
iced_style = "0.7.0"
tokio = { version = "1.18.2", features = ["process", "macros", "io-util"] }
sled = "0.34.7"

pop-launcher-toolkit = { git = "https://github.com/pop-os/launcher/" }
structopt = { version = "^0", default-features = false, optional = true }
freedesktop-icons = "0.2.0"
freedesktop-icons = "0.2.3"

log = { version = "0.4.11" }
env_logger = { version = "0.8.1" }
env_logger = { version = "0.10.0" }
once_cell = "1.10.0"
anyhow = "1.0.34"
dirs = "4.0"
dirs = "5.0.0"
thiserror = "1.0.31"

serde = { version = "^1", features = ["derive"] }
serde_ini = "0.2.0"
serde_json = "1.0.59"
serde_with = "1.13.0"
ron = "0.6.5"
pest = "2.1.3"
pest_derive = "2.1.0"
font-kit = "0.10.1"
ico = "0.1.0"
ico = "0.3.0"
regex = "1.5.5"
shell-words = "^1"

[dev-dependencies]
criterion = "0.3"
speculoos = "0.9.0"
criterion = "0.4.0"
speculoos = "0.11.0"
pretty_assertions = "1.2.1"

[[bench]]
Expand Down
2 changes: 1 addition & 1 deletion src/app/entries/db_entry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use iced::Row;
use iced::widget::Row;
use std::borrow::Cow;
use std::path::PathBuf;

Expand Down
46 changes: 26 additions & 20 deletions src/app/entries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use crate::app::style::rows::RowStyles;
use crate::app::Message;
use crate::icons::{fallback_icon, Extension, IconPath};
use crate::THEME;
use iced::{Container, Image, Length, Row, Text};
use iced_native::widget::Column;
use iced_native::Alignment;
use iced::widget::Row;
use iced::widget::{Container, Image};
use iced::{Alignment, Length, Renderer};
use iced_native::row;
use iced_native::widget::{column, container, text};
use std::borrow::Cow;

pub(crate) mod db_entry;
Expand Down Expand Up @@ -43,37 +45,40 @@ pub(crate) trait AsEntry<'a> {
where
'b: 'a,
{
let title_row = Container::new(
Row::new().push(Text::new(self.get_display_name()).size(theme.title.font_size)),
let title_row: iced_native::widget::Container<'_, Message, Renderer> = container(
iced_native::widget::row(vec![text(self.get_display_name())
.size(theme.title.font_size)
.into()]),
)
.style(&theme.title)
// .style(&theme.title)
.padding(theme.title.padding.to_iced_padding())
.width(theme.title.width)
.height(theme.title.height)
.align_x(theme.title.align_x)
.align_y(theme.title.align_y);

let description_row = self.get_description().map(|description| {
Container::new(
Row::new().push(Text::new(description.as_ref()).size(theme.description.font_size)),
)
.style(&theme.description)
let description_row: std::option::Option<
iced_native::widget::Container<'_, Message, Renderer>,
> = self.get_description().map(|description| {
container(row!(
text(description.as_ref()).size(theme.description.font_size)
))
.padding(theme.description.padding.to_iced_padding())
.width(theme.description.width)
.height(theme.description.height)
.align_x(theme.description.align_x)
.align_y(theme.description.align_y)
});

let column = Column::new().push(title_row);
let column = column(vec![title_row.into()]);

let column = match description_row {
Some(description) if !theme.hide_description => column.push(description),
_ => column,
};

Container::new(row.push(column))
.style(theme)
// .style(theme.into())
.padding(theme.padding.to_iced_padding())
.width(theme.width)
.height(theme.height)
Expand Down Expand Up @@ -122,23 +127,24 @@ pub(crate) trait AsEntry<'a> {
Extension::Svg => Container::new(
icon.as_ref()
.to_svg(&theme.color)
.height(Length::Units(theme.icon_size))
.width(Length::Units(theme.icon_size)),
.height(iced_core::Length::Fixed(theme.icon_size as f32))
.width(iced_core::Length::Fixed(theme.icon_size as f32)),
),
Extension::Png => Container::new(
Image::new(&icon.as_ref().path)
.height(Length::Units(theme.icon_size))
.width(Length::Units(theme.icon_size)),
.height(Length::Fixed(theme.icon_size as f32))
.width(Length::Fixed(theme.icon_size as f32)),
),
},
None => Container::new(
fallback_icon(&theme.color)
.height(Length::Units(theme.icon_size))
.width(Length::Units(theme.icon_size)),
.height(Length::Fixed(theme.icon_size as f32))
.width(Length::Fixed(theme.icon_size as f32)),
),
};

icon.style(theme)
icon
//.style(theme)
.align_y(theme.align_y)
.align_x(theme.align_x)
.width(theme.width)
Expand Down
Loading

0 comments on commit 82b3cf9

Please sign in to comment.