Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the ProgressIndicator from Slint instead of the self-made one #21

Merged
merged 1 commit into from
Sep 20, 2023
Merged
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ rfd = { version = "0.11", default-features = false, features = [ "xdg-portal" ]
serde = "1.0.136"
serde_json = "1.0.78"
shlex = "1.1"
slint = { version = "1", default-features = false, features = [ "compat-1-0" ] }
slint = { version = "1.1", default-features = false, features = [ "compat-1-0" ] }
tokio = { version = "1.24.2", features= ["full"] }
toml_edit = "0.19.0"
git2 = "0.16.1"

[build-dependencies]
slint-build = { version = "1" }
slint-build = { version = "1.1" }

20 changes: 4 additions & 16 deletions ui/install.slint
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import {
ComboBox, VerticalBox, HorizontalBox, GridBox, Button,
LineEdit, ListView, GroupBox, CheckBox
LineEdit, ListView, GroupBox, CheckBox, ProgressIndicator
} from "std-widgets.slint";

import { CratesCompletionData } from "crates_completion.slint";
Expand Down Expand Up @@ -81,21 +81,9 @@ export component CargoInstallView inherits GridBox {
horizontal-alignment: right;
}
}
if crate.queued : Rectangle {
height: crate_name.preferred_height;
Rectangle {
y:0;
width: parent.width / 2;
x: parent.width - self.width - 6px;
height: parent.height - 6px;
Comment on lines -88 to -90
Copy link
Member Author

@tronical tronical Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this positioning be preserved somehow?

Right now element is just placed in the layout and we let the layout decide on the margin/spacing. Kind of easy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the screenshot, the progressbar seems to extand more than the text in both direction. I suppose it would look better if they had the same margin. Maybe you just need to put the ProgressIndicator in a HorizontalBox.
Or the whole thing in a GridBox with visible: condition; instead of if condition:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will try that.

property <color> col1 : #2320db;
property <color> col2 : #4fa4dd;

property <float> animated : Math.mod(animation-tick()/2s, 1);
background: self.animated < 0.25 ? @linear-gradient(90deg, self.col1 0%, self.col1 self.animated*4, self.col2 100%)
: self.animated < 0.5 ? @linear-gradient(90deg, self.col2 0%, self.col1 self.animated*4 - 1, self.col1 100%)
: self.animated < 0.75 ? @linear-gradient(90deg, self.col2 0%, self.col2 self.animated*4 - 2, self.col1 100%)
: @linear-gradient(90deg, self.col1 0%, self.col2 self.animated*4 - 3, self.col2 100%);
if crate.queued : HorizontalBox {
ProgressIndicator {
indeterminate: true;
}
}
}
Expand Down