Skip to content

Commit e6922dd

Browse files
committed
feat: icons, improved team picker, etc
1 parent 1ee726e commit e6922dd

14 files changed

Lines changed: 436 additions & 399 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
use iced::widget::{Row, Text};
2+
use iced::{Alignment::Center, Font, Length::Fixed, font};
3+
use iced::{Color, Element};
4+
5+
use super::THEME_ICON_SIZE;
6+
7+
pub(crate) fn load_fonts() -> Vec<std::borrow::Cow<'static, [u8]>> {
8+
vec![include_bytes!("./plume_icons.ttf").as_slice().into()]
9+
}
10+
11+
pub(crate) const GEAR: &str = "\u{e800}";
12+
pub(crate) const CHEVRON_BACK: &str = "\u{e801}";
13+
pub(crate) const DOWNLOAD: &str = "\u{e802}";
14+
pub(crate) const STAR: &str = "\u{e803}";
15+
pub(crate) const WRENCH: &str = "\u{e804}";
16+
pub(crate) const PLUS: &str = "\u{e805}";
17+
pub(crate) const MINUS: &str = "\u{e806}";
18+
pub(crate) const SHARE: &str = "\u{e807}";
19+
pub(crate) const FILE: &str = "\u{f15b}";
20+
21+
pub(crate) fn icon_text<M: 'static>(
22+
icon: &'static str,
23+
label: &'static str,
24+
color: Option<Color>,
25+
) -> Element<'static, M> {
26+
let icon_font = Font {
27+
family: iced::font::Family::Name("plume_icons".into()),
28+
weight: iced::font::Weight::Normal,
29+
stretch: iced::font::Stretch::Normal,
30+
style: iced::font::Style::Normal,
31+
};
32+
33+
let mut row = Row::new().spacing(10).align_y(Center);
34+
35+
let mut icon_text_widget = Text::new(icon)
36+
.font(icon_font)
37+
.width(Fixed(THEME_ICON_SIZE));
38+
if let Some(c) = color {
39+
icon_text_widget = icon_text_widget.color(c);
40+
}
41+
row = row.push(icon_text_widget);
42+
43+
let mut label_widget = Text::new(label);
44+
if let Some(c) = color {
45+
label_widget = label_widget.color(c);
46+
}
47+
row = row.push(label_widget);
48+
49+
row.into()
50+
}
51+
52+
pub(crate) fn icon(icon: &'static str) -> Text<'static> {
53+
let icon_font = Font {
54+
family: font::Family::Name("plume_icons".into()),
55+
weight: font::Weight::Normal,
56+
stretch: font::Stretch::Normal,
57+
style: font::Style::Normal,
58+
};
59+
60+
Text::new(icon)
61+
.font(icon_font)
62+
.align_x(Center)
63+
.width(Fixed(THEME_ICON_SIZE))
64+
}

apps/plumeimpactor/src/appearance/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
use iced::{Color, Theme, color};
22

33
mod button;
4+
mod fonts;
45
mod picklist;
56

67
pub(crate) use button::{p_button, s_button};
8+
#[allow(unused)]
9+
pub(crate) use fonts::{
10+
CHEVRON_BACK, DOWNLOAD, FILE, GEAR, MINUS, PLUS, SHARE, STAR, WRENCH, icon, icon_text,
11+
load_fonts,
12+
};
713
pub(crate) use picklist::s_pick_list;
814

915
pub(crate) const THEME_CORNER_RADIUS: f32 = 4.0;
1016
pub(crate) const THEME_FONT_SIZE: f32 = 12.0;
1117
pub(crate) const THEME_PADDING: f32 = 9.0;
18+
pub(crate) const THEME_ICON_SIZE: f32 = 12.0;
1219

1320
pub(crate) fn p_font() -> iced::Font {
1421
iced::Font {
7.54 KB
Binary file not shown.

apps/plumeimpactor/src/defaults.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub(crate) fn default_settings() -> iced::Settings {
1111
iced::Settings {
1212
default_font: appearance::p_font(),
1313
default_text_size: appearance::THEME_FONT_SIZE.into(),
14+
fonts: appearance::load_fonts(),
1415
..Default::default()
1516
}
1617
}

apps/plumeimpactor/src/screen/general.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ impl GeneralScreen {
8080
.spacing(10)
8181
.align_x(Center);
8282

83-
let footer_links =
84-
button(text("Give me a ⭐ star :3").color(Color::from_rgb(1.0, 0.75, 0.8)))
85-
.on_press(Message::OpenGitHub)
86-
.style(iced::widget::button::text);
83+
let footer_links = button(appearance::icon_text(
84+
appearance::STAR,
85+
"Star us on GitHub!",
86+
Some(Color::from_rgb(1.0, 0.75, 0.8)),
87+
))
88+
.on_press(Message::OpenGitHub)
89+
.style(iced::widget::button::text);
8790

8891
column![
8992
container(screen_content).center(Fill).height(Fill),
@@ -96,14 +99,18 @@ impl GeneralScreen {
9699
fn view_buttons(&self) -> Element<'_, Message> {
97100
container(
98101
row![
99-
button(text("Device Utilities").align_x(Center))
102+
button(appearance::icon_text(appearance::WRENCH, "Utilities", None))
100103
.on_press(Message::NavigateToUtilities)
101104
.width(Fill)
102105
.style(appearance::s_button),
103-
button(text("Import .ipa / .tipa").align_x(Center))
104-
.on_press(Message::OpenFileDialog)
105-
.width(Fill)
106-
.style(appearance::s_button)
106+
button(appearance::icon_text(
107+
appearance::DOWNLOAD,
108+
"Import .ipa / .tipa",
109+
None
110+
))
111+
.on_press(Message::OpenFileDialog)
112+
.width(Fill)
113+
.style(appearance::s_button)
107114
]
108115
.spacing(appearance::THEME_PADDING),
109116
)

0 commit comments

Comments
 (0)