Skip to content
Snippets Groups Projects
Commit e3a73ac9 authored by Liam Coursodon's avatar Liam Coursodon Committed by Sébastien Blin
Browse files

TextEditor: General upgrade

Popup take text size according to languagePopup takes size of the text in fonction
Edition button are now colored when actif

GitLab: #1096
Change-Id: I4ddfe8de267a0e0582dde602aa2ad42f5cf535e8
parent 416417d1
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ Popup { ...@@ -51,7 +51,7 @@ Popup {
anchors.centerIn: parent anchors.centerIn: parent
orientation: ListView.Vertical orientation: ListView.Vertical
spacing: 5 spacing: 0
width: contentItem.childrenRect.width width: contentItem.childrenRect.width
height: contentHeight height: contentHeight
...@@ -64,45 +64,45 @@ Popup { ...@@ -64,45 +64,45 @@ Popup {
color: "transparent" color: "transparent"
} }
onCountChanged: {
for (var i = 0; i < count; i++) {
var item = listViewMoreButton.itemAtIndex(i);
item.width = listViewMoreButton.width;
}
}
delegate: ItemDelegate { delegate: ItemDelegate {
width: control.width id: control
height: control.height
text: modelData.toolTip
AbstractButton {
id: control contentItem: RowLayout {
Rectangle {
anchors.centerIn: parent id: image
height: JamiTheme.chatViewFooterRealButtonSize + 10 width: 26
height: 26
text: modelData.toolTip radius: 5
color: JamiTheme.transparentColor
contentItem: RowLayout { ResponsiveImage {
Rectangle { anchors.fill: parent
id: image source: modelData.iconSrc
width: 26 color: control.hovered ? JamiTheme.chatViewFooterImgHoverColor : JamiTheme.chatViewFooterImgColor
height: 26
radius: 5
color: JamiTheme.transparentColor
ResponsiveImage {
anchors.fill: parent
source: modelData.iconSrc
color: control.hovered ? JamiTheme.chatViewFooterImgHoverColor : JamiTheme.chatViewFooterImgColor
}
}
Text {
text: control.text
color: control.hovered ? JamiTheme.chatViewFooterImgHoverColor : "#7f7f7f"
} }
} }
background: Rectangle { Text {
color: control.hovered ? JamiTheme.showMoreButtonOpenColor : JamiTheme.transparentColor Layout.alignment: Qt.AlignLeft
text: control.text
color: control.hovered ? JamiTheme.chatViewFooterImgHoverColor : "#7f7f7f"
} }
}
background: Rectangle {
color: control.hovered ? JamiTheme.showMoreButtonOpenColor : JamiTheme.transparentColor
}
action: modelData action: modelData
onClicked: { onClicked: {
root.close(); root.close();
}
} }
} }
} }
......
...@@ -242,7 +242,9 @@ Item { ...@@ -242,7 +242,9 @@ Item {
property color showMoreButtonOpenColor: darkTheme ? "#4d4d4d" : "#e5e5e5" property color showMoreButtonOpenColor: darkTheme ? "#4d4d4d" : "#e5e5e5"
property color chatViewFooterSeparateLineColor: darkTheme ? "#5c5c5c" : "#929292" property color chatViewFooterSeparateLineColor: darkTheme ? "#5c5c5c" : "#929292"
property color chatViewFooterSendButtonColor: darkTheme ? "#03B9E9" : "#005699" property color chatViewFooterSendButtonColor: darkTheme ? "#03B9E9" : "#005699"
property color chatViewFooterSendButtonDisableColor: darkTheme ? "#191a1c" : "#f0f0f1"
property color chatViewFooterSendButtonImgColor: darkTheme ? blackColor : whiteColor property color chatViewFooterSendButtonImgColor: darkTheme ? blackColor : whiteColor
property color chatViewFooterSendButtonImgColorDisable: darkTheme ? "#4d4d4d" : "#cbcbcb"
property color chatViewFooterRectangleBorderColor: darkTheme ? "#4d4d4d" : "#e5e5e5" property color chatViewFooterRectangleBorderColor: darkTheme ? "#4d4d4d" : "#e5e5e5"
// ChatView Header // ChatView Header
......
...@@ -304,7 +304,9 @@ Rectangle { ...@@ -304,7 +304,9 @@ Rectangle {
} }
onHeightChanged: { onHeightChanged: {
Qt.callLater(loader.item.scrollToBottom); if (loader.item != null) {
Qt.callLater(loader.item.scrollToBottom);
}
} }
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
......
...@@ -255,6 +255,16 @@ Window { ...@@ -255,6 +255,16 @@ Window {
shortcut2: "" shortcut2: ""
description: qsTr("Ordered list") description: qsTr("Ordered list")
} }
ListElement {
shortcut: "Shift + Alt + T"
shortcut2: ""
description: qsTr("Show Formatting")
}
ListElement {
shortcut: "Shift + Alt + P"
shortcut2: ""
description: qsTr("Show Preview")
}
} }
Rectangle { Rectangle {
......
This diff is collapsed.
...@@ -22,6 +22,8 @@ import net.jami.Constants 1.1 ...@@ -22,6 +22,8 @@ import net.jami.Constants 1.1
import net.jami.Enums 1.1 import net.jami.Enums 1.1
import net.jami.Models 1.1 import net.jami.Models 1.1
import "../../commoncomponents" import "../../commoncomponents"
import QtQuick.Layouts
import SortFilterProxyModel 0.2
JamiFlickable { JamiFlickable {
id: root id: root
...@@ -36,12 +38,17 @@ JamiFlickable { ...@@ -36,12 +38,17 @@ JamiFlickable {
property alias selectedText: textArea.selectedText property alias selectedText: textArea.selectedText
property alias selectionStart: textArea.selectionStart property alias selectionStart: textArea.selectionStart
property alias selectionEnd: textArea.selectionEnd property alias selectionEnd: textArea.selectionEnd
property bool showPreview: false
ScrollBar.vertical.visible: textArea.text ScrollBar.vertical.visible: textArea.text
ScrollBar.horizontal.visible: textArea.text ScrollBar.horizontal.visible: textArea.text
signal sendMessagesRequired signal sendMessagesRequired
function heightBinding() {
textArea.height = Qt.binding(() => textArea.paintedHeight);
}
function selectText(start, end) { function selectText(start, end) {
textArea.select(start, end); textArea.select(start, end);
} }
...@@ -71,11 +78,72 @@ JamiFlickable { ...@@ -71,11 +78,72 @@ JamiFlickable {
} }
interactive: true interactive: true
attachedFlickableMoving: contentHeight > height || root.moving attachedFlickableMoving: textAreaPreview.height > height || textArea.height > height || root.moving
contentHeight: showPreview ? textAreaPreview.height : textArea.height
onShowPreviewChanged: {
if (showPreview) {
textAreaPreview.height = textArea.lineCount === 1 ? textArea.height : textAreaPreview.paintedHeight;
}
heightBinding();
}
TextArea {
id: textAreaPreview
onWidthChanged: root.height = this.height
overwriteMode: false
readOnly: true
height: textArea.lineCount === 1 ? textArea.height : this.paintedHeight
width: textArea.width
visible: showPreview
leftPadding: JamiTheme.scrollBarHandleSize
rightPadding: JamiTheme.scrollBarHandleSize
topPadding: 0
bottomPadding: 0
Connections {
target: textArea
function onTextChanged() {
MessagesAdapter.parseMessage("", textArea.text, false, "", "");
}
}
Connections {
target: MessagesAdapter
function onMessageParsed(messageId, messageText) {
if (messageId === "") {
textAreaPreview.text = messageText;
}
}
}
verticalAlignment: TextEdit.AlignVCenter
font.pointSize: JamiTheme.textFontSize + 2
font.hintingPreference: Font.PreferNoHinting
color: JamiTheme.textColor
wrapMode: TextEdit.Wrap
textFormat: TextEdit.RichText
placeholderTextColor: JamiTheme.messageBarPlaceholderTextColor
horizontalAlignment: Text.AlignLeft
background: Rectangle {
border.width: 0
color: "transparent"
}
}
TextArea.flickable: TextArea { TextArea.flickable: TextArea {
id: textArea id: textArea
visible: !showPreview
leftPadding: JamiTheme.scrollBarHandleSize leftPadding: JamiTheme.scrollBarHandleSize
rightPadding: JamiTheme.scrollBarHandleSize rightPadding: JamiTheme.scrollBarHandleSize
topPadding: 0 topPadding: 0
...@@ -83,6 +151,8 @@ JamiFlickable { ...@@ -83,6 +151,8 @@ JamiFlickable {
persistentSelection: true persistentSelection: true
height: this.paintedHeight
verticalAlignment: TextEdit.AlignVCenter verticalAlignment: TextEdit.AlignVCenter
font.pointSize: JamiTheme.textFontSize + 2 font.pointSize: JamiTheme.textFontSize + 2
...@@ -97,7 +167,7 @@ JamiFlickable { ...@@ -97,7 +167,7 @@ JamiFlickable {
background: Rectangle { background: Rectangle {
border.width: 0 border.width: 0
color: JamiTheme.transparentColor color: "transparent"
} }
onReleased: function (event) { onReleased: function (event) {
...@@ -129,7 +199,8 @@ JamiFlickable { ...@@ -129,7 +199,8 @@ JamiFlickable {
} else if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { } else if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) {
const isEnterNewLine = UtilsAdapter.getAppValue(Settings.Key.ChatViewEnterIsNewLine); const isEnterNewLine = UtilsAdapter.getAppValue(Settings.Key.ChatViewEnterIsNewLine);
const isShiftPressed = (keyEvent.modifiers & Qt.ShiftModifier); const isShiftPressed = (keyEvent.modifiers & Qt.ShiftModifier);
if ((isEnterNewLine && isShiftPressed) || (!isEnterNewLine && !isShiftPressed)) { const isCtrlPressed = (keyEvent.modifiers & Qt.ControlModifier);
if (!isEnterNewLine && !isShiftPressed || isCtrlPressed) {
root.sendMessagesRequired(); root.sendMessagesRequired();
keyEvent.accepted = true; keyEvent.accepted = true;
} }
......
...@@ -449,6 +449,10 @@ MessagesAdapter::onNewInteraction(const QString& convUid, ...@@ -449,6 +449,10 @@ MessagesAdapter::onNewInteraction(const QString& convUid,
void void
MessagesAdapter::onMessageParsed(const QString& messageId, const QString& parsed) MessagesAdapter::onMessageParsed(const QString& messageId, const QString& parsed)
{ {
if (messageId.isEmpty()) {
Q_EMIT messageParsed(messageId, parsed);
return;
}
const QString& convId = lrcInstance_->get_selectedConvUid(); const QString& convId = lrcInstance_->get_selectedConvUid();
const QString& accId = lrcInstance_->get_currentAccountId(); const QString& accId = lrcInstance_->get_currentAccountId();
auto& conversation = lrcInstance_->getConversationFromConvUid(convId, accId); auto& conversation = lrcInstance_->getConversationFromConvUid(convId, accId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment