mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added icon for inaccessible users.
This commit is contained in:
parent
3467fe226f
commit
823b4e6b98
11 changed files with 49 additions and 3 deletions
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic.png
Normal file
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic@2x.png
Normal file
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic@3x.png
Normal file
BIN
Telegram/Resources/icons/dialogs/inaccessible_userpic@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
BIN
Telegram/Resources/icons/info/inaccessible_userpic.png
Normal file
BIN
Telegram/Resources/icons/info/inaccessible_userpic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
Telegram/Resources/icons/info/inaccessible_userpic@2x.png
Normal file
BIN
Telegram/Resources/icons/info/inaccessible_userpic@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
Telegram/Resources/icons/info/inaccessible_userpic@3x.png
Normal file
BIN
Telegram/Resources/icons/info/inaccessible_userpic@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4 KiB |
|
@ -248,9 +248,12 @@ void PeerData::updateNameDelayed(
|
|||
|
||||
not_null<Ui::EmptyUserpic*> PeerData::ensureEmptyUserpic() const {
|
||||
if (!_userpicEmpty) {
|
||||
const auto user = asUser();
|
||||
_userpicEmpty = std::make_unique<Ui::EmptyUserpic>(
|
||||
Data::PeerUserpicColor(id),
|
||||
name());
|
||||
user && user->isInaccessible()
|
||||
? Ui::EmptyUserpic::InaccessibleName()
|
||||
: name());
|
||||
}
|
||||
return _userpicEmpty.get();
|
||||
}
|
||||
|
|
|
@ -319,6 +319,7 @@ dialogsForumIconOver: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgOver, po
|
|||
dialogsForumIconActive: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
|
||||
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
|
||||
dialogsInaccessibleUserpic: icon {{ "dialogs/inaccessible_userpic", historyPeerUserpicFg }};
|
||||
|
||||
dialogsSendStateSkip: 20px;
|
||||
dialogsSendingIcon: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||
|
|
|
@ -326,6 +326,8 @@ infoTopicCover: InfoProfileCover(infoProfileMegagroupCover) {
|
|||
statusTop: 38px;
|
||||
}
|
||||
|
||||
infoProfileInaccessibleUserpic: icon {{ "info/inaccessible_userpic", historyPeerUserpicFg }};
|
||||
|
||||
infoVerifiedCheckPosition: point(4px, 2px);
|
||||
infoVerifiedCheck: icon {
|
||||
{ "profile_verified_star", profileVerifiedCheckBg },
|
||||
|
|
|
@ -23,7 +23,13 @@ namespace {
|
|||
[[nodiscard]] bool IsExternal(const QString &name) {
|
||||
return !name.isEmpty()
|
||||
&& (name.front() == QChar(0))
|
||||
&& QStringView(name).mid(1) == qstr("external");
|
||||
&& QStringView(name).mid(1) == u"external"_q;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsInaccessible(const QString &name) {
|
||||
return !name.isEmpty()
|
||||
&& (name.front() == QChar(0))
|
||||
&& QStringView(name).mid(1) == u"inaccessible"_q;
|
||||
}
|
||||
|
||||
void PaintSavedMessagesInner(
|
||||
|
@ -161,6 +167,33 @@ void PaintExternalMessagesInner(
|
|||
fg);
|
||||
}
|
||||
|
||||
void PaintInaccessibleAccountInner(
|
||||
QPainter &p,
|
||||
int x,
|
||||
int y,
|
||||
int size,
|
||||
const style::color &fg) {
|
||||
if (size > st::defaultDialogRow.photoSize) {
|
||||
PaintIconInner(
|
||||
p,
|
||||
x,
|
||||
y,
|
||||
size,
|
||||
st::infoProfilePhotoInnerSize,
|
||||
st::infoProfileInaccessibleUserpic,
|
||||
fg);
|
||||
} else {
|
||||
PaintIconInner(
|
||||
p,
|
||||
x,
|
||||
y,
|
||||
size,
|
||||
st::defaultDialogRow.photoSize,
|
||||
st::dialogsInaccessibleUserpic,
|
||||
fg);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Callback>
|
||||
[[nodiscard]] QPixmap Generate(int size, Callback callback) {
|
||||
auto result = QImage(
|
||||
|
@ -186,6 +219,10 @@ QString EmptyUserpic::ExternalName() {
|
|||
return QChar(0) + u"external"_q;
|
||||
}
|
||||
|
||||
QString EmptyUserpic::InaccessibleName() {
|
||||
return QChar(0) + u"inaccessible"_q;
|
||||
}
|
||||
|
||||
template <typename Callback>
|
||||
void EmptyUserpic::paint(
|
||||
QPainter &p,
|
||||
|
@ -207,6 +244,8 @@ void EmptyUserpic::paint(
|
|||
|
||||
if (IsExternal(_string)) {
|
||||
PaintExternalMessagesInner(p, x, y, size, st::historyPeerUserpicFg);
|
||||
} else if (IsInaccessible(_string)) {
|
||||
PaintInaccessibleAccountInner(p, x, y, size, st::historyPeerUserpicFg);
|
||||
} else {
|
||||
p.setFont(font);
|
||||
p.setBrush(Qt::NoBrush);
|
||||
|
@ -410,7 +449,7 @@ QPixmap EmptyUserpic::generate(int size) {
|
|||
}
|
||||
|
||||
void EmptyUserpic::fillString(const QString &name) {
|
||||
if (IsExternal(name)) {
|
||||
if (IsExternal(name) || IsInaccessible(name)) {
|
||||
_string = name;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Ui {
|
|||
class EmptyUserpic {
|
||||
public:
|
||||
[[nodiscard]] static QString ExternalName();
|
||||
[[nodiscard]] static QString InaccessibleName();
|
||||
|
||||
EmptyUserpic(const style::color &color, const QString &name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue