super-tts-app/src/ui/views/about.rs
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-3.0-only |
2 | | //! About page view for the Super TTS application. |
3 | | |
4 | | use cosmic::iced::Alignment; |
5 | | use cosmic::iced::widget::column; |
6 | | use cosmic::widget::{self, button}; |
7 | | use cosmic::{Element, cosmic_theme, theme}; |
8 | | |
9 | | use crate::ui::messages::{Message, ShellMessage}; |
10 | | |
11 | | const APP_ICON: &[u8] = |
12 | | include_bytes!("../../../resources/icons/hicolor/scalable/apps/super-tts-app.svg"); |
13 | | pub const REPOSITORY: &str = env!("CARGO_PKG_REPOSITORY"); |
14 | | |
15 | | /// About page view |
16 | 0 | pub fn page() -> Element<'static, Message> { |
17 | 0 | let cosmic_theme::Spacing { space_xxs, .. } = theme::active().cosmic().spacing; |
18 | | |
19 | 0 | let icon = widget::svg(widget::svg::Handle::from_memory(APP_ICON)); |
20 | | |
21 | 0 | let title = widget::text::title3("Super TTS"); |
22 | | |
23 | 0 | let hash = env!("VERGEN_GIT_SHA"); |
24 | 0 | let short_hash: String = hash.chars().take(7).collect(); |
25 | 0 | let date = env!("VERGEN_GIT_COMMIT_DATE"); |
26 | | |
27 | 0 | let link = widget::button::link(REPOSITORY) |
28 | 0 | .on_press(Message::Shell(ShellMessage::OpenRepositoryUrl)) |
29 | 0 | .padding(0); |
30 | | |
31 | 0 | column![ |
32 | 0 | icon, |
33 | 0 | title, |
34 | 0 | link, |
35 | 0 | button::link(format!("Git: {short_hash} ({date})")) |
36 | 0 | .on_press(Message::Shell(ShellMessage::LaunchUrl(format!( |
37 | 0 | "{REPOSITORY}/commits/{hash}" |
38 | 0 | )))) |
39 | 0 | .padding(0), |
40 | | ] |
41 | 0 | .align_x(Alignment::Center) |
42 | 0 | .spacing(space_xxs) |
43 | 0 | .into() |
44 | 0 | } |