2017-12-05 08:43:18 +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.
|
2017-12-05 08:43:18 +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
|
2017-12-05 08:43:18 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
#include "base/weak_ptr.h"
|
|
|
|
|
2017-12-05 08:43:18 +00:00
|
|
|
namespace Ui {
|
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
class EmptyUserpic final : public base::has_weak_ptr {
|
2017-12-05 08:43:18 +00:00
|
|
|
public:
|
2022-12-03 15:57:15 +00:00
|
|
|
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
|
|
|
|
2022-12-03 15:57:15 +00:00
|
|
|
EmptyUserpic(const BgColors &colors, const QString &name);
|
2017-12-05 08:43:18 +00:00
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
void paintCircle(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 08:43:18 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size) const;
|
|
|
|
void paintRounded(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 08:43:18 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
2022-10-14 13:25:05 +00:00
|
|
|
int size,
|
|
|
|
int radius = 0) const;
|
2017-12-05 08:43:18 +00:00
|
|
|
void paintSquare(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 08:43:18 +00:00
|
|
|
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;
|
2017-12-05 08:43:18 +00:00
|
|
|
|
2017-12-05 11:50:32 +00:00
|
|
|
static void PaintSavedMessages(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 11:50:32 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size);
|
2017-12-05 16:48:03 +00:00
|
|
|
static void PaintSavedMessages(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 16:48:03 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size,
|
2022-12-03 15:57:15 +00:00
|
|
|
QBrush bg,
|
2017-12-05 16:48:03 +00:00
|
|
|
const style::color &fg);
|
2022-12-05 12:18:10 +00:00
|
|
|
[[nodiscard]] static QImage GenerateSavedMessages(int size);
|
2017-12-05 11:50:32 +00:00
|
|
|
|
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,
|
2022-12-03 15:57:15 +00:00
|
|
|
QBrush bg,
|
2020-09-11 15:33:26 +00:00
|
|
|
const style::color &fg);
|
2022-12-05 12:18:10 +00:00
|
|
|
[[nodiscard]] static QImage GenerateRepliesMessages(int size);
|
2020-09-11 15:33:26 +00:00
|
|
|
|
2017-12-05 08:43:18 +00:00
|
|
|
~EmptyUserpic();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void paint(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2017-12-05 08:43:18 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size,
|
2022-12-03 17:36:08 +00:00
|
|
|
Fn<void()> paintBackground) const;
|
2017-12-05 08:43:18 +00:00
|
|
|
|
|
|
|
void fillString(const QString &name);
|
|
|
|
|
2022-12-03 15:57:15 +00:00
|
|
|
const BgColors _colors;
|
2017-12-05 08:43:18 +00:00
|
|
|
QString _string;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Ui
|