Update libqmatrixclient.
Add author label. Add time label. Use Roboto font.
This commit is contained in:
parent
f892236bfe
commit
6d17716e97
|
@ -9,7 +9,7 @@ import Spectral.Setting 0.1
|
||||||
import Spectral.Component 2.0
|
import Spectral.Component 2.0
|
||||||
import Spectral.Font 0.1
|
import Spectral.Font 0.1
|
||||||
|
|
||||||
RowLayout {
|
ColumnLayout {
|
||||||
readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote" || aboveEventType === "other")
|
readonly property bool avatarVisible: !sentByMe && (aboveAuthor !== author || aboveSection !== section || aboveEventType === "state" || aboveEventType === "emote" || aboveEventType === "other")
|
||||||
readonly property bool highlighted: !(sentByMe || eventType === "notice" )
|
readonly property bool highlighted: !(sentByMe || eventType === "notice" )
|
||||||
readonly property bool sentByMe: author === currentRoom.localUser
|
readonly property bool sentByMe: author === currentRoom.localUser
|
||||||
|
@ -18,12 +18,31 @@ RowLayout {
|
||||||
signal saveFileAs()
|
signal saveFileAs()
|
||||||
signal openExternally()
|
signal openExternally()
|
||||||
|
|
||||||
|
Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft
|
||||||
|
|
||||||
|
id: root
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.leftMargin: 48
|
||||||
|
|
||||||
|
text: author.displayName
|
||||||
|
|
||||||
|
visible: avatarVisible
|
||||||
|
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.weight: Font.Medium
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft
|
||||||
|
|
||||||
z: -5
|
z: -5
|
||||||
|
|
||||||
id: messageRow
|
id: messageRow
|
||||||
|
|
||||||
Layout.alignment: sentByMe ? Qt.AlignRight : Qt.AlignLeft
|
|
||||||
|
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|
||||||
ImageItem {
|
ImageItem {
|
||||||
|
@ -46,7 +65,7 @@ RowLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
Layout.maximumWidth: messageListView.width - (!sentByMe ? 40 + messageRow.spacing : 0) - 48
|
Layout.maximumWidth: messageListView.width - (!sentByMe ? 32 + messageRow.spacing : 0) - 48
|
||||||
|
|
||||||
topPadding: 8
|
topPadding: 8
|
||||||
bottomPadding: 8
|
bottomPadding: 8
|
||||||
|
@ -54,14 +73,15 @@ RowLayout {
|
||||||
rightPadding: 16
|
rightPadding: 16
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: sentByMe ? "#009DC2" : (highlighted || eventType) === "notice" ? "#4285F4" : "#673AB7"
|
color: sentByMe ? "#009DC2" : eventType === "notice" ? "#4285F4" : "#673AB7"
|
||||||
radius: 18
|
radius: 18
|
||||||
|
|
||||||
AutoMouseArea {
|
AutoMouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onSecondaryClicked: {
|
onSecondaryClicked: {
|
||||||
messageContextMenu.row = messageRow
|
index === messageListView.currentIndex ? messageListView.currentIndex = -1 : messageListView.currentIndex = index
|
||||||
|
messageContextMenu.root = root
|
||||||
messageContextMenu.model = model
|
messageContextMenu.model = model
|
||||||
messageContextMenu.selectedText = contentLabel.selectedText
|
messageContextMenu.selectedText = contentLabel.selectedText
|
||||||
messageContextMenu.popup()
|
messageContextMenu.popup()
|
||||||
|
@ -139,8 +159,8 @@ RowLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
messageRow.saveFileAs.connect(saveFileAs)
|
root.saveFileAs.connect(saveFileAs)
|
||||||
messageRow.openExternally.connect(downloadAndOpen)
|
root.openExternally.connect(downloadAndOpen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,8 +180,8 @@ RowLayout {
|
||||||
id: downloadable
|
id: downloadable
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
messageRow.saveFileAs.connect(saveFileAs)
|
root.saveFileAs.connect(saveFileAs)
|
||||||
messageRow.openExternally.connect(downloadAndOpen)
|
root.openExternally.connect(downloadAndOpen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,11 +218,23 @@ RowLayout {
|
||||||
onDownloadedChanged: downloaded && playOnFinished ? spectralController.playAudio(progressInfo.localPath) : {}
|
onDownloadedChanged: downloaded && playOnFinished ? spectralController.playAudio(progressInfo.localPath) : {}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
messageRow.saveFileAs.connect(saveFileAs)
|
root.saveFileAs.connect(saveFileAs)
|
||||||
messageRow.openExternally.connect(downloadAndOpen)
|
root.openExternally.connect(downloadAndOpen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.leftMargin: sentByMe ? 12 : 48
|
||||||
|
|
||||||
|
text: Qt.formatDateTime(time, "dd/MM/yyyy '-' hh:mm")
|
||||||
|
|
||||||
|
visible: index === messageListView.currentIndex
|
||||||
|
|
||||||
|
font.pixelSize: 13
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
property var row: null
|
property var root: null
|
||||||
property var model: null
|
property var model: null
|
||||||
property string selectedText
|
property string selectedText
|
||||||
|
|
||||||
|
@ -23,14 +23,14 @@ Menu {
|
||||||
height: visible ? undefined : 0
|
height: visible ? undefined : 0
|
||||||
text: "Open Externally"
|
text: "Open Externally"
|
||||||
|
|
||||||
onTriggered: row.openExternally()
|
onTriggered: root.openExternally()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
visible: isFile
|
visible: isFile
|
||||||
height: visible ? undefined : 0
|
height: visible ? undefined : 0
|
||||||
text: "Save As"
|
text: "Save As"
|
||||||
|
|
||||||
onTriggered: row.saveFileAs()
|
onTriggered: root.saveFileAs()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
height: visible ? undefined : 0
|
height: visible ? undefined : 0
|
||||||
|
|
|
@ -80,10 +80,12 @@ Item {
|
||||||
|
|
||||||
id: messageListView
|
id: messageListView
|
||||||
|
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
displayMarginBeginning: 100
|
displayMarginBeginning: 100
|
||||||
displayMarginEnd: 100
|
displayMarginEnd: 100
|
||||||
verticalLayoutDirection: ListView.BottomToTop
|
verticalLayoutDirection: ListView.BottomToTop
|
||||||
spacing: 4
|
highlightMoveDuration: 500
|
||||||
|
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
boundsBehavior: Flickable.DragOverBounds
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6f18091a48530399908fbc6ebcb0697bae970abb
|
Subproject commit e1fdb33a4161b29d6df590ccea339d361d9fc4e8
|
|
@ -11,3 +11,4 @@ Primary=#344955
|
||||||
Accent=#673AB7
|
Accent=#673AB7
|
||||||
;Foreground=#1D333E
|
;Foreground=#1D333E
|
||||||
;Background=#161616
|
;Background=#161616
|
||||||
|
Font/Family=Roboto
|
||||||
|
|
|
@ -75,11 +75,11 @@ void Controller::loginWithCredentials(QString serverAddr, QString user,
|
||||||
setConnection(conn);
|
setConnection(conn);
|
||||||
});
|
});
|
||||||
connect(conn, &Connection::networkError,
|
connect(conn, &Connection::networkError,
|
||||||
[=](QString error, QByteArray detail) {
|
[=](QString error, QString, int, int) {
|
||||||
emit errorOccured("Network Error", error);
|
emit errorOccured("Network Error", error);
|
||||||
});
|
});
|
||||||
connect(conn, &Connection::loginError,
|
connect(conn, &Connection::loginError,
|
||||||
[=](QString error, QByteArray detail) {
|
[=](QString error, QString) {
|
||||||
emit errorOccured("Login Failed", error);
|
emit errorOccured("Login Failed", error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@ void Controller::invokeLogin() {
|
||||||
addConnection(c);
|
addConnection(c);
|
||||||
});
|
});
|
||||||
connect(c, &Connection::loginError,
|
connect(c, &Connection::loginError,
|
||||||
[=](QString error, QByteArray detail) {
|
[=](QString error, QString) {
|
||||||
emit errorOccured("Login Failed", error);
|
emit errorOccured("Login Failed", error);
|
||||||
});
|
});
|
||||||
connect(c, &Connection::networkError,
|
connect(c, &Connection::networkError,
|
||||||
[=](QString error, QByteArray detail) {
|
[=](QString error, QString, int, int) {
|
||||||
emit errorOccured("Network Error", error);
|
emit errorOccured("Network Error", error);
|
||||||
});
|
});
|
||||||
c->connectWithToken(account.userId(), accessToken, account.deviceId());
|
c->connectWithToken(account.userId(), accessToken, account.deviceId());
|
||||||
|
|
Loading…
Reference in New Issue