Enable Sticker and Emote messages

pull/91/head
Nicolas Werner 5 years ago
parent 67d255a2de
commit 425d534e22
  1. 4
      resources/qml/TimelineView.qml
  2. 3
      resources/qml/delegates/ImageMessage.qml
  3. 16
      src/timeline2/TimelineModel.cpp

@ -110,7 +110,9 @@ Rectangle {
//case MtxEvent.Topic: return "delegates/Topic.qml" //case MtxEvent.Topic: return "delegates/Topic.qml"
case MtxEvent.NoticeMessage: return "delegates/NoticeMessage.qml" case MtxEvent.NoticeMessage: return "delegates/NoticeMessage.qml"
case MtxEvent.TextMessage: return "delegates/TextMessage.qml" case MtxEvent.TextMessage: return "delegates/TextMessage.qml"
case MtxEvent.EmoteMessage: return "delegates/TextMessage.qml"
case MtxEvent.ImageMessage: return "delegates/ImageMessage.qml" case MtxEvent.ImageMessage: return "delegates/ImageMessage.qml"
case MtxEvent.Sticker: return "delegates/ImageMessage.qml"
case MtxEvent.FileMessage: return "delegates/FileMessage.qml" case MtxEvent.FileMessage: return "delegates/FileMessage.qml"
case MtxEvent.VideoMessage: return "delegates/PlayableMediaMessage.qml" case MtxEvent.VideoMessage: return "delegates/PlayableMediaMessage.qml"
case MtxEvent.AudioMessage: return "delegates/PlayableMediaMessage.qml" case MtxEvent.AudioMessage: return "delegates/PlayableMediaMessage.qml"
@ -204,7 +206,7 @@ Rectangle {
onTriggered: chat.model.redactEvent(model.id) onTriggered: chat.model.redactEvent(model.id)
} }
MenuItem { MenuItem {
visible: model.type == MtxEvent.ImageMessage || model.type == MtxEvent.VideoMessage || model.type == MtxEvent.AudioMessage || model.type == MtxEvent.FileMessage visible: model.type == MtxEvent.ImageMessage || model.type == MtxEvent.VideoMessage || model.type == MtxEvent.AudioMessage || model.type == MtxEvent.FileMessage || model.type == MtxEvent.Sticker
text: qsTr("Save as") text: qsTr("Save as")
onTriggered: timelineManager.saveMedia(model.url, model.filename, model.mimetype, model.type) onTriggered: timelineManager.saveMedia(model.url, model.filename, model.mimetype, model.type)
} }

@ -1,5 +1,7 @@
import QtQuick 2.6 import QtQuick 2.6
import com.github.nheko 1.0
Item { Item {
width: 300 width: 300
height: 300 * eventData.proportionalHeight height: 300 * eventData.proportionalHeight
@ -13,6 +15,7 @@ Item {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
MouseArea { MouseArea {
enabled: eventData.type == MtxEvent.ImageMessage
anchors.fill: parent anchors.fill: parent
onClicked: timelineManager.openImageOverlay(eventData.url, eventData.filename, eventData.mimetype, eventData.type) onClicked: timelineManager.openImageOverlay(eventData.url, eventData.filename, eventData.mimetype, eventData.type)
} }

@ -16,26 +16,26 @@
namespace { namespace {
template<class T> template<class T>
QString QString
eventId(const T &event) eventId(const mtx::events::RoomEvent<T> &event)
{ {
return QString::fromStdString(event.event_id); return QString::fromStdString(event.event_id);
} }
template<class T> template<class T>
QString QString
roomId(const T &event) roomId(const mtx::events::Event<T> &event)
{ {
return QString::fromStdString(event.room_id); return QString::fromStdString(event.room_id);
} }
template<class T> template<class T>
QString QString
senderId(const T &event) senderId(const mtx::events::RoomEvent<T> &event)
{ {
return QString::fromStdString(event.sender); return QString::fromStdString(event.sender);
} }
template<class T> template<class T>
QDateTime QDateTime
eventTimestamp(const T &event) eventTimestamp(const mtx::events::RoomEvent<T> &event)
{ {
return QDateTime::fromMSecsSinceEpoch(event.origin_server_ts); return QDateTime::fromMSecsSinceEpoch(event.origin_server_ts);
} }
@ -94,7 +94,7 @@ eventFormattedBody(const mtx::events::RoomEvent<T> &e)
template<class T> template<class T>
QString QString
eventUrl(const T &) eventUrl(const mtx::events::Event<T> &)
{ {
return ""; return "";
} }
@ -108,7 +108,7 @@ eventUrl(const mtx::events::RoomEvent<T> &e)
template<class T> template<class T>
QString QString
eventFilename(const T &) eventFilename(const mtx::events::Event<T> &)
{ {
return ""; return "";
} }
@ -148,14 +148,14 @@ eventFilesize(const mtx::events::RoomEvent<T> &e) -> decltype(e.content.info.siz
template<class T> template<class T>
int64_t int64_t
eventFilesize(const T &) eventFilesize(const mtx::events::Event<T> &)
{ {
return 0; return 0;
} }
template<class T> template<class T>
QString QString
eventMimeType(const T &) eventMimeType(const mtx::events::Event<T> &)
{ {
return QString(); return QString();
} }

Loading…
Cancel
Save