Skip to content

Commit

Permalink
Use the ProgressIndicator from Slint instead of the self-made one
Browse files Browse the repository at this point in the history
This way it is styled in the same way as the surrounding controls (such as the button).
  • Loading branch information
tronical committed Sep 20, 2023
1 parent fecf866 commit 10f77c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
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;
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

0 comments on commit 10f77c9

Please sign in to comment.