Init file sending.
This commit is contained in:
parent
4ef063ea82
commit
731cef3c77
|
@ -1 +1 @@
|
||||||
Subproject commit 496e106083f3740d44716b96ed1b098d61df19eb
|
Subproject commit 56480bc96b28356c44547cc3d9ea1afbda9f04f9
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.9
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
import QtMultimedia 5.8
|
||||||
|
|
||||||
|
AvatarContainer {
|
||||||
|
Button {
|
||||||
|
id: downloadButton
|
||||||
|
|
||||||
|
text: content.body
|
||||||
|
highlighted: !sentByMe
|
||||||
|
flat: true
|
||||||
|
|
||||||
|
onClicked: downloadable.downloadAndOpen()
|
||||||
|
|
||||||
|
Audio {
|
||||||
|
audioRole: Audio.VoiceCommunicationRole
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -154,6 +154,7 @@ Item {
|
||||||
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
|
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
|
||||||
currentRoom.fileTransferCompleted.connect(function(id, localFile, mxcUrl) {
|
currentRoom.fileTransferCompleted.connect(function(id, localFile, mxcUrl) {
|
||||||
console.log("File transferred: " + id + ":" + mxcUrl)
|
console.log("File transferred: " + id + ":" + mxcUrl)
|
||||||
|
matriqueController.postFile(currentRoom, localFile, mxcUrl)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
res.qrc
1
res.qrc
|
@ -24,5 +24,6 @@
|
||||||
<file>qml/component/FileBubble.qml</file>
|
<file>qml/component/FileBubble.qml</file>
|
||||||
<file>qml/component/AvatarContainer.qml</file>
|
<file>qml/component/AvatarContainer.qml</file>
|
||||||
<file>qml/form/RoomListForm.qml</file>
|
<file>qml/form/RoomListForm.qml</file>
|
||||||
|
<file>qml/component/AudioBubble.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -79,8 +79,12 @@ void Controller::reconnect() {
|
||||||
m_connection->connectWithToken(userID, token, "");
|
m_connection->connectWithToken(userID, token, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::postFile(QMatrixClient::Room* room,
|
void Controller::postFile(QMatrixClient::Room* room, const QUrl& localFile,
|
||||||
const QUrl& localFilename) {
|
const QUrl& mxcUrl) {
|
||||||
// auto job = m_connection->uploadFile(localFilename.toLocalFile());
|
QJsonObject json{{"body", localFile.fileName()},
|
||||||
// room->fileTransferInfo(localFilename.fileName())
|
{"filename", localFile.fileName()},
|
||||||
|
{"url", mxcUrl.url()}};
|
||||||
|
room->postMessage(QMatrixClient::RoomMessageEvent{
|
||||||
|
localFile.fileName(), "m.file",
|
||||||
|
new QMatrixClient::EventContent::FileContent(json)});
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,8 @@ class Controller : public QObject {
|
||||||
void errorOccured();
|
void errorOccured();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void postFile(QMatrixClient::Room* room, const QUrl& localFilename);
|
void postFile(QMatrixClient::Room* room, const QUrl& localFile,
|
||||||
|
const QUrl& mxcUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTROLLER_H
|
#endif // CONTROLLER_H
|
||||||
|
|
|
@ -273,8 +273,9 @@ QVariant MessageEventModel::data(const QModelIndex& index, int role) const {
|
||||||
return "notice";
|
return "notice";
|
||||||
case MessageEventType::Image:
|
case MessageEventType::Image:
|
||||||
return "image";
|
return "image";
|
||||||
case MessageEventType::File:
|
|
||||||
case MessageEventType::Audio:
|
case MessageEventType::Audio:
|
||||||
|
// return "audio";
|
||||||
|
case MessageEventType::File:
|
||||||
case MessageEventType::Video:
|
case MessageEventType::Video:
|
||||||
return "file";
|
return "file";
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue