Merge pull request #378 from LorenDB/readReceipts
Display read receipts when read indicator is clicked
This commit is contained in:
commit
20885dd66a
@ -5,9 +5,11 @@ import QtQuick.Controls 2.3
|
|||||||
AbstractButton {
|
AbstractButton {
|
||||||
id: button
|
id: button
|
||||||
|
|
||||||
|
property alias cursor: mouseArea.cursorShape
|
||||||
property string image: undefined
|
property string image: undefined
|
||||||
property color highlightColor: colors.highlight
|
property color highlightColor: colors.highlight
|
||||||
property color buttonTextColor: colors.buttonText
|
property color buttonTextColor: colors.buttonText
|
||||||
|
property bool changeColorOnHover: true
|
||||||
|
|
||||||
focusPolicy: Qt.NoFocus
|
focusPolicy: Qt.NoFocus
|
||||||
width: 16
|
width: 16
|
||||||
@ -18,7 +20,7 @@ AbstractButton {
|
|||||||
|
|
||||||
// Workaround, can't get icon.source working for now...
|
// Workaround, can't get icon.source working for now...
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "image://colorimage/" + image + "?" + (button.hovered ? highlightColor : buttonTextColor)
|
source: image != "" ? ("image://colorimage/" + image + "?" + ((button.hovered && changeColorOnHover) ? highlightColor : buttonTextColor)) : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -2,17 +2,17 @@ import QtQuick 2.5
|
|||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Rectangle {
|
ImageButton {
|
||||||
id: indicator
|
id: indicator
|
||||||
|
|
||||||
property int state: 0
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
width: 16
|
width: 16
|
||||||
height: 16
|
height: 16
|
||||||
ToolTip.visible: ma.containsMouse && state != MtxEvent.Empty
|
hoverEnabled: true
|
||||||
|
changeColorOnHover: (model.state == MtxEvent.Read)
|
||||||
|
cursor: (model.state == MtxEvent.Read) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
ToolTip.visible: hovered && model.state != MtxEvent.Empty
|
||||||
ToolTip.text: {
|
ToolTip.text: {
|
||||||
switch (state) {
|
switch (model.state) {
|
||||||
case MtxEvent.Failed:
|
case MtxEvent.Failed:
|
||||||
return qsTr("Failed");
|
return qsTr("Failed");
|
||||||
case MtxEvent.Sent:
|
case MtxEvent.Sent:
|
||||||
@ -26,32 +26,23 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
onClicked: {
|
||||||
id: ma
|
if (model.state == MtxEvent.Read)
|
||||||
|
TimelineManager.timeline.readReceiptsAction(model.id);
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
image: {
|
||||||
id: stateImg
|
switch (model.state) {
|
||||||
|
case MtxEvent.Failed:
|
||||||
// Workaround, can't get icon.source working for now...
|
return ":/icons/icons/ui/remove-symbol.png";
|
||||||
anchors.fill: parent
|
case MtxEvent.Sent:
|
||||||
source: {
|
return ":/icons/icons/ui/clock.png";
|
||||||
switch (indicator.state) {
|
case MtxEvent.Received:
|
||||||
case MtxEvent.Failed:
|
return ":/icons/icons/ui/checkmark.png";
|
||||||
return "image://colorimage/:/icons/icons/ui/remove-symbol.png?" + colors.buttonText;
|
case MtxEvent.Read:
|
||||||
case MtxEvent.Sent:
|
return ":/icons/icons/ui/double-tick-indicator.png";
|
||||||
return "image://colorimage/:/icons/icons/ui/clock.png?" + colors.buttonText;
|
default:
|
||||||
case MtxEvent.Received:
|
return "";
|
||||||
return "image://colorimage/:/icons/icons/ui/checkmark.png?" + colors.buttonText;
|
|
||||||
case MtxEvent.Read:
|
|
||||||
return "image://colorimage/:/icons/icons/ui/double-tick-indicator.png?" + colors.buttonText;
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StatusIndicator {
|
StatusIndicator {
|
||||||
state: model.state
|
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16
|
Layout.preferredHeight: 16
|
||||||
width: 16
|
width: 16
|
||||||
|
Loading…
Reference in New Issue
Block a user