Run qmlformat

This commit is contained in:
Tobias Fella
2024-02-20 18:11:23 +01:00
parent f2c12c582e
commit a10da64378
18 changed files with 120 additions and 100 deletions

View File

@@ -57,7 +57,7 @@ ColumnLayout {
*/ */
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: if (downloaded) { onDownloadedChanged: if (downloaded) {
audio.play() audio.play();
} }
/** /**
@@ -93,7 +93,7 @@ ColumnLayout {
target: playButton target: playButton
icon.name: "media-playback-stop" icon.name: "media-playback-stop"
onClicked: { onClicked: {
root.room.cancelFileTransfer(root.eventId) root.room.cancelFileTransfer(root.eventId);
} }
} }
}, },
@@ -105,7 +105,7 @@ ColumnLayout {
icon.name: "media-playback-start" icon.name: "media-playback-start"
onClicked: { onClicked: {
audio.source = root.fileTransferInfo.localPath; audio.source = root.fileTransferInfo.localPath;
audio.play() audio.play();
} }
} }
}, },

View File

@@ -106,7 +106,7 @@ QQC2.Control {
/** /**
* @brief Request a context menu be show for the message. * @brief Request a context menu be show for the message.
*/ */
signal showMessageMenu() signal showMessageMenu
contentItem: ColumnLayout { contentItem: ColumnLayout {
id: contentColumn id: contentColumn
@@ -152,8 +152,12 @@ QQC2.Control {
timeline: root.timeline timeline: root.timeline
maxContentWidth: root.maxContentWidth maxContentWidth: root.maxContentWidth
onReplyClicked: (eventId) => {root.replyClicked(eventId)} onReplyClicked: eventId => {
onSelectedTextChanged: (selectedText) => {root.selectedTextChanged(selectedText);} root.replyClicked(eventId);
}
onSelectedTextChanged: selectedText => {
root.selectedTextChanged(selectedText);
}
onShowMessageMenu: root.showMessageMenu() onShowMessageMenu: root.showMessageMenu()
} }
} }

View File

@@ -94,7 +94,10 @@ Loader {
text: i18n("Remove") text: i18n("Remove")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
icon.color: "red" icon.color: "red"
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Remove Message"), title: i18nc("@title", "Remove Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -106,7 +109,7 @@ Loader {
onTriggered: { onTriggered: {
currentRoom.mainCache.replyId = eventId; currentRoom.mainCache.replyId = eventId;
currentRoom.editCache.editId = ""; currentRoom.editCache.editId = "";
RoomManager.requestFullScreenClose() RoomManager.requestFullScreenClose();
} }
} }
@@ -114,7 +117,10 @@ Loader {
text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report")
icon.name: "dialog-warning-symbolic" icon.name: "dialog-warning-symbolic"
visible: !author.isLocalUser visible: !author.isLocalUser
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Report Message"), title: i18nc("@title", "Report Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -139,12 +145,14 @@ Loader {
icon.name: modelData.icon.name icon.name: modelData.icon.name
onTriggered: modelData.trigger() onTriggered: modelData.trigger()
} }
onObjectAdded: (index, object) => {menuItem.insertItem(0, object)} onObjectAdded: (index, object) => {
menuItem.insertItem(0, object);
}
} }
} }
onObjectAdded: (index, object) => { onObjectAdded: (index, object) => {
object.visible = false; object.visible = false;
menu.addMenu(object) menu.addMenu(object);
} }
} }
@@ -153,7 +161,7 @@ Loader {
QQC2.MenuItem { QQC2.MenuItem {
visible: modelData.visible visible: modelData.visible
action: modelData action: modelData
onClicked: root.item.close(); onClicked: root.item.close()
} }
} }
QQC2.Menu { QQC2.Menu {
@@ -161,7 +169,7 @@ Loader {
title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText) title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText)
property bool isVisible: webshortcutmodel.enabled property bool isVisible: webshortcutmodel.enabled
Component.onCompleted: { Component.onCompleted: {
webshortcutmenu.parent.visible = isVisible webshortcutmenu.parent.visible = isVisible;
} }
onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible
Instantiator { Instantiator {
@@ -238,7 +246,7 @@ Loader {
visible: modelData.visible visible: modelData.visible
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered();
root.item.close(); root.item.close();
} }
} }
@@ -274,7 +282,7 @@ Loader {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onLinkActivated: RoomManager.resolveResource(link, "join"); onLinkActivated: RoomManager.resolveResource(link, "join")
} }
} }
} }
@@ -320,7 +328,7 @@ Loader {
visible: modelData.visible visible: modelData.visible
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered();
root.item.close(); root.item.close();
} }
} }
@@ -360,4 +368,3 @@ Loader {
} }
} }
} }

