2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Move EmptyUserpic from data_peer to empty_userpic.

This commit is contained in:
John Preston
2017-12-05 12:43:18 +04:00
parent 68009b6fba
commit 5eeb8143b6
14 changed files with 346 additions and 303 deletions

View File

@@ -24,53 +24,22 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "data/data_flags.h"
#include "data/data_notify_settings.h"
int PeerColorIndex(PeerId peerId);
int PeerColorIndex(int32 bareId);
class EmptyUserpic {
public:
EmptyUserpic();
EmptyUserpic(PeerId peerId, const QString &name);
EmptyUserpic(const QString &nonce, const QString &name);
void set(PeerId peerId, const QString &name);
void clear();
explicit operator bool() const {
return (_impl != nullptr);
}
void paint(
Painter &p,
int x,
int y,
int outerWidth,
int size) const;
void paintRounded(
Painter &p,
int x,
int y,
int outerWidth,
int size) const;
void paintSquare(
Painter &p,
int x,
int y,
int outerWidth,
int size) const;
QPixmap generate(int size);
StorageKey uniqueKey() const;
~EmptyUserpic();
private:
class Impl;
std::unique_ptr<Impl> _impl;
friend class Impl;
};
namespace Ui {
class EmptyUserpic;
} // namespace Ui
class PeerData;
class UserData;
class ChatData;
class ChannelData;
namespace Data {
int PeerColorIndex(PeerId peerId);
int PeerColorIndex(int32 bareId);
style::color PeerUserpicColor(PeerId peerId);
} // namespace Data
class PeerClickHandler : public ClickHandler {
public:
@@ -86,10 +55,6 @@ private:
};
class UserData;
class ChatData;
class ChannelData;
class PeerData {
protected:
PeerData(const PeerId &id);
@@ -270,12 +235,14 @@ protected:
private:
void fillNames();
std::unique_ptr<Ui::EmptyUserpic> createEmptyUserpic() const;
void refreshEmptyUserpic() const;
static constexpr auto kUnknownPhotoId = PhotoId(0xFFFFFFFFFFFFFFFFULL);
ImagePtr _userpic;
PhotoId _userpicPhotoId = kUnknownPhotoId;
mutable EmptyUserpic _userpicEmpty;
mutable std::unique_ptr<Ui::EmptyUserpic> _userpicEmpty;
StorageImageLocation _userpicLocation;
Data::NotifySettings _notify;