tdesktop/Telegram/SourceFiles/ui/empty_userpic.h

103 lines
1.9 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/weak_ptr.h"
namespace Ui {
class EmptyUserpic final : public base::has_weak_ptr {
public:
struct BgColors {
const style::color color1;
const style::color color2;
};
2023-10-16 09:52:08 +00:00
[[nodiscard]] static uint8 ColorIndex(uint64 id);
[[nodiscard]] static EmptyUserpic::BgColors UserpicColor(
uint8 colorIndex);
2022-12-03 17:36:08 +00:00
2021-01-20 14:09:45 +00:00
[[nodiscard]] static QString ExternalName();
2022-11-11 06:40:33 +00:00
[[nodiscard]] static QString InaccessibleName();
2021-01-20 14:09:45 +00:00
EmptyUserpic(const BgColors &colors, const QString &name);
void paintCircle(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
int size) const;
void paintRounded(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
2022-10-14 13:25:05 +00:00
int size,
int radius = 0) const;
void paintSquare(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
int size) const;
2022-12-03 17:36:08 +00:00
[[nodiscard]] QPixmap generate(int size);
[[nodiscard]] std::pair<uint64, uint64> uniqueKey() const;
static void PaintSavedMessages(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
int size);
static void PaintSavedMessages(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
int size,
QBrush bg,
const style::color &fg);
[[nodiscard]] static QImage GenerateSavedMessages(int size);
2020-09-11 15:33:26 +00:00
static void PaintRepliesMessages(
2022-09-16 20:23:27 +00:00
QPainter &p,
2020-09-11 15:33:26 +00:00
int x,
int y,
int outerWidth,
int size);
static void PaintRepliesMessages(
2022-09-16 20:23:27 +00:00
QPainter &p,
2020-09-11 15:33:26 +00:00
int x,
int y,
int outerWidth,
int size,
QBrush bg,
2020-09-11 15:33:26 +00:00
const style::color &fg);
[[nodiscard]] static QImage GenerateRepliesMessages(int size);
2020-09-11 15:33:26 +00:00
~EmptyUserpic();
private:
void paint(
2022-09-16 20:23:27 +00:00
QPainter &p,
int x,
int y,
int outerWidth,
int size,
2022-12-03 17:36:08 +00:00
Fn<void()> paintBackground) const;
void fillString(const QString &name);
const BgColors _colors;
QString _string;
};
} // namespace Ui