MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / saveToFile

Method saveToFile

Telegram/SourceFiles/data/data_photo_media.cpp:203–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203bool PhotoMedia::saveToFile(const QString &path) {
204 constexpr auto large = PhotoSize::Large;
205 if (const auto video = videoContent(large); !video.isEmpty()) {
206 QFile f(path);
207 return f.open(QIODevice::WriteOnly)
208 && (f.write(video) == video.size());
209 } else if (const auto photo = imageBytes(large); !photo.isEmpty()) {
210 QFile f(path);
211 return f.open(QIODevice::WriteOnly)
212 && (f.write(photo) == photo.size());
213 } else if (const auto fallback = image(large)->original()
214 ; !fallback.isNull()) {
215 return fallback.save(path, "JPG");
216 }
217 return false;
218}
219
220bool PhotoMedia::setToClipboard() {
221 constexpr auto large = PhotoSize::Large;

Callers 8

saveAsMethod · 0.80
downloadMediaMethod · 0.80
SessionControllerMethod · 0.80
openPhotoExternalMethod · 0.80
AddActionFunction · 0.80
savePhotoToFileMethod · 0.80
savePhotoToFileMethod · 0.80
SavePhotoToFileFunction · 0.80

Calls 7

originalMethod · 0.80
isEmptyMethod · 0.45
openMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45
isNullMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected