Remove unnecessary properties; simplify hover code

pull/378/head
Loren Burkholder 4 years ago
parent 139ab146bb
commit 7671927fa4
  1. 19
      resources/qml/StatusIndicator.qml
  2. 2
      resources/qml/TimelineRow.qml

@ -5,13 +5,11 @@ import im.nheko 1.0
ImageButton {
id: indicator
property int state: 0
property string eventId
width: 16
height: 16
hoverEnabled: true
ToolTip.visible: hovered && state != MtxEvent.Empty
changeColorOnHover: (model.state == MtxEvent.Read)
ToolTip.visible: hovered && model.state != MtxEvent.Empty
ToolTip.text: {
switch (state) {
case MtxEvent.Failed:
@ -28,12 +26,12 @@ ImageButton {
}
onClicked: {
if (state == MtxEvent.Read)
TimelineManager.timeline.readReceiptsAction(eventId);
if (model.state == MtxEvent.Read)
TimelineManager.timeline.readReceiptsAction(model.id);
}
image: {
switch (state) {
switch (model.state) {
case MtxEvent.Failed:
return ":/icons/icons/ui/remove-symbol.png";
case MtxEvent.Sent:
@ -46,11 +44,4 @@ ImageButton {
return "";
}
}
changeColorOnHover: {
if (state == MtxEvent.Read)
return true;
else
return false;
}
}

@ -69,8 +69,6 @@ Item {
}
StatusIndicator {
state: model.state
eventId: model.id
Layout.alignment: Qt.AlignRight | Qt.AlignTop
Layout.preferredHeight: 16
width: 16

Loading…
Cancel
Save