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: {
contentItem.channelName.input.text = ""
contentItem.channelName.input.icon.emoji = ""
contentItem.channelName.input.forceActiveFocus(Qt.MouseFocusReason)
contentItem.channelName.input.edit.forceActiveFocus(Qt.MouseFocusReason)
if (isEdit) {
//% "Edit #%1"
header.title = qsTrId("edit---1").arg(popup.channelName);
@ -50,12 +50,13 @@ StatusModal {
contentItem.channelName.input.icon.emoji = popup.channelEmoji
} else {
// 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
}
else {
contentItem.channelName.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji()
} else {
contentItem.channelName.input.icon.emoji =
StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall)
}
}
@ -116,9 +117,11 @@ StatusModal {
}
input.isIconSelectable: true
input.icon.color: colorDialog.color.toString()
input.leftPadding: 16
onIconClicked: {
popup.emojiPopupOpened = true
popup.emojiPopup.open()
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall
popup.emojiPopup.x = popup.x + Style.current.padding
popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding
}
@ -145,6 +148,12 @@ StatusModal {
anchors.leftMargin: 16
}
Item {
id: spacer2
height: 8
width: parent.width
}
Item {
anchors.horizontalCenter: parent.horizontalCenter
height: colorSelectorButton.height + 16

View File

@ -91,7 +91,7 @@ StatusModal {
passwordInput.text = "";
accountNameInput.text = "";
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)
advancedSelection.expanded = false
advancedSelection.reset()
@ -154,8 +154,10 @@ StatusModal {
label: qsTrId("account-name")
input.isIconSelectable: true
input.icon.color: colorSelectionGrid.selectedColor ? colorSelectionGrid.selectedColor : Theme.palette.directColor1
input.leftPadding: 16
onIconClicked: {
popup.emojiPopup.open()
popup.emojiPopup.emojiSize = StatusQUtils.Emoji.size.verySmall
popup.emojiPopup.x = popup.x + accountNameInput.x + Style.current.padding
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 alias searchString: searchBox.text
property var skinColors: ["1f3fb", "1f3fc", "1f3fd", "1f3fe", "1f3ff"]
property string emojiSize: ""
signal emojiSelected(string emoji, bool atCu)
@ -77,7 +78,8 @@ Popup {
emojiSectionsRepeater.itemAt(0).allEmojis = 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()
}
@ -202,6 +204,10 @@ Popup {
Qt.callLater(populateCategories);
}
onClosed: {
popup.emojiSize = ""
}
contentItem: ColumnLayout {
anchors.fill: parent
spacing: 0