View File

@@ -59,7 +59,7 @@ ColumnLayout {
*/ */
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: { onDownloadedChanged: {
itineraryModel.path = root.fileTransferInfo.localPath itineraryModel.path = root.fileTransferInfo.localPath;
if (autoOpenFile) { if (autoOpenFile) {
openSavedFile(); openSavedFile();
} }
@@ -76,9 +76,9 @@ ColumnLayout {
property real maxContentWidth: -1 property real maxContentWidth: -1
function saveFileAs() { function saveFileAs() {
const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay) const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay);
dialog.open() dialog.open();
dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId) dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId);
} }
function openSavedFile() { function openSavedFile() {
@@ -209,10 +209,10 @@ ColumnLayout {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: { onAccepted: {
Config.lastSaveDirectory = folder Config.lastSaveDirectory = folder;
Config.save() Config.save();
if (autoOpenFile) { if (autoOpenFile) {
UrlHelper.copyTo(root.fileTransferInfo.localPath, file) UrlHelper.copyTo(root.fileTransferInfo.localPath, file);
} else { } else {
root.room.download(root.eventId, file); root.room.download(root.eventId, file);
} }
@@ -239,9 +239,9 @@ ColumnLayout {
text: model.name text: model.name
} }
QQC2.Label { QQC2.Label {
text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : "" text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : ""
visible: model.coach visible: model.coach
opacity: 0.7 opacity: 0.7
} }
} }
RowLayout { RowLayout {
@@ -260,7 +260,7 @@ ColumnLayout {
} }
ColumnLayout { ColumnLayout {
QQC2.Label { QQC2.Label {
text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "") text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "")
} }
QQC2.Label { QQC2.Label {
text: model.arrivalTime text: model.arrivalTime

View File

@@ -129,32 +129,34 @@ Item {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds
onTapped: { onTapped: {
root.QQC2.ToolTip.hide() root.QQC2.ToolTip.hide();
if (root.mediaInfo.animated) { if (root.mediaInfo.animated) {
_private.imageItem.paused = true _private.imageItem.paused = true;
} }
root.timeline.interactive = false root.timeline.interactive = false;
// We need to make sure the index is that of the MediaMessageFilterModel. // We need to make sure the index is that of the MediaMessageFilterModel.
if (root.timeline.model instanceof MessageFilterModel) { if (root.timeline.model instanceof MessageFilterModel) {
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)) RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
} else { } else {
RoomManager.maximizeMedia(root.index) RoomManager.maximizeMedia(root.index);
} }
} }
} }
function downloadAndOpen() { function downloadAndOpen() {
if (_private.downloaded) { if (_private.downloaded) {
openSavedFile() openSavedFile();
} else { } else {
openOnFinished = true openOnFinished = true;
root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)) root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId));
} }
} }
function openSavedFile() { function openSavedFile() {
if (UrlHelper.openUrl(root.fileTransferInfo.localPath)) return; if (UrlHelper.openUrl(root.fileTransferInfo.localPath))
if (UrlHelper.openUrl(root.fileTransferInfo.localDir)) return; return;
if (UrlHelper.openUrl(root.fileTransferInfo.localDir))
return;
} }
MediaSizeHelper { MediaSizeHelper {

View File

@@ -64,8 +64,10 @@ ColumnLayout {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: { onTapped: {
let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel}); let map = fullScreenMap.createObject(parent, {
map.open() liveLocationModel: liveLocationModel
});
map.open();
} }
onLongPressed: openMessageContext("") onLongPressed: openMessageContext("")
} }
@@ -76,7 +78,7 @@ ColumnLayout {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@@ -49,11 +49,10 @@ RowLayout {
level: 2 level: 2
text: { text: {
switch (root.type) { switch (root.type) {
case LoadComponent.Reply: case LoadComponent.Reply:
return i18n("Loading reply"); return i18n("Loading reply");
case LoadComponent.LinkPreview: case LoadComponent.LinkPreview:
return i18n("Loading URL preview"); return i18n("Loading URL preview");
} }
} }
} }

View File

@@ -88,8 +88,13 @@ ColumnLayout {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: { onTapped: {
let map = fullScreenMap.createObject(parent, {latitude: root.latitude, longitude: root.longitude, asset: root.asset, author: root.author}); let map = fullScreenMap.createObject(parent, {
map.open() latitude: root.latitude,
longitude: root.longitude,
asset: root.asset,
author: root.author
});
map.open();
} }
onLongPressed: openMessageContext("") onLongPressed: openMessageContext("")
} }
@@ -100,13 +105,13 @@ ColumnLayout {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }
Component { Component {
id: fullScreenMap id: fullScreenMap
FullScreenMap { } FullScreenMap {}
} }
TextComponent { TextComponent {

View File

@@ -48,7 +48,7 @@ DelegateChooser {
/** /**
* @brief Request a context menu be show for the message. * @brief Request a context menu be show for the message.
*/ */
signal showMessageMenu() signal showMessageMenu
role: "componentType" role: "componentType"
@@ -56,7 +56,7 @@ DelegateChooser {
roleValue: MessageComponentType.Text roleValue: MessageComponentType.Text
delegate: TextComponent { delegate: TextComponent {
maxContentWidth: root.maxContentWidth maxContentWidth: root.maxContentWidth
onSelectedTextChanged: root.selectedTextChanged(selectedText); onSelectedTextChanged: root.selectedTextChanged(selectedText)
onShowMessageMenu: root.showMessageMenu() onShowMessageMenu: root.showMessageMenu()
} }
} }
@@ -129,7 +129,9 @@ DelegateChooser {
roleValue: MessageComponentType.Reply roleValue: MessageComponentType.Reply
delegate: ReplyComponent { delegate: ReplyComponent {
maxContentWidth: root.maxContentWidth maxContentWidth: root.maxContentWidth
onReplyClicked: (eventId) => {root.replyClicked(eventId)} onReplyClicked: eventId => {
root.replyClicked(eventId);
}
} }
} }

View File

@@ -333,7 +333,9 @@ TimelineDelegate {
onReplyClicked: eventId => { onReplyClicked: eventId => {
root.replyClicked(eventId); root.replyClicked(eventId);
} }
onSelectedTextChanged: (selectedText) => {root.selectedText = selectedText;} onSelectedTextChanged: selectedText => {
root.selectedText = selectedText;
}
onShowMessageMenu: _private.showMessageMenu() onShowMessageMenu: _private.showMessageMenu()
showBackground: root.cardBackground && !Config.compactLayout showBackground: root.cardBackground && !Config.compactLayout
@@ -407,7 +409,7 @@ TimelineDelegate {
property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && root.author.isLocalUser && !Config.compactLayout && !root.alwaysMaxWidth property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && root.author.isLocalUser && !Config.compactLayout && !root.alwaysMaxWidth
function showMessageMenu() { function showMessageMenu() {
RoomManager.viewEventMenu(root.eventId, root.room, root.selectedText) RoomManager.viewEventMenu(root.eventId, root.room, root.selectedText);
} }
} }
} }

View File

@@ -69,7 +69,7 @@ ColumnLayout {
} }
} }
Label { Label {
visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded
text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "") text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "")
font.pointSize: questionLabel.font.pointSize * 0.8 font.pointSize: questionLabel.font.pointSize * 0.8
} }

