Better image overlay handling when downloading

- hides the overlay when prompting for download location
 - cancel re-shows the dialog
 - success closes the overlay
 - would be nice to have a return code from the download fn in
 mtxclient.

Closes #140
This commit is contained in:
Adasauce 2020-03-20 10:05:12 -03:00
parent b41e2e6f18
commit d0a1e81f43
No known key found for this signature in database
GPG key ID: B4FD3151235211CB
3 changed files with 20 additions and 6 deletions

View file

@ -175,9 +175,20 @@ TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const
auto imgDialog = new dialogs::ImageOverlay(pixmap);
imgDialog->showFullScreen();
connect(imgDialog, &dialogs::ImageOverlay::saving, timeline_, [this, eventId]() {
timeline_->saveMedia(eventId);
});
connect(imgDialog,
&dialogs::ImageOverlay::saving,
timeline_,
[this, eventId, imgDialog]() {
// hide the overlay while presenting the save dialog for better
// cross platform support.
imgDialog->hide();
if (!timeline_->saveMedia(eventId)) {
imgDialog->show();
} else {
imgDialog->close();
}
});
});
}