Merge remote-tracking branch 'origin/master' into searching

This commit is contained in:
Sebastian Wolf 2020-12-21 23:33:51 +01:00
commit a0a2e6bdca
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
4 changed files with 42 additions and 15 deletions

View file

@ -153,7 +153,7 @@ Item {
asynchronous: true asynchronous: true
visible: status === Image.Ready ? true : false visible: status === Image.Ready ? true : false
layer.enabled: videoMessageComponent.highlighted layer.enabled: videoMessageComponent.highlighted
layer.effect: PressEffect { source: singleImage } layer.effect: PressEffect { source: placeholderImage }
} }
BackgroundImage { BackgroundImage {
@ -161,7 +161,6 @@ Item {
} }
Rectangle { Rectangle {
id: placeholderBackground
color: "black" color: "black"
opacity: 0.3 opacity: 0.3
height: parent.height height: parent.height
@ -241,7 +240,6 @@ Item {
} }
Rectangle { Rectangle {
id: videoErrorShade
width: parent.width width: parent.width
height: parent.height height: parent.height
color: "lightgrey" color: "lightgrey"

View file

@ -16,8 +16,7 @@ var re = /(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[
// avoid using a string literal like '\u200D' here because minifiers expand it inline // avoid using a string literal like '\u200D' here because minifiers expand it inline
U200D = String.fromCharCode(0x200D), U200D = String.fromCharCode(0x200D),
basePath = Qt.resolvedUrl("./emoji/"), basePath = Qt.resolvedUrl("./emoji/");
ampersandRe = /\&(?!amp;)/g;
function toCodePoint(unicodeSurrogates) { function toCodePoint(unicodeSurrogates) {
var var
@ -41,15 +40,13 @@ function toCodePoint(unicodeSurrogates) {
function emojify(str, emojiSize) { function emojify(str, emojiSize) {
return String(str).replace(re, function (rawText) { return String(str).replace(re, function (rawText) {
var ret = rawText, var iconId = toCodePoint(rawText.indexOf(U200D) < 0 ?
iconId = toCodePoint(rawText.indexOf(U200D) < 0 ?
rawText.replace(UFE0Fg, '') : rawText.replace(UFE0Fg, '') :
rawText rawText);
); return iconId ?
if (iconId) {
// recycle the match string replacing the emoji // recycle the match string replacing the emoji
// with its image counter part // with its image counter part
ret = '<img '.concat( '<img '.concat(
'src="', 'src="',
basePath, basePath,
iconId, iconId,
@ -59,8 +56,7 @@ function emojify(str, emojiSize) {
'" height="', '" height="',
Math.round(emojiSize * 6 / 5 ), Math.round(emojiSize * 6 / 5 ),
'"/>' '"/>'
); ) : rawText;
} }
return ret.replace(ampersandRe, "&amp;"); );
});
} }

View file

@ -18,6 +18,7 @@
*/ */
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import WerkWolf.Fernschreiber 1.0
import "../components" import "../components"
import "../js/twemoji.js" as Emoji import "../js/twemoji.js" as Emoji
import "../js/functions.js" as Functions import "../js/functions.js" as Functions
@ -41,6 +42,38 @@ Page {
description: "here be dragons" description: "here be dragons"
} }
SectionHeader {
text: "Chats"
}
TextSwitch {
checked: chatListModel.showAllChats
text: "Show all chats"
description: "Including the ones referenced by the chats you have joined."
automaticCheck: false
onClicked: chatListModel.showAllChats = !chatListModel.showAllChats
}
Row {
TextField {
id: chatId
anchors.bottom: parent.bottom
width: column.width - joinButton.width - Theme.horizontalPageMargin
placeholderText: "Chat id"
labelVisible: false
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.enabled: text.length > 0
EnterKey.onClicked: tdLibWrapper.joinChat(text)
}
Button {
id: joinButton
text: "Join by id"
anchors.bottom: parent.bottom
enabled: chatId.text.length > 0
onClicked: tdLibWrapper.joinChat(chatId.text)
}
}
} }
VerticalScrollDecorator {} VerticalScrollDecorator {}

View file

@ -493,7 +493,7 @@ void ChatListModel::addVisibleChat(ChatData *chat)
void ChatListModel::updateChatVisibility(const TDLibWrapper::Group *group) void ChatListModel::updateChatVisibility(const TDLibWrapper::Group *group)
{ {
LOG("Updating chat visibility" << group->groupId); LOG("Updating chat visibility" << (group ? qPrintable(QString::number(group->groupId)) : ""));
// See if any group has been removed from from view // See if any group has been removed from from view
for (int i = 0; i < chatList.size(); i++) { for (int i = 0; i < chatList.size(); i++) {
ChatData *chat = chatList.at(i); ChatData *chat = chatList.at(i);