fix: fix emoji icon picker and create channel inputs

Fixes #5673
This commit is contained in:
Jonathan Rainville 2022-05-09 12:12:17 -04:00 committed by Iuri Matias
parent 2d72525645
commit 9586ff9dc5
4 changed files with 27 additions and 10 deletions

@ -1 +1 @@
Subproject commit b4ebc520e1933555514b58a4d431579b7cc98a63 Subproject commit a9c79b03595d7c8f515aa014cad0471dec7a6b11

View File

@ -40,7 +40,7 @@ StatusModal {
onOpened: { onOpened: {
contentItem.channelName.input.text = "" contentItem.channelName.input.text = ""
contentItem.channelName.input.icon.emoji = "" contentItem.channelName.input.icon.emoji = ""
contentItem.channelName.input.forceActiveFocus(Qt.MouseFocusReason) contentItem.channelName.input.edit.forceActiveFocus(Qt.MouseFocusReason)
if (isEdit) { if (isEdit) {
//% "Edit #%1" //% "Edit #%1"
header.title = qsTrId("edit---1").arg(popup.channelName); header.title = qsTrId("edit---1").arg(popup.channelName);
@ -50,12 +50,13 @@ StatusModal {
contentItem.channelName.input.icon.emoji = popup.channelEmoji contentItem.channelName.input.icon.emoji = popup.channelEmoji
} else { } else {
// Assign a random emoji to channels who down't have one (from old versions) // Assign a random emoji to channels who down't have one (from old versions)
contentItem.channelName.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji() contentItem.channelName.input.icon.emoji =
StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
} }
scrollView.channelColorDialog.color = popup.channelColor scrollView.channelColorDialog.color = popup.channelColor
} } else {
else { contentItem.channelName.input.icon.emoji =
contentItem.channelName.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji() StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
} }
} }
@ -66,7 +67,7 @@ StatusModal {
target: emojiPopup target: emojiPopup
onEmojiSelected: function (emojiText, atCursor) { onEmojiSelected: function (emojiText, atCursor) {
scrollView.channelName.input.icon.emoji = emojiText scrollView.channelName.input.icon.emoji = emojiText
} }
onClosed: { onClosed: {
popup.emojiPopupOpened = false popup.emojiPopupOpened = false
@ -116,9 +117,11 @@ StatusModal {
} }
input.isIconSelectable: true input.isIconSelectable: true
input.icon.color: colorDialog.color.toString() input.icon.color: colorDialog.color.toString()
input.leftPadding: 16
onIconClicked: { onIconClicked: {
popup.emojiPopupOpened = true popup.emojiPopupOpened = true
popup.emojiPopup.open() popup.emojiPopup.open()
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall
popup.emojiPopup.x = popup.x + Style.current.padding popup.emojiPopup.x = popup.x + Style.current.padding
popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding
} }
@ -138,13 +141,19 @@ StatusModal {
} }
StatusBaseText { StatusBaseText {
text: qsTr("Channel colour") text: qsTr("Channel colour")
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.directColor1 color: Theme.palette.directColor1
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 16 anchors.leftMargin: 16
} }
Item {
id: spacer2
height: 8
width: parent.width
}
Item { Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: colorSelectorButton.height + 16 height: colorSelectorButton.height + 16

View File

@ -91,7 +91,7 @@ StatusModal {
passwordInput.text = ""; passwordInput.text = "";
accountNameInput.text = ""; accountNameInput.text = "";
accountNameInput.reset() accountNameInput.reset()
accountNameInput.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji() accountNameInput.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
colorSelectionGrid.selectedColorIndex = Math.floor(Math.random() * colorSelectionGrid.model.length) colorSelectionGrid.selectedColorIndex = Math.floor(Math.random() * colorSelectionGrid.model.length)
advancedSelection.expanded = false advancedSelection.expanded = false
advancedSelection.reset() advancedSelection.reset()
@ -154,8 +154,10 @@ StatusModal {
label: qsTrId("account-name") label: qsTrId("account-name")
input.isIconSelectable: true input.isIconSelectable: true
input.icon.color: colorSelectionGrid.selectedColor ? colorSelectionGrid.selectedColor : Theme.palette.directColor1 input.icon.color: colorSelectionGrid.selectedColor ? colorSelectionGrid.selectedColor : Theme.palette.directColor1
input.leftPadding: 16
onIconClicked: { onIconClicked: {
popup.emojiPopup.open() popup.emojiPopup.open()
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall
popup.emojiPopup.x = popup.x + accountNameInput.x + Style.current.padding popup.emojiPopup.x = popup.x + accountNameInput.x + Style.current.padding
popup.emojiPopup.y = popup.y + contentItem.y + accountNameInput.y + accountNameInput.height + Style.current.halfPadding popup.emojiPopup.y = popup.y + contentItem.y + accountNameInput.y + accountNameInput.height + Style.current.halfPadding
} }

View File

@ -16,6 +16,7 @@ Popup {
property var categories: [] property var categories: []
property alias searchString: searchBox.text property alias searchString: searchBox.text
property var skinColors: ["1f3fb", "1f3fc", "1f3fd", "1f3fe", "1f3ff"] property var skinColors: ["1f3fb", "1f3fc", "1f3fd", "1f3fe", "1f3ff"]
property string emojiSize: ""
signal emojiSelected(string emoji, bool atCu) signal emojiSelected(string emoji, bool atCu)
@ -77,7 +78,8 @@ Popup {
emojiSectionsRepeater.itemAt(0).allEmojis = recentEmojis emojiSectionsRepeater.itemAt(0).allEmojis = recentEmojis
localAccountSensitiveSettings.recentEmojis = recentEmojis localAccountSensitiveSettings.recentEmojis = recentEmojis
popup.emojiSelected(StatusQUtils.Emoji.parse(encodedIcon) + ' ', true) // Adding a space because otherwise, some emojis would fuse since emoji is just a string // Adding a space because otherwise, some emojis would fuse since emoji is just a string
popup.emojiSelected(StatusQUtils.Emoji.parse(encodedIcon, popup.emojiSize || undefined) + ' ', true)
popup.close() popup.close()
} }
@ -202,6 +204,10 @@ Popup {
Qt.callLater(populateCategories); Qt.callLater(populateCategories);
} }
onClosed: {
popup.emojiSize = ""
}
contentItem: ColumnLayout { contentItem: ColumnLayout {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0