Add a SpitView on chat.

Fix a crash on notification bubble : Remove the shortcut as notifications are seen in panels.
Clean format after deleting text in chat editor.
This commit is contained in:
Julien Wadel 2023-09-22 16:25:38 +02:00
parent aac2d9f120
commit 7b2ce18409
5 changed files with 42 additions and 22 deletions

View file

@ -169,10 +169,11 @@ set(ENABLE_CXX_WRAPPER ON CACHE BOOL "Build the C++ wrapper for Liblinphone." FO
set(ENABLE_THEORA OFF)
set(ENABLE_QT_GL ${ENABLE_VIDEO})
find_package(Qt5 5.12 COMPONENTS Core REQUIRED)
# Qt5.13 because of Spitview
find_package(Qt5 5.13 COMPONENTS Core REQUIRED)
if(NOT Qt5_FOUND)
message(FATAL_ERROR "Minimum supported Qt5 version is 5.12!")
message(FATAL_ERROR "Minimum supported Qt5 version is 5.13!")
endif()
set(LINPHONEAPP_BUILD_TYPE "Default" CACHE STRING "Type of build")

View file

@ -163,8 +163,31 @@ Item {
scrollBar.visible = true
}
}
Timer{
id: clearDelay
property bool cleared: true
interval: 20
repeat: false
onTriggered: if(!cleared && textArea.getText(0, textArea.text.length) == '') {
textArea.textFormat= TextEdit.PlainText
textArea.clear()
textArea.textFormat=TextEdit.RichText
cleared = true
}
}
onTextChanged: {
if(clearDelay.cleared) {
var plainText = getText(0, text.length)
if( plainText == '') {
clearDelay.cleared = false
clearDelay.restart()
}
}
}
function handleValidation () {
validText(getText(0, text.length)) // Remove rich format to send plain text
var plainText = getText(0, text.length)
validText(plainText) // Remove rich format to send plain text
}
background: Rectangle {

View file

@ -96,10 +96,6 @@ Item {
count: CoreManager.eventCount
iconSize: AccountStatusStyle.messageCounter.iconSize
pointSize: AccountStatusStyle.messageCounter.pointSize
MouseArea{
anchors.fill: parent
onClicked: window.setView('HistoryView')
}
}
}
}//RowLayout

View file

@ -1,5 +1,5 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import Common 1.0
@ -76,11 +76,10 @@ Rectangle {
function goToMessageId(messageId){
positionViewAtIndex(container.proxyModel.loadTillMessageId(messageId))
}
ColumnLayout {
SplitView{
anchors.fill: parent
spacing: 0
orientation: Qt.Vertical
ScrollableListView {
id: chat
// -----------------------------------------------------------------------
@ -126,8 +125,8 @@ Rectangle {
text: "X"
}
Layout.fillHeight: true
Layout.fillWidth: true
SplitView.fillHeight: true
SplitView.fillWidth: true
clip: false
highlightFollowsCurrentItem: false
// Use moving event => this is a user action.
@ -396,12 +395,11 @@ Rectangle {
pointSize: Units.dp * 7
}
}
}
Rectangle {
id: bottomChatBackground
Layout.fillWidth: true
Layout.preferredHeight: textAreaBorders.height + chatMessagePreview.height+messageBlock.height + chatEmojis.height
SplitView.fillWidth: true
SplitView.minimumHeight: textAreaBorders.minimumHeight + chatMessagePreview.height+messageBlock.height + chatEmojis.minimumHeight
color: ChatStyle.sendArea.backgroundBorder.colorModel.color
visible: proxyModel.chatRoomModel && !proxyModel.chatRoomModel.isReadOnly && (!proxyModel.chatRoomModel.haveEncryption && SettingsModel.standardChatEnabled || proxyModel.chatRoomModel.haveEncryption && SettingsModel.secureChatEnabled)
@ -420,6 +418,7 @@ Rectangle {
ChatMessagePreview{
id: chatMessagePreview
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: ChatStyle.sendArea.backgroundBorder.width
maxHeight: container.height - textAreaBorders.height
replyChatRoomModel: proxyModel.chatRoomModel
@ -429,8 +428,11 @@ Rectangle {
}
ChatEmojis{
id: chatEmojis
property int minimumHeight: visible ? 150 : 0
onEmojiClicked: textArea.insertEmoji(emoji)
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: minimumHeight
}
// -------------------------------------------------------------------------
// Send area.
@ -438,8 +440,10 @@ Rectangle {
Borders {
id: textAreaBorders
property int minimumHeight: visible ? ChatStyle.sendArea.height + ChatStyle.sendArea.border.width : 0
Layout.fillWidth: true
Layout.preferredHeight: textArea.height
Layout.fillHeight: true
Layout.minimumHeight: minimumHeight
Layout.leftMargin: ChatStyle.sendArea.backgroundBorder.width
borderColor: ChatStyle.sendArea.border.colorModel.color
topWidth: ChatStyle.sendArea.border.width
@ -450,11 +454,8 @@ Rectangle {
enabled:proxyModel && proxyModel.chatRoomModel ? !proxyModel.chatRoomModel.isReadOnly:false
isEphemeral : proxyModel && proxyModel.chatRoomModel ? proxyModel.chatRoomModel.ephemeralEnabled:false
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.fill: parent
height: visible ? ChatStyle.sendArea.height + ChatStyle.sendArea.border.width : 0
minimumHeight:ChatStyle.sendArea.height + ChatStyle.sendArea.border.width
maximumHeight:container.height/2

View file

@ -17,7 +17,6 @@ import 'Chat.js' as Logic
Item{
id: mainItem
visible: false
height: visible ? 150 : 0
//Layout.preferredHeight: visible ? 150 : 0
//Layout.maximumHeight: visible ? 150 : 0
signal emojiClicked(var emoji)