adding a custom loading spinner to slides

This commit is contained in:
Chris Cochrun 2024-04-11 09:33:03 -05:00
parent 5df0302be9
commit 2428792895
5 changed files with 90 additions and 1 deletions

View file

@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><style>.spinner_98HH{animation:spinner_mnRT 1.6s cubic-bezier(0.52,.6,.25,.99) infinite}.spinner_roCJ{animation-delay:.2s}.spinner_q4Oo{animation-delay:.4s}@keyframes spinner_mnRT{0%{r:0;opacity:1}75%,100%{r:11px;opacity:0}}</style><circle class="spinner_98HH" cx="12" cy="12" r="0"/><circle class="spinner_98HH spinner_roCJ" cx="12" cy="12" r="0"/><circle class="spinner_98HH spinner_q4Oo" cx="12" cy="12" r="0"/></svg>

After

Width:  |  Height:  |  Size: 503 B

View file

@ -0,0 +1,80 @@
import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15
import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
Controls.BusyIndicator {
id: root
property color color
visible: true
contentItem: Item {
implicitWidth: 64
implicitHeight: 64
Item {
id: item
x: parent.width / 2 - 32
y: parent.height / 2 - 32
width: 64
height: 64
opacity: root.running ? 1 : 0
Behavior on opacity {
OpacityAnimator {
duration: 250
}
}
Repeater {
id: repeater
model: 1
Rectangle {
id: delegate
required property int index
x: item.width / 2 - width / 2
y: item.height / 2 - height / 2
implicitWidth: root.width
implicitHeight: root.width
radius: 500
color: root.color
opacity: delegate.scale
/* visible: root.visible */
/* Text { */
/* text: delegate.scale + " & " + delegate.opacity */
/* } */
PropertyAnimation {
target: delegate
property: "scale"
running: root.visible && root.running
from: 0
to: 1
loops: Animation.Infinite
duration: 500 * index
easing.type: Easing.OutInExpo
easing.amplitude: 2.0
}
/* transform: [ */
/* Translate { */
/* y: -Math.min(item.width, item.height) * 0.5 */
/* x: index */
/* }, */
/* Rotation { */
/* angle: delegate.index / repeater.count * 360 */
/* origin.x: 5 */
/* origin.y: 5 */
/* } */
/* ] */
}
}
}
}
}

View file

@ -42,6 +42,13 @@ Item {
currentFrame: pdfIndex
}
Presenter.LoadingSpinner {
id: loadingSpinner
color: Kirigami.Theme.highlightColor
running: true
anchors.fill: parent
}
FastBlur {
id: imageBlue
anchors.fill: parent

View file

@ -26,7 +26,9 @@
<file>qml/presenter/RangedSlider.qml</file>
<file>qml/presenter/NewVideo.qml</file>
<file>qml/presenter/TextBackground.qml</file>
<file>qml/presenter/LoadingSpinner.qml</file>
<file>assets/parallel.jpg</file>
<file>assets/black.jpg</file>
<file>assets/pulse-multiple.svg</file>
</qresource>
</RCC>

View file

@ -331,7 +331,6 @@ impl slide_model::SlideModel {
screenshot.to_str().unwrap()
).insert(0, &QString::from("file://")).to_owned();
slide.video_thumbnail = screenshot_string;
// let runtime = tokio::runtime::Runtime::new().unwrap();
std::thread::spawn(move || {
let result = ffmpeg::bg_from_video(&path, &screenshot);
match result {