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

Method set

Telegram/SourceFiles/data/data_cloud_file.cpp:41–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void CloudImage::set(
42 not_null<Main::Session*> session,
43 const ImageWithLocation &data) {
44 const auto &was = _file.location.file().data;
45 const auto &now = data.location.file().data;
46 if (!data.location.valid()) {
47 _file.flags |= CloudFile::Flag::Cancelled;
48 _file.loader = nullptr;
49 _file.location = ImageLocation();
50 _file.byteSize = 0;
51 _file.flags = CloudFile::Flag();
52 _view = std::weak_ptr<QImage>();
53 } else if (was != now
54 && (!v::is<InMemoryLocation>(was) || v::is<InMemoryLocation>(now))) {
55 _file.location = ImageLocation();
56 _view = std::weak_ptr<QImage>();
57 }
58 UpdateCloudFile(
59 _file,
60 data,
61 session->data().cache(),
62 kImageCacheTag,
63 [=](FileOrigin origin) { load(session, origin); },
64 [=](QImage preloaded, QByteArray) {
65 setToActive(session, std::move(preloaded));
66 });
67}
68
69void CloudImage::update(
70 not_null<Main::Session*> session,

Callers

nothing calls this directly

Calls 5

ImageLocationClass · 0.85
UpdateCloudFileFunction · 0.85
FlagEnum · 0.70
validMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected