Skip to content

Commit

Permalink
chore: update libcosmic/about page
Browse files Browse the repository at this point in the history
  • Loading branch information
edfloreshz committed Nov 10, 2024
1 parent 9329f5f commit 599a2c0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 48 deletions.
52 changes: 36 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions i18n/en/tasks.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ delete = Delete
view = View
menu-settings = Settings...
menu-about = About Tasks...
## About
repository = Repository
support = Support
website = Website
68 changes: 38 additions & 30 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::core::models::Task;
use crate::core::service::{Provider, TaskService};
use chrono::{Local, NaiveDate};
use cli_clipboard::{ClipboardContext, ClipboardProvider};
use cosmic::app::about::About;
use cosmic::app::{message, Core, Message as CosmicMessage};
use cosmic::cosmic_config::Update;
use cosmic::cosmic_theme::ThemeMode;
use cosmic::iced::alignment::{Horizontal, Vertical};
use cosmic::iced::keyboard::{Key, Modifiers};
use cosmic::iced::{event, keyboard::Event as KeyEvent, window, Event, Length, Subscription};
use cosmic::widget::about::About;
use cosmic::widget::menu::action::MenuAction;
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::segmented_button::{Entity, EntityMut, SingleSelect};
Expand Down Expand Up @@ -61,7 +61,7 @@ pub enum Message {
Dialog(DialogAction),
ToggleContextPage(ContextPage),
Application(ApplicationAction),
Cosmic(cosmic::app::cosmic::Message),
Open(String),
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -181,17 +181,17 @@ impl Tasks {
}

fn settings(&self) -> Element<Message> {
widget::settings::section()
.title(fl!("appearance"))
.add(widget::settings::item::item(
widget::scrollable(widget::settings::section().title(fl!("appearance")).add(
widget::settings::item::item(
fl!("theme"),
widget::dropdown(
&self.app_themes,
Some(self.config.app_theme.into()),
|theme| Message::Application(ApplicationAction::AppTheme(theme)),
),
))
.into()
),
))
.into()
}

fn create_nav_item(&mut self, list: &List) -> EntityMut<SingleSelect> {
Expand Down Expand Up @@ -226,14 +226,20 @@ impl Application for Tasks {
let nav_model = segmented_button::ModelBuilder::default().build();
let service = TaskService::new(Self::APP_ID, Provider::Computer);
let about = About::default()
.set_application_name(fl!("tasks"))
.set_application_icon(Self::APP_ID)
.set_developer_name("Eduardo Flores")
.set_license_type("GPL-3.0")
.set_version("0.1.1")
.set_support_url("https://github.com/cosmic-utils/tasks/issues")
.set_repository_url("https://github.com/cosmic-utils/tasks")
.set_developers([("Eduardo Flores".into(), "[email protected]".into())]);
.name(fl!("tasks"))
.icon(Self::APP_ID)
.version("0.1.1")
.author("Eduardo Flores")
.license("GPL-3.0-only")
.links([
(fl!("repository"), "https://github.com/cosmic-utils/tasks"),
(
fl!("support"),
"https://github.com/cosmic-utils/tasks/issues",
),
(fl!("website"), "https://tasks.edfloreshz.dev"),
])
.developers([("Eduardo Flores", "[email protected]")]);

let mut app = Tasks {
core,
Expand Down Expand Up @@ -266,17 +272,13 @@ impl Application for Tasks {
(app, app::Task::batch(tasks))
}

fn about(&self) -> Option<&About> {
Some(&self.about)
}

fn context_drawer(&self) -> Option<Element<Message>> {
if !self.core.window.show_context {
return None;
}

Some(match self.context_page {
ContextPage::About => self.about_view()?.map(Message::Cosmic),
ContextPage::About => widget::about(&self.about, Message::Open),
ContextPage::Settings => self.settings(),
ContextPage::TaskDetails => self.details.view().map(Message::Details),
})
Expand Down Expand Up @@ -362,10 +364,10 @@ impl Application for Tasks {
let mut tasks = vec![];

match message {
Message::Cosmic(message) => {
tasks.push(cosmic::app::command::message(cosmic::app::message::cosmic(
message,
)));
Message::Open(url) => {
if let Err(err) = open::that_detached(url) {
log::error!("{err}")
}
}
Message::Content(message) => {
let content_tasks = self.content.update(message);
Expand Down Expand Up @@ -710,7 +712,8 @@ impl Application for Tasks {
let spacing = theme::active().cosmic().spacing;

let dialog = match dialog_page {
DialogPage::New(name) => widget::dialog(fl!("create-list"))
DialogPage::New(name) => widget::dialog()
.title(fl!("create-list"))
.primary_action(
widget::button::suggested(fl!("save"))
.on_press_maybe(Some(Message::Dialog(DialogAction::Complete))),
Expand All @@ -732,7 +735,8 @@ impl Application for Tasks {
])
.spacing(spacing.space_xxs),
),
DialogPage::Rename(entity, name) => widget::dialog(fl!("rename-list"))
DialogPage::Rename(entity, name) => widget::dialog()
.title(fl!("rename-list"))
.primary_action(
widget::button::suggested(fl!("save"))
.on_press_maybe(Some(Message::Dialog(DialogAction::Complete))),
Expand All @@ -757,7 +761,8 @@ impl Application for Tasks {
])
.spacing(spacing.space_xxs),
),
DialogPage::Delete(_) => widget::dialog(fl!("delete-list"))
DialogPage::Delete(_) => widget::dialog()
.title(fl!("delete-list"))
.body(fl!("delete-list-confirm"))
.primary_action(
widget::button::suggested(fl!("ok"))
Expand All @@ -784,7 +789,8 @@ impl Application for Tasks {
.into()
})
.collect();
let mut dialog = widget::dialog(fl!("icon-select"))
let mut dialog = widget::dialog()
.title(fl!("icon-select"))
.body(fl!("icon-select-body"))
.primary_action(
widget::button::suggested(fl!("ok"))
Expand All @@ -811,7 +817,8 @@ impl Application for Tasks {
dialog
}
DialogPage::Calendar(date) => {
let dialog = widget::dialog(fl!("select-date"))
let dialog = widget::dialog()
.title(fl!("select-date"))
.primary_action(
widget::button::suggested(fl!("ok"))
.on_press_maybe(Some(Message::Dialog(DialogAction::Complete))),
Expand All @@ -831,7 +838,8 @@ impl Application for Tasks {
dialog
}
DialogPage::Export(contents) => {
let dialog = widget::dialog(fl!("export"))
let dialog = widget::dialog()
.title(fl!("export"))
.control(
widget::container(scrollable(widget::text(contents)).width(Length::Fill))
.height(Length::Fixed(200.0))
Expand Down
3 changes: 1 addition & 2 deletions src/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ impl Content {
widget::column::with_capacity(2)
.spacing(spacing.space_xxs)
.push(self.list_header(list))
.push(items)
.push(items.apply(widget::scrollable))
.apply(widget::container)
.height(Length::Shrink)
.apply(widget::scrollable)
.height(Length::Fill)
.into()
}
Expand Down

0 comments on commit 599a2c0

Please sign in to comment.