2021-10-01 15:58:36 +00:00
|
|
|
import QtQuick 2.13
|
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-10-01 15:58:36 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
height: childrenRect.height + Style.current.smallPadding * 2
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2021-12-09 12:53:40 +00:00
|
|
|
property int nextMessageIndex
|
|
|
|
property string nextMsgTimestamp
|
2021-10-01 15:58:36 +00:00
|
|
|
signal clicked()
|
|
|
|
signal timerTriggered()
|
|
|
|
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
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
active: false
|
|
|
|
sourceComponent: StatusLoadingIndicator {
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: fetchMoreButton
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Style.current.blue
|
|
|
|
//% "↓ Fetch more messages"
|
|
|
|
text: qsTrId("load-more-messages")
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: sep1.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
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
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
//% "before %1"
|
2021-12-09 12:53:40 +00:00
|
|
|
text: qsTrId("before--1").arg((nextMessageIndex > -1 ? new Date(nextMsgTimestamp * 1) : new Date()).toLocaleString(Qt.locale(localAppSettings.locale)))
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
Separator {
|
|
|
|
anchors.top: fetchDate.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
}
|
|
|
|
}
|