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
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
namespace Ui {
|
|
|
|
struct PeerUserpicView;
|
|
|
|
} // namespace Ui
|
2020-05-29 15:10:25 +00:00
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
namespace Window::Notifications {
|
|
|
|
|
|
|
|
[[nodiscard]] QImage GenerateUserpic(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Ui::PeerUserpicView &view);
|
2016-10-03 08:56:03 +00:00
|
|
|
|
|
|
|
class CachedUserpics : public QObject {
|
|
|
|
public:
|
2022-12-05 12:18:10 +00:00
|
|
|
CachedUserpics();
|
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,
|
2022-12-05 12:18:10 +00:00
|
|
|
Ui::PeerUserpicView &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
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
} // namespace Window::Notifications
|