2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
2021-10-26 14:21:08 +00:00
|
|
|
|
2023-01-12 22:39:46 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-26 14:21:08 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2021-12-08 21:20:43 +00:00
|
|
|
import shared.stores 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
2022-05-17 13:38:37 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
property int nextMessageIndex
|
2022-07-05 10:12:27 +00:00
|
|
|
property double nextMsgTimestamp
|
2022-05-17 13:38:37 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
signal clicked()
|
|
|
|
signal timerTriggered()
|
2022-04-01 10:30:55 +00:00
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
implicitHeight: childrenRect.height + Theme.smallPadding * 2
|
2022-07-05 10:12:27 +00:00
|
|
|
|
2022-04-01 10:30:55 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-01-12 22:39:46 +00:00
|
|
|
readonly property string formattedDate: nextMessageIndex > -1 ? LocaleUtils.formatDate(nextMsgTimestamp) : LocaleUtils.formatDate()
|
2022-04-01 10:30:55 +00:00
|
|
|
}
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
interval: 3000
|
|
|
|
onTriggered: {
|
|
|
|
fetchLoaderIndicator.active = false;
|
|
|
|
fetchMoreButton.visible = true;
|
|
|
|
fetchDate.visible = true;
|
|
|
|
root.timerTriggered();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep1
|
|
|
|
}
|
2021-11-25 13:28:52 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
Loader {
|
|
|
|
id: fetchLoaderIndicator
|
|
|
|
anchors.top: sep1.bottom
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: Theme.padding
|
2021-10-01 15:58:36 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
active: false
|
|
|
|
sourceComponent: StatusLoadingIndicator {
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: fetchMoreButton
|
|
|
|
font.weight: Font.Medium
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
|
|
|
color: Theme.palette.primaryColor1
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("↓ Fetch more messages")
|
2021-10-01 15:58:36 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: sep1.bottom
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: Theme.smallPadding
|
2021-10-01 15:58:36 +00:00
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
root.clicked();
|
|
|
|
fetchLoaderIndicator.active = true;
|
|
|
|
fetchMoreButton.visible = false;
|
|
|
|
fetchDate.visible = false;
|
2021-11-25 13:28:52 +00:00
|
|
|
timer.start();
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: fetchDate
|
|
|
|
anchors.top: fetchMoreButton.bottom
|
|
|
|
anchors.topMargin: 3
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
color: Theme.palette.secondaryText
|
2022-07-12 08:22:53 +00:00
|
|
|
text: qsTr("Before %1").arg(d.formattedDate)
|
2022-05-17 13:38:37 +00:00
|
|
|
visible: d.formattedDate
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
2022-05-17 13:38:37 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
Separator {
|
|
|
|
anchors.top: fetchDate.bottom
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: Theme.smallPadding
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
}
|