Additional info for chats in filters
This commit is contained in:
parent
2e3f6bc039
commit
215b302b09
5 changed files with 121 additions and 8 deletions
|
|
@ -2542,4 +2542,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ktg_phone_copied" = "Phone copied to clipboard.";
|
||||
"ktg_mention_copied" = "Username copied to clipboard.";
|
||||
|
||||
"ktg_status_mutual_contact" = "mutual contact";
|
||||
"ktg_status_contact" = "contact";
|
||||
"ktg_status_non_contact" = "non-contact";
|
||||
"ktg_supergroup_status" = "supergroup";
|
||||
|
||||
"ktg_group_status_not_in" = "not a member";
|
||||
"ktg_channel_status_not_in" = "not subscribed";
|
||||
"ktg_group_status_owner" = "is owner";
|
||||
"ktg_group_status_admin" = "is admin";
|
||||
|
||||
// Keys finished
|
||||
|
|
|
|||
|
|
@ -139,5 +139,13 @@
|
|||
"ktg_supergroup_id_copied": "ID супергруппы скопирован.",
|
||||
"ktg_channel_id_copied": "ID канала скопирован.",
|
||||
"ktg_phone_copied": "Номер телефона скопирован.",
|
||||
"ktg_mention_copied": "Имя пользователя скопировано."
|
||||
"ktg_mention_copied": "Имя пользователя скопировано.",
|
||||
"ktg_status_mutual_contact": "взаимный контакт",
|
||||
"ktg_status_contact": "контакт",
|
||||
"ktg_status_non_contact": "не контакт",
|
||||
"ktg_supergroup_status": "супергруппа",
|
||||
"ktg_group_status_not_in": "не участник",
|
||||
"ktg_channel_status_not_in": "не подписчик",
|
||||
"ktg_group_status_owner": "вы владелец",
|
||||
"ktg_group_status_admin": "вы админ"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/filters/edit_filter_chats_list.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
|
@ -19,6 +20,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/filter_icon_panel.h"
|
||||
#include "data/data_chat_filters.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_session.h"
|
||||
#include "kotato/json_settings.h"
|
||||
#include "settings/settings_common.h"
|
||||
|
|
@ -222,6 +226,8 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
|
|||
const auto nameLeft = st.namePosition.x();
|
||||
p.setFont(st::windowFilterSmallItem.nameStyle.font);
|
||||
const auto nameTop = st.namePosition.y();
|
||||
const auto chatNameTop = st.chatNamePosition.y();
|
||||
const auto chatDescTop = st.chatDescPosition.y();
|
||||
for (const auto &[flag, button] : _removeFlag) {
|
||||
PaintFilterChatsTypeIcon(
|
||||
p,
|
||||
|
|
@ -239,6 +245,9 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
|
|||
FilterChatsTypeName(flag));
|
||||
top += st.height;
|
||||
}
|
||||
|
||||
QStringList statuses;
|
||||
|
||||
for (auto &[history, userpic, button] : _removePeer) {
|
||||
const auto savedMessages = history->peer->isSelf();
|
||||
if (savedMessages) {
|
||||
|
|
@ -262,13 +271,90 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
|
|||
top + iconTop,
|
||||
width(),
|
||||
st.photoSize);
|
||||
|
||||
if (history->peer->isUser()) {
|
||||
const auto user = history->peer->asUser();
|
||||
const auto flags = user->flags();
|
||||
|
||||
if (user->isInaccessible()) {
|
||||
statuses << tr::ktg_user_status_unaccessible(tr::now);
|
||||
} else {
|
||||
if (user->isSupport()) {
|
||||
statuses << tr::lng_status_support(tr::now);
|
||||
}
|
||||
if (user->isBot()) {
|
||||
statuses << tr::lng_status_bot(tr::now);
|
||||
} else if (flags & MTPDuser::Flag::f_mutual_contact) {
|
||||
statuses << tr::ktg_status_mutual_contact(tr::now);
|
||||
} else if (flags & MTPDuser::Flag::f_contact) {
|
||||
statuses << tr::ktg_status_contact(tr::now);
|
||||
} else {
|
||||
statuses << tr::ktg_status_non_contact(tr::now);
|
||||
}
|
||||
}
|
||||
} else if (history->peer->isChat()) {
|
||||
statuses << tr::lng_group_status(tr::now);
|
||||
|
||||
const auto chat = history->peer->asChat();
|
||||
if (!chat->amIn()) {
|
||||
statuses << tr::ktg_group_status_not_in(tr::now);
|
||||
} else if (chat->amCreator()) {
|
||||
statuses << tr::ktg_group_status_owner(tr::now);
|
||||
} else if (chat->hasAdminRights()) {
|
||||
statuses << tr::ktg_group_status_admin(tr::now);
|
||||
}
|
||||
|
||||
} else if (history->peer->isChannel()) {
|
||||
if (history->peer->isMegagroup()) {
|
||||
statuses << tr::ktg_supergroup_status(tr::now);
|
||||
} else {
|
||||
statuses << tr::lng_channel_status(tr::now);
|
||||
}
|
||||
|
||||
const auto channel = history->peer->asChannel();
|
||||
if (!channel->amIn()) {
|
||||
statuses << (channel->isMegagroup()
|
||||
? tr::ktg_group_status_not_in(tr::now)
|
||||
: tr::ktg_channel_status_not_in(tr::now));
|
||||
} else if (channel->amCreator()) {
|
||||
statuses << tr::ktg_group_status_owner(tr::now);
|
||||
} else if (channel->hasAdminRights()) {
|
||||
statuses << tr::ktg_group_status_admin(tr::now);
|
||||
}
|
||||
}
|
||||
|
||||
p.setPen(st::contactsNameFg);
|
||||
history->peer->nameText().drawLeftElided(
|
||||
p,
|
||||
nameLeft,
|
||||
top + nameTop,
|
||||
button->x() - nameLeft,
|
||||
width());
|
||||
if (statuses.empty()) {
|
||||
p.setFont(st::windowFilterSmallItem.nameStyle.font);
|
||||
history->peer->nameText().drawLeftElided(
|
||||
p,
|
||||
nameLeft,
|
||||
top + nameTop,
|
||||
button->x() - nameLeft,
|
||||
width());
|
||||
} else {
|
||||
auto nameStr = Ui::Text::String{
|
||||
st::windowFilterChatNameStyle,
|
||||
history->peer->nameText().toString(),
|
||||
Ui::NameTextOptions() };
|
||||
|
||||
nameStr.drawLeftElided(
|
||||
p,
|
||||
nameLeft,
|
||||
top + chatNameTop,
|
||||
button->x() - nameLeft,
|
||||
width());
|
||||
|
||||
p.setPen(st::windowSubTextFg);
|
||||
p.setFont(st::windowFilterChatDescStyle.font);
|
||||
p.drawTextLeft(
|
||||
nameLeft,
|
||||
top + chatDescTop,
|
||||
width(),
|
||||
statuses.join(", "));
|
||||
|
||||
statuses.clear();
|
||||
}
|
||||
}
|
||||
top += st.height;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,8 @@ windowFilterSmallItem: PeerListItem(defaultPeerListItem) {
|
|||
height: 44px;
|
||||
photoPosition: point(15px, 5px);
|
||||
namePosition: point(62px, 14px);
|
||||
chatNamePosition: point(62px, 5px);
|
||||
chatDescPosition: point(62px, 23px);
|
||||
photoSize: 34px;
|
||||
checkbox: RoundImageCheckbox(defaultPeerListCheckbox) {
|
||||
imageRadius: 17px;
|
||||
|
|
@ -321,6 +323,13 @@ windowArchiveToast: Toast(defaultToast) {
|
|||
maxWidth: boxWideWidth;
|
||||
}
|
||||
|
||||
windowFilterChatNameStyle: TextStyle(defaultTextStyle) {
|
||||
font: font(11px semibold);
|
||||
}
|
||||
windowFilterChatDescStyle: TextStyle(defaultTextStyle) {
|
||||
font: font(11px);
|
||||
}
|
||||
|
||||
// Mac specific
|
||||
|
||||
macAccessoryWidth: 450.;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7afb927acff954c592af05d5621d50556cb9f0ca
|
||||
Subproject commit 300b93d200a95c10e84f6b89402d9447f1980382
|
||||
Loading…
Add table
Reference in a new issue