New attachment mechanism. Also add image from clipboard.

This commit is contained in:
Black Hat
2019-05-19 21:58:54 +08:00
parent ae5154fd35
commit 603cb33042
16 changed files with 279 additions and 67 deletions

View File

@@ -44,18 +44,11 @@ inline QSize getImageSize(const QUrl& imageUrl) {
return reader.size();
}
void SpectralRoom::chooseAndUploadFile() {
auto localFile = QFileDialog::getOpenFileUrl(Q_NULLPTR, tr("Save File as"));
if (!localFile.isEmpty()) {
uploadFile(localFile);
}
}
void SpectralRoom::uploadFile(const QUrl& url) {
void SpectralRoom::uploadFile(const QUrl& url, const QString& body) {
if (url.isEmpty())
return;
QString txnID = postFile(url.fileName(), url, false);
QString txnID = postFile(body.isEmpty() ? url.fileName() : body, url, false);
setHasFileUploading(true);
connect(this, &Room::fileTransferCompleted,
[=](QString id, QUrl localFile, QUrl mxcUrl) {