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:
parent
0a1eaac9a4
commit
1233357649
|
@ -107,14 +107,13 @@ void FileTransferInstance::onFileTransferFinished(ToxFile File)
|
||||||
|
|
||||||
if (File.direction == ToxFile::RECEIVING)
|
if (File.direction == ToxFile::RECEIVING)
|
||||||
{
|
{
|
||||||
QPixmap preview;
|
QImage preview;
|
||||||
QFile previewFile(File.filePath);
|
QFile previewFile(File.filePath);
|
||||||
if (previewFile.open(QIODevice::ReadOnly) && previewFile.size() <= 1024*1024*25) // Don't preview big (>25MiB) images
|
if (previewFile.open(QIODevice::ReadOnly) && previewFile.size() <= 1024*1024*25) // Don't preview big (>25MiB) images
|
||||||
{
|
{
|
||||||
if (preview.loadFromData(previewFile.readAll()))
|
if (preview.loadFromData(previewFile.readAll()))
|
||||||
{
|
{
|
||||||
preview = preview.scaledToHeight(40);
|
pic = preview.scaledToHeight(40);
|
||||||
// pic->setPixmap(preview);
|
|
||||||
}
|
}
|
||||||
previewFile.close();
|
previewFile.close();
|
||||||
}
|
}
|
||||||
|
@ -303,7 +302,7 @@ QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage
|
||||||
|
|
||||||
QString content;
|
QString content;
|
||||||
content += "<p>" + filename + "</p>";
|
content += "<p>" + filename + "</p>";
|
||||||
content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size; + " (" + speed + ")</p>\n";
|
content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size + " (" + speed + " ETA: " + eta + ")</p>\n";
|
||||||
|
|
||||||
return wrapIntoForm(content, type, imgAstr, imgBstr);
|
return wrapIntoForm(content, type, imgAstr, imgBstr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user