Add pie shaped progress bar for chatbar instead of busy indicator
 Closes network/neochat#151
This commit is contained in:
@@ -11,6 +11,7 @@ Dependencies:
|
||||
'frameworks/kconfig': '@stable'
|
||||
'frameworks/syntax-highlighting': '@stable'
|
||||
'frameworks/kitemmodels': '@stable'
|
||||
'frameworks/kquickcharts': '@stable'
|
||||
'frameworks/knotifications': '@stable'
|
||||
'libraries/kquickimageeditor': '@stable'
|
||||
'frameworks/sonnet': '@stable'
|
||||
@@ -38,6 +39,7 @@ Dependencies:
|
||||
'frameworks/kconfig': '@latest-kf6'
|
||||
'frameworks/syntax-highlighting': '@latest-kf6'
|
||||
'frameworks/kitemmodels': '@latest-kf6'
|
||||
'frameworks/kquickcharts': '@latest-kf6'
|
||||
'frameworks/knotifications': '@latest-kf6'
|
||||
'libraries/kquickimageeditor': '@latest-kf6'
|
||||
'frameworks/sonnet': '@latest-kf6'
|
||||
|
||||
@@ -111,6 +111,7 @@ set_package_properties(cmark PROPERTIES
|
||||
|
||||
ecm_find_qmlmodule(org.kde.kquickimageeditor 1.0)
|
||||
ecm_find_qmlmodule(org.kde.kitemmodels 1.0)
|
||||
ecm_find_qmlmodule(org.kde.quickcharts 1.0)
|
||||
|
||||
find_package(KQuickImageEditor COMPONENTS)
|
||||
set_package_properties(KQuickImageEditor PROPERTIES
|
||||
|
||||
@@ -313,14 +313,9 @@ QQC2.Control {
|
||||
QQC2.ToolTip.text: modelData.tooltip
|
||||
HoverHandler { id: hoverHandler }
|
||||
|
||||
QQC2.BusyIndicator {
|
||||
anchors.fill: parent
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
visible: running
|
||||
running: modelData.isBusy
|
||||
PieProgressBar {
|
||||
visible: modelData.isBusy
|
||||
progress: currentRoom.fileUploadingProgress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
src/qml/Component/ChatBox/PieProgressBar.qml
Normal file
65
src/qml/Component/ChatBox/PieProgressBar.qml
Normal file
@@ -0,0 +1,65 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.kirigami 2.18 as Kirigami
|
||||
import org.kde.quickcharts 1.0 as Charts
|
||||
|
||||
/**
|
||||
* @brief A circular progress bar that fills an arc as progress goes up.
|
||||
*/
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
/**
|
||||
* @brief Progress of the circle as a percentage.
|
||||
*
|
||||
* Range - 0% to 100%.
|
||||
*/
|
||||
property int progress: 0
|
||||
|
||||
/**
|
||||
* @brief Offset angle for the start of the pie fill arc.
|
||||
*
|
||||
* This defaults to 0, i.e. an upward vertical line from the center. This rotates
|
||||
* that start point by the desired number of degrees.
|
||||
*
|
||||
* Range - 0 degrees to 360 degrees
|
||||
*/
|
||||
property int startOffset: 0
|
||||
|
||||
/**
|
||||
* @brief Fill color of the pie.
|
||||
*/
|
||||
property color pieColor: Kirigami.Theme.highlightColor
|
||||
|
||||
width: Kirigami.Units.iconSizes.smallMedium
|
||||
height: Kirigami.Units.iconSizes.smallMedium
|
||||
radius: width / 2
|
||||
color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15)
|
||||
|
||||
Charts.PieChart {
|
||||
id: chart
|
||||
anchors.fill: parent
|
||||
anchors.margins: 1
|
||||
|
||||
filled: true
|
||||
// Set chart background color so the parent filled rectangle looks like
|
||||
// an outline.
|
||||
backgroundColor: Kirigami.Theme.backgroundColor
|
||||
fromAngle: root.startOffset
|
||||
toAngle: 360 + root.startOffset
|
||||
range {
|
||||
from: 0
|
||||
to: 100
|
||||
automatic: false
|
||||
}
|
||||
valueSources: Charts.SingleValueSource {
|
||||
value: root.progress
|
||||
}
|
||||
colorSource: Charts.SingleValueSource {
|
||||
value: Kirigami.Theme.highlightColor
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
<file alias="AttachmentPane.qml">qml/Component/ChatBox/AttachmentPane.qml</file>
|
||||
<file alias="ReplyPane.qml">qml/Component/ChatBox/ReplyPane.qml</file>
|
||||
<file alias="CompletionMenu.qml">qml/Component/ChatBox/CompletionMenu.qml</file>
|
||||
<file alias="PieProgressBar.qml">qml/Component/ChatBox/PieProgressBar.qml</file>
|
||||
<file alias="EmojiPicker.qml">qml/Component/Emoji/EmojiPicker.qml</file>
|
||||
<file alias="ReplyComponent.qml">qml/Component/Timeline/ReplyComponent.qml</file>
|
||||
<file alias="StateDelegate.qml">qml/Component/Timeline/StateDelegate.qml</file>
|
||||
|
||||
Reference in New Issue
Block a user