Use GridView for sticker picker

This commit is contained in:
Sebastian J. Wolf 2020-10-18 16:29:34 +02:00
parent a9f7a10033
commit e578c6bef3
2 changed files with 78 additions and 79 deletions

View file

@ -74,30 +74,26 @@ Item {
elide: Text.ElideRight
text: qsTr("Recently used")
}
Flickable {
width: parent.width
height: recentStickersRow.height + Theme.paddingSmall
anchors.horizontalCenter: parent.horizontalCenter
contentWidth: recentStickersRow.width
clip: true
Row {
id: recentStickersRow
spacing: Theme.paddingMedium
Repeater {
SilicaGridView {
id: recentStickersGridView
width: parent.width
height: Theme.itemSizeExtraLarge
cellWidth: Theme.itemSizeExtraLarge;
cellHeight: Theme.itemSizeExtraLarge;
visible: count > 0
clip: true
flow: GridView.FlowTopToBottom
model: stickerPickerOverlayItem.recentStickers
Item {
height: singleRecentStickerRow.height
width: singleRecentStickerRow.width
delegate: Item {
width: recentStickersGridView.cellWidth
height: recentStickersGridView.cellHeight
Row {
id: singleRecentStickerRow
spacing: Theme.paddingSmall
Image {
source: modelData.thumbnail.photo.local.path
width: Theme.itemSizeExtraLarge
height: Theme.itemSizeExtraLarge
anchors.fill: parent
asynchronous: true
onStatusChanged: {
if (status === Image.Ready) {
@ -105,7 +101,6 @@ Item {
}
}
}
}
MouseArea {
anchors.fill: parent
@ -116,11 +111,13 @@ Item {
stickerPickerLoader.active = false;
}
}
}
}
HorizontalScrollDecorator {}
}
}
Repeater {
model: stickerPickerOverlayItem.installedStickerSets
width: stickerPickerFlickable.width
@ -136,22 +133,22 @@ Item {
elide: Text.ElideRight
text: modelData.title
}
Flickable {
SilicaGridView {
id: installedStickerSetGridView
width: parent.width
height: installedStickerSetRow.height + Theme.paddingSmall
anchors.horizontalCenter: parent.horizontalCenter
contentWidth: installedStickerSetRow.width
clip: true
Row {
id: installedStickerSetRow
spacing: Theme.paddingMedium
Repeater {
model: modelData.stickers
Item {
width: Theme.itemSizeExtraLarge
height: Theme.itemSizeExtraLarge
cellWidth: Theme.itemSizeExtraLarge;
cellHeight: Theme.itemSizeExtraLarge;
visible: count > 0
clip: true
flow: GridView.FlowTopToBottom
model: modelData.stickers
delegate: Item {
width: installedStickerSetGridView.cellWidth
height: installedStickerSetGridView.cellHeight
Image {
id: singleStickerImage
source: modelData.thumbnail.photo.local.is_downloading_completed ? modelData.thumbnail.photo.local.path : ""
@ -184,9 +181,10 @@ Item {
}
}
}
HorizontalScrollDecorator {}
}
}
}
}
}
}

View file

@ -846,6 +846,7 @@ void TDLibWrapper::setInitialParameters()
initialParameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString());
initialParameters.insert("system_version", QSysInfo::prettyProductName());
initialParameters.insert("application_version", "0.3");
// initialParameters.insert("use_test_dc", true);
requestObject.insert("parameters", initialParameters);
this->sendRequest(requestObject);
}