square-messages
Black Hat 2018-10-01 10:08:07 +08:00
parent 56b820e1a8
commit 0654a8b2b6
5 changed files with 8 additions and 3 deletions

View File

@ -17,6 +17,7 @@ Control {
onSecondaryClicked: {
messageContextMenu.row = messageRow
messageContextMenu.model = model
messageContextMenu.selectedText = contentLabel.selectedText
messageContextMenu.popup()
}
}

View File

@ -72,6 +72,8 @@ RowLayout {
TextEdit {
Layout.fillWidth: true
id: contentLabel
text: (highlighted ? "<style>a{color: white;} .user-pill{color: white}</style>" : "<style>a{color: " + Material.accent + ";} .user-pill{color: " + Material.accent + "}</style>") + display
visible: isText

View File

@ -121,6 +121,7 @@ Item {
verticalLayoutDirection: ListView.BottomToTop
spacing: 8
cacheBuffer: 200
flickDeceleration: 4096
boundsBehavior: Flickable.DragOverBounds
@ -130,7 +131,7 @@ Item {
onContentYChanged: {
// Check whether we're about to bump into the ceiling in 2 seconds
var curVelocity = verticalVelocity // Snapshot the current speed
if(curVelocity < 0 && contentY + curVelocity * 2 < originY)
if(curVelocity < 0 && contentY - 5000 < originY)
{
currentRoom.getPreviousContent(50);
}

View File

@ -4,6 +4,7 @@ import QtQuick.Controls 2.2
Menu {
property var row: null
property var model: null
property string selectedText
readonly property bool isFile: model && (model.eventType === "video" || model.eventType === "audio" || model.eventType === "file" || model.eventType === "image")
@ -48,7 +49,7 @@ Menu {
onTriggered: {
inputField.clear()
inputField.insert(0, "> <" + model.author.id + "><" + model.eventId + "> " + model.message + "\n\n")
inputField.insert(0, "> <" + model.author.id + "><" + model.eventId + "> " + (selectedText != "" ? selectedText : model.message) + "\n\n")
}
}
MenuItem {

View File

@ -330,7 +330,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
if (e.hasTextContent() && e.mimeType().name() != "text/plain") {
static const QRegExp userPillRegExp(
"<a href =\"https://matrix.to/#/@.*:.*\">(.*)</a>");
"<a href=\"https://matrix.to/#/@.*:.*\">(.*)</a>");
QString formattedStr(
static_cast<const TextContent*>(e.content())->body);
formattedStr.replace(userPillRegExp,