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

@@ -1,13 +0,0 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Dialogs 1.2
FileDialog {
id: locationDialog
title: "Please choose a location"
folder: shortcuts.home
selectFolder: true
onAccepted: currentRoom.downloadFile(eventId, folder + "/" + currentRoom.fileNameToDownload(eventId))
onVisibleChanged: visible ? {} : locationDialog.destroy()
}

View File

@@ -17,7 +17,7 @@ Item {
onDownloadedChanged: downloaded && openOnFinished ? openSavedFile() : {}
function saveFileAs() {
Qt.createComponent("DownloadDialog.qml").createObject(this).open()
matriqueController.saveFileAs(currentRoom, eventId)
}
function downloadAndOpen()

View File

@@ -4,7 +4,7 @@ import QtQuick.Controls.Material 2.2
import Matrique 0.1
Item {
id: messageDelegate
readonly property bool hidden: marks === EventStatus.Redacted || marks === EventStatus.Hidden
readonly property bool darkTheme: Material.theme == Material.Dark
readonly property color background: darkTheme ? "#242424" : "lightgrey"
@@ -12,7 +12,7 @@ Item {
readonly property bool sentByMe: author === currentRoom.localUser
readonly property bool isState: eventType === "state" || eventType === "emote"
visible: marks !== EventStatus.Hidden
id: messageDelegate
z: -5
width: delegateLoader.width
@@ -29,8 +29,10 @@ Item {
Loader {
id: delegateLoader
asynchronous: setting.asyncMessageDelegate
source: {
if (eventType == "redaction") return ""
if (eventType == "redaction" || hidden) return ""
switch (eventType) {
case "state":
case "emote":