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"
|
2016-10-05 16:56:27 +00:00
|
|
|
#include "core/single_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;
|
|
|
|
SingleTimer _clearTimer;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namesapce Notifications
|
|
|
|
} // namespace Window
|