fixing the spinner to always be the right size

This commit is contained in:
Chris Cochrun 2024-04-12 07:22:59 -05:00
parent 402bc08d52
commit 6177219482
4 changed files with 10 additions and 10 deletions

View file

@ -11,15 +11,13 @@ Controls.BusyIndicator {
visible: root.running visible: root.running
contentItem: Item { contentItem: Item {
implicitWidth: 64 anchors.fill: parent
implicitHeight: 64
Item { Item {
id: item id: item
x: parent.width / 2 - 32 x: parent.width / 2 - 32
y: parent.height / 2 - 32 y: parent.height / 2 - 32
width: 64 anchors.fill: parent
height: 64
opacity: root.running ? 1 : 0 opacity: root.running ? 1 : 0
Behavior on opacity { Behavior on opacity {
@ -47,7 +45,7 @@ Controls.BusyIndicator {
property: "width" property: "width"
running: root.running running: root.running
from: 0 - (index * 100) from: 0 - (index * 100)
to: root.width * 1.8 to: Kirigami.Units.gridUnit * 5
loops: Animation.Infinite loops: Animation.Infinite
duration: 1400 duration: 1400
easing.type: Easing.InSine easing.type: Easing.InSine

View file

@ -6,6 +6,7 @@ import QtMultimedia 5.15
import QtGraphicalEffects 1.15 import QtGraphicalEffects 1.15
import org.kde.kirigami 2.13 as Kirigami import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter import "./" as Presenter
import org.presenter 1.0
Item { Item {
id: root id: root
@ -45,7 +46,7 @@ Item {
Presenter.LoadingSpinner { Presenter.LoadingSpinner {
id: loadingSpinner id: loadingSpinner
color: Kirigami.Theme.highlightColor color: Kirigami.Theme.highlightColor
running: itemType === "video" && imageSource.length() < 1 running: !fileHelper.validate(imageSource)
anchors.fill: parent anchors.fill: parent
} }

View file

@ -461,9 +461,10 @@ Item {
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
visible: false visible: false
Controls.BusyIndicator { Presenter.LoadingSpinner {
anchors.centerIn: parent anchors.centerIn: parent
running: true running: parent.visible
color: Kirigami.Theme.highlightColor
} }
} }
} }

View file

@ -68,12 +68,12 @@ impl file_helper::FileHelper {
match file_string { match file_string {
Some(file) => { Some(file) => {
let exists = Path::new(&file).exists(); let exists = Path::new(&file).exists();
println!("{file} exists? {exists}"); debug!(file, exists);
exists exists
} }
None => { None => {
let exists = Path::new(&file.to_string()).exists(); let exists = Path::new(&file.to_string()).exists();
println!("{file} exists? {exists}"); debug!(?file, exists);
exists exists
} }
} }