mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: show badges in dialogs list
This commit is contained in:
parent
5d96eab7b4
commit
51122ab3ba
13 changed files with 115 additions and 2 deletions
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 401 B |
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official@2x.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 712 B |
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official@3x.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_official@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 957 B |
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 282 B |
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter@2x.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 415 B |
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter@3x.png
Normal file
BIN
Telegram/Resources/icons/ayu/dialogs_extera_supporter@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 568 B |
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
using "ui/colors.palette";
|
using "ui/colors.palette";
|
||||||
using "ui/widgets/widgets.style";
|
using "ui/widgets/widgets.style";
|
||||||
|
using "dialogs/dialogs.style";
|
||||||
|
|
||||||
ayuGhostIcon: icon {{ "ayu/ghost", menuIconColor }};
|
ayuGhostIcon: icon {{ "ayu/ghost", menuIconColor }};
|
||||||
ayuMenuIcon: icon {{ "ayu/ayu_menu", menuIconColor }};
|
ayuMenuIcon: icon {{ "ayu/ayu_menu", menuIconColor }};
|
||||||
|
@ -40,3 +41,14 @@ editedIconPadding: margins(0px, 0px, 0px, 0px);
|
||||||
|
|
||||||
deletedIcon: icon {{ "ayu/trash_bin", windowFg }};
|
deletedIcon: icon {{ "ayu/trash_bin", windowFg }};
|
||||||
deletedIconPadding: margins(0px, 0px, 0px, 0px);
|
deletedIconPadding: margins(0px, 0px, 0px, 0px);
|
||||||
|
|
||||||
|
dialogsExteraOfficialIcon: ThreeStateIcon {
|
||||||
|
icon: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBg }};
|
||||||
|
over: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBgOver }};
|
||||||
|
active: icon {{ "ayu/dialogs_extera_official", dialogsVerifiedIconBgActive }};
|
||||||
|
}
|
||||||
|
dialogsExteraSupporterIcon: ThreeStateIcon {
|
||||||
|
icon: icon {{ "ayu/dialogs_extera_supporter", dialogsVerifiedIconBg }};
|
||||||
|
over: icon {{ "ayu/dialogs_extera_supporter", dialogsVerifiedIconBgOver }};
|
||||||
|
active: icon {{ "ayu/dialogs_extera_supporter", dialogsVerifiedIconBgActive }};
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <xxhash.h> // XXH64.
|
#include <xxhash.h> // XXH64.
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "styles/style_ayu_icons.h"
|
||||||
|
|
||||||
|
|
||||||
[[nodiscard]] PeerListRowId UniqueRowIdFromString(const QString &d) {
|
[[nodiscard]] PeerListRowId UniqueRowIdFromString(const QString &d) {
|
||||||
return XXH64(d.data(), d.size() * sizeof(ushort), 0);
|
return XXH64(d.data(), d.size() * sizeof(ushort), 0);
|
||||||
}
|
}
|
||||||
|
@ -800,6 +804,12 @@ int PeerListRow::paintNameIconGetWidth(
|
||||||
.verified = &(selected
|
.verified = &(selected
|
||||||
? st::dialogsVerifiedIconOver
|
? st::dialogsVerifiedIconOver
|
||||||
: st::dialogsVerifiedIcon),
|
: st::dialogsVerifiedIcon),
|
||||||
|
.exteraOfficial = &(selected
|
||||||
|
? st::dialogsExteraOfficialIcon.over
|
||||||
|
: st::dialogsExteraOfficialIcon.icon),
|
||||||
|
.exteraSupporter = &(selected
|
||||||
|
? st::dialogsExteraSupporterIcon.over
|
||||||
|
: st::dialogsExteraSupporterIcon.icon),
|
||||||
.premium = &(selected
|
.premium = &(selected
|
||||||
? st::dialogsPremiumIcon.over
|
? st::dialogsPremiumIcon.over
|
||||||
: st::dialogsPremiumIcon.icon),
|
: st::dialogsPremiumIcon.icon),
|
||||||
|
|
|
@ -84,6 +84,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "styles/style_ayu_icons.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -1458,6 +1462,14 @@ void InnerWidget::paintPeerSearchResult(
|
||||||
: context.selected
|
: context.selected
|
||||||
? &st::dialogsVerifiedIconOver
|
? &st::dialogsVerifiedIconOver
|
||||||
: &st::dialogsVerifiedIcon),
|
: &st::dialogsVerifiedIcon),
|
||||||
|
.exteraOfficial = &ThreeStateIcon(
|
||||||
|
st::dialogsExteraOfficialIcon,
|
||||||
|
context.active,
|
||||||
|
context.selected),
|
||||||
|
.exteraSupporter = &ThreeStateIcon(
|
||||||
|
st::dialogsExteraSupporterIcon,
|
||||||
|
context.active,
|
||||||
|
context.selected),
|
||||||
.premium = &ThreeStateIcon(
|
.premium = &ThreeStateIcon(
|
||||||
st::dialogsPremiumIcon,
|
st::dialogsPremiumIcon,
|
||||||
context.active,
|
context.active,
|
||||||
|
|
|
@ -44,6 +44,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "styles/style_ayu_icons.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Dialogs::Ui {
|
namespace Dialogs::Ui {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -716,6 +720,14 @@ void PaintRow(
|
||||||
: context.selected
|
: context.selected
|
||||||
? &st::dialogsVerifiedIconOver
|
? &st::dialogsVerifiedIconOver
|
||||||
: &st::dialogsVerifiedIcon),
|
: &st::dialogsVerifiedIcon),
|
||||||
|
.exteraOfficial = &ThreeStateIcon(
|
||||||
|
st::dialogsExteraOfficialIcon,
|
||||||
|
context.active,
|
||||||
|
context.selected),
|
||||||
|
.exteraSupporter = &ThreeStateIcon(
|
||||||
|
st::dialogsExteraSupporterIcon,
|
||||||
|
context.active,
|
||||||
|
context.selected),
|
||||||
.premium = &ThreeStateIcon(
|
.premium = &ThreeStateIcon(
|
||||||
st::dialogsPremiumIcon,
|
st::dialogsPremiumIcon,
|
||||||
context.active,
|
context.active,
|
||||||
|
|
|
@ -74,6 +74,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_chat_filters.h"
|
#include "data/data_chat_filters.h"
|
||||||
#include "history/admin_log/history_admin_log_section.h"
|
#include "history/admin_log/history_admin_log_section.h"
|
||||||
#include "styles/style_ayu_styles.h"
|
#include "styles/style_ayu_styles.h"
|
||||||
|
#include "styles/style_ayu_icons.h"
|
||||||
|
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
|
@ -616,6 +617,8 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
||||||
.nameWidth = _title.maxWidth(),
|
.nameWidth = _title.maxWidth(),
|
||||||
.outerWidth = width(),
|
.outerWidth = width(),
|
||||||
.verified = &st::dialogsVerifiedIcon,
|
.verified = &st::dialogsVerifiedIcon,
|
||||||
|
.exteraOfficial = &st::dialogsExteraOfficialIcon.icon,
|
||||||
|
.exteraSupporter = &st::dialogsExteraSupporterIcon.icon,
|
||||||
.premium = &st::dialogsPremiumIcon.icon,
|
.premium = &st::dialogsPremiumIcon.icon,
|
||||||
.scam = &st::attentionButtonFg,
|
.scam = &st::attentionButtonFg,
|
||||||
.premiumFg = &st::dialogsVerifiedIconBg,
|
.premiumFg = &st::dialogsVerifiedIconBg,
|
||||||
|
|
|
@ -19,6 +19,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/unread_badge_paint.h"
|
#include "ui/unread_badge_paint.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -154,6 +158,16 @@ int PeerBadge::drawGetWidth(Painter &p, Descriptor &&descriptor) {
|
||||||
&& (!paintVerify || descriptor.bothVerifyAndStatus);
|
&& (!paintVerify || descriptor.bothVerifyAndStatus);
|
||||||
const auto paintStar = premiumStar && !paintVerify;
|
const auto paintStar = premiumStar && !paintVerify;
|
||||||
|
|
||||||
|
const auto paintExteraDev =
|
||||||
|
isExteraPeer(getBareID(peer)) && (!paintEmoji || descriptor.bothVerifyAndStatus);
|
||||||
|
const auto paintExteraSupporter = !paintExteraDev &&
|
||||||
|
isSupporterPeer(getBareID(peer)) && (!paintEmoji || descriptor.bothVerifyAndStatus);
|
||||||
|
const auto exteraWidth = paintExteraDev
|
||||||
|
? descriptor.exteraOfficial->width()
|
||||||
|
: paintExteraSupporter
|
||||||
|
? descriptor.exteraSupporter->width()
|
||||||
|
: 0;
|
||||||
|
|
||||||
auto result = 0;
|
auto result = 0;
|
||||||
if (paintEmoji) {
|
if (paintEmoji) {
|
||||||
auto &rectForName = descriptor.rectForName;
|
auto &rectForName = descriptor.rectForName;
|
||||||
|
@ -161,13 +175,34 @@ int PeerBadge::drawGetWidth(Painter &p, Descriptor &&descriptor) {
|
||||||
if (paintVerify) {
|
if (paintVerify) {
|
||||||
rectForName.setWidth(rectForName.width() - verifyWidth);
|
rectForName.setWidth(rectForName.width() - verifyWidth);
|
||||||
}
|
}
|
||||||
|
if (paintExteraDev || paintExteraSupporter) {
|
||||||
|
rectForName.setWidth(rectForName.width() - exteraWidth);
|
||||||
|
}
|
||||||
result += drawPremiumEmojiStatus(p, descriptor);
|
result += drawPremiumEmojiStatus(p, descriptor);
|
||||||
if (!paintVerify) {
|
if (!paintVerify && !paintExteraDev) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
rectForName.setWidth(rectForName.width() + verifyWidth);
|
if (paintVerify) {
|
||||||
|
rectForName.setWidth(rectForName.width() + verifyWidth);
|
||||||
|
}
|
||||||
|
if (paintExteraDev || paintExteraSupporter) {
|
||||||
|
rectForName.setWidth(rectForName.width() + exteraWidth);
|
||||||
|
}
|
||||||
descriptor.nameWidth += result;
|
descriptor.nameWidth += result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paintExteraDev || paintExteraSupporter) {
|
||||||
|
if (paintStar) {
|
||||||
|
auto &rectForName = descriptor.rectForName;
|
||||||
|
rectForName.setWidth(rectForName.width() - exteraWidth);
|
||||||
|
result += drawPremiumStar(p, descriptor);
|
||||||
|
rectForName.setWidth(rectForName.width() + exteraWidth);
|
||||||
|
descriptor.nameWidth += result;
|
||||||
|
}
|
||||||
|
result += paintExteraDev ? drawExteraOfficial(p, descriptor) : drawExteraSupporter(p, descriptor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (paintVerify) {
|
if (paintVerify) {
|
||||||
result += drawVerifyCheck(p, descriptor);
|
result += drawVerifyCheck(p, descriptor);
|
||||||
return result;
|
return result;
|
||||||
|
@ -267,6 +302,30 @@ int PeerBadge::drawPremiumStar(Painter &p, const Descriptor &descriptor) {
|
||||||
return iconw;
|
return iconw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PeerBadge::drawExteraOfficial(Painter &p, const Descriptor &descriptor) {
|
||||||
|
const auto iconw = descriptor.exteraOfficial->width();
|
||||||
|
const auto rectForName = descriptor.rectForName;
|
||||||
|
const auto nameWidth = descriptor.nameWidth;
|
||||||
|
descriptor.exteraOfficial->paint(
|
||||||
|
p,
|
||||||
|
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
|
||||||
|
rectForName.y(),
|
||||||
|
descriptor.outerWidth);
|
||||||
|
return iconw;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PeerBadge::drawExteraSupporter(Painter &p, const Descriptor &descriptor) {
|
||||||
|
const auto iconw = descriptor.exteraSupporter->width();
|
||||||
|
const auto rectForName = descriptor.rectForName;
|
||||||
|
const auto nameWidth = descriptor.nameWidth;
|
||||||
|
descriptor.exteraSupporter->paint(
|
||||||
|
p,
|
||||||
|
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
|
||||||
|
rectForName.y(),
|
||||||
|
descriptor.outerWidth);
|
||||||
|
return iconw;
|
||||||
|
}
|
||||||
|
|
||||||
void PeerBadge::unload() {
|
void PeerBadge::unload() {
|
||||||
_emojiStatus = nullptr;
|
_emojiStatus = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
int nameWidth = 0;
|
int nameWidth = 0;
|
||||||
int outerWidth = 0;
|
int outerWidth = 0;
|
||||||
const style::icon *verified = nullptr;
|
const style::icon *verified = nullptr;
|
||||||
|
const style::icon *exteraOfficial = nullptr;
|
||||||
|
const style::icon *exteraSupporter = nullptr;
|
||||||
const style::icon *premium = nullptr;
|
const style::icon *premium = nullptr;
|
||||||
const style::color *scam = nullptr;
|
const style::color *scam = nullptr;
|
||||||
const style::color *premiumFg = nullptr;
|
const style::color *premiumFg = nullptr;
|
||||||
|
@ -89,6 +91,9 @@ private:
|
||||||
int drawPremiumEmojiStatus(Painter &p, const Descriptor &descriptor);
|
int drawPremiumEmojiStatus(Painter &p, const Descriptor &descriptor);
|
||||||
int drawPremiumStar(Painter &p, const Descriptor &descriptor);
|
int drawPremiumStar(Painter &p, const Descriptor &descriptor);
|
||||||
|
|
||||||
|
int drawExteraOfficial(Painter &p, const Descriptor &descriptor);
|
||||||
|
int drawExteraSupporter(Painter &p, const Descriptor &descriptor);
|
||||||
|
|
||||||
std::unique_ptr<EmojiStatus> _emojiStatus;
|
std::unique_ptr<EmojiStatus> _emojiStatus;
|
||||||
mutable std::unique_ptr<BotVerifiedData> _botVerifiedData;
|
mutable std::unique_ptr<BotVerifiedData> _botVerifiedData;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue