1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

show image preview after file receiving completed

This commit is contained in:
apprb 2014-09-07 15:51:54 +07:00
parent 0a1eaac9a4
commit 1233357649

View File

@ -107,14 +107,13 @@ void FileTransferInstance::onFileTransferFinished(ToxFile File)
if (File.direction == ToxFile::RECEIVING)
{
QPixmap preview;
QImage preview;
QFile previewFile(File.filePath);
if (previewFile.open(QIODevice::ReadOnly) && previewFile.size() <= 1024*1024*25) // Don't preview big (>25MiB) images
{
if (preview.loadFromData(previewFile.readAll()))
{
preview = preview.scaledToHeight(40);
// pic->setPixmap(preview);
pic = preview.scaledToHeight(40);
}
previewFile.close();
}
@ -303,7 +302,7 @@ QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage
QString content;
content += "<p>" + filename + "</p>";
content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size; + "&nbsp;(" + speed + ")</p>\n";
content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size + "&nbsp;(" + speed + " ETA: " + eta + ")</p>\n";
return wrapIntoForm(content, type, imgAstr, imgBstr);
}