+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

feature/force-download #46

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct Addon {
// States for GUI
pub details_btn_state: iced::button::State,
pub update_btn_state: iced::button::State,
pub force_btn_state: iced::button::State,
pub delete_btn_state: iced::button::State,
}

Expand Down Expand Up @@ -65,6 +66,7 @@ impl Addon {
repository_identifiers,
details_btn_state: Default::default(),
update_btn_state: Default::default(),
force_btn_state: Default::default(),
delete_btn_state: Default::default(),
}
}
Expand Down
30 changes: 26 additions & 4 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ impl Application for Ajour {
.width(Length::Units(85))
.style(style::StatusTextContainer);

let delete_row_text = Text::new("Details").size(default_font_size);
let delete_row_container = Container::new(delete_row_text)
let details_row_text = Text::new("Details").size(default_font_size);
let details_row_container = Container::new(details_row_text)
.width(Length::Units(70))
.style(style::StatusTextContainer);

Expand All @@ -231,7 +231,7 @@ impl Application for Ajour {
.push(local_version_container)
.push(remote_version_container)
.push(status_row_container)
.push(delete_row_container)
.push(details_row_container)
.push(right_spacer);
}

Expand Down Expand Up @@ -391,6 +391,23 @@ impl Application for Ajour {
let bottom_space = Space::new(Length::Units(0), Length::Units(4));
let notes_text = Text::new(notes).size(default_font_size);

let mut force_download_button = Button::new(
&mut addon.force_btn_state,
Text::new("Force update").size(default_font_size),
)
.style(style::DefaultBoxedButton);

// If we have remote version on addon, enable force update.
if addon.remote_version.is_some() {
force_download_button =
force_download_button.on_press(Interaction::Update(addon.id.clone()));
}

let force_download_button: Element<Interaction> = force_download_button.into();

// Space between buttons.
let button_space = Space::new(Length::Units(5), Length::Units(0));

let delete_button: Element<Interaction> = Button::new(
&mut addon.delete_btn_state,
Text::new("Delete").size(default_font_size),
Expand All @@ -399,12 +416,17 @@ impl Application for Ajour {
.style(style::DeleteBoxedButton)
.into();

let row = Row::new().push(delete_button.map(Message::Interaction));
let row = Row::new()
.push(force_download_button.map(Message::Interaction))
.push(button_space)
.push(delete_button.map(Message::Interaction));

let column = Column::new()
.push(notes_text)
.push(space)
.push(row)
.push(bottom_space);

let details_container = Container::new(column)
.width(Length::Fill)
.padding(5)
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载