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 elide: Text.ElideRight
text: qsTr("Recently used") text: qsTr("Recently used")
} }
Flickable {
width: parent.width
height: recentStickersRow.height + Theme.paddingSmall
anchors.horizontalCenter: parent.horizontalCenter
contentWidth: recentStickersRow.width
clip: true
Row { SilicaGridView {
id: recentStickersRow id: recentStickersGridView
spacing: Theme.paddingMedium width: parent.width
Repeater { height: Theme.itemSizeExtraLarge
cellWidth: Theme.itemSizeExtraLarge;
cellHeight: Theme.itemSizeExtraLarge;
visible: count > 0
clip: true
flow: GridView.FlowTopToBottom
model: stickerPickerOverlayItem.recentStickers model: stickerPickerOverlayItem.recentStickers
Item { delegate: Item {
height: singleRecentStickerRow.height width: recentStickersGridView.cellWidth
width: singleRecentStickerRow.width height: recentStickersGridView.cellHeight
Row {
id: singleRecentStickerRow
spacing: Theme.paddingSmall
Image { Image {
source: modelData.thumbnail.photo.local.path source: modelData.thumbnail.photo.local.path
width: Theme.itemSizeExtraLarge anchors.fill: parent
height: Theme.itemSizeExtraLarge
asynchronous: true asynchronous: true
onStatusChanged: { onStatusChanged: {
if (status === Image.Ready) { if (status === Image.Ready) {
@ -105,7 +101,6 @@ Item {
} }
} }
} }
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -116,11 +111,13 @@ Item {
stickerPickerLoader.active = false; stickerPickerLoader.active = false;
} }
} }
}
} }
HorizontalScrollDecorator {}
} }
}
Repeater { Repeater {
model: stickerPickerOverlayItem.installedStickerSets model: stickerPickerOverlayItem.installedStickerSets
width: stickerPickerFlickable.width width: stickerPickerFlickable.width
@ -136,22 +133,22 @@ Item {
elide: Text.ElideRight elide: Text.ElideRight
text: modelData.title text: modelData.title
} }
Flickable {
SilicaGridView {
id: installedStickerSetGridView
width: parent.width 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 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 { Image {
id: singleStickerImage id: singleStickerImage
source: modelData.thumbnail.photo.local.is_downloading_completed ? modelData.thumbnail.photo.local.path : "" 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("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString());
initialParameters.insert("system_version", QSysInfo::prettyProductName()); initialParameters.insert("system_version", QSysInfo::prettyProductName());
initialParameters.insert("application_version", "0.3"); initialParameters.insert("application_version", "0.3");
// initialParameters.insert("use_test_dc", true);
requestObject.insert("parameters", initialParameters); requestObject.insert("parameters", initialParameters);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }