Rewrite FileDialog in C++ && add setting to force async load timelime.

Also fixes repeat section label and empty space when message is redacted.

Fixes #27
This commit is contained in:
Black Hat
2018-08-14 14:05:41 +08:00
parent 1e5fda47ab
commit 09fdd52524
11 changed files with 63 additions and 55 deletions

View File

@@ -191,12 +191,15 @@ Item {
}
delegate: Column {
readonly property bool hidden: marks === EventStatus.Redacted || marks === EventStatus.Hidden
width: parent.width
height: hidden ? -8 : undefined
spacing: 8
RowLayout {
width: parent.width * 0.8
visible: section !== aboveSection
visible: section !== aboveSection && !hidden
anchors.horizontalCenter: parent.horizontalCenter
spacing: 8
@@ -300,30 +303,19 @@ Item {
contentItem: MaterialIcon { icon: "\ue226" }
onClicked: fileDialog.visible = true
FileDialog {
id: fileDialog
title: "Please choose a file"
folder: shortcuts.home
selectMultiple: false
onAccepted: {
currentRoom.uploadFile(fileUrl, fileUrl, matriqueController.getMIME(fileUrl))
var fileTransferProgressCallback = function(id, sent, total) {
if (id == fileUrl) { inputField.progress = sent / total }
}
var completedCallback = function(id, localFile, mxcUrl) {
if (id == fileUrl) {
matriqueController.postFile(currentRoom, localFile, mxcUrl)
inputField.progress = 0
currentRoom.fileTransferCompleted.disconnect(fileTransferProgressCallback)
currentRoom.fileTransferCompleted.disconnect(completedCallback)
}
}
currentRoom.fileTransferProgress.connect(fileTransferProgressCallback)
currentRoom.fileTransferCompleted.connect(completedCallback)
onClicked: {
var fileTransferProgressCallback = function(id, sent, total) {
inputField.progress = sent / total
}
var completedCallback = function(id, localFile, mxcUrl) {
inputField.progress = 0
currentRoom.fileTransferCompleted.disconnect(fileTransferProgressCallback)
currentRoom.fileTransferCompleted.disconnect(completedCallback)
}
currentRoom.fileTransferProgress.connect(fileTransferProgressCallback)
currentRoom.fileTransferCompleted.connect(completedCallback)
matriqueController.uploadFile(currentRoom)
}
}

View File

@@ -1,5 +0,0 @@
import QtQuick 2.9
Item {
}

View File

@@ -3,12 +3,18 @@ import QtQuick.Controls 2.2
Page {
property alias lazyLoad: lazyLoadSwitch.checked
property alias asyncMessageDelegate: asyncMessageDelegateSwitch.checked
Column {
Switch {
id: lazyLoadSwitch
text: "Lazy Load at Initial Sync"
text: "Lazy load at initial sync"
}
Switch {
id: asyncMessageDelegateSwitch
text: "Force loading message delegates asynchronously"
}
Button {
text: "Invoke GC"
highlighted: true