mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(chatform): cleanup if block and use positive comparison
This commit is contained in:
parent
780a017928
commit
2d520322a7
@ -820,22 +820,22 @@ void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
|
||||
|
||||
QFile file(filepath);
|
||||
|
||||
if (!file.open(QFile::ReadWrite))
|
||||
if (file.open(QFile::ReadWrite))
|
||||
{
|
||||
pixmap.save(&file, "PNG");
|
||||
|
||||
qint64 filesize = file.size();
|
||||
file.close();
|
||||
QFileInfo fi(file);
|
||||
|
||||
emit sendFile(f->getFriendID(), fi.fileName(), fi.filePath(), filesize);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("Failed to open temporary file", "Temporary file for screenshot"),
|
||||
tr("qTox wasn't able to save the screenshot"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pixmap.save(&file, "PNG");
|
||||
|
||||
qint64 filesize = file.size();
|
||||
file.close();
|
||||
QFileInfo fi(file);
|
||||
|
||||
emit sendFile(f->getFriendID(), fi.fileName(), fi.filePath(), filesize);
|
||||
}
|
||||
|
||||
void ChatForm::onLoadHistory()
|
||||
|
Loading…
x
Reference in New Issue
Block a user