View File

@@ -15,7 +15,6 @@ Kirigami.Dialog {
property var connection property var connection
parent: applicationWindow().overlay parent: applicationWindow().overlay
leftPadding: 0 leftPadding: 0
@@ -47,22 +46,21 @@ Kirigami.Dialog {
} }
} }
} }
} }
FormCard.FormDelegateSeparator {} FormCard.FormDelegateSeparator {}
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Join") text: i18nc("@action:button", "Join")
onClicked: { onClicked: {
SpaceHierarchyCache.recommendedSpaceHidden = true SpaceHierarchyCache.recommendedSpaceHidden = true;
RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join") RoomManager.resolveResource(SpaceHierarchyCache.recommendedSpaceId, "join");
root.close() root.close();
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Ignore") text: i18nc("@action:button", "Ignore")
onClicked: { onClicked: {
SpaceHierarchyCache.recommendedSpaceHidden = true SpaceHierarchyCache.recommendedSpaceHidden = true;
root.close() root.close();
} }
} }
} }

View File

@@ -33,7 +33,7 @@ Delegates.RoundedItemDelegate {
Accessible.name: root.displayName Accessible.name: root.displayName
Accessible.onPressAction: clicked() Accessible.onPressAction: clicked()
onClicked: RoomManager.resolveResource(currentRoom.id); onClicked: RoomManager.resolveResource(currentRoom.id)
onPressAndHold: createRoomListContextMenu() onPressAndHold: createRoomListContextMenu()
Keys.onSpacePressed: clicked() Keys.onSpacePressed: clicked()
@@ -42,7 +42,7 @@ Delegates.RoundedItemDelegate {
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: (eventPoint, button) => root.createRoomListContextMenu(); onTapped: (eventPoint, button) => root.createRoomListContextMenu()
} }
contentItem: RowLayout { contentItem: RowLayout {

View File

@@ -173,7 +173,7 @@ Kirigami.Page {
required property TreeView treeView required property TreeView treeView
required property bool current required property bool current
onCurrentChanged: if (current) { onCurrentChanged: if (current) {
forceActiveFocus(Qt.TabFocusReason) forceActiveFocus(Qt.TabFocusReason);
} }
implicitWidth: treeView.width implicitWidth: treeView.width

View File

@@ -19,7 +19,7 @@ QQC2.ItemDelegate {
required property int row required property int row
required property bool current required property bool current
onCurrentChanged: if (current) { onCurrentChanged: if (current) {
collapseButton.forceActiveFocus(Qt.TabFocusReason) collapseButton.forceActiveFocus(Qt.TabFocusReason);
} }
required property bool selected required property bool selected

View File

@@ -26,7 +26,7 @@ QQC2.Control {
target: RoomManager target: RoomManager
function onConnectionChanged() { function onConnectionChanged() {
// We need to rebind as any previous change will have been overwritten. // We need to rebind as any previous change will have been overwritten.
selectedSpaceId = RoomManager.lastSpaceId selectedSpaceId = RoomManager.lastSpaceId;
} }
} }
@@ -267,7 +267,7 @@ QQC2.Control {
onClicked: { onClicked: {
recommendedSpaceDialogComponent.createObject(QQC2.ApplicationWindow.overlay, { recommendedSpaceDialogComponent.createObject(QQC2.ApplicationWindow.overlay, {
connection: root.connection connection: root.connection
}).open() }).open();
} }
Component { Component {
id: recommendedSpaceDialogComponent id: recommendedSpaceDialogComponent

View File

@@ -53,7 +53,7 @@ TextEdit {
/** /**
* @brief Request a context menu be show for the message. * @brief Request a context menu be show for the message.
*/ */
signal showMessageMenu() signal showMessageMenu
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
@@ -122,8 +122,8 @@ a{
textFormat: Text.RichText textFormat: Text.RichText
onLinkActivated: link => { onLinkActivated: link => {
spoilerRevealed = true spoilerRevealed = true;
RoomManager.resolveResource(link, "join") RoomManager.resolveResource(link, "join");
} }
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") { onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
applicationWindow().hoverLinkIndicator.text = hoveredLink; applicationWindow().hoverLinkIndicator.text = hoveredLink;

View File

@@ -59,12 +59,11 @@ Video {
readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed readonly property bool downloaded: root.fileTransferInfo && root.fileTransferInfo.completed
onDownloadedChanged: { onDownloadedChanged: {
if (downloaded) { if (downloaded) {
root.source = root.fileTransferInfo.localPath root.source = root.fileTransferInfo.localPath;
} }
if (downloaded && playOnFinished) { if (downloaded && playOnFinished) {
playSavedFile() playSavedFile();
playOnFinished = false playOnFinished = false;
} }
} }
@@ -220,19 +219,19 @@ Video {
onClicked: { onClicked: {
if (root.volume > 0) { if (root.volume > 0) {
root.volume = 0 root.volume = 0;
} else { } else {
if (unmuteVolume === 0) { if (unmuteVolume === 0) {
root.volume = 1 root.volume = 1;
} else { } else {
root.volume = unmuteVolume root.volume = unmuteVolume;
} }
} }
} }
onHoveredChanged: { onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) { if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart() videoControlTimer.restart();
volumePopupTimer.restart() volumePopupTimer.restart();
} }
} }
@@ -256,13 +255,13 @@ Video {
to: 1 to: 1
value: root.volume value: root.volume
onMoved: { onMoved: {
root.volume = value root.volume = value;
volumeButton.unmuteVolume = value volumeButton.unmuteVolume = value;
} }
onHoveredChanged: { onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) { if (!hovered && (root.state === "paused" || root.state === "playing")) {
rooteoControlTimer.restart() rooteoControlTimer.restart();
volumePopupTimer.restart() volumePopupTimer.restart();
} }
} }
} }
@@ -274,8 +273,8 @@ Video {
id: volumePopupHoverHandler id: volumePopupHoverHandler
onHoveredChanged: { onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) { if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart() videoControlTimer.restart();
volumePopupTimer.restart() volumePopupTimer.restart();
} }
} }
} }
@@ -303,13 +302,13 @@ Video {
text: i18n("Maximize") text: i18n("Maximize")
icon.name: "view-fullscreen" icon.name: "view-fullscreen"
onTriggered: { onTriggered: {
root.timeline.interactive = false root.timeline.interactive = false;
root.pause() root.pause();
// We need to make sure the index is that of the MediaMessageFilterModel. // We need to make sure the index is that of the MediaMessageFilterModel.
if (root.timeline.model instanceof MessageFilterModel) { if (root.timeline.model instanceof MessageFilterModel) {
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)) RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
} else { } else {
RoomManager.maximizeMedia(root.index) RoomManager.maximizeMedia(root.index);
} }
} }
} }
@@ -339,7 +338,7 @@ Video {
id: videoHoverHandler id: videoHoverHandler
onHoveredChanged: { onHoveredChanged: {
if (!hovered && (root.state === "paused" || root.state === "playing")) { if (!hovered && (root.state === "paused" || root.state === "playing")) {
videoControlTimer.restart() videoControlTimer.restart();
} }
} }
} }
@@ -349,12 +348,12 @@ Video {
gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds
onTapped: if (root.fileTransferInfo.completed) { onTapped: if (root.fileTransferInfo.completed) {
if (root.playbackState == MediaPlayer.PlayingState) { if (root.playbackState == MediaPlayer.PlayingState) {
root.pause() root.pause();
} else { } else {
root.play() root.play();
} }
} else { } else {
root.downloadAndPlay() root.downloadAndPlay();
} }
} }
@@ -367,15 +366,15 @@ Video {
function downloadAndPlay() { function downloadAndPlay() {
if (root.downloaded) { if (root.downloaded) {
playSavedFile() playSavedFile();
} else { } else {
playOnFinished = true playOnFinished = true;
root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)) root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId));
} }
} }
function playSavedFile() { function playSavedFile() {
root.stop() root.stop();
root.play() root.play();
} }
} }