2023-03-20 18:58:20 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-08-30 16:33:43 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2023-03-20 18:58:20 +00:00
|
|
|
required property int currentCategory;
|
|
|
|
property bool loading: false
|
2022-08-30 16:33:43 +00:00
|
|
|
|
|
|
|
signal doRetry()
|
|
|
|
|
|
|
|
color: Style.current.background
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: emptyText
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: {
|
2023-03-20 18:58:20 +00:00
|
|
|
if (root.loading) {
|
|
|
|
return qsTr("Loading gifs...")
|
|
|
|
}
|
|
|
|
if (root.currentCategory === GifPopupDefinitions.Category.Favorite) {
|
2022-08-30 16:33:43 +00:00
|
|
|
return qsTr("Favorite GIFs will appear here")
|
2023-03-20 18:58:20 +00:00
|
|
|
}
|
|
|
|
if (root.currentCategory === GifPopupDefinitions.Category.Recent) {
|
2022-08-30 16:33:43 +00:00
|
|
|
return qsTr("Recent GIFs will appear here")
|
|
|
|
}
|
|
|
|
|
|
|
|
return qsTr("Error while contacting Tenor API, please retry.")
|
|
|
|
}
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Retry")
|
|
|
|
|
2023-03-20 18:58:20 +00:00
|
|
|
visible: !root.loading &&
|
|
|
|
(root.currentCategory === GifPopupDefinitions.Category.Trending ||
|
|
|
|
root.currentCategory === GifPopupDefinitions.Category.Search)
|
2022-08-30 16:33:43 +00:00
|
|
|
|
|
|
|
anchors.top: emptyText.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
onClicked: root.doRetry()
|
|
|
|
}
|
|
|
|
}
|