chore: re-add sticker loading UI
The sticker loading UI was removed when the StatusChatInput and friends were added in. This PR re-adds the sticker loading UI introduced in PR# 955 (https://github.com/status-im/nim-status-client/pull/955).
This commit is contained in:
parent
4354ee15ed
commit
ba48b266a9
|
@ -100,10 +100,10 @@ QtObject:
|
||||||
self.stickerPacksLoaded()
|
self.stickerPacksLoaded()
|
||||||
self.installedStickerPacksUpdated()
|
self.installedStickerPacksUpdated()
|
||||||
|
|
||||||
proc getNumInstalledStickerPacks(self: StickersView): QVariant {.slot.} =
|
proc getNumInstalledStickerPacks(self: StickersView): int {.slot.} =
|
||||||
newQVariant(self.status.stickers.installedStickerPacks.len)
|
self.status.stickers.installedStickerPacks.len
|
||||||
|
|
||||||
QtProperty[QVariant] numInstalledStickerPacks:
|
QtProperty[int] numInstalledStickerPacks:
|
||||||
read = getNumInstalledStickerPacks
|
read = getNumInstalledStickerPacks
|
||||||
notify = installedStickerPacksUpdated
|
notify = installedStickerPacksUpdated
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,6 @@ Rectangle {
|
||||||
onStickerSelected: {
|
onStickerSelected: {
|
||||||
control.stickerSelected(hashId, packId)
|
control.stickerSelected(hashId, packId)
|
||||||
messageInputField.forceActiveFocus();
|
messageInputField.forceActiveFocus();
|
||||||
stickersPopup.close()
|
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
stickersBtn.highlighted = false
|
stickersBtn.highlighted = false
|
||||||
|
|
|
@ -22,19 +22,12 @@ GridView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 4
|
anchors.topMargin: 4
|
||||||
anchors.leftMargin: 4
|
anchors.leftMargin: 4
|
||||||
Image {
|
ImageLoader {
|
||||||
width: 80
|
width: 80
|
||||||
height: 80
|
height: 80
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: height
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
source: "https://ipfs.infura.io/ipfs/" + url
|
source: "https://ipfs.infura.io/ipfs/" + url
|
||||||
MouseArea {
|
onClicked: {
|
||||||
cursorShape: Qt.PointingHandCursor
|
root.stickerClicked(hash, packId)
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
root.stickerClicked(hash, packId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@ import "../../shared/status"
|
||||||
import "../../app/AppLayouts/Chat/ChatColumn/samples"
|
import "../../app/AppLayouts/Chat/ChatColumn/samples"
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: popup
|
id: root
|
||||||
property var recentStickers: StickerData {}
|
property var recentStickers: StickerData {}
|
||||||
property var stickerPackList: StickerPackData {}
|
property var stickerPackList: StickerPackData {}
|
||||||
signal stickerSelected(string hashId, string packId)
|
signal stickerSelected(string hashId, string packId)
|
||||||
|
property int installedPacksCount: chatsModel.stickers.numInstalledStickerPacks
|
||||||
|
property bool stickerPacksLoaded: false
|
||||||
width: 360
|
width: 360
|
||||||
height: 440
|
height: 440
|
||||||
modal: false
|
modal: false
|
||||||
|
@ -75,10 +77,11 @@ Popup {
|
||||||
Item {
|
Item {
|
||||||
id: noStickerPacks
|
id: noStickerPacks
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: stickerGrid.count <= 0 || stickerPackListView.count <= 0
|
visible: false
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: imgNoStickers
|
id: imgNoStickers
|
||||||
|
visible: lblNoStickersYet.visible || lblNoRecentStickers.visible
|
||||||
width: 56
|
width: 56
|
||||||
height: 56
|
height: 56
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -96,7 +99,7 @@ Popup {
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: lblNoStickersYet
|
id: lblNoStickersYet
|
||||||
visible: stickerPackListView.count <= 0
|
visible: root.installedPacksCount === 0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
//% "You don't have any stickers yet"
|
//% "You don't have any stickers yet"
|
||||||
|
@ -107,7 +110,7 @@ Popup {
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: lblNoRecentStickers
|
id: lblNoRecentStickers
|
||||||
visible: stickerPackListView.count > 0 && stickerGrid.count <= 0
|
visible: stickerPackListView.selectedPackId === -1 && chatsModel.stickers.recent.rowCount() === 0 && !lblNoStickersYet.visible
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
//% "Recently used stickers will appear here"
|
//% "Recently used stickers will appear here"
|
||||||
|
@ -118,7 +121,7 @@ Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
visible: stickerPackListView.count <= 0
|
visible: lblNoStickersYet.visible
|
||||||
//% "Get Stickers"
|
//% "Get Stickers"
|
||||||
label: qsTrId("get-stickers")
|
label: qsTrId("get-stickers")
|
||||||
anchors.top: noStickersContainer.bottom
|
anchors.top: noStickersContainer.bottom
|
||||||
|
@ -135,7 +138,29 @@ Popup {
|
||||||
id: stickerGrid
|
id: stickerGrid
|
||||||
model: recentStickers
|
model: recentStickers
|
||||||
onStickerClicked: {
|
onStickerClicked: {
|
||||||
popup.stickerSelected(hash, packId)
|
root.stickerSelected(hash, packId)
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StatusStickerList {
|
||||||
|
id: loadingGrid
|
||||||
|
visible: chatsModel.stickers.recent.rowCount() === 0
|
||||||
|
interactive: false
|
||||||
|
model: new Array(20)
|
||||||
|
delegate: Item {
|
||||||
|
width: stickerGrid.cellWidth
|
||||||
|
height: stickerGrid.cellHeight
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 4
|
||||||
|
anchors.leftMargin: 4
|
||||||
|
Rectangle {
|
||||||
|
width: 80
|
||||||
|
height: 80
|
||||||
|
radius: width / 2
|
||||||
|
color: Style.current.backgroundHover
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,15 +175,13 @@ Popup {
|
||||||
Layout.bottomMargin: 8
|
Layout.bottomMargin: 8
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
|
||||||
RoundedIcon {
|
StatusRoundButton {
|
||||||
id: btnAddStickerPack
|
id: btnAddStickerPack
|
||||||
anchors.left: parent.left
|
size: "medium"
|
||||||
anchors.top: parent.top
|
icon.name: "plusSign"
|
||||||
width: 24
|
implicitWidth: 24
|
||||||
height: 24
|
implicitHeight: 24
|
||||||
iconWidth: 13.5
|
state: root.stickerPacksLoaded ? "default" : "pending"
|
||||||
iconHeight: 13.5
|
|
||||||
source: "../../app/img/plusSign.svg"
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
stickersContainer.visible = false
|
stickersContainer.visible = false
|
||||||
stickerMarket.visible = true
|
stickerMarket.visible = true
|
||||||
|
@ -215,9 +238,32 @@ Popup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Repeater {
|
||||||
|
id: loadingStickerPackListView
|
||||||
|
model: new Array(7)
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
Layout.preferredHeight: height
|
||||||
|
Layout.preferredWidth: width
|
||||||
|
radius: width / 2
|
||||||
|
color: Style.current.backgroundHover
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Connections {
|
||||||
|
target: chatsModel.stickers
|
||||||
|
onStickerPacksLoaded: {
|
||||||
|
root.stickerPacksLoaded = true
|
||||||
|
stickerPackListView.visible = true
|
||||||
|
loadingGrid.visible = false
|
||||||
|
loadingStickerPackListView.model = []
|
||||||
|
noStickerPacks.visible = installedPacksCount === 0 || chatsModel.stickers.recent.rowCount() === 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue