summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-10-04 01:10:46 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2019-11-23 20:06:15 +0100
commita8166462adc8ffd8d6c5d2a9a50e5cde5c810588 (patch)
tree1a85c25470d5a83509c4110932ea7e4573354db8 /resources
parentAdd basic read_event support (qml) (diff)
downloadnheko-a8166462adc8ffd8d6c5d2a9a50e5cde5c810588.tar.xz
File messages (qml)
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/TimelineView.qml1
-rw-r--r--resources/qml/delegates/FileMessage.qml57
-rw-r--r--resources/res.qrc1
3 files changed, 59 insertions, 0 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 35dcae03..c4750ddf 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -111,6 +111,7 @@ Rectangle {
 					case MtxEvent.NoticeMessage: return "delegates/NoticeMessage.qml"
 					case MtxEvent.TextMessage: return "delegates/TextMessage.qml"
 					case MtxEvent.ImageMessage: return "delegates/ImageMessage.qml"
+					case MtxEvent.FileMessage: return "delegates/FileMessage.qml"
 					//case MtxEvent.VideoMessage: return "delegates/VideoMessage.qml"
 					case MtxEvent.Redacted: return "delegates/Redacted.qml"
 					default: return "delegates/placeholder.qml"
diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml
new file mode 100644
index 00000000..3099acaa
--- /dev/null
+++ b/resources/qml/delegates/FileMessage.qml
@@ -0,0 +1,57 @@
+import QtQuick 2.6
+
+Row {
+Rectangle {
+	radius: 10
+	color: colors.dark
+	height: row.height
+	width: row.width
+
+	Row {
+		id: row
+
+		spacing: 15
+		padding: 12
+
+		Rectangle {
+			color: colors.light
+			radius: 22
+			height: 44
+			width: 44
+			Image {
+				id: img
+				anchors.centerIn: parent
+
+				source: "qrc:/icons/icons/ui/arrow-pointing-down.png"
+				fillMode: Image.Pad
+
+			}
+			MouseArea {
+				anchors.fill: parent
+				onClicked: timelineManager.saveMedia(eventData.url, eventData.filename, eventData.mimetype, eventData.type)
+				cursorShape: Qt.PointingHandCursor
+			}
+		}
+		Column {
+			TextEdit {
+				text: eventData.body
+				textFormat: TextEdit.PlainText
+				readOnly: true
+				wrapMode: Text.Wrap
+				selectByMouse: true
+				color: colors.text
+			}
+			TextEdit {
+				text: eventData.filesize
+				textFormat: TextEdit.PlainText
+				readOnly: true
+				wrapMode: Text.Wrap
+				selectByMouse: true
+				color: colors.text
+			}
+		}
+	}
+}
+Rectangle {
+}
+}
diff --git a/resources/res.qrc b/resources/res.qrc
index 02b4c0c0..c865200c 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -122,6 +122,7 @@
         <file>qml/delegates/TextMessage.qml</file>
         <file>qml/delegates/NoticeMessage.qml</file>
         <file>qml/delegates/ImageMessage.qml</file>
+        <file>qml/delegates/FileMessage.qml</file>
         <file>qml/delegates/Redacted.qml</file>
         <file>qml/delegates/placeholder.qml</file>
     </qresource>