mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 23:43:06 +02:00
Improve topics layout management.
This commit is contained in:
parent
853757e611
commit
d0e5ea78a5
7 changed files with 37 additions and 16 deletions
|
@ -2078,6 +2078,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_action_changed_title" = "{from} changed group name to «{title}»";
|
"lng_action_changed_title" = "{from} changed group name to «{title}»";
|
||||||
"lng_action_changed_title_channel" = "Channel name was changed to «{title}»";
|
"lng_action_changed_title_channel" = "Channel name was changed to «{title}»";
|
||||||
"lng_action_created_chat" = "{from} created the group «{title}»";
|
"lng_action_created_chat" = "{from} created the group «{title}»";
|
||||||
|
"lng_action_created_monoforum" = "Direct messages were enabled in this channel.";
|
||||||
"lng_action_ttl_changed" = "{from} set messages to auto-delete in {duration}";
|
"lng_action_ttl_changed" = "{from} set messages to auto-delete in {duration}";
|
||||||
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
|
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
|
||||||
"lng_action_ttl_changed_channel" = "Messages in this channel will be automatically deleted after {duration}";
|
"lng_action_ttl_changed_channel" = "Messages in this channel will be automatically deleted after {duration}";
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ void Controller::fillDirectMessagesButton() {
|
||||||
tr::lng_manage_monoforum(),
|
tr::lng_manage_monoforum(),
|
||||||
std::move(label),
|
std::move(label),
|
||||||
[=] { showEditDirectMessagesBox(); },
|
[=] { showEditDirectMessagesBox(); },
|
||||||
{ &st::menuIconChatBubble });
|
{ .icon = &st::menuIconChatBubble, .newBadge = true });
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//void Controller::fillInviteLinkButton() {
|
//void Controller::fillInviteLinkButton() {
|
||||||
|
@ -1127,7 +1127,7 @@ void Controller::fillForumButton() {
|
||||||
changes->events_starting_with({}) | rpl::map(label),
|
changes->events_starting_with({}) | rpl::map(label),
|
||||||
[] {},
|
[] {},
|
||||||
st::manageGroupTopicsButton,
|
st::manageGroupTopicsButton,
|
||||||
{ &st::menuIconTopics }));
|
{ .icon = &st::menuIconTopics, .newBadge = true }));
|
||||||
|
|
||||||
button->setClickedCallback(crl::guard(this, [=] {
|
button->setClickedCallback(crl::guard(this, [=] {
|
||||||
if (!*_forumSavedValue && _controls.forumToggleLocked) {
|
if (!*_forumSavedValue && _controls.forumToggleLocked) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ LayoutButton::LayoutButton(
|
||||||
const auto icon = iconWidget.release();
|
const auto icon = iconWidget.release();
|
||||||
setClickedCallback([=] {
|
setClickedCallback([=] {
|
||||||
group->setValue(type);
|
group->setValue(type);
|
||||||
|
iconAnimate(anim::repeat::once);
|
||||||
});
|
});
|
||||||
group->value() | rpl::start_with_next([=](LayoutType value) {
|
group->value() | rpl::start_with_next([=](LayoutType value) {
|
||||||
const auto active = (value == type);
|
const auto active = (value == type);
|
||||||
|
@ -93,9 +94,6 @@ LayoutButton::LayoutButton(
|
||||||
}
|
}
|
||||||
_active = active;
|
_active = active;
|
||||||
_text.update();
|
_text.update();
|
||||||
if (_active) {
|
|
||||||
iconAnimate(anim::repeat::once);
|
|
||||||
}
|
|
||||||
_activeAnimation.start([=] {
|
_activeAnimation.start([=] {
|
||||||
icon->update();
|
icon->update();
|
||||||
}, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration);
|
}, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration);
|
||||||
|
@ -170,6 +168,10 @@ void ToggleTopicsBox(
|
||||||
st::settingsButtonNoIcon));
|
st::settingsButtonNoIcon));
|
||||||
toggle->toggleOn(rpl::single(enabled));
|
toggle->toggleOn(rpl::single(enabled));
|
||||||
|
|
||||||
|
Ui::AddSkip(container);
|
||||||
|
Ui::AddDivider(container);
|
||||||
|
Ui::AddSkip(container);
|
||||||
|
|
||||||
const auto group = std::make_shared<Ui::RadioenumGroup<LayoutType>>(tabs
|
const auto group = std::make_shared<Ui::RadioenumGroup<LayoutType>>(tabs
|
||||||
? LayoutType::Tabs
|
? LayoutType::Tabs
|
||||||
: LayoutType::List);
|
: LayoutType::List);
|
||||||
|
|
|
@ -110,6 +110,7 @@ void TopicsView::prepare(MsgId frontRootId, Fn<void()> customEmojiRepaint) {
|
||||||
_jumpToTopic = false;
|
_jumpToTopic = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_allLoaded = _forum->topicsList()->loaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopicsView::prepare(PeerId frontPeerId, Fn<void()> customEmojiRepaint) {
|
void TopicsView::prepare(PeerId frontPeerId, Fn<void()> customEmojiRepaint) {
|
||||||
|
@ -182,6 +183,7 @@ void TopicsView::prepare(PeerId frontPeerId, Fn<void()> customEmojiRepaint) {
|
||||||
_jumpToTopic = false;
|
_jumpToTopic = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_allLoaded = _monoforum->chatsList()->loaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TopicsView::jumpToTopicWidth() const {
|
int TopicsView::jumpToTopicWidth() const {
|
||||||
|
@ -207,10 +209,13 @@ void TopicsView::paint(
|
||||||
rect.setWidth(rect.width() - _lastTopicJumpGeometry.rightCut);
|
rect.setWidth(rect.width() - _lastTopicJumpGeometry.rightCut);
|
||||||
auto skipBig = _jumpToTopic && !context.active;
|
auto skipBig = _jumpToTopic && !context.active;
|
||||||
if (_titles.empty()) {
|
if (_titles.empty()) {
|
||||||
|
const auto text = (_monoforum && _allLoaded)
|
||||||
|
? tr::lng_filters_no_chats(tr::now)
|
||||||
|
: tr::lng_contacts_loading(tr::now);
|
||||||
p.drawText(
|
p.drawText(
|
||||||
rect.x(),
|
rect.x(),
|
||||||
rect.y() + st::normalFont->ascent,
|
rect.y() + st::normalFont->ascent,
|
||||||
tr::lng_contacts_loading(tr::now));
|
text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto &title : _titles) {
|
for (const auto &title : _titles) {
|
||||||
|
|
|
@ -121,6 +121,7 @@ private:
|
||||||
JumpToLastGeometry _lastTopicJumpGeometry;
|
JumpToLastGeometry _lastTopicJumpGeometry;
|
||||||
int _version = -1;
|
int _version = -1;
|
||||||
bool _jumpToTopic = false;
|
bool _jumpToTopic = false;
|
||||||
|
bool _allLoaded = false;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
|
|
|
@ -4632,20 +4632,30 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
||||||
|
|
||||||
auto prepareChatCreate = [this](const MTPDmessageActionChatCreate &action) {
|
auto prepareChatCreate = [this](const MTPDmessageActionChatCreate &action) {
|
||||||
auto result = PreparedServiceText();
|
auto result = PreparedServiceText();
|
||||||
result.links.push_back(fromLink());
|
if (_history->peer->isMonoforum()) {
|
||||||
result.text = tr::lng_action_created_chat(
|
result.text = tr::lng_action_created_monoforum(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_from,
|
Ui::Text::WithEntities);
|
||||||
fromLinkText(), // Link 1.
|
} else {
|
||||||
lt_title,
|
result.links.push_back(fromLink());
|
||||||
{ .text = qs(action.vtitle()) },
|
result.text = tr::lng_action_created_chat(
|
||||||
Ui::Text::WithEntities);
|
tr::now,
|
||||||
|
lt_from,
|
||||||
|
fromLinkText(), // Link 1.
|
||||||
|
lt_title,
|
||||||
|
{ .text = qs(action.vtitle()) },
|
||||||
|
Ui::Text::WithEntities);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto prepareChannelCreate = [this](const MTPDmessageActionChannelCreate &action) {
|
auto prepareChannelCreate = [this](const MTPDmessageActionChannelCreate &action) {
|
||||||
auto result = PreparedServiceText();
|
auto result = PreparedServiceText();
|
||||||
if (isPost()) {
|
if (_history->peer->isMonoforum()) {
|
||||||
|
result.text = tr::lng_action_created_monoforum(
|
||||||
|
tr::now,
|
||||||
|
Ui::Text::WithEntities);
|
||||||
|
} else if (isPost()) {
|
||||||
result.text = tr::lng_action_created_channel(
|
result.text = tr::lng_action_created_channel(
|
||||||
tr::now,
|
tr::now,
|
||||||
Ui::Text::WithEntities);
|
Ui::Text::WithEntities);
|
||||||
|
|
|
@ -1695,7 +1695,9 @@ void TopBarWidget::updateOnlineDisplay() {
|
||||||
} else if (const auto monoforum = peer->monoforum()) {
|
} else if (const auto monoforum = peer->monoforum()) {
|
||||||
const auto chats = monoforum->chatsList();
|
const auto chats = monoforum->chatsList();
|
||||||
const auto count = chats->fullSize().current();
|
const auto count = chats->fullSize().current();
|
||||||
text = tr::lng_filters_chats_count(tr::now, lt_count, count);
|
text = (count > 0)
|
||||||
|
? tr::lng_filters_chats_count(tr::now, lt_count, count)
|
||||||
|
: tr::lng_filters_no_chats(tr::now);
|
||||||
} else if (peer->isMonoforum()) {
|
} else if (peer->isMonoforum()) {
|
||||||
text = tr::lng_chat_status_direct(tr::now);
|
text = tr::lng_chat_status_direct(tr::now);
|
||||||
} else if (const auto channel = peer->asChannel()) {
|
} else if (const auto channel = peer->asChannel()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue