2016-10-03 08:56:03 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-10-03 08:56:03 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-10-03 08:56:03 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "window/notifications_manager.h"
|
2019-01-18 11:26:43 +00:00
|
|
|
#include "base/timer.h"
|
2016-10-03 08:56:03 +00:00
|
|
|
|
2020-05-29 15:10:25 +00:00
|
|
|
namespace Data {
|
|
|
|
class CloudImageView;
|
|
|
|
} // namespace Data
|
|
|
|
|
2016-10-03 08:56:03 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Notifications {
|
|
|
|
|
|
|
|
class CachedUserpics : public QObject {
|
|
|
|
public:
|
2017-01-07 11:55:05 +00:00
|
|
|
enum class Type {
|
|
|
|
Rounded,
|
|
|
|
Circled,
|
|
|
|
};
|
2016-10-03 08:56:03 +00:00
|
|
|
|
2020-05-29 15:10:25 +00:00
|
|
|
CachedUserpics(Type type);
|
2016-10-03 08:56:03 +00:00
|
|
|
~CachedUserpics();
|
|
|
|
|
2020-05-29 15:10:25 +00:00
|
|
|
[[nodiscard]] QString get(
|
|
|
|
const InMemoryKey &key,
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
std::shared_ptr<Data::CloudImageView> &view);
|
2016-10-03 08:56:03 +00:00
|
|
|
|
|
|
|
private:
|
2020-05-29 15:10:25 +00:00
|
|
|
void clear();
|
2016-10-03 08:56:03 +00:00
|
|
|
void clearInMs(int ms);
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time clear(crl::time ms);
|
2016-10-03 08:56:03 +00:00
|
|
|
|
2017-01-07 11:55:05 +00:00
|
|
|
Type _type = Type::Rounded;
|
2016-10-03 08:56:03 +00:00
|
|
|
struct Image {
|
2020-05-28 14:32:10 +00:00
|
|
|
crl::time until = 0;
|
2016-10-03 08:56:03 +00:00
|
|
|
QString path;
|
|
|
|
};
|
2019-03-22 13:43:34 +00:00
|
|
|
using Images = QMap<InMemoryKey, Image>;
|
2016-10-03 08:56:03 +00:00
|
|
|
Images _images;
|
|
|
|
bool _someSavedFlag = false;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _clearTimer;
|
2016-10-03 08:56:03 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namesapce Notifications
|
|
|
|
} // namespace Window
|