2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Support adaptive forum userpic rounding radius.

This commit is contained in:
John Preston
2022-12-05 16:18:10 +04:00
parent 2407ac50bc
commit cb653df0f6
100 changed files with 662 additions and 724 deletions

View File

@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_flags.h"
#include "data/notify/data_peer_notify_settings.h"
#include "data/data_cloud_file.h"
#include "ui/userpic_view.h"
struct BotInfo;
class PeerData;
@@ -36,13 +37,12 @@ class Forum;
class ForumTopic;
class Session;
class GroupCall;
class CloudImageView;
struct ReactionId;
int PeerColorIndex(PeerId peerId);
[[nodiscard]] int PeerColorIndex(PeerId peerId);
// Must be used only for PeerColor-s.
PeerId FakePeerIdForJustName(const QString &name);
[[nodiscard]] PeerId FakePeerIdForJustName(const QString &name);
class RestrictionCheckResult {
public:
@@ -264,13 +264,13 @@ public:
void setUserpicPhoto(const MTPPhoto &data);
void paintUserpic(
Painter &p,
std::shared_ptr<Data::CloudImageView> &view,
Ui::PeerUserpicView &view,
int x,
int y,
int size) const;
void paintUserpicLeft(
Painter &p,
std::shared_ptr<Data::CloudImageView> &view,
Ui::PeerUserpicView &view,
int x,
int y,
int w,
@@ -279,30 +279,14 @@ public:
}
void loadUserpic();
[[nodiscard]] bool hasUserpic() const;
[[nodiscard]] std::shared_ptr<Data::CloudImageView> activeUserpicView();
[[nodiscard]] std::shared_ptr<Data::CloudImageView> createUserpicView();
[[nodiscard]] bool useEmptyUserpic(
std::shared_ptr<Data::CloudImageView> &view) const;
[[nodiscard]] InMemoryKey userpicUniqueKey(
std::shared_ptr<Data::CloudImageView> &view) const;
void saveUserpic(
std::shared_ptr<Data::CloudImageView> &view,
const QString &path,
int size) const;
void saveUserpicRounded(
std::shared_ptr<Data::CloudImageView> &view,
const QString &path,
int size) const;
[[nodiscard]] QPixmap genUserpic(
std::shared_ptr<Data::CloudImageView> &view,
int size) const;
[[nodiscard]] Ui::PeerUserpicView activeUserpicView();
[[nodiscard]] Ui::PeerUserpicView createUserpicView();
[[nodiscard]] bool useEmptyUserpic(Ui::PeerUserpicView &view) const;
[[nodiscard]] InMemoryKey userpicUniqueKey(Ui::PeerUserpicView &view) const;
[[nodiscard]] QImage generateUserpicImage(
std::shared_ptr<Data::CloudImageView> &view,
int size) const;
[[nodiscard]] QImage generateUserpicImage(
std::shared_ptr<Data::CloudImageView> &view,
Ui::PeerUserpicView &view,
int size,
ImageRoundRadius radius) const;
std::optional<int> radius = {}) const;
[[nodiscard]] ImageLocation userpicLocation() const {
return _userpic.location();
}
@@ -332,8 +316,7 @@ public:
return _openLink;
}
[[nodiscard]] Image *currentUserpic(
std::shared_ptr<Data::CloudImageView> &view) const;
[[nodiscard]] QImage *userpicCloudImage(Ui::PeerUserpicView &view) const;
[[nodiscard]] bool canPinMessages() const;
[[nodiscard]] bool canEditMessagesIndefinitely() const;
@@ -423,6 +406,7 @@ protected:
const QString &newUsername);
void updateUserpic(PhotoId photoId, MTP::DcId dcId, bool hasVideo);
void clearUserpic();
void invalidateEmptyUserpic();
private:
void fillNames();