mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 {
|
not_null<Ui::EmptyUserpic*> PeerData::ensureEmptyUserpic() const {
|
||||||
if (!_userpicEmpty) {
|
if (!_userpicEmpty) {
|
||||||
|
const auto user = asUser();
|
||||||
_userpicEmpty = std::make_unique<Ui::EmptyUserpic>(
|
_userpicEmpty = std::make_unique<Ui::EmptyUserpic>(
|
||||||
Data::PeerUserpicColor(id),
|
Data::PeerUserpicColor(id),
|
||||||
name());
|
user && user->isInaccessible()
|
||||||
|
? Ui::EmptyUserpic::InaccessibleName()
|
||||||
|
: name());
|
||||||
}
|
}
|
||||||
return _userpicEmpty.get();
|
return _userpicEmpty.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,7 @@ dialogsForumIconOver: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgOver, po
|
||||||
dialogsForumIconActive: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgActive, point(1px, 4px) }};
|
dialogsForumIconActive: icon {{ "dialogs/dialogs_forum", dialogsChatIconFgActive, point(1px, 4px) }};
|
||||||
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
|
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
|
||||||
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
|
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
|
||||||
|
dialogsInaccessibleUserpic: icon {{ "dialogs/inaccessible_userpic", historyPeerUserpicFg }};
|
||||||
|
|
||||||
dialogsSendStateSkip: 20px;
|
dialogsSendStateSkip: 20px;
|
||||||
dialogsSendingIcon: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
dialogsSendingIcon: icon {{ "dialogs/dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||||
|
|
|
@ -326,6 +326,8 @@ infoTopicCover: InfoProfileCover(infoProfileMegagroupCover) {
|
||||||
statusTop: 38px;
|
statusTop: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infoProfileInaccessibleUserpic: icon {{ "info/inaccessible_userpic", historyPeerUserpicFg }};
|
||||||
|
|
||||||
infoVerifiedCheckPosition: point(4px, 2px);
|
infoVerifiedCheckPosition: point(4px, 2px);
|
||||||
infoVerifiedCheck: icon {
|
infoVerifiedCheck: icon {
|
||||||
{ "profile_verified_star", profileVerifiedCheckBg },
|
{ "profile_verified_star", profileVerifiedCheckBg },
|
||||||
|
|
|
@ -23,7 +23,13 @@ namespace {
|
||||||
[[nodiscard]] bool IsExternal(const QString &name) {
|
[[nodiscard]] bool IsExternal(const QString &name) {
|
||||||
return !name.isEmpty()
|
return !name.isEmpty()
|
||||||
&& (name.front() == QChar(0))
|
&& (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(
|
void PaintSavedMessagesInner(
|
||||||
|
@ -161,6 +167,33 @@ void PaintExternalMessagesInner(
|
||||||
fg);
|
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>
|
template <typename Callback>
|
||||||
[[nodiscard]] QPixmap Generate(int size, Callback callback) {
|
[[nodiscard]] QPixmap Generate(int size, Callback callback) {
|
||||||
auto result = QImage(
|
auto result = QImage(
|
||||||
|
@ -186,6 +219,10 @@ QString EmptyUserpic::ExternalName() {
|
||||||
return QChar(0) + u"external"_q;
|
return QChar(0) + u"external"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString EmptyUserpic::InaccessibleName() {
|
||||||
|
return QChar(0) + u"inaccessible"_q;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
void EmptyUserpic::paint(
|
void EmptyUserpic::paint(
|
||||||
QPainter &p,
|
QPainter &p,
|
||||||
|
@ -207,6 +244,8 @@ void EmptyUserpic::paint(
|
||||||
|
|
||||||
if (IsExternal(_string)) {
|
if (IsExternal(_string)) {
|
||||||
PaintExternalMessagesInner(p, x, y, size, st::historyPeerUserpicFg);
|
PaintExternalMessagesInner(p, x, y, size, st::historyPeerUserpicFg);
|
||||||
|
} else if (IsInaccessible(_string)) {
|
||||||
|
PaintInaccessibleAccountInner(p, x, y, size, st::historyPeerUserpicFg);
|
||||||
} else {
|
} else {
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
p.setBrush(Qt::NoBrush);
|
p.setBrush(Qt::NoBrush);
|
||||||
|
@ -410,7 +449,7 @@ QPixmap EmptyUserpic::generate(int size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyUserpic::fillString(const QString &name) {
|
void EmptyUserpic::fillString(const QString &name) {
|
||||||
if (IsExternal(name)) {
|
if (IsExternal(name) || IsInaccessible(name)) {
|
||||||
_string = name;
|
_string = name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Ui {
|
||||||
class EmptyUserpic {
|
class EmptyUserpic {
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static QString ExternalName();
|
[[nodiscard]] static QString ExternalName();
|
||||||
|
[[nodiscard]] static QString InaccessibleName();
|
||||||
|
|
||||||
EmptyUserpic(const style::color &color, const QString &name);
|
EmptyUserpic(const style::color &color, const QString &name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue