Changeset View
Changeset View
Standalone View
Standalone View
src/contents/ui/StickerPicker.qml
| Show All 11 Lines | |||||
| import moe.kazv.mxc.kazv 0.0 as MK | import moe.kazv.mxc.kazv 0.0 as MK | ||||
| import '.' as Kazv | import '.' as Kazv | ||||
| ColumnLayout { | ColumnLayout { | ||||
| id: stickerPicker | id: stickerPicker | ||||
| property var stickerPackList | property var stickerPackList | ||||
| spacing: 0 | spacing: 0 | ||||
| property var currentIndex: 0 | |||||
| signal sendMessageRequested(var eventJson) | signal sendMessageRequested(var eventJson) | ||||
| ScrollView { | TabBar { | ||||
| id: packListScrollView | id: packListView | ||||
| Layout.fillWidth: true | Layout.fillWidth: true | ||||
| Layout.minimumHeight: Kirigami.Units.gridUnit * 2 | Layout.minimumHeight: Kirigami.Units.gridUnit * 2 | ||||
| Layout.preferredHeight: packListView.height | |||||
| ListView { | Repeater { | ||||
| id: packListView | |||||
| orientation: ListView.Horizontal | |||||
| height: contentHeight | |||||
| anchors.fill: parent | |||||
| currentIndex: 0 | |||||
| model: stickerPackList | model: stickerPackList | ||||
| delegate: ToolButton { | delegate: TabButton { | ||||
| objectName: `stickerPack${index}` | objectName: `stickerPack${index}` | ||||
| property var pack: stickerPackList.at(index) | property var pack: stickerPackList.at(index) | ||||
| icon.name: 'smiley' | icon.name: 'smiley' | ||||
| text: l10n.get('sticker-picker-user-stickers') | text: pack.packName ? pack.packName : l10n.get('sticker-picker-user-stickers') | ||||
| checked: ListView.currentIndex === index | checked: stickerPicker.currentIndex === index | ||||
| onClicked: ListView.currentIndex = index | onClicked: stickerPicker.currentIndex = index | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| property var currentPack: packListView.currentItem && packListView.currentItem.pack | property var currentPack: stickerPackList.at(currentIndex) | ||||
| property var stickerSize: Kirigami.Units.iconSizes.enormous | property var stickerSize: Kirigami.Units.iconSizes.enormous | ||||
| property var stickerMargin: Kirigami.Units.smallSpacing | property var stickerMargin: Kirigami.Units.smallSpacing | ||||
| GridView { | GridView { | ||||
| id: stickersGridView | id: stickersGridView | ||||
| Layout.fillWidth: true | Layout.fillWidth: true | ||||
| Layout.minimumHeight: stickerPicker.stickerSize * 5 | Layout.minimumHeight: stickerPicker.stickerSize * 5 | ||||
| Show All 37 Lines | |||||