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
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
namespace Notifications {
|
|
|
|
|
|
|
|
class CachedUserpics : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-01-07 11:55:05 +00:00
|
|
|
enum class Type {
|
|
|
|
Rounded,
|
|
|
|
Circled,
|
|
|
|
};
|
|
|
|
CachedUserpics(Type type);
|
2016-10-03 08:56:03 +00:00
|
|
|
|
|
|
|
QString get(const StorageKey &key, PeerData *peer);
|
|
|
|
|
|
|
|
~CachedUserpics();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onClear();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void clearInMs(int ms);
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs clear(TimeMs 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 {
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs until;
|
2016-10-03 08:56:03 +00:00
|
|
|
QString path;
|
|
|
|
};
|
|
|
|
using Images = QMap<StorageKey, Image>;
|
|
|
|
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
|