| 39 | } |
| 40 | |
| 41 | void 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 | |
| 69 | void CloudImage::update( |
| 70 | not_null<Main::Session*> session, |
nothing calls this directly
no test coverage detected