Add upload status.
This commit is contained in:
parent
731cef3c77
commit
cf84320794
|
@ -150,17 +150,28 @@ Item {
|
||||||
folder: shortcuts.home
|
folder: shortcuts.home
|
||||||
selectMultiple: false
|
selectMultiple: false
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
console.log("You chose: " + fileDialog.fileUrl)
|
|
||||||
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
|
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
|
||||||
currentRoom.fileTransferCompleted.connect(function(id, localFile, mxcUrl) {
|
var fileTransferProgressCallback = function(id, sent, total) {
|
||||||
console.log("File transferred: " + id + ":" + mxcUrl)
|
if (id == fileDialog.fileUrl) { inputField.progress = sent / total }
|
||||||
|
}
|
||||||
|
var completedCallback = function(id, localFile, mxcUrl) {
|
||||||
|
if (id == fileDialog.fileUrl) {
|
||||||
matriqueController.postFile(currentRoom, localFile, mxcUrl)
|
matriqueController.postFile(currentRoom, localFile, mxcUrl)
|
||||||
})
|
inputField.progress = 0
|
||||||
|
currentRoom.fileTransferCompleted.disconnect(fileTransferProgressCallback)
|
||||||
|
currentRoom.fileTransferCompleted.disconnect(completedCallback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
currentRoom.fileTransferProgress.connect(fileTransferProgressCallback)
|
||||||
|
currentRoom.fileTransferCompleted.connect(completedCallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
|
property real progress: 0
|
||||||
|
|
||||||
id: inputField
|
id: inputField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -170,7 +181,16 @@ Item {
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
||||||
background: Rectangle { color: Material.theme == Material.Light ? "#eaeaea" : "#242424" }
|
background: Item {
|
||||||
|
Rectangle {
|
||||||
|
width: inputField.width * inputField.progress
|
||||||
|
height: parent.height
|
||||||
|
z: 5
|
||||||
|
color: Material.accent
|
||||||
|
opacity: 0.4
|
||||||
|
}
|
||||||
|
Rectangle { anchors.fill: parent; color: Material.theme == Material.Light ? "#eaeaea" : "#242424" }
|
||||||
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
if (inputField.text) {
|
if (inputField.text) {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "imageprovider.h"
|
#include "imageprovider.h"
|
||||||
#include "messageeventmodel.h"
|
#include "messageeventmodel.h"
|
||||||
#include "roomlistmodel.h"
|
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
#include "roomlistmodel.h"
|
||||||
|
|
||||||
using namespace QMatrixClient;
|
using namespace QMatrixClient;
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ int main(int argc, char *argv[]) {
|
||||||
// QNetworkProxy::setApplicationProxy(proxy);
|
// QNetworkProxy::setApplicationProxy(proxy);
|
||||||
|
|
||||||
qRegisterMetaType<Room *>("Room*");
|
qRegisterMetaType<Room *>("Room*");
|
||||||
|
qRegisterMetaType<User *>("User*");
|
||||||
|
|
||||||
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
||||||
qmlRegisterType<RoomListModel>("Matrique", 0, 1, "RoomListModel");
|
qmlRegisterType<RoomListModel>("Matrique", 0, 1, "RoomListModel");
|
||||||
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
||||||
qRegisterMetaType<User *>("User*");
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue